Win a copy of Spark in Action this week in the Open Source Projects forum!

Jerry Goldbaum

Greenhorn
+ Follow
since Oct 31, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jerry Goldbaum

Hi,

I am considering "alone" mode solution.
As far as I understand in Alone mode only one jar should be started, like: java -jar mysolution alone, and that's it?
In this version GUI should consist functionality to open database from file and perform all actions that usually Client did over network?

Best regards,
Tnts
Ok, I need to reconsider my design - I will be back in a few days
Hi Chris,



But remoteDB is intended to be used by RMI so in this case it mean that every method should be declared in remoteDB with the same signature as in DBClient, I would only need to add RemoteException. As far as I know compiler does not allow to add Exceptions freely. You are not allowed to declare exceptions other than in DBClient or their subclasses. So in result I am not able to have RemoteException needed for RMI in this solution (?)
Ok but that is exactly what I am doing already, or am I wrong somewhere?

I have DBClient interface and it's Data class implementing this interface.
I have DBR interface with RemoteException:


and implementation going like this:

But the issue is that remoteDB extends DBR and not DBClient so in my GuiController I am not able to obtain a proper reference based on run mode: network or local. Different interfaces are responsible for database access in different modes (because DBClient can not be exposed via RMI) ...
Hi,

I know the difference between "is" and "have" in OO principles however in this case i do not get it.
Could you explain what exactly do you mean?
Hi,

I know about solution 1 but I do not like it.
Solution 2 is what I was chasing for the last few days.
However I do not understand how it should be done.
If I create third interface, let it be called TheInterface, in my opinion it should extend both previous interfaces (DBClient and DBR)?

But after I do something like this:

it does not work, casting problems....



I started to reread Interfaces and OOD chapters one more time.
Hi,

Christian,
My DBClient interface from SUN does not throw RemoteException needed for RMI implementation.
That is why I had to create second interface, DBR, having the same list of methods with RemoteException declared.

As you can see DBR does not extend DBClient.

then I created new interface

because I see it more transparent this way, so I can later implement one interface in implementation class for RMI:
Hi,

I am thinking about the solution for two days and I am desperate now Please HELP
In my solution, in some degree, I follow the book "SCJD Exam with J2SE 5".
I have a problem with proper Object Oriented design related to GuiController class.

My design as it is now:
LOCAL OBJECTS DESIGN:
  • Interface provided by SUN: DBClient
  • DBClient "must have according to instruction from SUN" implementation class: Data

  • RMI OBJECTS DESIGN
  • To support RMI I created new interface: DBR (contains all methods from DBClient with RemoteException declared)
  • Interface to be exported by RMI is: remoteDB (extends Remote, DBR)
  • Class implementing remoteDB: RemoteDBImpl (implements remoteDB) - this class nicely wraps all exceptions and rethrows RemoteException if neeeded.


  • The most simple solution for me would be to create separate controller for local mode and other for network mode, however it seems to be lame...
    How to overcome the issue with DBClient and remoteDB not being compatible....
    I tried to create next interface, extending both DBClient and remoteDB and then by some type casting obtain proper reference however it failed....

    My goal is to obtain a controller reference like in the example solution:


    best regards,
    Found it,
    stubs must be generated or "dynamic class loading" will occur so it would be against one of "must" rules.
    Hello,

    I am reading my instructions and looking for a sentence where it is said that I must provide stubs precompiled with rmic.
    Till now I have found only "...provide all classes pre-installed so that no dynamic class downloading occurs." - does it mean that rmic must be used or not?
    Hi,

    This is my first post here so, Hello everyone!

    In The Book "SCJD Exam with j2se" (by Andrew Monkhouse ), in RMI section, factory pattern is utilized to obtain new instance of DVDDatabase class.
    I was analyzing this idea and I have got a question that I am not able to answer myself:
    Why do we need to multiple instances of this class? Can't it be done with only single instance? Every client would be supplied with the same reference of DVDDatabase (singleton?) and requests would be processed by "file access" class object according to locking mechanism implemented in "file access" class?

    I remember that in book example client ID is provided by reference to DVDDatabase, and in my case client ID is provided as a number requested when locking/unlocking methods (so called: cookie).

    So in my opinion when i have got a cookie value I do not need to utilize a factory pattern?

    Best regards,

    [ October 31, 2008: Message edited by: tnts2008 ]

    [ October 31, 2008: Message edited by: tnts2008 ]

    [ November 03, 2008: Message edited by: tnts2008 ]

    [ November 03, 2008: Message edited by: tnts2008 ]
    [ November 03, 2008: Message edited by: tnts2008 ]