org.jboss.cache.marshall
Class RegionManager

java.lang.Object
  extended by org.jboss.cache.marshall.RegionManager

public class RegionManager
extends java.lang.Object

Factory to create region from configuration, to track region, and to resolve naming conflict for regions. Note that in addition to user-specified regions, there is also a global cache _default_ region that covers everything else.

Note that this is almost identical to the one used in eviction policy. We will need to refactor them in the future for everyone to use.

Version:
$Id: RegionManager.java,v 1.11 2006/06/07 22:28:08 msurtani Exp $
Author:
Ben Wang 08-2005

Constructor Summary
RegionManager()
           
 
Method Summary
 void checkConflict(Fqn fqn)
          Check for conflict in the current regions.
 void checkConflict(java.lang.String myFqn)
          Check for conflict in the current regions.
 Region createRegion(Fqn fqn, java.lang.ClassLoader cl, boolean inactive)
          Create a region based on fqn.
 Region createRegion(java.lang.String fqn, java.lang.ClassLoader cl)
          Create a region based on fqn.
 Region createRegion(java.lang.String fqn, java.lang.ClassLoader cl, boolean inactive)
          Create a region based on fqn.
 Region getRegion(Fqn fqn)
          Returns the Region corresponding to this Fqn.
 Region getRegion(java.lang.String myFqn)
          Returns the Region belonging to a String FQN.
 Region[] getRegions()
          Gets the Regions managed by this object.
 boolean hasRegion(Fqn fqn)
          Returns true if the region exists.
 boolean hasRegion(java.lang.String myFqn)
          Returns true if the region exists.
 boolean removeRegion(Fqn fqn)
          Removes a region by Fqn, returns true if the region was found.
 void removeRegion(java.lang.String fqn)
          Removes a region by string.
 void setUnmarshallingClassLoader(Fqn subtree)
          Helper utility that checks for a classloader registered for the given Fqn, and if found sets it as the TCCL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegionManager

public RegionManager()
Method Detail

createRegion

public Region createRegion(java.lang.String fqn,
                           java.lang.ClassLoader cl)
                    throws RegionNameConflictException
Create a region based on fqn.

Parameters:
fqn - The region identifier.
cl - Class loader
Throws:
RegionNameConflictException

createRegion

public Region createRegion(java.lang.String fqn,
                           java.lang.ClassLoader cl,
                           boolean inactive)
                    throws RegionNameConflictException
Create a region based on fqn.

Parameters:
fqn - The region identifier.
cl - Class loader
Throws:
RegionNameConflictException

createRegion

public Region createRegion(Fqn fqn,
                           java.lang.ClassLoader cl,
                           boolean inactive)
                    throws RegionNameConflictException
Create a region based on fqn.

Parameters:
fqn - The region identifier.
cl - Class loader
Throws:
RegionNameConflictException

removeRegion

public void removeRegion(java.lang.String fqn)
Removes a region by string.


removeRegion

public boolean removeRegion(Fqn fqn)
Removes a region by Fqn, returns true if the region was found.


hasRegion

public boolean hasRegion(java.lang.String myFqn)
Returns true if the region exists.


hasRegion

public boolean hasRegion(Fqn fqn)
Returns true if the region exists.


getRegion

public Region getRegion(java.lang.String myFqn)
Returns the Region belonging to a String FQN.


getRegion

public Region getRegion(Fqn fqn)
Returns the Region corresponding to this Fqn.


getRegions

public Region[] getRegions()
Gets the Regions managed by this object.

Returns:
the regions. Will not return null.

checkConflict

public void checkConflict(java.lang.String myFqn)
                   throws RegionNameConflictException
Check for conflict in the current regions. There is a conflict if fqn is any parent fqn of the current regions.

Parameters:
myFqn - Current fqn for potential new region.
Throws:
RegionNameConflictException - to indicate a region name conflict has ocurred.

checkConflict

public void checkConflict(Fqn fqn)
                   throws RegionNameConflictException
Check for conflict in the current regions. There is a conflict if fqn is any parent fqn of the current regions.

Throws:
RegionNameConflictException

setUnmarshallingClassLoader

public void setUnmarshallingClassLoader(Fqn subtree)
Helper utility that checks for a classloader registered for the given Fqn, and if found sets it as the TCCL. If the given Fqn is under the _BUDDY_BACKUP_ region, the equivalent region in the main tree is used to find the classloader.

Parameters:
subtree - Fqn pointing to a region for which a special classloader may have been registered.


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.