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.27 $
Author:
Avalon Development Team

Field Summary
static String BLOCK_GROUP_KEY
          Group identifier manifest key.
 
Fields inherited from interface org.apache.avalon.repository.provider.InitialContext
CACHE_KEY, FACTORY_ARTIFACTS_KEY, HOSTS_KEY, IMPLEMENTATION_KEY, LINE, ONLINE_KEY, PROXY_HOST_KEY, PROXY_PASSWORD_KEY, PROXY_PORT_KEY, PROXY_USERNAME_KEY
 
Method Summary
 String getApplicationKey()
          Return the application key.
 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.
 boolean getOnlineMode()
          Get the online mode of the repository.
 Repository getRepository()
          Return the inital repository.
 Manifest install(URL url)
          Install a block archive into the repository cache.
 Builder newBuilder(Artifact artifact)
          Create a factory builder using a supplied artifact.
 Builder newBuilder(ClassLoader classloader, Artifact artifact)
          Create a factory builder using a supplied artifact.
 
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

BLOCK_GROUP_KEY

public static final String BLOCK_GROUP_KEY
Group identifier manifest key.

See Also:
Constant Field Values
Method Detail

getRepository

public Repository getRepository()
Return the inital repository.

Specified by:
getRepository in interface InitialContext
Returns:
the repository

getOnlineMode

public boolean getOnlineMode()
Get the online mode of the repository.

Specified by:
getOnlineMode in interface InitialContext
Returns:
the online mode

getApplicationKey

public String getApplicationKey()
Return the application key. The value of the key may be used to resolve property files by using the convention [key].properties.

Specified by:
getApplicationKey in interface InitialContext
Returns:
the application key.

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

newBuilder

public Builder newBuilder(Artifact artifact)
                   throws Exception
Create a factory builder using a supplied artifact.

Specified by:
newBuilder in interface InitialContext
Parameters:
artifact - the factory artifact
Returns:
the factory builder
Throws:
Exception - if a builder creation error occurs

newBuilder

public Builder newBuilder(ClassLoader classloader,
                          Artifact artifact)
                   throws Exception
Create a factory builder using a supplied artifact.

Specified by:
newBuilder in interface InitialContext
Parameters:
classloader - the parent classloader
artifact - the factory artifact
Returns:
the factory
Throws:
Exception - if a factory creation error occurs

install

public Manifest install(URL url)
                 throws RepositoryException
Install a block archive into the repository cache.

Specified by:
install in interface InitialContext
Parameters:
url - the block archive url
Returns:
the block manifest
Throws:
RepositoryException


Copyright © The Apache Software Foundation. All Rights Reserved.