|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.repository.main.DefaultInitialContextFactory
A utility class used to establish a new InitialContext
instance. An initial context is normally created by simply
instantiating the factory using a application key and a working
directory.
final String key = "demo"; final File work = new File( System.getProperty( "user.dir" ) ); final InitialContextFactory factory = new DefaultInitialContextFactory( key, work ); InitialContext context = factory.createInitialContext();
Field Summary |
Fields inherited from interface org.apache.avalon.repository.provider.InitialContextFactory |
KEYS |
Constructor Summary | |
DefaultInitialContextFactory(String key)
Creates an initial repository context factory relative to the current working directory. |
|
DefaultInitialContextFactory(String key,
File work)
Creates an initial repository context factory. |
Method Summary | |
InitialContext |
createInitialContext()
Creation of an inital context based on the system and working directory, parent classloader, repository cache manager implementation artifact, cache directory, and remote hosts sequence supplied to the factory. |
String |
getApplicationKey()
Return the application key. |
File |
getCacheDirectory()
Return the assigned or default cache directory. |
File |
getHomeDirectory()
Return the home directory value direved from the application key. |
String[] |
getHosts()
Return the assigned or default host sequence. |
Artifact |
getImplementation()
Return the implementation artifact. |
boolean |
getOnlineMode()
Return the application key. |
ClassLoader |
getParentClassLoader()
Return the parent classloader. |
String |
getProxyHost()
Get the proxy host name. |
String |
getProxyPassword()
Set the proxy account password. |
int |
getProxyPort()
Get the proxy host port. |
String |
getProxyUsername()
Get the proxy username. |
Artifact[] |
getRegisteredArtifacts()
Return the registory. |
File |
getWorkingDirectory()
Return the working directory value. |
void |
setCacheDirectory(File cache)
The cache directory is the directory into which resources such as jar files are loaded by a repository cache manager. |
void |
setFactoryArtifacts(Artifact[] artifacts)
Register a set of factory artifacts. |
void |
setHosts(String[] hosts)
Set the initial hosts to be used by a repository cache manager implementation and the initial context implementation when resolving dependent resources. |
void |
setImplementation(Artifact artifact)
The initial context factory support the establishment of an initial context which is associated with a repository cache manager implementation. |
void |
setOnlineMode(boolean policy)
Set the online mode of the repository. |
void |
setParentClassLoader(ClassLoader classloader)
Set the parent classloader. |
void |
setProxyHost(String host)
Set the proxy host name. |
void |
setProxyPassword(String password)
Set the proxy account password. |
void |
setProxyPort(int port)
Set the proxy host port. |
void |
setProxyUsername(String username)
Set the proxy username. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultInitialContextFactory(String key) throws IOException
Creates an initial repository context factory relative to the current working directory. This is equivalent to the following invocation:
final String key = "demo"; final File work = new File( System.getProperty( "user.dir" ); InitialContextFactory factory = new DefaultInitialContextFactory( key, work );
key
- the application key
IOException
- if an error occurs during establishment
NullPointerException
- if tyhe supplied key is nullpublic DefaultInitialContextFactory(String key, File work) throws IOException
Creates an initial repository context factory. The supplied key is used to establish the application root directory and property files at application, user and working directory levels. A key such as 'merlin' will be transformed to the environment symbol 'MERLIN_HOME' (i.e. uppercase of key plus _HOME) and resolved to a value. If the symbol is undefined, the application home directory defaults to a file path ${user.home}/.[key] (so for example, if MERLIN_HOME is undefined the default application home for Merlin is ${user.home}/.merlin. Based on the application root directory, a set of property files with the name [key].properties are resolved from the following locations:
The order in which properties are evaluated in in accordance the above list. The current working directory properties take precedence over properties defined in the user's home directory which in turn take precedence over properties defined under the application home directory. System properties take precedence over all properties.
key
- the application keywork
- the working directory
IOException
- if an error occurs during establishment
NullPointerException
- if the supplied key or work
arguments are nullMethod Detail |
public void setFactoryArtifacts(Artifact[] artifacts)
setFactoryArtifacts
in interface InitialContextFactory
artifacts
- the artifact referencespublic void setOnlineMode(boolean policy)
setOnlineMode
in interface InitialContextFactory
policy
- the connected policypublic void setParentClassLoader(ClassLoader classloader)
setParentClassLoader
in interface InitialContextFactory
classloader
- the parent classloaderpublic void setImplementation(Artifact artifact)
setImplementation
in interface InitialContextFactory
artifact
- the repository cache manager artifactpublic void setCacheDirectory(File cache)
setCacheDirectory
in interface InitialContextFactory
cache
- the repository cache directorypublic void setHosts(String[] hosts)
setHosts
in interface InitialContextFactory
hosts
- a sequence of remote host urlspublic void setProxyHost(String host)
setProxyHost
in interface InitialContextFactory
host
- the proxy host namepublic void setProxyPort(int port)
setProxyPort
in interface InitialContextFactory
port
- the proxy portpublic void setProxyUsername(String username)
setProxyUsername
in interface InitialContextFactory
username
- the proxy usernamepublic void setProxyPassword(String password)
setProxyPassword
in interface InitialContextFactory
password
- the proxy passwordpublic InitialContext createInitialContext()
createInitialContext
in interface InitialContextFactory
public Artifact[] getRegisteredArtifacts()
public boolean getOnlineMode()
public String getApplicationKey()
public File getHomeDirectory()
getHomeDirectory
in interface InitialContextFactory
public File getWorkingDirectory()
public ClassLoader getParentClassLoader()
public Artifact getImplementation()
public File getCacheDirectory()
public String[] getHosts()
public String getProxyHost()
public int getProxyPort()
public String getProxyUsername()
public String getProxyPassword()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |