001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.cocoon;
018:
019: import java.io.IOException;
020: import java.io.InputStream;
021: import java.util.Properties;
022:
023: /**
024: * The <code>Constants</code> use throughout the core of the Cocoon engine.
025: *
026: * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
027: * @author <a href="mailto:proyal@managingpartners.com">Peter Royal</a>
028: * @version CVS $Id: Constants.java 433543 2006-08-22 06:22:54Z crossley $
029: */
030: public final class Constants {
031:
032: /** Our properties are now here: */
033: private static final String PROPS_FILE = "org/apache/cocoon/cocoon.properties";
034:
035: static final Properties properties;
036:
037: /**
038: * Load the cocoon properties
039: */
040: static {
041: properties = new Properties();
042: try {
043: final InputStream is = Constants.class.getClassLoader()
044: .getResourceAsStream(PROPS_FILE);
045: if (null == is) {
046: throw new RuntimeException(
047: "Cocoon cannot find required properties from "
048: + PROPS_FILE);
049: }
050: properties.load(is);
051: } catch (IOException ioe) {
052: throw new RuntimeException(
053: "Cocoon cannot load required properties from "
054: + PROPS_FILE);
055: }
056:
057: }
058:
059: /** The name of this project. */
060: public static final String NAME = properties.getProperty("name");
061:
062: /** The version of this build. */
063: public static final String VERSION = properties
064: .getProperty("version");
065:
066: /** The full name of this project. */
067: public static final String COMPLETE_NAME = properties
068: .getProperty("fullname")
069: + " " + VERSION;
070:
071: /** The version of the configuration schema */
072: public static final String CONF_VERSION = "2.1";
073:
074: /** The year of the build */
075: public static final String YEAR = properties.getProperty("year");
076:
077: /**
078: * The request parameter name to reload the configuration.
079: *
080: * FIXME(GP): Isn't this Servlet specific?
081: */
082: public static final String RELOAD_PARAM = "cocoon-reload";
083:
084: /**
085: * The request parameter name to add a line of the request duration.
086: *
087: * FIXME(GP): Isn't this Servlet specific?
088: */
089: public static final String SHOWTIME_PARAM = "cocoon-showtime";
090:
091: /**
092: * The request parameter name to request a specific view of a resource.
093: *
094: * FIXME(GP): Isn't this Servlet specific?
095: */
096: public static final String VIEW_PARAM = "cocoon-view";
097:
098: /**
099: * The request parameter name to trigger a specific action.
100: *
101: * FIXME(GP): Isn't this Servlet specific?
102: */
103: public static final String ACTION_PARAM = "cocoon-action";
104:
105: /**
106: * The request parameter prefix to trigger a specific action.
107: *
108: * FIXME(GP): Isn't this Servlet specific?
109: */
110: public static final String ACTION_PARAM_PREFIX = "cocoon-action-";
111:
112: /** The name of the property holding the class for a XML parser */
113: public static final String PARSER_PROPERTY = "org.apache.excalibur.xml.sax.SAXParser";
114:
115: /** The name of the class for the default XML parser to use */
116: public static final String DEFAULT_PARSER = "org.apache.excalibur.xml.impl.JaxpParser";
117:
118: /** The name of the property holding the class for a XML parser
119: * @deprecated This will be removed in future release */
120: public static final String DEPRECATED_PARSER_PROPERTY = "org.apache.cocoon.components.parser.Parser";
121:
122: /** The namespace for the XSP core logicsheet. */
123: public static final String XSP_URI = "http://apache.org/xsp";
124:
125: /**
126: * The namespace prefix for the request logicsheet.
127: *
128: * FIXME(GP): Would logicsheets belong to the core?
129: */
130: public static final String XSP_REQUEST_PREFIX = "xsp-request";
131:
132: /**
133: * The namespace for the request logicsheet.
134: *
135: * FIXME(GP): Would logicsheets belong to the core?
136: */
137: public static final String XSP_REQUEST_URI = XSP_URI
138: + "/request/2.0";
139:
140: /**
141: * The namespace prefix for the response logicsheet.
142: *
143: * FIXME(GP): Would logicsheets belong to the core?
144: */
145: public static final String XSP_RESPONSE_PREFIX = "xsp-response";
146:
147: /**
148: * The namespace for the response logicsheet.
149: *
150: * FIXME(GP): Would logicsheets belong to the core?
151: */
152: public static final String XSP_RESPONSE_URI = XSP_URI
153: + "/response/2.0";
154:
155: /**
156: * The namespace prefix for the cookie logicsheet.
157: *
158: * FIXME(GP): Would logicsheets belong to the core?
159: */
160: public static final String XSP_COOKIE_PREFIX = "xsp-cookie";
161:
162: /**
163: * The namespace for the cookie logicsheet.
164: *
165: * FIXME(GP): Would logicsheets belong to the core?
166: */
167: public static final String XSP_COOKIE_URI = XSP_URI + "/cookie/2.0";
168:
169: /**
170: * Don't know exactly what this is for. (I can guess it's for the FormValidator)
171: *
172: * FIXME(GP): Isn't this component specific?
173: */
174: public static final String XSP_FORMVALIDATOR_PATH = "org.apache.cocoon.acting.FormValidatorAction.results";
175:
176: /** The URI for xml namespaces */
177: public static final String XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
178:
179: /**
180: * Mime-type for the link view
181: *
182: * FIXME(GP): Isn't this Environment specific?
183: */
184: public static final String LINK_CONTENT_TYPE = "application/x-cocoon-links";
185:
186: /**
187: * Name of the request value for the link view
188: *
189: * FIXME(GP): Isn't this Environment specific?
190: */
191: public static final String LINK_VIEW = "links";
192:
193: /** Don't know exactly what this is for (and it is not used in the code base) */
194: public static final String LINK_CRAWLING_ROLE = "static";
195:
196: /**
197: * Key of the Map of index translation table.
198: * <p>Presence of this Map in the ObjectModel indicates to the Sitemap that link
199: * translation mode has been requested by the environment. Sitemap adds LinkTranslator
200: * transformer to the pipeline, which replaces all the links in the input document with
201: * the links from this translation table.
202: * <p>
203: * TODO(VG): Move this declaration to ObjectModelHelper
204: * comment found at ObjectModelHelper(JH):
205: * LINK_OBJECT should also be moved to CommandLineEnvironment
206: */
207: public static final String LINK_OBJECT = "link";
208:
209: /**
210: * Key of the List for collecting links.
211: * <p>Presence of this Map in the ObjectModel indicates to the Sitemap that link
212: * gathering mode has been requested by the environment. Sitemap adds LinkGatherer
213: * transformer to the pipeline, which gathers the links in the input document into
214: * this List.
215: * <p>
216: */
217: public static final String LINK_COLLECTION_OBJECT = "link-collection";
218:
219: /**
220: * The name of a <code>NotifyingObject</code> in the so called objectModel <code>Map</code>.
221: */
222: public static final String NOTIFYING_OBJECT = "notifying-object";
223:
224: /**
225: * The default URI to be used when a URI requested refers to
226: * a directory, e.g. http://localhost:8080/site/
227: */
228: public static final String INDEX_URI = "index";
229:
230: /**
231: * The directory to use as context root.
232: */
233: public static final String DEFAULT_CONTEXT_DIR = "./webapp";
234:
235: /**
236: * The diretory to use to use for the generated output.
237: */
238: public static final String DEFAULT_DEST_DIR = "./site";
239:
240: /**
241: * The diretory to use for generated files.
242: */
243: public static final String DEFAULT_WORK_DIR = "./work";
244:
245: /**
246: * How a default configuration file is named.
247: */
248: public static final String DEFAULT_CONF_FILE = "cocoon.xconf";
249:
250: /** The namespace URI for the Error/Exception XML */
251: public static final String ERROR_NAMESPACE_URI = "http://apache.org/cocoon/error/2.1";
252:
253: /** The namespace prefix for the Error/Exception XML */
254: public static final String ERROR_NAMESPACE_PREFIX = "error";
255:
256: /** Application <code>Context</code> Key for the environmental Context */
257: public static final String CONTEXT_ENVIRONMENT_CONTEXT = "environment-context";
258:
259: /** Application <code>Context</code> Key for the global classloader */
260: public static final String CONTEXT_CLASS_LOADER = "class-loader";
261:
262: /** Application <code>Context</code> Key for the work directory path */
263: public static final String CONTEXT_WORK_DIR = "work-directory";
264:
265: /** Application <code>Context</code> Key for the upload directory path */
266: public static final String CONTEXT_UPLOAD_DIR = "upload-directory";
267:
268: /** Application <code>Context</code> Key for the cache directory path */
269: public static final String CONTEXT_CACHE_DIR = "cache-directory";
270:
271: /** Application <code>Context</code> Key for the current classpath */
272: public static final String CONTEXT_CLASSPATH = "classpath";
273:
274: /**
275: * Application <code>Context</code> Key for the URL to the configuration file
276: * (usually named cocoon.xconf)
277: */
278: public static final String CONTEXT_CONFIG_URL = "config-url";
279:
280: /** Application <code>Context</code> Key for the default encoding */
281: public static final String CONTEXT_DEFAULT_ENCODING = "default-encoding";
282:
283: /**
284: * Should descriptors be reloaded?
285: *
286: * FIXME(GP): Isn't this Action specific only?
287: */
288: public static final boolean DESCRIPTOR_RELOADABLE_DEFAULT = true;
289:
290: }
|