View Javadoc

1   /* CoreConfig.java - Basic core configuration component
2    *
3    * Copyright (c)2005 Roscopeco Open Technologies & Contributors
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   *
17   * File version: $Revision: 1.7 $ $Date: 2005/08/22 00:22:19 $
18   * Originated: 25-Jul-2005
19   * Author: Ross Bamford (rosco<at>roscopeco.co.uk)
20   */
21  
22  package org.roscopeco.janno.core;
23  
24  import java.io.File;
25  import java.io.InputStream;
26  import java.net.MalformedURLException;
27  import java.net.URL;
28  
29  import javax.servlet.ServletContext;
30  
31  import org.apache.commons.logging.Log;
32  
33  import org.roscopeco.moxy.core.MoxyContext;
34  
35  /***
36   * Holds basic configuration information about the Janno core. An implementation
37   * of this component is implicitly registered in the root <code>server</code>
38   * context.
39   * 
40   * @author Ross Bamford (rosco&lt;at&gt;roscopeco.co.uk)
41   * @version $Revision: 1.7 $ $Date: 2005/08/22 00:22:19 $
42   */
43  public interface CoreConfig
44  {
45    /***
46     * @return The root of the Janno installation, or <code>null</code> if Janno
47     *         is deployed as a packed War.
48     */
49    public File getJannoRoot();
50  
51    // TODO rnrl
52    /***
53     * @deprecated You should deploy Janno unpacked, and most app servers will 
54     * unpack it if you don't anyway, so this method mostly returns 
55     * <code>null</code>. It will be removed before feature lock.
56     * 
57     * @return The WAR file Janno is deployed from, or <code>null</code> if
58     *         unpacked deployment was used, or the core could not determine the
59     *         location of the file.
60     */
61    @Deprecated
62    public File getJannoWar();
63  
64    /***
65     * Returns the directory containing modules for deployment. This may be a
66     * subdirectory of the root, or not. It must of course be visible to the
67     * application server. <p/> In an unpacked deployment where no explicit
68     * configuration is made, this will return the default
69     * <code>META-INF/modules</code>, although no validation is performed.
70     * 
71     * @return The module directory, or <code>null</code> if the module
72     *         directory couldn't be determined.
73     */
74    public File getModuleDirectory();
75  
76    /***
77     * @return The root (<code>server</code>) context in the Janno tree.
78     */
79    public MoxyContext getServerContext();
80  
81    // TODO rnrl
82    /***
83     * @return The {@link javax.servlet.ServletContext} allocated to the Janno
84     *          core.
85     *          
86     * @deprecated Janno is no longer limited to a single web-application. This method
87     *             returns an undefined value and will be removed before feature lock.          
88     */
89    @Deprecated
90    public ServletContext getServletContext();
91  
92    // TODO rnrl
93    /***
94     * Obtains a URL referencing the requested webapp resource. This uses the
95     * ServletContext's <code>getResource</code> method and should be
96     * independent of the deployment method in use. <p/> Paths should be specified
97     * with leading slash, relative to the Janno webapp root.
98     * 
99     * @return A {@link java.net.URL} referencing the requested resource.
100    *          
101    * @deprecated Janno is no longer limited to a single web-application. This method
102    *             returns an undefined value and will be removed before feature lock.          
103    */
104   @Deprecated
105   public URL getApplicationResource(String path) throws MalformedURLException;
106 
107   // TODO rnrl
108   /***
109    * Obtains an InputStream with data from the requested webapp resource. This
110    * uses the ServletContext's <code>getResourceAsStream</code> method and
111    * should be independent of the deployment method in use. <p/> Paths should be
112    * specified with leading slash, relative to the Janno webapp root.
113    * 
114    * @return A {@link java.io.InputStream} referencing the requested resource.
115    *          
116    * @deprecated Janno is no longer limited to a single web-application. This method
117    *             returns an undefined value and will be removed before feature lock.          
118    */
119   @Deprecated
120   public InputStream getApplicationResourceAsStream(String path);
121 
122   /*** 
123    * @return The {@link org.apache.commons.logging.Log} provided for module 
124    * deployer and other core code to use. This is independent of any 
125    * ServletContext log and will usually be routed to the server log unless
126    * configured otherwise.
127    */
128   public Log getLog();
129 }