• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RemoteDataInterface and DataInterface

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am having an error and I do not know why. My DataInterface is a interface and has all the public methods of the Data class. My RemoteDataInterface extends DataInterface, Remote and for all these public methods it throws RemoteException. When I compile the RemoteDataInterface it does not compile. The error says RemoteDataInterface's method not compatible with DataInterface.
There are numerous posts on this site which they say that they have done it this way. What am I missing?? Please help!
JLS 9.4.1

Thanks!
Amish
[ January 25, 2003: Message edited by: Amish Patel ]
[ January 25, 2003: Message edited by: Amish Patel ]
 
Matt Ghiold
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a thought, why are you having 2 data interfaces? Having 2 is a bit redundant when your more then likely to be having the same methods, with the exception being that they throw RemoteException.
The client will have to try/catch for RemoteException either way, so I think it makes your design cleaner to have 1 DataInterface.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason for having RemoteDataInterface and LocalDataInterface is I do not want to have my DataInterface extends Remote. I think it does not make sense in local mode for DataInterface to extend Remote when it has nothing to do with Remote.
But as far as my question goes is DataInterface suppose to throw any exception?
What kind of exception will RemoteDataInterface throw other than RemoteException?
Thanks
-Amish
Originally posted by Matt Ghiold:
Just a thought, why are you having 2 data interfaces? Having 2 is a bit redundant when your more then likely to be having the same methods, with the exception being that they throw RemoteException.
The client will have to try/catch for RemoteException either way, so I think it makes your design cleaner to have 1 DataInterface.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After thinking about this I think DataInterface should not throw any exception. RemoteDataInterface should throw the respective exception from methods in Data and RemoteException for all methods. LocalDataInterface should only throw exception for the respective methods of Data.
Please let me know your comments!
-Amish
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can see I am going around in circles. I think rather than duplicating my code in RemoteDataInterface, I should just have DataInterface throw RemoteException. RemoteDataInterface extends DataInterface, Remote. Also I do not think I need LocalDataInterface as my Data object is not a instance of Remote. So now LocalData class implements DataInterface and has Data as its instance.
Please add your comments!
Thanks
Amish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic