KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > repository > provider > InitialContextFactory


1 /*
2  * Copyright 2004 Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.avalon.repository.provider;
19
20
21 import java.io.File JavaDoc;
22
23 import org.apache.avalon.repository.Artifact;
24
25
26 /**
27  * Utility interface that provides support for the creation of a
28  * new initial context.
29  *
30  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
31  * @version $Revision: 1.9 $
32  */

33 public interface InitialContextFactory
34 {
35    /**
36     * An array of property keys that are used to locate default
37     * values.
38     *
39     * @see InitialContext#IMPLEMENTATION_KEY
40     * @see InitialContext#CACHE_KEY
41     * @see InitialContext#HOSTS_KEY
42     * @see InitialContext#ONLINE_KEY
43     * @see InitialContext#FACTORY_ARTIFACTS_KEY
44     */

45     String JavaDoc[] KEYS =
46       new String JavaDoc[]{
47         InitialContext.ONLINE_KEY,
48         InitialContext.IMPLEMENTATION_KEY,
49         InitialContext.CACHE_KEY,
50         InitialContext.HOSTS_KEY,
51         InitialContext.FACTORY_ARTIFACTS_KEY };
52
53    /**
54     * Return the home directory value direved from the application key.
55     * @return the home directory.
56     */

57     File JavaDoc getHomeDirectory();
58
59    /**
60     * Register a set of factory artifacts.
61     * @param artifacts the factory artifact references
62     */

63     void setFactoryArtifacts( Artifact[] artifacts );
64
65    /**
66     * Set the online mode of the repository. The default policy is to
67     * to enable online access to remote repositories. Setting the onLine
68     * mode to false disables remote repository access.
69     *
70     * @param policy the online connected policy
71     */

72     void setOnlineMode( boolean policy );
73
74    /**
75     * Set the parent classloader.
76     *
77     * @param classloader the parent classloader
78     */

79     void setParentClassLoader( ClassLoader JavaDoc classloader );
80
81    /**
82     * The initial context factory support the establishment of an
83     * initial context which is associated with a repository cache
84     * manager implementation. A client can override the default
85     * repository cache manager implementation by declaring an
86     * artifact referencing a compliant factory (not normally
87     * required).
88     *
89     * @param artifact the repository cache manager artifact
90     */

91     void setImplementation( Artifact artifact );
92
93    /**
94     * The cache directory is the directory into which resources
95     * such as jar files are loaded by a repository cache manager.
96     *
97     * @param cache the repository cache directory
98     */

99     void setCacheDirectory( File JavaDoc cache );
100
101    /**
102     * Set the proxy host name. If not supplied proxy usage will be
103     * disabled.
104     *
105     * @param host the proxy host name
106     */

107     void setProxyHost( String JavaDoc host );
108
109    /**
110     * Set the proxy host port.
111     *
112     * @param port the proxy port
113     */

114     void setProxyPort( int port );
115
116    /**
117     * Set the proxy username.
118     *
119     * @param username the proxy username
120     */

121     void setProxyUsername( String JavaDoc username );
122
123    /**
124     * Set the proxy account password.
125     *
126     * @param password the proxy password
127     */

128     void setProxyPassword( String JavaDoc password );
129
130    /**
131     * Set the initial hosts to be used by a repository cache manager
132     * implementation and the initial context implementation when
133     * resolving dependent resources. If is resource is not present
134     * in a local cache, remote hosts are checked in the order presented
135     * in the supplied list. A host may be a file url or a http url.
136     *
137     * @param hosts a sequence of remote host urls
138     */

139     void setHosts( String JavaDoc[] hosts );
140
141    /**
142     * Creation of an inital context based on the system and working
143     * directory, parent classloader, repository cache manager implementation
144     * artifact, cache directory, and remote hosts sequence supplied to the
145     * factory.
146     *
147     * @return a new initial context
148     */

149     InitialContext createInitialContext();
150 }
151
Popular Tags