jgroup.relacs.gmi
Class JeriEGMILayer

java.lang.Object
  extended by net.jini.jeri.AbstractILFactory
      extended by jgroup.relacs.gmi.JeriEGMILayer
All Implemented Interfaces:
ExternalGMIService, Layer, Layer.FinalizeLayer, MembershipListener, net.jini.jeri.InvocationLayerFactory

public class JeriEGMILayer
extends net.jini.jeri.AbstractILFactory
implements ExternalGMIService, MembershipListener, Layer.FinalizeLayer

This layer implements the external group method invocation service based on JERI.

It enables a server to listen for group method invocations from clients external to the object group that the server is a member of and dispatch these invocations to one or more servers within the group.

Since:
Jgroup 2.1
Author:
Tor Arve Stangeland, Hein Meling

Nested Class Summary
 
Nested classes/interfaces inherited from interface jgroup.core.ExternalGMIService
ExternalGMIService.BootstrapInvocationHandler
 
Nested classes/interfaces inherited from interface jgroup.core.Layer
Layer.FinalizeLayer
 
Nested classes/interfaces inherited from interface jgroup.core.MembershipListener
MembershipListener.AllowDuplicateViews
 
Nested classes/interfaces inherited from interface net.jini.jeri.InvocationLayerFactory
net.jini.jeri.InvocationLayerFactory.Instances
 
Method Summary
 void addListener(java.lang.Object listener)
          Add a server/layer that is listening for external group method invocations.
 void complete(java.lang.Object server)
          This method is called by the GroupManager after the construction of all the layers, i.e., all addListener calls have been completed, and the MethodTable is fully populated.
 net.jini.jeri.InvocationDispatcher createInvocationDispatcher(java.util.Collection methods, java.rmi.Remote impl, net.jini.jeri.ServerCapabilities caps)
           
 java.lang.reflect.InvocationHandler createInvocationHandler(java.lang.Class[] interfaces, java.rmi.Remote impl, net.jini.jeri.ObjectEndpoint oe)
           
 ExternalGMIService.BootstrapInvocationHandler getBootstrapHandler()
          Returns an BootstrapInvocationHandler that can be bound to a normal Java RMI registry instance and later merged with others.
protected  java.lang.Class[] getExtraProxyInterfaces(java.rmi.Remote impl)
          By overriding this method we may avoid patching the Mahalo implementation to support our GroupInvocationHandler implementation.
 IID getIdentifier()
          Returns the invocation identifier for the current external group method invocation.
static JeriEGMILayer getLayer(GroupManager gm, MulticastService mcast, MembershipService pgms)
           
 ProtocolDispatcher getProtocol(MethodSemantics semantics)
          Construct a ProtocolDispatcher instance for the given method invocation semantics.
 java.rmi.Remote getProxy(java.rmi.Remote impl)
          Returns a proxy exported with the BasicJeriExporter.
 DependableRegistry.RegistryEntry getRegistryEntry(java.lang.String serviceName)
          Returns the registry entry type required for this implementation of the external GMI service.
 void hasLeft()
          Upcall that is invoked by Jgroup to acknowledge the fact that this object has left the group.
 void prepareChange()
          Upcall that is invoked by the group membership service to notify that the current view is not valid any more, and the group membership service is trying to reach an agreement on a new view.
 void viewChange(View view)
          Notify the invocation dispatcher and the request handler of the most recent server-side view identifier.
 
Methods inherited from class net.jini.jeri.AbstractILFactory
createInstances, equals, getClassLoader, getInvocationDispatcherMethods, getProxyInterfaces, getRemoteInterfaces, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getLayer

public static JeriEGMILayer getLayer(GroupManager gm,
                                     MulticastService mcast,
                                     MembershipService pgms)

addListener

public void addListener(java.lang.Object listener)
Add a server/layer that is listening for external group method invocations.

Specified by:
addListener in interface Layer
Parameters:
listener - An Object representation of the listener interface. This will typically be cast to the appropriate listener interface type after checking the type with the instanceof operator.

complete

public void complete(java.lang.Object server)
              throws JgroupException
This method is called by the GroupManager after the construction of all the layers, i.e., all addListener calls have been completed, and the MethodTable is fully populated. The purpose of this method is to determine which protocols are actually needed by the server (and its required layers) and from that construct the protocol instances and add them to the GroupRequestHandler object. This method will also pass the server reference to the protocol instances that need it.

Specified by:
complete in interface Layer.FinalizeLayer
Parameters:
server - The server using a layer implementing the FinalizeLayer interface.
Throws:
JgroupException - if a protocol instance could not be constructed,
See Also:
Layer.FinalizeLayer.complete(java.lang.Object)

getProtocol

public ProtocolDispatcher getProtocol(MethodSemantics semantics)
                               throws JgroupException
Construct a ProtocolDispatcher instance for the given method invocation semantics. The protocol instances must follow these rules of design:
  1. The protocol implementation must implement the ProtocolDispatcher interface, or do so implicitly through inheritence.
  2. The constructor must provide only a single constructor.
  3. The constructor cannot throw checked exceptions.
  4. The parameter types of the constructor must correspond to a *Service.class available from the group manager; that is it must be a layer. In addition, one of the parameters may be of type GroupInvocationDispatcher.

Parameters:
semantics - the method invocation semantics whose protocol to obtain
Returns:
the protocol instance for the provided method invocation semantics.
Throws:
JgroupException - if the protocol could not be constructed, one of the above rules of design was broken.

createInvocationHandler

public java.lang.reflect.InvocationHandler createInvocationHandler(java.lang.Class[] interfaces,
                                                                   java.rmi.Remote impl,
                                                                   net.jini.jeri.ObjectEndpoint oe)
                                                            throws java.rmi.server.ExportException
Specified by:
createInvocationHandler in class net.jini.jeri.AbstractILFactory
Throws:
java.rmi.server.ExportException

createInvocationDispatcher

public net.jini.jeri.InvocationDispatcher createInvocationDispatcher(java.util.Collection methods,
                                                                     java.rmi.Remote impl,
                                                                     net.jini.jeri.ServerCapabilities caps)
                                                              throws java.rmi.server.ExportException
Specified by:
createInvocationDispatcher in class net.jini.jeri.AbstractILFactory
Throws:
java.rmi.server.ExportException

getExtraProxyInterfaces

protected java.lang.Class[] getExtraProxyInterfaces(java.rmi.Remote impl)
                                             throws java.rmi.server.ExportException
By overriding this method we may avoid patching the Mahalo implementation to support our GroupInvocationHandler implementation.

Overrides:
getExtraProxyInterfaces in class net.jini.jeri.AbstractILFactory
Throws:
java.rmi.server.ExportException

viewChange

@MembershipListener.AllowDuplicateViews
public void viewChange(View view)
Notify the invocation dispatcher and the request handler of the most recent server-side view identifier.

Specified by:
viewChange in interface MembershipListener
Parameters:
view - The new view that has been installed.
See Also:
MembershipListener.viewChange(jgroup.core.View)

prepareChange

public void prepareChange()
Description copied from interface: MembershipListener
Upcall that is invoked by the group membership service to notify that the current view is not valid any more, and the group membership service is trying to reach an agreement on a new view.

Specified by:
prepareChange in interface MembershipListener
See Also:
MembershipService

hasLeft

public void hasLeft()
Description copied from interface: MembershipListener
Upcall that is invoked by Jgroup to acknowledge the fact that this object has left the group. This method is only invoked after the leave method has been invoked on the group membership service.

Specified by:
hasLeft in interface MembershipListener
See Also:
MembershipService

getIdentifier

public IID getIdentifier()
Description copied from interface: ExternalGMIService
Returns the invocation identifier for the current external group method invocation.

Specified by:
getIdentifier in interface ExternalGMIService

getRegistryEntry

public DependableRegistry.RegistryEntry getRegistryEntry(java.lang.String serviceName)
                                                  throws JgroupException
Description copied from interface: ExternalGMIService
Returns the registry entry type required for this implementation of the external GMI service.

Specified by:
getRegistryEntry in interface ExternalGMIService
Throws:
JgroupException

getBootstrapHandler

public ExternalGMIService.BootstrapInvocationHandler getBootstrapHandler()
                                                                  throws JgroupException
Description copied from interface: ExternalGMIService
Returns an BootstrapInvocationHandler that can be bound to a normal Java RMI registry instance and later merged with others.

Specified by:
getBootstrapHandler in interface ExternalGMIService
Throws:
JgroupException

getProxy

public java.rmi.Remote getProxy(java.rmi.Remote impl)
                         throws java.rmi.server.ExportException
Description copied from interface: ExternalGMIService
Returns a proxy exported with the BasicJeriExporter.

Specified by:
getProxy in interface ExternalGMIService
Parameters:
impl - the remote object to be exported
Returns:
the exported proxy
Throws:
java.rmi.server.ExportException


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.