File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Packaging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Packaging" Watch "Packaging" New topic
Author

Packaging

Nico Vanoppen
Greenhorn

Joined: Mar 22, 2002
Posts: 12
Hi everybody,
I've been reading thru a lot of postings on this forum and finally I've come to a design that satisfies me. I used the connection factory implementation, which has been the subject for about a zillion times on this forum
In a nutshell :
DataInterface
-------------
extends Remote
contains all public Data methods
RemoteDataImpl
--------------
extends UnicastRemoteObject implements DataInterface
wraps Data
contains reference to Lockmanager
LocalDataImpl
-------------
implements DataInterface
wraps Data
RemoteDataFactoryImpl
---------------------
RMIregistry bound
extends unicastRemoteobject implements RemoteDataFactory
returns RemoteDataImpl objects that contain a reference to an unique Data object
Data
----
just minding it's own business
Server
------
binds RemoteDataFactoryImpl to the registry
LockManager
-----------
Guards the locks
DataProxy
---------
this is the client's gateway to the data
implements DataInterface
2 ctors : local - remote
Now, I'm having troubles choosing the righ packages for these classes. I tried the following
suncertify.client
-----------------
DataProxy
LocalDataImpl
suncertify.server
-----------------
Server
LockManager
RemoteDataImpl
RemoteDataFactoryImpl
suncertify.db
-------------
Data
classes provided by Sun
suncertify.common
-----------------
DataInterface
RemoteDataFactory
I try achieve that a client only needs suncertify.client + suncertify.common, and that a server only needs to import suncertify.server + suncertify.common, but I'm not sure if I'm sticking to the requirement that
Any additional classes you create that are related to the database should be placed in the suncertify.db package
with this. I'm also not sure (yet) that a client doesn't need to import the suncertify.db package...
Any suggestions ?
Thanks
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Design looks solid. Sun instructions clearly says this is a clien/server application. Therefore importing db classes in client packages would be fine.
Dasong
Ranch Hand

Joined: Apr 05, 2002
Posts: 36
Hi Sai Prasad,
I heard I don't have to download Server_Stub from server side when run client side Application. That means I have to put package suncertify.server.* at client side right?
Dasong
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
I don't see any reason for you to include any server class at the client. You need to import the interface which contains the public methods in Data class and DataInfo.
Only in the client proxy class you have to import the interface implemented by the remote server which is responsible to instantiate Connection/RemoteImpl objects for the client.
Dasong
Ranch Hand

Joined: Apr 05, 2002
Posts: 36
Hi Sai Prasad,
I mean when run server and client program on different machine You have to copy server_Stub to client side or download _Stub from server side.
Dasong
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
Read the post on the other thread
Dasong
Ranch Hand

Joined: Apr 05, 2002
Posts: 36
Hi Guys,
your suggestion please.
I cann't access db.db and userguide.html(for online help) when run client.jar
thanks
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
It would be helpful if you can provide more information like,
1) Are you trying to access db.db in local or remote mode
2) Where the html file is located
3) Do you have the _Stub classes bundled with the client jar file?
Dasong
Ranch Hand

Joined: Apr 05, 2002
Posts: 36
we have a dir like starting\. I put the all the client.jar, db.db and Userguide.html files under the starting\ like this starting\client.jar, starting\db.db, starting\Userguide.html,
The condition is I access local db.db instead of remote server.
when I run Java -jar client.jar db.db. Exception was thrown.
when I access remote server using client.jar is ok. But I still failed to show online help by using Userguide.html outside the client.jar
Thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Packaging
 
Similar Threads
Local mode - Remote mode
Hopefully my final design, comments welcome
Initial design review
To those who are using a connection Factory, help me out please
Connection Object for lock/unlock...?