org.openpermis.editor.policy.configuration
Class BasicConfiguration

java.lang.Object
  extended by org.openpermis.editor.policy.configuration.BasicConfiguration
All Implemented Interfaces:
ComponentFactory, Configuration

public class BasicConfiguration
extends Object
implements Configuration

Configuration object that holds a component factory and further information specified in the configuration file.

Since:
0.9.0

Field Summary
static String EDITOR_PRESENTERS
          Section name as it appears in the configuration file.
static String EDITOR_VIEWS
          Section name as it appears in the configuration file.
static String EDITORS_GROUP
          Section name as it appears in the configuration file.
static String GENERIC_GROUP
          Section name as it appears in the configuration file.
static String PLUGINS
          Section name as it appears in the configuration file.
static String POLICY
          Section name as it appears in the configuration file.
static String TOOL_PRESENTERS
          Section name as it appears in the configuration file.
static String TOOL_VIEWS
          Section name as it appears in the configuration file.
static String TOOLS_GROUP
          Section name as it appears in the configuration file.
protected static ConfigurationSectionTrader TRADER
          Default trader used as configuration section factory by the reader.
 
Constructor Summary
BasicConfiguration(URL url)
          Creates a new component factory for the specified configuration URL.
 
Method Summary
 void addFactoryAdapter(org.picocontainer.ComponentAdapter<?> componentAdapter)
          Adds a component adapter to the factory container.
 void addFactoryComponent(Object implOrInstance)
          Adds a component implementation or instance to the factory container.
 void addFactoryComponent(Object componentKey, Object implOrInstance)
          Adds a component implementation or instance to the factory container with a key.
 boolean canCreate(TypeKey typeKey)
          Check if this factory can create components of the given type.
<T> T
create(Class<?> type, State... context)
          Creates a component.
<T> T
create(TypeKey typeKey, State... context)
          Creates a typed component.
 ApplicationView createApplicationView()
          Returns a new instance of the application view configured.
 List<Class<?>> getOrder(String section)
          Returns the order in which implementation classes of the specified section have been listed.
 Object getSetting(Object type, String key)
          Returns the setting value for the specified type and key.
<T> List<T>
instances(Class<T> type)
          Returns a list of all instances of a specific type stored at the factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRADER

protected static final ConfigurationSectionTrader TRADER
Default trader used as configuration section factory by the reader.

Since:
0.9.0

GENERIC_GROUP

public static final String GENERIC_GROUP
Section name as it appears in the configuration file.

Constant Field Value:
"generic"
Since:
0.9.0

POLICY

public static final String POLICY
Section name as it appears in the configuration file.

Constant Field Value:
"policy"
Since:
0.9.0

PLUGINS

public static final String PLUGINS
Section name as it appears in the configuration file.

Constant Field Value:
"plugins"
Since:
0.9.0

EDITORS_GROUP

public static final String EDITORS_GROUP
Section name as it appears in the configuration file.

Constant Field Value:
"editors"
Since:
0.9.0

EDITOR_PRESENTERS

public static final String EDITOR_PRESENTERS
Section name as it appears in the configuration file.

Constant Field Value:
"editor-presenters"
Since:
0.9.0

EDITOR_VIEWS

public static final String EDITOR_VIEWS
Section name as it appears in the configuration file.

Constant Field Value:
"editor-views"
Since:
0.9.0

TOOLS_GROUP

public static final String TOOLS_GROUP
Section name as it appears in the configuration file.

Constant Field Value:
"tools"
Since:
0.9.0

TOOL_PRESENTERS

public static final String TOOL_PRESENTERS
Section name as it appears in the configuration file.

Constant Field Value:
"tool-presenters"
Since:
0.9.0

TOOL_VIEWS

public static final String TOOL_VIEWS
Section name as it appears in the configuration file.

Constant Field Value:
"tool-views"
Since:
0.9.0
Constructor Detail

BasicConfiguration

public BasicConfiguration(URL url)
                   throws ConfigurationException
Creates a new component factory for the specified configuration URL.

Parameters:
url - the URL to read the configuration file from.
Throws:
ConfigurationException - passed on, see ConfigurationReader.configure(org.openpermis.editor.policy.configuration.ClassSettings, org.picocontainer.MutablePicoContainer).
Since:
0.9.0
Method Detail

addFactoryComponent

public void addFactoryComponent(Object implOrInstance)
Description copied from interface: Configuration
Adds a component implementation or instance to the factory container.

Implementation classes will be added without caching.

Specified by:
addFactoryComponent in interface Configuration
Parameters:
implOrInstance - the component implementation or instance add.
Since:
0.9.0

addFactoryComponent

public void addFactoryComponent(Object componentKey,
                                Object implOrInstance)
Description copied from interface: Configuration
Adds a component implementation or instance to the factory container with a key.

Implementation classes will be added without caching.

Specified by:
addFactoryComponent in interface Configuration
Parameters:
componentKey - the component key to use.
implOrInstance - the component implementation or instance add.
Since:
0.9.0

addFactoryAdapter

public void addFactoryAdapter(org.picocontainer.ComponentAdapter<?> componentAdapter)
Description copied from interface: Configuration
Adds a component adapter to the factory container.

Specified by:
addFactoryAdapter in interface Configuration
Parameters:
componentAdapter - the component adapter to add.
Since:
0.9.0

createApplicationView

public ApplicationView createApplicationView()
Description copied from interface: Configuration
Returns a new instance of the application view configured.

Specified by:
createApplicationView in interface Configuration
Returns:
the application view instance requested.
Since:
0.9.0

getOrder

public List<Class<?>> getOrder(String section)
Description copied from interface: Configuration
Returns the order in which implementation classes of the specified section have been listed.

Specified by:
getOrder in interface Configuration
Parameters:
section - the section as it appears in the configuration file.
Returns:
the order requested, may be null for inexistent sections.
Since:
0.9.0

getSetting

public Object getSetting(Object type,
                         String key)
Description copied from interface: Configuration
Returns the setting value for the specified type and key.

Specified by:
getSetting in interface Configuration
Parameters:
type - the class for which to retrieve the value of key.
key - the key for which to retrieve the value.
Returns:
the value requested, null if undefined.
Since:
0.9.0

canCreate

public boolean canCreate(TypeKey typeKey)
Description copied from interface: ComponentFactory
Check if this factory can create components of the given type.

Specified by:
canCreate in interface ComponentFactory
Parameters:
typeKey - the type key for which to check if the factory can create an instance.
Returns:
true if the factory can provide an instance, false otherwise.
Since:
0.9.0

create

public <T> T create(Class<?> type,
                    State... context)
Description copied from interface: ComponentFactory
Creates a component.

The context state supplied is used to fill in missing parameters that are not available as default instances or implementations at the factory.

Specified by:
create in interface ComponentFactory
Type Parameters:
T - the component type, has to correspond to the scope of the type key.
Parameters:
type - the class for which to create the component.
context - additional state to inject to the component created.
Returns:
the component created.
Since:
0.9.0

create

public <T> T create(TypeKey typeKey,
                    State... context)
Description copied from interface: ComponentFactory
Creates a typed component.

The context state supplied is used to fill in missing parameters that are not available as default instances or implementations at the factory.

Specified by:
create in interface ComponentFactory
Type Parameters:
T - the component type, has to correspond to the scope of the type key.
Parameters:
typeKey - the type key for which to create the component.
context - additional state to inject to the component created.
Returns:
the component created.
Since:
0.9.0

instances

public <T> List<T> instances(Class<T> type)
Description copied from interface: ComponentFactory
Returns a list of all instances of a specific type stored at the factory.

Take care to use this method only to retrieve cached instances otherwise this factory will create an instance for each of the registered implementation types that are assignable to the type specified.

Specified by:
instances in interface ComponentFactory
Type Parameters:
T - the instance type to retrieve.
Parameters:
type - the class of the instance type to retrieve.
Returns:
the list of all known instances, never null but may be empty.
Since:
0.9.0


OpenPermis Role Based Access Control 0.9.0 (Build 16)
2009/08/13 07:17:21
Copyright (c) 2002-2007 Ergon Informatik AG