• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: Need some clarification on the single mode flag

 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need some feedback from you concerning the single mode flag.

My understanding is:

  • java -jar runme.jar server starts the server either on your local or remote machine but how do I now which one? Do you let the user select whether local or remote by entering IP Address or hostname.
  • java -jar runme.jar alone starts local server and local client.
  • java -jar runme.jar starts a client that connects to a remote server


  • Anyone disagree ?

    Regards,
    Darya
     
    Olena Golub
    Ranch Hand
    Posts: 113
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Darya,

    Do you use RMI or Sockets?

    If you use RMI, you don�t need to give any IP Adresses, your need to use something in this way:


    As you see, you need to give only the connection port.
    As Frans said in another topic:
    You do not need to specify the server address when you bind the object. It will be implicitly set.


    After your have started this (server) on one computer, you can connect to this server from the same computer by entering only "localhost" and port, or connect from another computer, by entering the address or IP of the computer, where you have started your server and use the same port. You can connect to this server as to local server or as to remote server. It will be always the same code.

    For standalone you don�t need to start server! (Folks, help me, if I am wrong).
    Because the assignment says (You should have the same):

    "� this mode must use the database and GUI from the networked form, but must not user the network server code at all �"


    Regards,
    Olena.
    [ May 11, 2005: Message edited by: Olena Golub ]
     
    Wei-ju Wu
    Ranch Hand
    Posts: 147
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    in other words (but meaning the same :-) ): you start the server on a machine which will be your server host. To the client, the server might be on a remote machine if you start the GUI on another computer within your network.
     
    David Sham
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    This is my understanding and how I implemented my project:

    java -jar runme.jar server - starts the server only on the machine your are currently using. You should specify a database file upon startup of the server for the server to use.

    java -jar runme.jar - starts the network client either on the same machine as the server (using localhost and port no), or on a different machine than the server (using machine name and port no). The user should specify the desired server to connect to upon startup of the network client.

    java -jar runme.jar alone - starts the standalone application on the machine you are currently using. No networking occurs at all (no interaction with the server). The server does not need to be running anywhere and is not involved. The user should be able to specify a database file to work with upon startup of the application.

    Somebody please correct me if that is wrong, but that is how I've implemented the assignment. Thanks.
     
    Darya Akbari
    Ranch Hand
    Posts: 1855
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi,

    Thanks for your answers but I can see also some uncertainty on your side.

    I take it a little further :roll: . Please view my understanding of the single mode flag and its usage below:

    Scenario 1:


    Scenario 2:


    Scenario 1 shows the usage of the alone mode flag. Both Client and Server run on same host. Or other said the program run in
    non-networked mode and hence is not allowed to use any network code. Right?

    Scenario 2 shows the usage of the server mode flag and no flag. First the server (host 3) must run before clients (host1 and host2) can connect. Here I make use of network code. Right?

    Now what is network code? To my understanding (I use the RMI approach) it is the stuff generated by the RMI compiler (rmic). My overall architecture has a data layer, a network layer and a gui layer.

    Now the connections (I) and (II) are handled through my network layer. This sounds strange at first for Scenario 1 because there is no network at all between client and server but my instruction hints:


    ... Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all. ...


    Hence I think it's ok to put the local and remote connection implementation into the network layer.

    Last but not least I have a general problem with the terms Client and Server. For Scenario 1 it makes less sense to my mind because its one monolith application. In Scenario 2 however it makes sense because I have a clear separation through RMI.

    Can you agree with it or am I talking nonsense ?

    Forgive me this long post

    Regards,
    Darya
     
    DANNY JI
    Greenhorn
    Posts: 9
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I think it is OK and that is What i have do.
     
    David Sham
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Scenario 1 shows the usage of the alone mode flag. Both Client and Server run on same host. Or other said the program run in
    non-networked mode and hence is not allowed to use any network code. Right?

    You are referring to standalone mode here. There is no "server" in standalone (or local) mode. In standalone mode, your application need only to connect to the database file.

    Scenario 2 shows the usage of the server mode flag and no flag. First the server (host 3) must run before clients (host1 and host2) can connect. Here I make use of network code. Right?

    Yes. But there is no "server" running on "host1" and "host2" - they are the network clients connected to the server which is "host3".

    Last but not least I have a general problem with the terms Client and Server. For Scenario 1 it makes less sense to my mind because its one monolith application. In Scenario 2 however it makes sense because I have a clear separation through RMI.

    It does not have to be "one monolith" application. You can break down the design of the application using MVC. The GUI for the client is the same in both network and standalone modes. So there is only 1 GUI you need to write for the client. You can also separate out the event handling of the GUI into 1 or more controller classes. Therefore, where the client gets the data from becomes immaterial to the client. The client should not know if the data it retrieves comes from the database or from a networked server. In other words, you should use an interface reference as an abstraction layer between your client and the database and/or server back-end.
     
    Darya Akbari
    Ranch Hand
    Posts: 1855
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi David,

    The abstraction layer you talk about is my network layer where I handle remote and local connect to the database. My GUI layer is based on MVC and my model class in MVC has only access to an abstract connection class in the network layer.

    Actually I have all in place but what drives me nervous is the right handling of the single mode flag or better said the use of terms client and server.

    So do the other agree on my 2 Scenarios :roll: ?

    Regards,
    Darya
     
    Wei-ju Wu
    Ranch Hand
    Posts: 147
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    For me it is a little unclear from your descriptions if you use a local network through the loopback device (aka localhost aka 127.0.0.1). You have to avoid local networking for alone mode.

    Therefore, for RMI it means, you are not supposed to use UnicastRemoteObject, Registry and your rmic generated stub classes (beware, JDK 1.5 does this automatically) in alone mode to connect to your data access.

    Your user interface will talk to your data access layer using regular function calls.
     
    David Sham
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Darya,
    I caught something you said here:
    ...my model class in MVC has only access to an abstract connection class in the network layer.

    Actually, in MVC, the model should have access to nothing. It should know about absolutely nothing other than the data it contains, and any business specific functionality it performs on that data. It should have no references to any other resources (databases, servers, or otherwise). The model itself should not communicate with anything. The controller that uses the model should do all the communicating using the model. The controller should send the model to the database or server, but the model should not send any of it's own data to the database or server. Otherwise, the model would become dependent on other references in the application and the result would be a polluted design for the model. Just wanted to clarify this. Thanks.
     
    Darya Akbari
    Ranch Hand
    Posts: 1855
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Wei-ju,

    thanks for your concerns. I definitely do not use loopback, RMI or the like in alone mode.

    Regards,
    Darya
     
    Darya Akbari
    Ranch Hand
    Posts: 1855
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi David,

    I can't share your view about MVC .

    There are several reasons for. One is that the model has a tight relation to the data its present. The other reason is that my controller is the strategy that I plug into my view.

    I can't imagine a design clearer than my

    Regards,
    Darya
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic