org.apache.avalon.repository.main
Class DefaultInitialContext

java.lang.Object
  extended byorg.apache.avalon.repository.main.AbstractBuilder
      extended byorg.apache.avalon.repository.main.DefaultInitialContext
All Implemented Interfaces:
InitialContext

public class DefaultInitialContext
extends AbstractBuilder
implements InitialContext

Sets up the environment to create repositories by downloading the required jars, preparing a ClassLoader and delegating calls to repository factory methods using the newly configured ClassLoader.

Version:
$Revision: 1.13 $
Author:
Alex Karasulu, Stephen McConnell

Field Summary
static String AVALON_PROPERTIES
          The name of the properties file to be searched for confiuration properties.
 
Fields inherited from interface org.apache.avalon.repository.provider.InitialContext
CACHE_KEY, HOSTS_KEY
 
Constructor Summary
DefaultInitialContext()
          Creates an initial repository context.
DefaultInitialContext(Artifact artifact, File cache, String[] hosts)
          Creates an initial repository context.
DefaultInitialContext(File cache)
          Creates an initial repository context.
DefaultInitialContext(File base, ClassLoader loader, Artifact artifact, File cache, String[] hosts)
          Creates an initial repository context.
DefaultInitialContext(File cache, String[] hosts)
          Creates an initial repository context.
DefaultInitialContext(String[] hosts)
          Creates an initial repository context.
 
Method Summary
static File getAvalonHome()
          Return the Avalon system common directory.
 File getInitialCacheDirectory()
          Return cache root directory.
 Factory getInitialFactory()
          Return the initial repository factory.
 String[] getInitialHosts()
          Return the initial set of host names.
 File getInitialWorkingDirectory()
          Return the base working directory.
 
Methods inherited from class org.apache.avalon.repository.main.AbstractBuilder
createDelegate, loadFactoryClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AVALON_PROPERTIES

public static final String AVALON_PROPERTIES
The name of the properties file to be searched for confiuration properties. Seaches will be conducted on the current directory and the user's home directory.

See Also:
Constant Field Values
Constructor Detail

DefaultInitialContext

public DefaultInitialContext()
                      throws RepositoryException
Creates an initial repository context.

Throws:
RepositoryException - if an error occurs during establishment

DefaultInitialContext

public DefaultInitialContext(File cache)
                      throws RepositoryException
Creates an initial repository context.

Parameters:
cache - the cache directory
Throws:
RepositoryException - if an error occurs during establishment

DefaultInitialContext

public DefaultInitialContext(String[] hosts)
                      throws RepositoryException
Creates an initial repository context.

Parameters:
hosts - a set of initial remote repository addresses
Throws:
RepositoryException - if an error occurs during establishment

DefaultInitialContext

public DefaultInitialContext(File cache,
                             String[] hosts)
                      throws RepositoryException
Creates an initial repository context.

Parameters:
hosts - a set of initial remote repository addresses
cache - the cache directory
Throws:
RepositoryException - if an error occurs during establishment

DefaultInitialContext

public DefaultInitialContext(Artifact artifact,
                             File cache,
                             String[] hosts)
                      throws RepositoryException
Creates an initial repository context.

Parameters:
artifact - an artifact referencing the default implementation
cache - the cache directory
hosts - a set of initial remote repository addresses
Throws:
RepositoryException - if an error occurs during establishment

DefaultInitialContext

public DefaultInitialContext(File base,
                             ClassLoader loader,
                             Artifact artifact,
                             File cache,
                             String[] hosts)
                      throws RepositoryException
Creates an initial repository context.

Parameters:
artifact - an artifact referencing the default implementation
cache - the cache directory
hosts - a set of initial remote repository addresses
Throws:
RepositoryException - if an error occurs during establishment
Method Detail

getAvalonHome

public static File getAvalonHome()
Return the Avalon system common directory. This directory is is used as the default root directory against which the default application repository is established.

Returns:
the avalon system home directory.

getInitialWorkingDirectory

public File getInitialWorkingDirectory()
Return the base working directory.

Specified by:
getInitialWorkingDirectory in interface InitialContext
Returns:
the base directory

getInitialCacheDirectory

public File getInitialCacheDirectory()
Return cache root directory.

Specified by:
getInitialCacheDirectory in interface InitialContext
Returns:
the cache directory

getInitialHosts

public String[] getInitialHosts()
Return the initial set of host names.

Specified by:
getInitialHosts in interface InitialContext
Returns:
the host names sequence

getInitialFactory

public Factory getInitialFactory()
Return the initial repository factory.

Specified by:
getInitialFactory in interface InitialContext
Returns:
the initial repository factory


Copyright © Apache Software Foundation. All Rights Reserved.