Hi Javini,
Originally posted by Javini Javono:
Hi,
Let us assume that the software will not address multiple database
file tables (as it is assumed that appropriate changes could be made
to handle this case).
Let us assume that the client can connect either locally or remotely.
Let us assume that a ConnectionFactory object is defined whose
purpose is to return an interface type IndependentConnectionInterface.
The client invokes the ConnectionFactory telling it whether it wants
a local or a remote connection. The ConnectionFactory, if getting
a local "connection", returns the appropriate local object which
implements IndependentConnectionInterface. If getting a remote connection,
the ConnectionFactory looks for an RMI registry binded object, obtains
it, and returns it since this remote object also implements
IndependentConnectionInterface.
So, the client's code looks like this:
I think I agree with what you've written to this point.
I think the conventional name for this method would be create rather than getInstance, but that's really a quibble about nomenclature for the factory design
pattern.
Here's where you start to lose me. I've no idea what an IndependentServerInterface is so I'll just ignore option 1 for now.
I think I agree with what you've written so far (option 2, that is).
For the above design, two things need to be implemented
as remote objects:
the "connection" and the "myServer" for option 1 design
or
the "connection" and the "data" for option 2 design
depending on the design chosen.
The above, is essentially a question: that is, is what is stated
correct?
My comments only address option 2 (I'm ignoring option 1 for now because I don't understand it):
I see why "data" would have to be a remote object. I don't see why "connection" would have to be remote object. It seems to me that "connection" would be a local object and that getData is the method that does the Naming.lookup to get the remote object "data."
Hope this helps,
George