This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

packaging stubs

 
Romeo Son
Ranch Hand
Posts: 92
Android Eclipse IDE Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

About the packaging of the stub classes in the application.
I have a default rmi package, foo.boo.rmi where I have the remote interfaces.
Then I have the server side rmi package, foo.boo.rmi.server, where I have the rmi implementation classes.
When I run rmic for Java 5 platform, it generates the stub classes for the above remote implementation classes.
At this point, I create another package, foo.boo.rmi.client and I copy the stub classes in this new package.

What do you think, is this packaging of the stubs correct?

Thanks,

Romeo
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Romeo,

You don't need to do this, you only need to (re) compile your remote classes with the rmic with the output directory in the same directory where you keep your (compiled) classes.

Regards,
M
 
Romeo Son
Ranch Hand
Posts: 92
Android Eclipse IDE Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mihai,

You are correct in this case because our assignment does not requests to split between server code and client code.
But anyway, I have three types of packages in my application, so that anyone wants to split client/server code, it can do it veary easily. (I have read in this forum that a few years ago, this was a requirement, to have two jars, client and server).
So I have the common package holding the interfaces (this package goes both on client and server sides), the server package holding local implementations and client package holding service layer implementations.
What basically I don't know, is if the stub generated by Java 5 is at the same time stub and skeleton, or just stub... So that if I would split the jars in client/server, this stubs would be only on client side, or on both sides (client and server).
Or I should not bother, and drop all rmi code in only one package?

Romeo

[ May 06, 2007: Message edited by: Romeo Son ]
[ May 06, 2007: Message edited by: Romeo Son ]
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Romeo

I think that you don't need to care about the client/server splinting - as far as you pack them in two different packages. More you can let the stub (rmic generated classes) files on both sides because on the run time the client obtains its stub from the rmi registry. At least this is my RMI understanding.

Regards,
M
 
Romeo Son
Ranch Hand
Posts: 92
Android Eclipse IDE Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,

I have read the RMI codebase tutorial in the week-end , and here is what I have understood.
The client obtains the stub reference from rmiRegsitry. First, it looks in its local classpath for the stub class definition. If it cannot find it, the stub reference has annotated the url where the class definition can be downloaded.
So, to avoid this downloading, you must package the stub in the client.

I hope my understanding is correct, and I don't fool anybody here...
 
Lucy Hummel
Ranch Hand
Posts: 232
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I do not know why you want to provide stubs in your submission.

My assignment does not require it and my runme.jar works without stubs.

So, may I ask why you take such big care about stubs?
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I don't know how is on you but in my specification I have a point called : Restrictions on RMI and this point contains something like this :

You must provide all classes pre-installed so that no dynamic class downloading occurs


Even if I'll like to use dynamic (proxy) stub generation the must clause constrains me to not to do it. Is a hard and unfair world out there.

Romeo, even is the jar separation has a practical advantage I think that it goes over the certification purpose, but if you think you can mention this in your choiches.txt file.

Regards,
M
 
Romeo Son
Ranch Hand
Posts: 92
Android Eclipse IDE Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Hummel,
Mihai has just answered your question.

Mihai,
Thanks for your reply.

Regards,
 
Mark Smyth
Ranch Hand
Posts: 288
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hummel Lucy:
Hi,

I do not know why you want to provide stubs in your submission.

My assignment does not require it and my runme.jar works without stubs.

So, may I ask why you take such big care about stubs?


I know of one person who got 0 for the server implementation because he did not use rmic to create the stubs.

My requirements stated that you must provide all classes pre-installed so that no dynamic class downloading occurs. If you do not create the stub class using rmic then your program will generate them on the fly thus violating this requirement.

See towards the end of this thread, I had a brief discussion about this very topic a few months ago:


http://www.coderanch.com/t/188775/java-developer-SCJD/certification/Building-ant
 
Romeo Son
Ranch Hand
Posts: 92
Android Eclipse IDE Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,

Did you have separate rmi packages for server side and client side?
I would like to make it clear by package names who is my client and who is my server.
 
Mark Smyth
Ranch Hand
Posts: 288
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Romeo Son:
Mark,

Did you have separate rmi packages for server side and client side?
I would like to make it clear by package names who is my client and who is my server.


I just had the one package for all the networking code called remote. My packages were db, gui, local and remote. Local contained my business logic objects (3 tier approach with Facade object) and remote contained the RMI wrappers for the local package (and the remote server object too). Dividing the client and server code into seperate packages would also be a good approach if you are more comfortable with that structure.
 
Romeo Son
Ranch Hand
Posts: 92
Android Eclipse IDE Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,

Thanks for your reply.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic