• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

need comments on network/non-network mode

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, everyone.
I need comments on when not using the network mode. I have the remote interface ContractorService which provides services to client requests. It has Data as a membe object. The Data is shared by all clients requests, and it serves as the engine[read/write/create/delete] to the database, and it is created when the service implementation object is created.
The ClientUI, keep a reference of the ContractorInterface, upon start up check the mode, assume "server" at this point, and make the connection. It is working, and nicely so far.
then my concern rises when start to think about alone mode. I thought of
doing it by sticking with the ContractorService and create ContractorServiceImp object which will create a Data object accessing a local database file.
Some manipulation may be needed in Data object this way. But will this violate the requiements simply because that the ContractorService being a subinterface of Remote and, I have DatabaseSchema object which implements Serilizable, would this be considered to a violation too?

The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.



To make my question clearer, here is what I meant:

This way, the rest of the ClientUI would not have to care about whether it is a network or local database being processed.

And right next to the above requirment is the following and look at this I would think that my approach above violate it. And I don't understand what it means by saying Architecturally, this mode must use the database and GUI from the networked form:

The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.


Thanks for you patience. It Ihave exposed too much, please advise me to get rid of some.
Bing
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually you are pretty right on the mark. The whole thing for the GUI is to use an interface instead of a concrete class, that way the GUI doesn't know that it is in Local or Remote mode, it doesn't care.
Now the only thing I would change for you, is to move the "IF" code from the GUI into a Factory class, and move the ContractorService reference to the Controller. I had the main class call the Factory getting the Data access and passing its reference and a reference to the GUI to the Controller. The GUI should only display the screen it should not have any business references or code.
Good Luck
Mark
 
Ben Zung
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark, for the comments/suggestions. Factory/Controller sounds like a far better practice.
Then what about the requiements? When initialize a ContractorService during alone mode, is ContractorService considered to be network server code? I am using some serilazed object(databaseschema), is this violate must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.?
Thanks.
bing
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I had my interface that both the local and remote implemented. This interface extended Remote, but threw the generic Exception. In the implementing classes, I made the Exceptions to be more specific. So the Remote could throw a RemoteException and it was legal.
So you ContractorService can extend Remote. Then you will have two classes that implement this interface. Maybe called ContractorServiceLocal, and ContractorServiceRemote.
I had DataInfo and FieldInfo both implement Serializable. Now a note, I had the older assignment, but this type of class is still fine to be Serializable, even though in local mode, it actually won't ever be Serialized or sent over RMI or a Socket.
Hope that helps.
Mark
 
Ben Zung
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark.
But somehow I am not that convinced.
Your interface implementation has both local and remote one, but the interface itself extends Remote. As further as I can understand, it is still using network server code -- referring to the Remote interface. Or network server code does not include Remote at all?
I am thinking if there is another way around. Meanwhile I am going to start a new topic asking for help to understand these requiements. Hope you dont mind.
Thanks.
Bing
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can create an interface that does not extend Reomte, and then create one more that does. But I think the one interface alone is enough to keep network and non-network mode out of the logic for the client.
Plus I got perfect in this area.
Starting a new thread is fine.
Mark
 
He baked a muffin that stole my car! And this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic