aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Remote & Local mode connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Remote & Local mode connection" Watch "Remote & Local mode connection" New topic
Author

Remote & Local mode connection

SungChan Park
Greenhorn

Joined: Jan 14, 2002
Posts: 22
Dear, all-members !
My package structure is as follows;
suncertify : 1. db ; Data.java,
DataInfo.java,
FieldInfo.java,
DatabaseException.java,
db.db
2. server ; DataServer.java(Interface),
Server.java,
ServerImpl.java
3. client ; DataClient.java(Interface),
DataClientGUI.java,
LocalDataClient.java,
RemoteClient.java
TableModel.java
To get a remote & local instance at GUI,
I intend to use following code snippet.
========================================
Data data;
if (local)
data = new LocalDataClient();
else
data = (ServerImpl) Name.lookup(bla bla)
========================================
Can anyone suggest a graceful way to implement it ?
Thanks in advance.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

It looks like it is a good implementation. If I had a suggestion to what you might be asking, I'd say put that code into a DataAccessFactory class, that the client main class calls with the necessay parameters.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
SungChan Park
Greenhorn

Joined: Jan 14, 2002
Posts: 22
Thanks, Mark Spritzler.
It seems that a graceful way to get a instance.
I'll try in that way.
Thanks you very much !
Suchak Jani
Ranch Hand

Joined: Jan 24, 2002
Posts: 68
Mark,
In the following code snippet.
========================================
Data data;
if (local)
data = new LocalDataClient();
else
data = (ServerImpl) Name.lookup(bla bla)
========================================
Does the rmi server not have to be up and running for the else to work ?
In other words what happens in the following secnario :-
The above client is in local mode and gets the local data connection.
Some other remote client can also connect because the server is up and running.
So would we not have two diffent connections to the database with their own Data objects and hence locking mechanism etc..
Please correct me if i am completely off beat here.
I did search the forum for this ,but still i am not very clear on this topic.
Thanks in advance.
Regards
Suchak Jani
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

If you are in local mode, no other "Client" from somewhere else can use the db.db file, local or remote.
In local mode there is no server.
Mark
Suchak Jani
Ranch Hand

Joined: Jan 24, 2002
Posts: 68
Mark,
In other words i would have three scripts.
1. Start Server Remote
2. Start Client Remote(depends on 1)
3. Start Client Local (independant)
Does the above look Ok.
Regards
Suchak Jani
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Yes, exactly.
Mark
Suchak Jani
Ranch Hand

Joined: Jan 24, 2002
Posts: 68
I guess now i can change my design.
Thanks Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remote & Local mode connection
 
Similar Threads
Design Question...
Why DON'T we need EJBMetaData with javax.ejb.EJBLocalHome?
RMI client implementing Data class methods???
Local Client
(HF EJB) abstract-schema-type == local component interface type?