• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

networking mode or stand-alone mode

 
Yan Zhou
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
peter wooster
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic