org.apache.avalon.composition.model.impl
Class DefaultSystemContextFactory

java.lang.Object
  extended byorg.apache.avalon.composition.model.impl.DefaultSystemContextFactory
All Implemented Interfaces:
SystemContextFactory

public class DefaultSystemContextFactory
extends Object
implements SystemContextFactory

Implementation of a system context that exposes a system wide set of parameters.

Version:
$Revision: 1.10 $ $Date: 2004/04/20 16:53:19 $
Author:
Avalon Development Team

Constructor Summary
DefaultSystemContextFactory(InitialContext context)
          Creation of a new system context factory.
 
Method Summary
static LoggingManager createLoggingManager(InitialContext context, Artifact artifact, File dir, URL path, boolean trace)
          Utility method to create the LoggingManager.
 SystemContext createSystemContext()
          Creation of a new system context using supplied and default values.
 File getAnchorDirectory()
          Return the anchor directory from which a container may use to establish relative classpath references.
 File getBaseDirectory()
          Return the base directory from which relative classloader references may be resolved.
 long getDefaultDeploymentTimeout()
          Return the default deployment phase timeout value.
 Map getGrantsTable()
          Return the initial grants table.
 File getHomeDirectory()
          Return the working directory from which containers may establish persistent content.
 Artifact getLifestyleArtifact()
          Return the artifact referencing the lifestyle factory.
 LoggingManager getLoggingManager()
          Return the logging manager.
 String getName()
          Return the name assigned to the system context.
 Context getParentContext()
          Return the parent context to use when establishing a new SystemContext.
 Repository getRepository()
          Return the system wide repository from which resource directives can be resolved.
 Artifact getRuntimeArtifact()
          Return the artifact referencing the runtime.
 Class getRuntimeClass()
          Return the class implementating the runtime.
 boolean getSecurityEnabled()
          Return the security enabled status flag.
 SecurityProfile[] getSecurityProfiles()
          Return the assigned security profiles.
 File getTempDirectory()
          Return the temporary directory from which a container may use to establish a transient content directory.
 boolean isTraceEnabled()
          Return the system trace flag.
 void setAnchorDirectory(File anchor)
          Set the anchor directory.
 void setDefaultDeploymentTimeout(long timeout)
          Set the system wide default deployment timeout.
 void setGrantsTable(Map grants)
          Set the initial set of address to security profile grants.
 void setLifestyleArtifact(Artifact artifact)
          Set the lifestyle factory using a supplied artifact.
 void setLoggingManager(LoggingManager logging)
          Set the logging manager.
 void setName(String name)
          Set the name of the logging channel to be used by the system context.
 void setParentContext(Context parent)
          Set the parent context of the system context.
 void setRepository(Repository repository)
          Set the application repository.
 void setRuntime(Artifact artifact)
          Set the runtime artifact.
 void setRuntime(Class clazz)
          Set the runtime using a supplied class.
 void setSecurityEnabled(boolean secure)
          Set the security enabled status.
 void setSecurityModel(SecurityModel security)
           
 void setSecurityProfiles(SecurityProfile[] profiles)
          Set the security profiles.
 void setTemporaryDirectory(File temp)
          Set the temporary directory.
 void setTraceEnabled(boolean trace)
          Set the system trace flag.
 void setWorkingDirectory(File work)
          Set the working directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSystemContextFactory

public DefaultSystemContextFactory(InitialContext context)
Creation of a new system context factory.

Parameters:
context - a repository initial context
Method Detail

setSecurityEnabled

public void setSecurityEnabled(boolean secure)
Set the security enabled status. If TRUE component level security policies will be enabled. If FALSE security will disabled. The default value is FALSE.

Specified by:
setSecurityEnabled in interface SystemContextFactory
Parameters:
secure - the security enabled status

setParentContext

public void setParentContext(Context parent)
Set the parent context of the system context. If undefined the system context will be created using a null parent.

Specified by:
setParentContext in interface SystemContextFactory
Parameters:
parent - the parent context

setRuntime

public void setRuntime(Artifact artifact)
Set the runtime artifact. The runtime artifact is a reference to a runtime system capable of supporting component lifestyle and lifecycle management.

Specified by:
setRuntime in interface SystemContextFactory
Parameters:
artifact - an artifact referencing the runtime
See Also:
Runtime, SystemContextFactory.setRuntime( Class )

setLifestyleArtifact

public void setLifestyleArtifact(Artifact artifact)
Description copied from interface: SystemContextFactory
Set the lifestyle factory using a supplied artifact.

Specified by:
setLifestyleArtifact in interface SystemContextFactory
Parameters:
artifact - a factory artifact supporting LifestyleFactory instance creation.
See Also:
Runtime, SystemContextFactory.setRuntime( Class )

setRuntime

public void setRuntime(Class clazz)
Description copied from interface: SystemContextFactory
Set the runtime using a supplied class.

Specified by:
setRuntime in interface SystemContextFactory
Parameters:
clazz - a runtime implementation class
See Also:
Runtime

setRepository

public void setRepository(Repository repository)
Description copied from interface: SystemContextFactory
Set the application repository.

Specified by:
setRepository in interface SystemContextFactory
Parameters:
repository - the application repository

setLoggingManager

public void setLoggingManager(LoggingManager logging)
Description copied from interface: SystemContextFactory
Set the logging manager.

Specified by:
setLoggingManager in interface SystemContextFactory
Parameters:
logging - the logging manager

setDefaultDeploymentTimeout

public void setDefaultDeploymentTimeout(long timeout)
Description copied from interface: SystemContextFactory
Set the system wide default deployment timeout.

Specified by:
setDefaultDeploymentTimeout in interface SystemContextFactory
Parameters:
timeout - the timeout value in milliseconds

setTraceEnabled

public void setTraceEnabled(boolean trace)
Set the system trace flag.

Specified by:
setTraceEnabled in interface SystemContextFactory
Parameters:
trace - the trace flag

setSecurityModel

public void setSecurityModel(SecurityModel security)

setWorkingDirectory

public void setWorkingDirectory(File work)
Description copied from interface: SystemContextFactory
Set the working directory.

Specified by:
setWorkingDirectory in interface SystemContextFactory
Parameters:
work - the working directory

setTemporaryDirectory

public void setTemporaryDirectory(File temp)
Description copied from interface: SystemContextFactory
Set the temporary directory.

Specified by:
setTemporaryDirectory in interface SystemContextFactory
Parameters:
temp - the temporary directory

setAnchorDirectory

public void setAnchorDirectory(File anchor)
Set the anchor directory.

Specified by:
setAnchorDirectory in interface SystemContextFactory
Parameters:
anchor - the anchor directory

setName

public void setName(String name)
Description copied from interface: SystemContextFactory
Set the name of the logging channel to be used by the system context.

Specified by:
setName in interface SystemContextFactory
Parameters:
name - the name to assign

setSecurityProfiles

public void setSecurityProfiles(SecurityProfile[] profiles)
Description copied from interface: SystemContextFactory
Set the security profiles.

Specified by:
setSecurityProfiles in interface SystemContextFactory
Parameters:
profiles - the security profiles

setGrantsTable

public void setGrantsTable(Map grants)
Set the initial set of address to security profile grants.

Specified by:
setGrantsTable in interface SystemContextFactory
Parameters:
grants - the initial grants table

createSystemContext

public SystemContext createSystemContext()
                                  throws SystemException
Creation of a new system context using supplied and default values.

Specified by:
createSystemContext in interface SystemContextFactory
Returns:
a new system context instance
Throws:
SystemException - if a stytem context creation error occurs

getSecurityEnabled

public boolean getSecurityEnabled()
Return the security enabled status flag. If the value return is TRUE then the composition model and runtime will validate component initiated requires against named permission profiles. If the value is FALSE the permission validation actions will not be performed. The default value is FALSE.

Returns:
the security enabled flag

getParentContext

public Context getParentContext()
Return the parent context to use when establishing a new SystemContext.

Returns:
the parent context

getName

public String getName()
Return the name assigned to the system context.

Returns:
system context name

getGrantsTable

public Map getGrantsTable()
Return the initial grants table.

Returns:
the grants table

getSecurityProfiles

public SecurityProfile[] getSecurityProfiles()
Return the assigned security profiles. If not profiles has been assigned the implementation returns an empty profile array.

Returns:
the security profiles

getBaseDirectory

public File getBaseDirectory()
Return the base directory from which relative classloader references may be resolved.

Returns:
the base directory

getHomeDirectory

public File getHomeDirectory()
Return the working directory from which containers may establish persistent content.

Returns:
the working directory

getTempDirectory

public File getTempDirectory()
Return the temporary directory from which a container may use to establish a transient content directory.

Returns:
the temporary directory

getAnchorDirectory

public File getAnchorDirectory()
Return the anchor directory from which a container may use to establish relative classpath references. If undefined the value returned will default to the basedir.

Returns:
the anchor directory

getRepository

public Repository getRepository()
Return the system wide repository from which resource directives can be resolved.

Returns:
the repository

isTraceEnabled

public boolean isTraceEnabled()
Return the system trace flag.

Returns:
the trace flag

getLoggingManager

public LoggingManager getLoggingManager()
Return the logging manager.

Returns:
the logging manager.

getDefaultDeploymentTimeout

public long getDefaultDeploymentTimeout()
Return the default deployment phase timeout value.

Returns:
the timeout value

getRuntimeClass

public Class getRuntimeClass()
Return the class implementating the runtime.

Returns:
the runtime class

getRuntimeArtifact

public Artifact getRuntimeArtifact()
Return the artifact referencing the runtime.

Returns:
the runtime artifact

getLifestyleArtifact

public Artifact getLifestyleArtifact()
Return the artifact referencing the lifestyle factory.

Returns:
the lifestyle factory artifact

createLoggingManager

public static LoggingManager createLoggingManager(InitialContext context,
                                                  Artifact artifact,
                                                  File dir,
                                                  URL path,
                                                  boolean trace)
                                           throws Exception
Utility method to create the LoggingManager.

Parameters:
context - the initial context reference
artifact - the logging implementation factory artifact
dir - the logging system base directory
path - the logging system configuration path
trace - the trace enabled flag
Returns:
the logging manager
Throws:
NullPointerException - if the supplied context is null
Exception


Copyright © The Apache Software Foundation. All Rights Reserved.