The JAIN SLEE specification defines that an SBB component has access to a JNDI API namespace where it may obtain access to various SLEE facilities and factories. Using the JNDI API for name lookups in SBB code generally works when you know exactly what you’re looking for, but an SBB that uses SBB parts may have entries in its JNDI namespace introduced by those SBB parts that may not be known at SBB compile time but are still of interest to the SBB. The JNDI API does not differentiate one binding from another; so it’s not easy for an SBB, for example, to find all resource adaptor entity bindings.
As an extension, Rhino provides all JNDI environment bindings to an SBB or SBB part in a separate map structure. The map is keyed on the fully qualified binding name, with map values containing metadata about the type of binding as well as the bound object itself.
An SBB obtains access to the JNDI bindings map from its RhinoSbbContext
object (a Rhino extension of SbbContext
):
package com.opencloud.rhino.slee;
import java.util.Map;
import javax.slee.SLEEException;
import javax.slee.SbbContext;
import com.opencloud.rhino.slee.environment.JndiBinding;
public interface RhinoSbbContext extends SbbContext {
public Map<String,JndiBinding> getJndiBindings()
throws SLEEException;
...
}
An SBB part obtains access to the JNDI bindings map from its SbbPartContext
object:
package com.opencloud.rhino.slee.sbbpart;
import java.util.Map;
import javax.slee.SLEEException;
import javax.slee.SbbContext;
import com.opencloud.rhino.slee.environment.JndiBinding;
public interface SbbPartContext extends SbbContext {
public Map<String,JndiBinding> getJndiBindings()
throws SLEEException;
...
}
JndiBinding class
The com.opencloud.rhino.slee.environment.JndiBinding
class is shown below:
package com.opencloud.rhino.slee.environment;
public abstract class JndiBinding {
public abstract BindingType getType();
public String getJndiName() { ... }
public Object getValue() { ... }
public boolean equals(Object o) { ... }
public int hashCode() { ... }
}
getType method
The getType
method returns the type of the JNDI binding.
The BindingType
enumeration is shown below:
package com.opencloud.rhino.slee.environment;
public enum BindingType {
ENV_ENTRY,
ACTIVITY_CONTEXT_INTERFACE_FACTORY,
RESOURCE_ADAPTOR_ENTITY,
FACILITY,
LIMITER_ENDPOINT
}
A JNDI binding may be one of:
-
an environment entry
-
an activity context interface factory, such as the null activity context interface factory
-
a resource adaptor entity link binding
-
a SLEE facility, such as the timer facility and alarm facility
Activity factories, such as the null activity factory and service activity factory are considered to be SLEE facilities for this purpose. -
a configured Rhino limiter endpoint.
getJndiName method
The getJndiName
method returns the fully qualified name of the JNDI binding.
This value is equal to the key that the JndiBinding
object is stored with in the map of bindings.
getValue method
The getValue
method returns the object bound to the JNDI name.
For example, this could be an environment entry value, a SLEE facility, and so on.
Subclasses of JndiBinding
The JndiBinding
class is an abstract class.
A subclass of JndiBinding
exists for each different type of binding.
Each of these is described below.
EnvEntry class
The EnvEntry
class is used to describe a JNDI binding for an environment entry.
The EnvEntry
class is shown below:
package com.opencloud.rhino.slee.environment;
public final class EnvEntry extends JndiBinding {
public EnvEntry(String jndiName, Object value) { ... }
public BindingType getType() { return BindingType.ENV_ENTRY; }
public String toString() { ... }
}
Facility class
The Facility
class is used to describe a JNDI binding for a SLEE facility such as the timer facility as well as activity factories such as the null activity factory.
The Facility
class is shown below:
package com.opencloud.rhino.slee.environment;
public final class Facility extends JndiBinding {
public Facility(String jndiName, Object value) { ... }
public BindingType getType() { return BindingType.FACILITY; }
public String toString() { ... }
}
LimiterEndpoint class
The LimiterEndpoint
class is used to describe a JNDI binding for a configured limiter endpoint.
The LimiterEndpoint
class is shown below:
package com.opencloud.rhino.slee.environment;
public final class LimiterEndpoint extends JndiBinding {
public LimiterEndpoint(String jndiName, Object value) { ... }
public BindingType getType() { return BindingType.LIMITER_ENDPOINT; }
public String toString() { ... }
}
ResourceAdaptorTypeBinding class
The ResourceAdaptorTypeBinding
class is the superclass for JNDI binding metadata classes related to resource adaptor types.
The ResourceAdaptorTypeBinding
class is shown below:
package com.opencloud.rhino.slee.environment;
import javax.slee.resource.ResourceAdaptorTypeID;
public abstract class ResourceAdaptorTypeBinding extends JndiBinding {
public ResourceAdaptorTypeID getResourceAdaptorType() { ... }
public int hashCode() { ... }
}
The getResourceAdaptorType
method returns the component identifier of the resource adaptor type that the binding is associated with.
ActivityContextInterfaceFactoryBinding class
The ActivityContextInterfaceFactoryBinding
class is used to describe a JNDI binding for an activity context interface factory.
The ActivityContextInterfaceFactoryBinding
class is shown below:
package com.opencloud.rhino.slee.environment;
import javax.slee.resource.ResourceAdaptorTypeID;
public final class ActivityContextInterfaceFactoryBinding extends ResourceAdaptorTypeBinding {
public ActivityContextInterfaceFactoryBinding(String jndiName, ResourceAdaptorTypeID raType, Object value) { ... }
public BindingType getType() { return BindingType.ACTIVITY_CONTEXT_INTERFACE_FACTORY; }
public String toString() { ... }
}
ResourceAdaptorEntityBinding class
The ResourceAdaptorEntityBinding
class is used to describe a JNDI binding for a resource adaptor entity.
The ResourceAdaptorEntityBinding
class is shown below:
package com.opencloud.rhino.slee.environment;
import javax.slee.resource.ResourceAdaptorTypeID;
public final class ResourceAdaptorEntityBinding extends ResourceAdaptorTypeBinding {
public ResourceAdaptorEntityBinding(String jndiName, ResourceAdaptorTypeID raType, Object value) { ... }
public BindingType getType() { return BindingType.RESOURCE_ADAPTOR_ENTITY; }
public String toString() { ... }
}