Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remote Interface

 
Tim Adam Cooper
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic