Meaningless Drivel is fun!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S : Couple of questions 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 "B&S : Couple of questions" Watch "B&S : Couple of questions" New topic
Author

B&S : Couple of questions

Bhavik Patel
Ranch Hand

Joined: Jul 12, 2004
Posts: 155
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


SCJP 1.4<br />SCWCD 1.4(91%)<br />Working on SCJD -Bodgitt & Scrapper Constructions...<br /> <br />"It takes 43 muscles to frown & 17 to smile but it doen't take any to just sit there with a dumb look on your face .. Keep Smiling "
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
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).


42
Liviu Carausu
Ranch Hand

Joined: Oct 07, 2004
Posts: 154
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


Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer.
Bhavik Patel
Ranch Hand

Joined: Jul 12, 2004
Posts: 155
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S : Couple of questions
 
Similar Threads
How to throw RemoteException?
Can't declare methods to throw java.rmi.RemoteException
NX: used RMI & Local in local Side
RMI illegal remote method error
B&S 2.2.2 - Network Layer Query