FileDocCategorySizeDatePackage
HAJNDI.javaAPI DocJBoss 4.2.14996Fri Jul 13 20:52:36 BST 2007org.jboss.ha.jndi

HAJNDI

public class HAJNDI extends Object implements org.jboss.ha.framework.interfaces.HAPartition.HAPartitionStateTransfer, Serializable, org.jnp.interfaces.Naming
This class extends the JNP JNDI implementation. binds and unbinds will be distributed to all members of the cluster that are running HAJNDI. lookups will look for Names in HAJNDI then delegate to the local InitialContext
author
Bill Burke
author
Scott.Stark@jboss.org
version
$Revision: 57188 $

Fields Summary
static final long
serialVersionUID
private static Logger
log
protected org.jboss.ha.framework.interfaces.HAPartition
partition
protected TreeHead
delegate
protected org.jnp.interfaces.Naming
haStub
Constructors Summary
public HAJNDI(org.jboss.ha.framework.interfaces.HAPartition partition)


   // Constructor --------------------------------------------------------
   
     
       
   
      if (partition == null)
         throw new IllegalArgumentException("Null partition");
      this.partition = partition;
      delegate = new TreeHead();
      delegate.setPartition(this.partition);
      delegate.setHARMIHead(this);
   
Methods Summary
public synchronized voidbind(javax.naming.Name name, java.lang.Object obj, java.lang.String className)

      delegate.bind (name, obj, className);
   
public javax.naming.ContextcreateSubcontext(javax.naming.Name name)

      return delegate.createSubcontext(name);
   
public voiddestroy()

      delegate.destroy();
      partition.unsubscribeFromStateTransferEvents("HAJNDI", this);      
   
public java.io.SerializablegetCurrentState()

      if( log.isTraceEnabled() )
         log.trace("getCurrentState called");
      return delegate;
   
public org.jnp.interfaces.NaminggetHAStub()

      return this.haStub;
   
public voidinit()

      log.debug("subscribeToStateTransferEvents");
      partition.subscribeToStateTransferEvents("HAJNDI", this);
      delegate.init();
   
public java.util.Collectionlist(javax.naming.Name name)

      return delegate.list(name) ;
   
public java.util.CollectionlistBindings(javax.naming.Name name)

      return delegate.listBindings(name);
   
public java.lang.Objectlookup(javax.naming.Name name)

      return delegate.lookup (name);
   
public synchronized voidrebind(javax.naming.Name name, java.lang.Object obj, java.lang.String className)

      delegate.rebind (name, obj, className);
   
public voidsetCurrentState(java.io.Serializable newState)

      if( log.isTraceEnabled() )
         log.trace("setCurrentState called");

      try
      {
         delegate.stop();
         delegate = (TreeHead)newState;
         delegate.setPartition(this.partition);
         delegate.setHARMIHead (this);
         delegate.init();
      }
      catch (Exception failed)
      {
         log.warn("Problem restoring state to HA-JNDI", failed);
      }
   
public voidsetHAStub(org.jnp.interfaces.Naming stub)

      this.haStub = stub;
   
public voidstop()

      delegate.stop();
   
public synchronized voidunbind(javax.naming.Name name)

      delegate.unbind (name);