wood burning stoves
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Regarding Interface design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Regarding Interface design" Watch "Regarding Interface design" New topic

Regarding Interface design

G.T. Reddy
Ranch Hand

Joined: Jun 25, 2002
Posts: 45
Hi everybody,

I designed interface as follws
public interface DataInterface extends Remote{
public FieldInfo [] getFieldInfo() throws RemoteException;
public DataInfo getRecord(int recNum) throws DatabaseException, RemoteException;
No I want to modify my existing interface design as follws:
public interface LocalDataInterface{
public FieldInfo [] getFieldInfo() throws Exception;
public int getRecordCount() throws databaseException;
public DataInfo getRecord(int recNum) throws DatabaseException;
Remote Interface:
public interface RemoteDataInterface extends
LocalDataInterface,Remote {
/* Now all the above methods will be availble here so no neeed to declare again.
So local client can get local object and remote client can get remote object.
Now my basic question is how to handle remote exceptions as well as DatabaseExceptions in each interface.
Shall I throw RemoteExceptions in LocalDataInterface so that will be availble to the child interface(RemoteDataInterface).
here I can not throw RemoteExceptions in LocalDataInterface as it doesn't extends the remote.

Am I correct?.

please clarify me.
G.T. Reddy
Ranch Hand

Joined: Jun 25, 2002
Posts: 45
please clarify me
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi G.T.Reddy,
The way you have your design setup is

I may be wrong on this, but I do not think you want DataInterface to extend remote. ( Make Sure Peter does not see it or else he will get angry )
You can code it as follows also
* public interface RemoteDataInterface extends LocalDataInterface, Remote.
All the methods in RemoteDataInterface should throw RemoteException.
Also LocalInterface should not throw remoteException as it is not a remote object.
I agree. Here's the link: http://aspose.com/file-tools
subject: Regarding Interface design
It's not a secret anymore!