|
|
The remote interface exposes all of the methods that we want our bean to
make available. Let's just make one simple method, hello,
available. This method will not take any arguments, though we can
expand this if we wish in the future.
-
Remember that our remote interface in RMI extended java.rmi.Remote.
In this case, we need to extend javax.ejb.EJBObject, which does
extend java.rmi.Remote, and adds a few more methods for our EJBObject
that is generated by the container.
-
Also remember that our remote method must declare that it can throw a java.rmi.RemoteException.
public interface Hello extends javax.ejb.EJBObject
{
public String sayHello() throws java.rmi.RemoteException;
}
-
The local interface is pretty much the same, with two differences:
-
It does not throw RemoteExceptions
-
It extends javax.ejb.EJBLocalObject.
public interface HelloLocal extends javax.ejb.EJBLocalObject
{
public String sayHello() throws java.rmi.RemoteException;
}
The Home Interface
|