org.codehaus.aspectwerkz.definition
Class SystemDefinitionContainer

java.lang.Object
  extended byorg.codehaus.aspectwerkz.definition.SystemDefinitionContainer

public class SystemDefinitionContainer
extends Object

The SystemDefintionContainer maintains all the definition and is aware of the classloader hierarchy.

A ThreadLocal structure is used during weaving to store current classloader defintion hierarchy.

Due to getResources() API, we maintain a perClassLoader loaded resource list so that it contains only resource defined within the classloader and not its parent.

Author:
Alexandre Vasseur

Field Summary
static String AOP_META_INF_XML_FILE
          The AOP deployment descriptor for any deployed unit Note: Tomcat 5 does not handles war/META-INF
static String AOP_WEB_INF_XML_FILE
          The AOP deployment descriptor for any deployed unit in a webapp TODO for EAR/EJB/JCA stuff
static Map s_classLoaderDefinitionLocations
          Map of SystemDefinition location (as URL[List]) per ClassLoader
static Map s_classLoaderHierarchicalSystemDefinitions
          Map of SystemDefinition[List] per ClassLoader, with the hierarchy structure
static Map s_classLoaderSystemDefinitions
          Map of SystemDefinition[List] per ClassLoader
static String URL_JVM_OPTION_SYSTEM
          Default location for default AspectWerkz definition file, JVM wide
static String WEB_WEB_INF_XML_FILE
           
 
Constructor Summary
SystemDefinitionContainer()
           
 
Method Summary
static void deploySystemDefinitions(ClassLoader loader, List definitions)
          Hotdeploy a list of SystemDefintions as defined at the level of the given ClassLoader

Note: this is used for Offline mode TODO: sync StartupManager TODO: flush sub systems defs or allow different organization if wished so ?

static void disableSystemWideDefinition()
          Turns on the option to avoid -Daspectwerkz.definition.file handling.
static void dump(ClassLoader loader)
          Pretty dump a classloader
static Set getAllRegisteredClassLoaders()
          Returns the list of all ClassLoaders registered so far Note: when a child ClassLoader is registered, all its parent hierarchy is registered
static List getHierarchicalDefs(ClassLoader loader)
          Returns the gathered SystemDefinition visible from a classloader.
static SystemDefinition getSystemDefinition(ClassLoader loader, String uuid)
          Lookup for a given SystemDefinition by uuid within a given ClassLoader The lookup does not go thru the ClassLoader hierarchy
static List getSystemDefinitions(ClassLoader loader)
          Return the list of SystemDefinitions defined at the given ClassLoader level.
static boolean isDefinedBy(ClassLoader loader, URL def)
          Check if a given resource has already been registered to a classloader and its parent hierachy
static void registerClassLoader(ClassLoader loader)
          Register a new ClassLoader in the system and gather all its definition and parents definitions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_classLoaderSystemDefinitions

public static final Map s_classLoaderSystemDefinitions
Map of SystemDefinition[List] per ClassLoader


s_classLoaderHierarchicalSystemDefinitions

public static final Map s_classLoaderHierarchicalSystemDefinitions
Map of SystemDefinition[List] per ClassLoader, with the hierarchy structure


s_classLoaderDefinitionLocations

public static final Map s_classLoaderDefinitionLocations
Map of SystemDefinition location (as URL[List]) per ClassLoader


URL_JVM_OPTION_SYSTEM

public static final String URL_JVM_OPTION_SYSTEM
Default location for default AspectWerkz definition file, JVM wide


AOP_META_INF_XML_FILE

public static final String AOP_META_INF_XML_FILE
The AOP deployment descriptor for any deployed unit Note: Tomcat 5 does not handles war/META-INF

See Also:
Constant Field Values

AOP_WEB_INF_XML_FILE

public static final String AOP_WEB_INF_XML_FILE
The AOP deployment descriptor for any deployed unit in a webapp TODO for EAR/EJB/JCA stuff

See Also:
Constant Field Values

WEB_WEB_INF_XML_FILE

public static final String WEB_WEB_INF_XML_FILE
See Also:
Constant Field Values
Constructor Detail

SystemDefinitionContainer

public SystemDefinitionContainer()
Method Detail

registerClassLoader

public static void registerClassLoader(ClassLoader loader)
Register a new ClassLoader in the system and gather all its definition and parents definitions.

Parameters:
loader - the class loader to register

isDefinedBy

public static boolean isDefinedBy(ClassLoader loader,
                                  URL def)
Check if a given resource has already been registered to a classloader and its parent hierachy

Parameters:
loader - the classloader which might define the resource
def - the resource
Returns:
true if classloader or its parent defines the resource

dump

public static void dump(ClassLoader loader)
Pretty dump a classloader

Parameters:
loader -

getHierarchicalDefs

public static List getHierarchicalDefs(ClassLoader loader)
Returns the gathered SystemDefinition visible from a classloader.

This method is using a cache. Caution when modifying this method since when an aop.xml is loaded, the aspect classes gets loaded as well, which triggers this cache, while the system is in fact not yet initialized properly.

Parameters:
loader -
Returns:
List of SystemDefinition

deploySystemDefinitions

public static void deploySystemDefinitions(ClassLoader loader,
                                           List definitions)
Hotdeploy a list of SystemDefintions as defined at the level of the given ClassLoader

Note: this is used for Offline mode TODO: sync StartupManager TODO: flush sub systems defs or allow different organization if wished so ?

Parameters:
loader - ClassLoader
definitions - SystemDefinitions list

getSystemDefinitions

public static List getSystemDefinitions(ClassLoader loader)
Return the list of SystemDefinitions defined at the given ClassLoader level. Does not handles the ClassLoader hierarchy.

Parameters:
loader -
Returns:
SystemDefinitions list

getSystemDefinition

public static SystemDefinition getSystemDefinition(ClassLoader loader,
                                                   String uuid)
Lookup for a given SystemDefinition by uuid within a given ClassLoader The lookup does not go thru the ClassLoader hierarchy

Parameters:
loader - ClassLoader
uuid - system uuid
Returns:
SystemDefinition or null if no such defined definition

getAllRegisteredClassLoaders

public static Set getAllRegisteredClassLoaders()
Returns the list of all ClassLoaders registered so far Note: when a child ClassLoader is registered, all its parent hierarchy is registered

Returns:
ClassLoader Set

disableSystemWideDefinition

public static void disableSystemWideDefinition()
Turns on the option to avoid -Daspectwerkz.definition.file handling.



Copyright © 2002-2004 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.