org.openpermis.editor.policy.view
Class PolicyViewConfiguration

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

public class PolicyViewConfiguration
extends Object
implements Configuration

Component factory that provides extended functionality for the policy view.

Since:
0.9.0

Constructor Summary
PolicyViewConfiguration(Configuration configuration, PolicyHolder holder)
          Creates policy view component factory.
 
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.
 boolean canCreatePolicyComponent(Class<?> scope, Class<?> type)
          Check if a component that depends on the currently loaded policy can be created.
protected  Configuration configure(Configuration config, PolicyHolder holder)
          Configures the specified component factory for use with the policy view.
<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.
protected
<T> List<T>
createOrderedList(Class<T> implClass, String section)
          Creates an ordered list for the specified implementation class.
 org.openpermis.policy.bean.PartBeanFactory createPartBeanFactory()
          Creates a part bean factory for this configuration.
<T> T
createPolicyComponent(Class<T> type)
          Creates a component that depends on the currently loaded policy.
<T> T
createPolicyComponent(Class<T> scope, Class<?> type, Object parameter)
          Creates a component that depends on the currently loaded policy.
 List<Tool> createStartupTools(List<Tool> toolList)
          Determines the list of tools to open at startup.
 String getLocation(Tool tool)
          Returns the preferred location specification for a tool.
 List<Class<?>> getOrder(String section)
          Returns the order in which implementation classes of the specified section have been listed.
 List<Plugin> getPlugins()
          Returns an ordered list of all known plugins.
 List<PolicyPlugin> getPolicyPlugins()
          Returns an ordered list of all known policy plugins.
 PolicySerializer getPolicySerializer()
          Returns the policy serializer of this configuration.
protected  PolicyPresenter getPresenter()
          Returns the currently active policy presenter.
 Object getSetting(Object type, String key)
          Returns the setting value for the specified type and key.
 List<Tool> getStartupTools()
          Returns the list of tools to open at startup.
 List<Tool> getTools()
          Returns an ordered list of all known tools.
<T> List<T>
instances(Class<T> type)
          Returns a list of all instances of a specific type stored at the factory.
 void setPresenter(PolicyPresenter presenter)
          Sets the currently active policy presenter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolicyViewConfiguration

public PolicyViewConfiguration(Configuration configuration,
                               PolicyHolder holder)
Creates policy view component factory.

Parameters:
configuration - the configuration to delegate to.
holder - the holder of the active policy.
Since:
0.9.0
Method Detail

configure

protected Configuration configure(Configuration config,
                                  PolicyHolder holder)
Configures the specified component factory for use with the policy view.

View specific classes needed for injection will be added here.

Parameters:
config - the actual configuration to delegate to.
holder - the holder of the active policy.
Returns:
the factory passed in for fluent use.
Since:
0.9.0

createOrderedList

protected <T> List<T> createOrderedList(Class<T> implClass,
                                        String section)
Creates an ordered list for the specified implementation class.

Returns:
the ordered list requested.
Since:
0.9.0

createStartupTools

public List<Tool> createStartupTools(List<Tool> toolList)
Determines the list of tools to open at startup.

Parameters:
toolList - the list of tools to consider.
Returns:
the startup tool list as a subset of the list specified.
Since:
0.9.0

setPresenter

public void setPresenter(PolicyPresenter presenter)
Sets the currently active policy presenter.

Parameters:
presenter - the presenter to mark as currently active, null if there is no active presenter.
Since:
0.9.0

getPresenter

protected PolicyPresenter getPresenter()
Returns the currently active policy presenter.

Returns:
the currently active policy presenter.
Since:
0.9.0

createPolicyComponent

public <T> T createPolicyComponent(Class<T> scope,
                                   Class<?> type,
                                   Object parameter)
Creates a component that depends on the currently loaded policy.

Type Parameters:
T - the type of component to create.
Parameters:
scope - the sort of component to create, e.g. Editor.class.
type - the type of component to create, e.g. TargetBean.class.
parameter - an additional parameter to pass to the constructor.
Returns:
the created component.
Since:
0.9.0

createPolicyComponent

public <T> T createPolicyComponent(Class<T> type)
Creates a component that depends on the currently loaded policy.

The currently active policy is injected as PolicyBean.

Type Parameters:
T - the type of component to create.
Parameters:
type - the type of component to create.
Returns:
the component created.
Since:
0.9.0

canCreatePolicyComponent

public boolean canCreatePolicyComponent(Class<?> scope,
                                        Class<?> type)
Check if a component that depends on the currently loaded policy can be created.

Parameters:
scope - the sort of component to create, e.g. Editor.class.
type - the type of component to create, e.g. TargetBean.class.
Returns:
true if an implementation is available, false otherwise.
Since:
0.9.0

getTools

public List<Tool> getTools()
Returns an ordered list of all known tools.

Returns:
the list of all tools known, never null.
Since:
0.9.0

getStartupTools

public List<Tool> getStartupTools()
Returns the list of tools to open at startup.

Returns:
the tool requested or null if there is none.
Since:
0.9.0

getPlugins

public List<Plugin> getPlugins()
Returns an ordered list of all known plugins.

Returns:
the list of all plugins known, never null.
Since:
0.9.0

getPolicyPlugins

public List<PolicyPlugin> getPolicyPlugins()
Returns an ordered list of all known policy plugins.

Returns:
the list of all policy plugins known, never null.
Since:
0.9.0

getLocation

public String getLocation(Tool tool)
Returns the preferred location specification for a tool.

Parameters:
tool - the tool for which to determine the location.
Returns:
the location specification or null if unknown.
Since:
0.9.0

createPartBeanFactory

public org.openpermis.policy.bean.PartBeanFactory createPartBeanFactory()
Creates a part bean factory for this configuration.

Returns:
the part bean factory created for this configuration.
Since:
0.9.0

getPolicySerializer

public PolicySerializer getPolicySerializer()
Returns the policy serializer of this configuration.

Returns:
the policy serializer of this configuration.
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

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

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

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

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

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