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

java.lang.Object
  extended byorg.apache.avalon.framework.context.DefaultContext
      extended byorg.apache.avalon.composition.model.impl.DefaultSystemContext
All Implemented Interfaces:
Context, SystemContext

public class DefaultSystemContext
extends DefaultContext
implements SystemContext

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

Version:
$Revision: 1.32 $ $Date: 2004/05/09 23:51:08 $
Author:
Avalon Development Team

Method Summary
 Runtime buildRuntimeInstance(InitialContext context, Class clazz, Artifact lifestyle)
          Build a runtime using a supplied class.
 void commission(DeploymentModel model)
          Request the commissioning of a runtime for a supplied deployment model.
 void decommission(DeploymentModel model)
          Request the decommissioning of a runtime for a supplied deployment model.
 File getAnchorDirectory()
          Return the anchor directory from which a container may use to resolve relative classpath references.
 ClassLoader getAPIClassLoader()
          Return the API classloader.
 File getBaseDirectory()
          Return the base directory from which relative classloader references may be resolved.
 long getDefaultDeploymentTimeout()
          Return the default deployment phase timeout value.
 File getHomeDirectory()
          Return the working directory from which containers may establish persistent content.
 Logger getLogger()
          Return the system logging channel.
 LoggingManager getLoggingManager()
          Return the logging manager.
 ModelFactory getModelFactory()
          Return the model factory.
 Repository getRepository()
          Return the system wide repository from which resource directives can be resolved.
 ClassLoader getSPIClassLoader()
          Return the SPI classloader.
 File getTempDirectory()
          Return the temporary directory from which a container may use to establish a transient content directory.
 boolean isCodeSecurityEnabled()
          Return the enabled status of the code security policy.
 boolean isTraceEnabled()
          Return the system trace flag.
 String processString(String name)
          Prepare a string representation of an object for presentation.
 void release(DeploymentModel model, Object instance)
          Request the release of an object from the runtime.
 Object resolve(DeploymentModel model)
          Request resolution of an object from the runtime.
 Object resolve(DeploymentModel model, boolean proxy)
          Request resolution of an object from the runtime.
 void setTraceEnabled(boolean trace)
          Set the system trace flag.
 String toString(Object object)
          Prepare a string representation of an object for presentation.
 String toString(Object[] objects)
          Prepare a string representation of an object array for presentation.
 
Methods inherited from class org.apache.avalon.framework.context.DefaultContext
checkWriteable, get, getContextData, getParent, hide, makeReadOnly, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.avalon.framework.context.Context
get
 

Method Detail

isCodeSecurityEnabled

public boolean isCodeSecurityEnabled()
Return the enabled status of the code security policy.

Specified by:
isCodeSecurityEnabled in interface SystemContext
Returns:
the code security enabled status

getModelFactory

public ModelFactory getModelFactory()
Return the model factory.

Specified by:
getModelFactory in interface SystemContext
Returns:
the factory

getBaseDirectory

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

Specified by:
getBaseDirectory in interface SystemContext
Returns:
the base directory

getHomeDirectory

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

Specified by:
getHomeDirectory in interface SystemContext
Returns:
the working directory

getTempDirectory

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

Specified by:
getTempDirectory in interface SystemContext
Returns:
the temporary directory

getAnchorDirectory

public File getAnchorDirectory()
Return the anchor directory from which a container may use to resolve relative classpath references.

Specified by:
getAnchorDirectory in interface SystemContext
Returns:
the anchor directory

getRepository

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

Specified by:
getRepository in interface SystemContext
Returns:
the repository

getAPIClassLoader

public ClassLoader getAPIClassLoader()
Return the API classloader.

Specified by:
getAPIClassLoader in interface SystemContext
Returns:
the system classloader

getSPIClassLoader

public ClassLoader getSPIClassLoader()
Return the SPI classloader.

Specified by:
getSPIClassLoader in interface SystemContext
Returns:
the system classloader

isTraceEnabled

public boolean isTraceEnabled()
Return the system trace flag.

Specified by:
isTraceEnabled in interface SystemContext
Returns:
the trace flag

setTraceEnabled

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

Parameters:
trace - the trace flag

getLoggingManager

public LoggingManager getLoggingManager()
Return the logging manager.

Specified by:
getLoggingManager in interface SystemContext
Returns:
the logging manager.

getLogger

public Logger getLogger()
Return the system logging channel.

Specified by:
getLogger in interface SystemContext
Returns:
the system logging channel

getDefaultDeploymentTimeout

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

Specified by:
getDefaultDeploymentTimeout in interface SystemContext
Returns:
the timeout value

commission

public void commission(DeploymentModel model)
                throws Exception
Request the commissioning of a runtime for a supplied deployment model.

Specified by:
commission in interface SystemContext
Parameters:
model - the deployment model
Throws:
Exception - of a commissioning error occurs

decommission

public void decommission(DeploymentModel model)
Request the decommissioning of a runtime for a supplied deployment model.

Specified by:
decommission in interface SystemContext
Parameters:
model - the deployment model
Throws:
Exception - of a commissioning error occurs

resolve

public Object resolve(DeploymentModel model)
               throws Exception
Request resolution of an object from the runtime.

Specified by:
resolve in interface SystemContext
Parameters:
model - the deployment model
Throws:
Exception - if a deployment error occurs

resolve

public Object resolve(DeploymentModel model,
                      boolean proxy)
               throws Exception
Request resolution of an object from the runtime.

Specified by:
resolve in interface SystemContext
Parameters:
model - the deployment model
proxy - if TRUE the return value will be proxied if the underlying component typoe suppports proxy representation
Throws:
Exception - if a deployment error occurs

release

public void release(DeploymentModel model,
                    Object instance)
Request the release of an object from the runtime.

Specified by:
release in interface SystemContext
Parameters:
model - the deployment model
instance - the object to release
Throws:
Exception - if a deployment error occurs

toString

public String toString(Object object)
Prepare a string representation of an object for presentation.

Specified by:
toString in interface SystemContext
Parameters:
object - the object to parse
Returns:
the presentation string

processString

public String processString(String name)
Prepare a string representation of an object for presentation.

Parameters:
name - the value to parse
Returns:
the presentation string

toString

public String toString(Object[] objects)
Prepare a string representation of an object array for presentation.

Specified by:
toString in interface SystemContext
Parameters:
objects - the array of objects
Returns:
the presentation string

buildRuntimeInstance

public Runtime buildRuntimeInstance(InitialContext context,
                                    Class clazz,
                                    Artifact lifestyle)
                             throws SystemException
Build a runtime using a supplied class.

Parameters:
context - the initial context from which to bootstrap the runtime
clazz - the runtime factory class
lifestyle - the artifact referencing the lifestyle factory
Returns:
a instance of the class
Throws:
SystemException - if the class does not expose a public constructor, or the constructor requires arguments that the builder cannot resolve, or if a unexpected instantiation error ooccurs


Copyright © The Apache Software Foundation. All Rights Reserved.