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.4 $ $Date: 2003/12/07 08:36:07 $
Author:
Avalon Development Team

Constructor Summary
DefaultSystemContext(LoggingManager logging, File base, File home, File temp, Repository repository, String category, boolean trace)
          Creation of a new system context.
 
Method Summary
static SystemContext createSystemContext(File base, File root, int priority)
          Creation of a new system context.
 File getBaseDirectory()
          Return the base directory from which relative classloader references may be resolved.
 ClassLoader getCommonClassLoader()
          Return the system classloader.
 ModelFactory getFactory()
          Return the model factory.
 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.
 Repository getRepository()
          Return the system wide repository from which resource directives can be resolved.
 ClassLoader getSystemClassLoader()
          Return the system classloader.
 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 setTraceEnabled(boolean trace)
          Set the system trace flag.
 
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
 

Constructor Detail

DefaultSystemContext

public DefaultSystemContext(LoggingManager logging,
                            File base,
                            File home,
                            File temp,
                            Repository repository,
                            String category,
                            boolean trace)
Creation of a new system context.

Parameters:
logging - the logging manager
base - the base directory from which relative references within a classpath or library directive shall be resolved
home - the home directory
temp - the temp directory
repository - a resource repository to be used when resolving resource directives
trace - flag indicating if internal logging is enabled
Method Detail

createSystemContext

public static SystemContext createSystemContext(File base,
                                                File root,
                                                int priority)
                                         throws Exception
Creation of a new system context.

Parameters:
base - the base directory from which relative references within a classpath or library directive shall be resolved
root - a repository root directory
priority - logging manager default priority
Returns:
a system context
Throws:
Exception

getFactory

public ModelFactory getFactory()
Return the model factory.

Specified by:
getFactory 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

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

getCommonClassLoader

public ClassLoader getCommonClassLoader()
Return the system classloader. This classloader is equivalent to the API classloader.

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

getSystemClassLoader

public ClassLoader getSystemClassLoader()
Return the system classloader. This classloader is equivalent to the SPI privileged classloader.

Specified by:
getSystemClassLoader 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


Copyright © Apache Software Foundation. All Rights Reserved.