org.objectweb.jac.core
Class ACConfiguration

java.lang.Object
  extended byorg.objectweb.jac.core.ACConfiguration
All Implemented Interfaces:
Serializable

public class ACConfiguration
extends Object
implements Serializable

This class defines aspect component configurations so that the programmer or the system administrator will be able to configure the available aspects for a given application.

The default available aspects in the system are the ones that are declared to the AC manager in the jac.prop (see the org.objectweb.jac.acs property).

See Also:
ApplicationRepository, Application, Parser, ACManager, Serialized Form

Field Summary
protected  Application application
          The application this configuration belongs to.
protected  URL filePath
          The configuration file's URL.
protected  String name
          The name of the configured AC.
protected  boolean weaveOnDemand
          This flag tells if the aspect that is configured by the current configuration will be woven on demand (by the administrator or by a configuration program) or if the aspect will be automatically woven and restored by the system.
 
Constructor Summary
ACConfiguration(Application application, String name, String filePath, boolean weaveNow)
          Creates a new aspect component configuration.
 
Method Summary
protected  void configure()
          Configures the aspect component.
static Object convertArray(Object[] array, Class componentType, Imports imports)
           
static Object convertValue(Object object, Class type)
           
static Object convertValue(Object object, Class type, Imports imports)
           
 Application getApplication()
          Gets the owning application.
 ClassItem getAspectClass()
          Return the class item for the configured aspect component.
protected static ClassItem getClass(String name, Imports imports)
           
 AspectComponent getInstance()
          Gets the aspect component instance that corresponds to this configuration.
 String getName()
          Gets the name of the configured AC as defined in the declared ACs of the AC manager.
 URL getURL()
          The getter of the configuration file's URL.
 boolean getWeaveOnDemand()
          Gets the weaveOnDemand flag value.
protected  AspectComponent instantiate()
          Instantiates a new aspect component.
protected static void resolveTypes(String[] types, Imports imports)
           
 void setName(String name)
          The aspect name setter.
 void setURL(URL filePath)
          Sets the URL of the configuration file that defines the configuration operations.
 void setWeaveOnDemand(boolean b)
          Sets the weaveOnDemand flag value.
 String toString()
          Returns a string representation of this configuration.
 void unweave()
          Unweaves the aspect component that corresponds to this configuration.
 void weave()
          Instantiates, configures, and weaves the aspect component that corresponds to this configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

application

protected Application application
The application this configuration belongs to.


name

protected String name
The name of the configured AC.


filePath

protected URL filePath
The configuration file's URL.


weaveOnDemand

protected boolean weaveOnDemand
This flag tells if the aspect that is configured by the current configuration will be woven on demand (by the administrator or by a configuration program) or if the aspect will be automatically woven and restored by the system.

For instance, a persistence aspect should always have this configuration flag to false whilst a debugging aspect should most of the time be woven on demand (when debugging is needed).

Constructor Detail

ACConfiguration

public ACConfiguration(Application application,
                       String name,
                       String filePath,
                       boolean weaveNow)
Creates a new aspect component configuration.

Parameters:
application - the application this configuration belongs to
name - the name of the AC as defined in the declared ACs of the AC manager, or the of the aspect component's class
filePath - the path of the configuration file; it can be absolute but, if relative, it is automatically concatened to the application's path
weaveNow - a true value means that the aspect that configured by this configuration will be automatically woven at the application's start, a false value means that the user will have to weave it with a program (or with the administration GUI); default is true
Method Detail

setURL

public void setURL(URL filePath)
Sets the URL of the configuration file that defines the configuration operations.

Parameters:
filePath - a valid file path
See Also:
getURL()

getURL

public URL getURL()
The getter of the configuration file's URL.

Returns:
the URL
See Also:
setURL(URL)

getWeaveOnDemand

public boolean getWeaveOnDemand()
Gets the weaveOnDemand flag value.

Returns:
the flag value

setWeaveOnDemand

public void setWeaveOnDemand(boolean b)
Sets the weaveOnDemand flag value.

Parameters:
b - the new flag value

getName

public String getName()
Gets the name of the configured AC as defined in the declared ACs of the AC manager.

Returns:
the AC name
See Also:
setName(String), ACManager

setName

public void setName(String name)
The aspect name setter. Must be declared in the jac.prop.

Parameters:
name - the aspect name
See Also:
ACManager

getInstance

public AspectComponent getInstance()
Gets the aspect component instance that corresponds to this configuration.

Returns:
the AC instance

getApplication

public Application getApplication()
Gets the owning application.

Returns:
the application that owns this configuration

getAspectClass

public ClassItem getAspectClass()
Return the class item for the configured aspect component.

Returns:
the AC type

instantiate

protected AspectComponent instantiate()
Instantiates a new aspect component.

Returns:
the new aspect component, null if something went wrong

configure

protected void configure()
Configures the aspect component.

This method takes the aspect component instance that corresponds to this configuration, parse the configuration file, and calls all the configuration operations that are defined in this file.

See Also:
Parser, getInstance()

convertArray

public static Object convertArray(Object[] array,
                                  Class componentType,
                                  Imports imports)
                           throws Exception
Throws:
Exception

convertValue

public static Object convertValue(Object object,
                                  Class type)
                           throws Exception
Throws:
Exception

convertValue

public static Object convertValue(Object object,
                                  Class type,
                                  Imports imports)
                           throws Exception
Throws:
Exception

resolveTypes

protected static void resolveTypes(String[] types,
                                   Imports imports)

getClass

protected static ClassItem getClass(String name,
                                    Imports imports)

weave

public void weave()
Instantiates, configures, and weaves the aspect component that corresponds to this configuration.

See Also:
instantiate(), configure()

unweave

public void unweave()
Unweaves the aspect component that corresponds to this configuration.


toString

public String toString()
Returns a string representation of this configuration.

Returns:
a string