File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Remote Interface 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 "Remote Interface" Watch "Remote Interface" New topic
Author

Remote Interface

Tim Adam Cooper
Greenhorn

Joined: Jul 29, 2002
Posts: 17
For the Java Developer project, I am writing a remote interface. The remote interface looks like as below:
public interface DBI extends java.rmi.Remote{
public FieldInfo[] getFieldInfo() throws java.rmi.RemoteException;
//other methods of Data Class go here that
//will throws RemoteException
}
Next, I write a class called Server that implements the remote interface as below:
public class Server extends UnicastRemoteObject
implements DBI {
public FieldInfo [] getFieldInfo() throws RemoteException {
return description;
}
//all other methods found in remote
//interface go here
}
I have two queries:
Query 1: I am unable to compile the class Server because in the method getFieldInfo(), the variable description is not found. This description variable is found in the Data class as below:
private FieldInfo [] description;
Is that correct that I have to copy the above description variable and put that variable in the interface DBI or do I put this variable in the class Server that implements the interface?
Query 2: Is it OK that I used the same method name found in the Data class and used the same method name in the Remote interface or should I be using a different method name?
dennis hu
Ranch Hand

Joined: Aug 27, 2002
Posts: 40
Hi Tim:
You Server object has not done any bussinesses with Data class, how can you get the vriable?
could you say it clearly?
Maybe you need a refernce of Data object in your Server class, and you can get the FieldInfo[] through the reference!
Tim Adam Cooper
Greenhorn

Joined: Jul 29, 2002
Posts: 17
OK, I understand that I will have to create an object of the Data class in the Server class but I am still unable to access the description variable found in the Data class because the description variable is a private field.
Jawad Kakar
Ranch Hand

Joined: Oct 06, 2002
Posts: 82
I create a reference to Data Class in the constructor of RemoteDataAccess i.e

RemoteServer interface have all PUBLIC method of Data class.
[ December 10, 2002: Message edited by: Jawad Kakar ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remote Interface
 
Similar Threads
Trying to instantiate my middle tier class??see code
Data Interface definition for server and client
Remote Interface
Design questions (with RMI)
Final design