FileDocCategorySizeDatePackage
Ejb3Registry.javaAPI DocJBoss 4.2.13928Fri Jul 13 20:53:58 BST 2007org.jboss.ejb3

Ejb3Registry

public class Ejb3Registry extends Object
Maintains an administration of all EJB3 container available.
author
William DeCoste
version
$Revision: 60233 $

Fields Summary
private static final Logger
log
private static Map
containers
Constructors Summary
Methods Summary
public static ContainerfindContainer(java.lang.String oid)
Find a potential container.

param
oid the canonical object name of the container
return
the container or null if not found


                                      
       
   
      return containers.get(oid);
   
public static ContainergetContainer(java.lang.String oid)
Returns the container specified by the given canocical object name. Never returns null.

param
oid the canonical object name of the container
return
the container
throws
IllegalStateException if the container is not registered

      if(!hasContainer(oid))
         throw new IllegalStateException("Container " + oid + " is not registered");
      return containers.get(oid);
   
public static java.util.CollectiongetContainers()
Returns an unmodifiable collection of the registered containers.

return
the containers

      return Collections.unmodifiableCollection(containers.values());
   
public static booleanhasContainer(java.lang.String oid)
Reports the existance of a container.

param
oid the canonical object name of the container
return
true if found, false otherwise

      return containers.containsKey(oid);
   
private static final java.lang.Stringoid(Container container)

      return container.getObjectName().getCanonicalName();
   
public static voidregister(Container container)
Registers a container.

param
container the container to register
throws
IllegalStateException if the container is already registered

      String oid = oid(container);
      if(hasContainer(oid))
         throw new IllegalStateException("Container " + oid + " + is already registered");
      containers.put(oid, container);
   
public static voidunregister(Container container)
Unregisters a container.

param
container the container to unregister
throws
IllegalStateException if the container is not registered

      String oid = oid(container);
      if(!hasContainer(oid))
         throw new IllegalStateException("Container " + oid + " + is not registered");
      containers.remove(oid);