• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S : Couple of questions

 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1> How to add RemoteException in throws clause of remote interface...

To declare the RemoteException in remote interface implementation of readRecord , I have to change the DBAccess interface readRecord method signature or adopt some pattern to decorate this ...If i don't declare throws RemoteException then it throws IllegalArgumentException at runtime.so how do i change the method signature in local interface so it can throw RemoteException ?? IF i add throws IOException in local method signature then it will work fine but it seems wrong and i will violate the contract... what other option can be here....



2> Dynamic Schema implementation is required or we can hard code the fields for its size and name.I have been wondering a lot about this question .Because if i implement the dynamic schema then also i have to
declare primary key fields(which requires that you know the fields before).
can ranchers share their view on implementing dynamic schema or not implementing...pros & cons..

Waiting for gurus to reply ...

Thanks
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that's one way to do it.
Another way is to have the DB interface available only to the server and expose something else entirely through RMI (a business object).
 
Liviu Carausu
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

1) for the remote interface I have an adapter that "adapts" a remote object to a DB interface. The Remote Exceptions are catched in the adapter and application specific exception are thrown further. For example in the DB "delete" method RemoteException is catched, RecordNotFoundException is thrown instead to satisfy the contract of the DB interface.

2) Dynamic Schema implementation makes no sense from my point of view because you still need a place where you must use the fields that are given in the specification.

Hope this helps,

Liviu
 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for 1>
I am adding one more interface DBRemoteReference that mathces to DBAccess interface(provided by sun ) with additional IOException in throws clause of each method.My structure looks like the following



Am i implementing the Adapter pattern right ?? main concern is the bold part..Am i on the right path ??

2> for this i am thinking to get rid of dynamic schema and hard code the fields..what do you guys think about it ??

Thanks for all your support.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic