org.codehaus.aspectwerkz.definition
Class DefinitionLoader

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

public class DefinitionLoader
extends java.lang.Object

Handles the loading of the definition in various ways and formats.

Author:
Jonas Bonér

Field Summary
static java.lang.String DEFAULT_DEFINITION_FILE_NAME
          The default name for the definition file.
static java.lang.String DEFAULT_SYSTEM
          The UUID of the single AspectWerkz system if only one definition is used.
static java.lang.String DEFINITION_FILE
          The path to the definition file.
 
Constructor Summary
DefinitionLoader()
           
 
Method Summary
static java.util.List createDefinition(org.dom4j.Document document)
          Creates, caches and returns new definition.
static AspectWerkzDefinition getDefinition(java.lang.String uuid)
          Loads the aspectwerkz definition from disk based on a specific UUID.
static java.io.InputStream getDefinitionInputStream()
          Returns an input stream to the definition if found on classpath.
static java.util.List getDefinitionsForTransformation()
          Loads the aspectwerkz definition from disk.
static AspectWerkzDefinition loadAndMergeDefinitions(java.lang.ClassLoader loader)
          Loads and merges the definition.
static java.util.List loadDefaultDefinitionsFromFile(boolean isDirty)
          Returns the definitions.
static java.util.List loadDefinitionsAsResource()
          Loads the definitions from disk.
static java.util.List loadDefinitionsFromDocument(org.dom4j.Document document)
          Returns the definition.
static java.util.List loadDefinitionsFromFile(java.lang.String definitionFile)
          Returns the definitions.
static java.util.List loadDefinitionsFromFile(java.lang.String definitionFile, boolean isDirty)
          Returns the definitions.
static java.util.List loadDefinitionsFromStream(java.io.InputStream stream)
          Returns the definitions.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SYSTEM

public static final java.lang.String DEFAULT_SYSTEM
The UUID of the single AspectWerkz system if only one definition is used.

See Also:
Constant Field Values

DEFINITION_FILE

public static final java.lang.String DEFINITION_FILE
The path to the definition file.


DEFAULT_DEFINITION_FILE_NAME

public static final java.lang.String DEFAULT_DEFINITION_FILE_NAME
The default name for the definition file.

See Also:
Constant Field Values
Constructor Detail

DefinitionLoader

public DefinitionLoader()
Method Detail

createDefinition

public static java.util.List createDefinition(org.dom4j.Document document)
Creates, caches and returns new definition. Loads the definition in the file specified.

Parameters:
document - the DOM document containing the definition
Returns:
the definitions

getDefinitionsForTransformation

public static java.util.List getDefinitionsForTransformation()
Loads the aspectwerkz definition from disk. Used by the transformers. Grabs the first one it finds (should only by one in the transformations process).

Returns:
the aspectwerkz definition

getDefinition

public static AspectWerkzDefinition getDefinition(java.lang.String uuid)
Loads the aspectwerkz definition from disk based on a specific UUID. Only loads from the disk if the timestamp for the latest parsing is older than the timestamp for the weave model.

Parameters:
uuid - the uuid for the weave model to load (null is allowed if only XML definition is used)
Returns:
the aspectwerkz definition

loadDefinitionsAsResource

public static java.util.List loadDefinitionsAsResource()
Loads the definitions from disk. Only loads a new model from disk if it has changed.

Returns:
the definitions

loadDefaultDefinitionsFromFile

public static java.util.List loadDefaultDefinitionsFromFile(boolean isDirty)
Returns the definitions.

If the file name is not specified as a parameter to the JVM it tries to locate a file named 'aspectwerkz.xml' on the classpath.

Parameters:
isDirty - flag to mark the the defintion as updated or not
Returns:
the definitions

loadDefinitionsFromFile

public static java.util.List loadDefinitionsFromFile(java.lang.String definitionFile)
Returns the definitions.

Parameters:
definitionFile - the definition file
Returns:
the definitions

getDefinitionInputStream

public static java.io.InputStream getDefinitionInputStream()
Returns an input stream to the definition if found on classpath.

Returns:
the input stream to the definition

loadDefinitionsFromFile

public static java.util.List loadDefinitionsFromFile(java.lang.String definitionFile,
                                                     boolean isDirty)
Returns the definitions.

Parameters:
definitionFile - the definition file
isDirty - flag to mark the the defintion as updated or not
Returns:
the definitions

loadDefinitionsFromStream

public static java.util.List loadDefinitionsFromStream(java.io.InputStream stream)
Returns the definitions.

Parameters:
stream - the stream containing the definition file
Returns:
the definitions

loadDefinitionsFromDocument

public static java.util.List loadDefinitionsFromDocument(org.dom4j.Document document)
Returns the definition.

Parameters:
document - the DOM document containing the definition file
Returns:
the definitions

loadAndMergeDefinitions

public static AspectWerkzDefinition loadAndMergeDefinitions(java.lang.ClassLoader loader)
Loads and merges the definition.

Parameters:
loader - the class loader to use
Returns:
the aspectwerkz definition


Copyright (c) 2002-2004 The AspectWerkz Team. All Rights Reserved.