• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help to check the DataAccess design

 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use
DataAccess extends Remote(interface) it contains all the public methods in Data and throw Exception.
Data implements DataAccess (class)
DataLocal extends Data implements DataAccess (class)
DataRemote extends Data implements DataAccess(class)
(coud be with lock unlock criteriafind methods)
1.but I wonder where shall extends UnicastRemoteException , where shall I throw RemoteException, does it need it?
2.where shall i put the lock unlock criteriafind method in the right place, i wonder
thank u for your help!
 
aadhi agathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kevin chang:
I use DataAccess extends Remote(interface) it contains all the public methods in Data and throw Exception.

Think the consequence of throwing a generic Exception. The client code will be living under danger. It should throw whatever is realistic and the client code will act accordingly. say an IOException or DatabaseException
Data implements DataAccess (class)

DataLocal extends Data implements DataAccess
DataRemote extends Data implements DataAccess

Extending the Data itself make it typecastable to DataAccess. Note the redundancy.

1.but I wonder where shall extends UnicastRemoteException , where shall I throw RemoteException, does it need it?

Your remote version of DataAccess needs to extend UnicastRemoteObject, hold on did u say
UnicastRemoteException, what for???


2.where shall i put the lock unlock criteriafind method in the right place, i wonder

Wherever it fits in your design. There is no concrete answer to "where will i put some x" . if you want to get useful guidelines, you have to propose a solution , for which ranchers will comment.
IMHO, the real meaning of doing a certification is for the learning purpose and don't miss the joy of it by asking please give me the Lock implementation and criteria find implementation.
Try proposing some design, listen for comments, argue your ideas, fine-tune, learn ,note though
that this is may take you some time but will
deserve much more than a mere stamping on your profile.

All the best !!!
[ April 04, 2003: Message edited by: aadhi agathi ]
 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After seeing a lot of post, i saw many design, but onthing thing make me very confused. i do know some point about.

DataAccess (interface)extends Remote
Data implements DataAccess

but i am still wodering why

class DataAccessLocal implements DataAccess
instead of
class DataAccessLocal extends Data implements DataAccess

where r the methods in Data? shall we put all the oringinal methods to DataAccessLocal use "Ctrl+C"+"Ctrl+V", how can we use DataAccessLocal without Data in them?
i'd appreciate someone could feedback
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class DataAccessLocal extends UnicastRemoteObject implements DataAccess
As far as the interface throwing Exception, that is fine. In the implementation of RemoteDataAccess you will have it throw the RemoteException.
Mark
 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi mark ,
i am still wondering about have to COPY all the contents in class Data TO class DataAccessRemote and DataAccessLocal instead of extends Data?
thanks !
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kevin. You don't have to copy any code from the Data class to these implementations. The implementations will have a reference to the Data class, and pass its calls to Data.
For instance
implementing class has

Mark
 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At last, I made it cleart, thanks Mark
 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
According to rudundency,is it suitable put the criteriaFind() both in DataAccessLocal and DataAccessRemote, or just put it in Data.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic