【Java开源代码栏目提醒】:网学会员,鉴于大家对Java开源代码十分关注,论文会员在此为大家搜集整理了“CustomerActivatable.java”一文,供大家参考学习!
package ejava.jndich20.jiniexample;
import java.rmi.RemoteException;
import java.rmi.Remote;
import java.rmi.MarshalledObject;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.activation.Activatable;
import java.rmi.activation.ActivationID;
import java.util.Hashtable;
import java.io.IOException;
/**
* CustomerActivatable, implements Customer
*/
public class CustomerActivatable extends Activatable
implements CustomerActivatableInterface
{
Hashtable customerInformation;
public CustomerActivatable(ActivationID id, MarshalledObject data)
throws RemoteException
{
super(id, 0);
try{
this.customerInformation = (Hashtable)data.get();
}
catch(ClassNotFoundException classNotFoundException){
System.out.println(" Class Not Found Exception :"+classNotFoundException);
classNotFoundException.printStackTrace();
}
catch(IOException ioException){
System.out.println(" Class Not Found Exception :"+ioException);
ioException.printStackTrace();
}
}
public void setState(String state)
{
customerInformation.put("STATE",state);
}
public void setFirstName(String firstName)
{
customerInformation.put("FIRST_NAME",firstName);
}
public void setLastName(String lastName)
{
customerInformation.put("LAST_NAME",lastName);
}
public void setStreet(String street)
{
customerInformation.put("STREET",street);
}
public void setZip(String zip)
{
customerInformation.put("ZIP",zip);
}
public void setCity(String city)
{
customerInformation.put("CITY",city);
}
public void setEmail(String email)
{
customerInformation.put("EMAIL",email);
}
public int customer_id()
throws RemoteException
{
Integer id =
(Integer)customerInformation.get("CUSTOMER_ID");
return id.intValue();
}
public String state()
throws RemoteException
{
return (String)customerInformation.get("STATE");
}
public String first_name()
throws RemoteException
{
return (String)customerInformation.get("FIRST_NAME");
}
public String last_name()
throws RemoteException
{
return (String)customerInformation.get("LAST_NAME");
}
public String city()
throws RemoteException
{
return (String)customerInformation.get("CITY");
}
public String zip()
throws RemoteException
{
return (String)customerInformation.get("ZIP");
}
public String street()
throws RemoteException
{
return (String)customerInformation.get("STREET");
}
public String email()
throws RemoteException
{
return (String)customerInformation.get("EMAIL");
}
}