wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes networking mode or stand-alone mode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "networking mode or stand-alone mode" Watch "networking mode or stand-alone mode" New topic
Author

networking mode or stand-alone mode

Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 137
My B&S assignment spec. says:

the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely.

I wonder what it means. Is this referring to the stand-alone mode, i.e., specified by command-line argument "alone", or is this referring to the network mode with server being the local host, i.e., server is //localhost. If it is the latter, how could I pass the networking layer entirely since the program is running in network mode, although the server happens to be localhost.

Thanks.
Yan
Inuka Vincit
Ranch Hand

Joined: Aug 10, 2004
Posts: 175
he networking must be bypassed entirely.

standalone mode should not use localhost. Implementation is entirely upto you. I just create an instance of the object implementing the Remote interface used for communication on the server side and pass it to the client side. Remember RMI to you(apart from dealing with the Remote exceptions and making connections) is just like calling on an object like it was on your computer.

When you use localhost its just like you were on two diffrent networks because communications go through RMI and the client and server run on two different VMs.
[ October 25, 2004: Message edited by: Inuka Vincit ]

MCP (C# application dev 70-316) 860<br />SCJP 1.4 100% SCJD (URLyBird) 378<br />MAD 100% nuts
peter wooster
Ranch Hand

Joined: Jun 13, 2004
Posts: 1033
Originally posted by Yan Zhou:
My B&S assignment spec. says:

the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely.

I wonder what it means. Is this referring to the stand-alone mode, i.e., specified by command-line argument "alone", or is this referring to the network mode with server being the local host, i.e., server is //localhost. If it is the latter, how could I pass the networking layer entirely since the program is running in network mode, although the server happens to be localhost.

Thanks.
Yan


The standalone mode MUST NOT use networking at all, it must access the database directly. What I do is have the Model access a DBAccess instance that is either a Data object or a DataProxy object the structure is:

Networked
Model -> DBAccess(DataProxy) -> DataAdapter --RMI--> DataAdapterImpl -> DBAccess(Data)

Standalone
Model -> DBAccess(Data)

The Model uses a Factory to produce the appropriate DBAccess instance. When RMI is used the Factory references a DataAdapterFactory that uses a single instance of DataAdapterFactoryImpl to provide instances on the server. This is the only object registered with the RMI registry.
Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 137
I agree with you entirely.

I am just wondering, when the spec. says:" the program must accept an indication that a local database is used", is that talking about the "alone" command line argument or something else?

In other words, how would user indicate that a local database is used?
Thanks.
Yan
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
I implemented my program to take the parameter as that notice. I don't think it is necessary to provide this switch while the client is running...


Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: networking mode or stand-alone mode