You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@apache.org on 2001/02/15 21:30:57 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/util RoleUtils.java
bloritsch 01/02/15 12:30:56
Modified: src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java Main.java
Notifier.java Roles.java
src/org/apache/cocoon/components/language/generator Tag:
xml-cocoon2 ProgramGeneratorImpl.java
src/org/apache/cocoon/components/language/markup/xsp Tag:
xml-cocoon2 XSPRequestHelper.java
XSPResponseHelper.java
src/org/apache/cocoon/components/language/programming Tag:
xml-cocoon2 CompiledProgrammingLanguage.java
src/org/apache/cocoon/components/language/programming/java
Tag: xml-cocoon2 JavaLanguage.java
src/org/apache/cocoon/environment/commandline Tag:
xml-cocoon2 CommandLineRequest.java
FileSavingEnvironment.java
LinkSamplingEnvironment.java
src/org/apache/cocoon/environment/http Tag: xml-cocoon2
HttpEnvironment.java
src/org/apache/cocoon/generation Tag: xml-cocoon2
ServletGenerator.java
src/org/apache/cocoon/reading Tag: xml-cocoon2
ResourceReader.java
src/org/apache/cocoon/selection/helpers Tag: xml-cocoon2
CodedSelectorHelper.java
src/org/apache/cocoon/serialization Tag: xml-cocoon2
LinkSerializer.java
src/org/apache/cocoon/servlet Tag: xml-cocoon2
CocoonServlet.java
src/org/apache/cocoon/sitemap Tag: xml-cocoon2
LinkTranslator.java
src/org/apache/cocoon/transformation Tag: xml-cocoon2
TraxTransformer.java XTTransformer.java
src/org/apache/cocoon/util Tag: xml-cocoon2 RoleUtils.java
Log:
Fixed anomalies with Cocoon proclaiming to be more than it should.
Revision Changes Path
No revision
No revision
1.4.2.53 +50 -106 xml-cocoon/src/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.4.2.52
retrieving revision 1.4.2.53
diff -u -r1.4.2.52 -r1.4.2.53
--- Cocoon.java 2001/02/15 18:17:05 1.4.2.52
+++ Cocoon.java 2001/02/15 20:28:22 1.4.2.53
@@ -17,11 +17,8 @@
import java.util.HashMap;
import java.util.Enumeration;
import java.util.Iterator;
-
import org.apache.avalon.Component;
import org.apache.avalon.Composer;
-import org.apache.avalon.ComponentManager;
-import org.apache.avalon.ComponentManagerException;
import org.apache.avalon.Context;
import org.apache.avalon.Contextualizable;
import org.apache.avalon.Modifiable;
@@ -30,7 +27,6 @@
import org.apache.avalon.SAXConfigurationHandler;
import org.apache.avalon.ConfigurationException;
import org.apache.avalon.Initializable;
-
import org.apache.cocoon.components.parser.Parser;
import org.apache.cocoon.components.url.URLFactory;
import org.apache.cocoon.environment.Environment;
@@ -39,21 +35,18 @@
import org.apache.cocoon.util.ClassUtils;
import org.apache.cocoon.util.NetUtils;
import org.apache.cocoon.DefaultComponentManager;
-
import org.apache.avalon.AbstractLoggable;
-
import org.xml.sax.SAXException;
import org.xml.sax.InputSource;
/**
- * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
- * (Apache Software Foundation, Exoffice Technologies)
+ * The Cocoon Object is the main Kernel for the entire Cocoon system.
+ *
+ * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a> (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.4.2.52 $ $Date: 2001/02/15 18:17:05 $
+ * @version CVS $Revision: 1.4.2.53 $ $Date: 2001/02/15 20:28:22 $
*/
-public class Cocoon extends AbstractLoggable
- implements Component, Configurable, ComponentManager, Modifiable, Processor, Constants, Contextualizable {
-
+public class Cocoon extends AbstractLoggable implements Component, Initializable, Modifiable, Processor, Contextualizable {
/** The application context */
private Context context;
@@ -84,9 +77,7 @@
/** The component manager. */
private DefaultComponentManager componentManager;
- /**
- * Create a new <code>Cocoon</code> instance.
- */
+ /** Create a new <code>Cocoon</code> instance. */
public Cocoon() throws ConfigurationException {
// Set the system properties needed by Xalan2.
setSystemProperties();
@@ -95,10 +86,9 @@
public void contextualize(Context context) {
if (this.context == null) {
this.context = context;
-
- this.classpath = (String) context.get(Constants.CONTEXT_CLASSPATH);
- this.workDir = (File) context.get(Constants.CONTEXT_WORK_DIR);
- this.configurationFile = (URL) context.get(Constants.CONTEXT_CONFIG_URL);
+ this.classpath = (String)context.get(Constants.CONTEXT_CLASSPATH);
+ this.workDir = (File)context.get(Constants.CONTEXT_WORK_DIR);
+ this.configurationFile = (URL)context.get(Constants.CONTEXT_CONFIG_URL);
}
}
@@ -106,144 +96,98 @@
this.componentManager = new DefaultComponentManager();
this.componentManager.contextualize(this.context);
this.componentManager.setLogger(getLogger());
-
getLogger().debug("New Cocoon object.");
-
// Setup the default parser, for parsing configuration.
// If one need to use a different parser, set the given system property
- String parser = System.getProperty(PARSER_PROPERTY, DEFAULT_PARSER);
+ String parser = System.getProperty(Constants.PARSER_PROPERTY, Constants.DEFAULT_PARSER);
getLogger().debug("Using parser: " + parser);
-
try {
- this.componentManager.addComponent(Roles.PARSER, ClassUtils.loadClass(parser),null);
- } catch ( Exception e ) {
+ this.componentManager.addComponent(Roles.PARSER, ClassUtils.loadClass(parser), null);
+ } catch (Exception e) {
getLogger().error("Could not load parser, Cocoon object not created.", e);
throw new ConfigurationException("Could not load parser " + parser, e);
}
- this.componentManager.addComponentInstance(Roles.COCOON, this);
-
getLogger().debug("Classpath = " + classpath);
-
getLogger().debug("Work directory = " + workDir.getCanonicalPath());
-
- Parser p = (Parser) this.lookup(Roles.PARSER);
- SAXConfigurationHandler b = new SAXConfigurationHandler();
- InputSource is = new InputSource(this.configurationFile.openStream());
-
- p.setContentHandler(b);
- is.setSystemId(this.configurationFile.toExternalForm());
- p.parse(is);
-
- this.configure(b.getConfiguration());
- }
-
- /**
- * Get the local classpath
- * @return the classpath available to this instance or null if not available.
- */
- public String getClasspath() {
- return this.classpath;
- }
-
- /**
- * Get the local workpath
- * @return the workpath available to this instance or null if not available.
- */
- public File getWorkDir() {
- return this.workDir;
+ this.configure();
}
- /**
- * Configure this <code>Cocoon</code> instance.
- */
- public void configure(Configuration conf)
- throws ConfigurationException {
+ /** Configure this <code>Cocoon</code> instance. */
+ public void configure() throws ConfigurationException {
+ try {
+ Parser p = (Parser)this.componentManager.lookup(Roles.PARSER);
+ SAXConfigurationHandler b = new SAXConfigurationHandler();
+ InputSource is = new InputSource(this.configurationFile.openStream());
+ p.setContentHandler(b);
+ is.setSystemId(this.configurationFile.toExternalForm());
+ p.parse(is);
+ this.configuration = b.getConfiguration();
+ } catch (Exception e) {
+ getLogger().error("Could not configure Cocoon environment", e);
+ throw new ConfigurationException("Error trying to load configurations");
+ }
- this.configuration = conf;
+ Configuration conf = this.configuration;
getLogger().debug("Root configuration: " + conf.getName());
- if (!"cocoon".equals(conf.getName())) {
+ if (! "cocoon".equals(conf.getName())) {
throw new ConfigurationException("Invalid configuration file\n" + conf.toString());
}
-
getLogger().debug("Configuration version: " + conf.getAttribute("version"));
- if (!CONF_VERSION.equals(conf.getAttribute("version"))) {
- throw new ConfigurationException("Invalid configuration schema version. Must be '"
- + CONF_VERSION + "'.");
+ if (Constants.CONF_VERSION.equals(conf.getAttribute("version")) == false) {
+ throw new ConfigurationException("Invalid configuration schema version. Must be '" + Constants.CONF_VERSION + "'.");
}
-
getLogger().debug("Setting up components...");
this.componentManager.configure(conf);
-
getLogger().debug("Setting up the sitemap.");
// Create the sitemap
Configuration sconf = conf.getChild("sitemap");
-
this.sitemapManager = new Manager(null);
this.sitemapManager.setLogger(getLogger());
- this.sitemapManager.compose(this);
+ this.sitemapManager.compose(this.componentManager);
this.sitemapManager.configure(conf);
this.sitemapFileName = sconf.getAttribute("file");
if (this.sitemapFileName == null) {
getLogger().error("No sitemap file name");
throw new ConfigurationException("No sitemap file name\n" + conf.toString());
}
-
getLogger().debug("Sitemap location = " + this.sitemapFileName);
}
-
- /**
- * Get the <code>Component</code> associated with the given role.
- */
- public Component lookup(String role)
- throws ComponentManagerException {
- return this.componentManager.lookup(role);
- }
- /**
- * Queries the class to estimate its ergodic period termination.
- */
+ /** Queries the class to estimate its ergodic period termination. */
public boolean modifiedSince(long date) {
boolean answer;
-
try {
answer = date < this.configurationFile.openConnection().getLastModified();
} catch (IOException ioe) {
getLogger().warn("Problem checking the date on the Configuration File.", ioe);
answer = false;
}
-
return answer;
}
+ /** Sets required system properties . */
+ protected void setSystemProperties() {
+ java.util.Properties props = new java.util.Properties();
+ // FIXME We shouldn't have to specify the SAXParser...
+ // This is needed by Xalan2, it is used by org.xml.sax.helpers.XMLReaderFactory
+ // to locate the SAX2 driver.
+ props.put("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");
+ java.util.Properties systemProps = System.getProperties();
+ Enumeration propEnum = props.propertyNames();
+ while (propEnum.hasMoreElements()) {
+ String prop = (String)propEnum.nextElement();
+ if (!systemProps.containsKey(prop))
+ systemProps.put(prop, props.getProperty(prop));
+ }
+ System.setProperties(systemProps);
+ }
+
/**
* Process the given <code>Environment</code> to produce the output.
*/
public boolean process(Environment environment)
throws Exception {
return this.sitemapManager.invoke(environment, "", this.sitemapFileName, true);
- }
-
- /**
- * Sets required system properties .
- */
- protected void setSystemProperties()
- {
- java.util.Properties props = new java.util.Properties();
-
- // FIXME We shouldn't have to specify the SAXParser...
- // This is needed by Xalan2, it is used by org.xml.sax.helpers.XMLReaderFactory
- // to locate the SAX2 driver.
- props.put("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");
-
- java.util.Properties systemProps = System.getProperties();
- Enumeration propEnum = props.propertyNames();
- while(propEnum.hasMoreElements())
- {
- String prop = (String)propEnum.nextElement();
- if(!systemProps.containsKey(prop))
- systemProps.put(prop, props.getProperty(prop));
- }
- System.setProperties(systemProps);
}
}
1.1.4.22 +16 -16 xml-cocoon/src/org/apache/cocoon/Attic/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Main.java,v
retrieving revision 1.1.4.21
retrieving revision 1.1.4.22
diff -u -r1.1.4.21 -r1.1.4.22
--- Main.java 2001/02/14 03:58:37 1.1.4.21
+++ Main.java 2001/02/15 20:28:25 1.1.4.22
@@ -49,7 +49,7 @@
* Command line entry point.
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.4.21 $ $Date: 2001/02/14 03:58:37 $
+ * @version CVS $Revision: 1.1.4.22 $ $Date: 2001/02/15 20:28:25 $
*/
public class Main {
@@ -98,9 +98,9 @@
public static void main(String[] args) throws Exception {
- String destDir = Cocoon.DEFAULT_DEST_DIR;
- String contextDir = Cocoon.DEFAULT_CONTEXT_DIR;
- String workDir = Cocoon.DEFAULT_WORK_DIR;
+ String destDir = Constants.DEFAULT_DEST_DIR;
+ String contextDir = Constants.DEFAULT_CONTEXT_DIR;
+ String workDir = Constants.DEFAULT_WORK_DIR;
List targets = new ArrayList();
CLArgsParser parser = new CLArgsParser(args, options);
String logUrl = "logs/cocoon.log";
@@ -213,7 +213,7 @@
}
private static void printVersion() {
- System.out.println(Cocoon.VERSION);
+ System.out.println(Constants.VERSION);
System.exit(0);
}
@@ -221,29 +221,29 @@
String lSep = System.getProperty("line.separator");
StringBuffer msg = new StringBuffer();
msg.append("------------------------------------------------------------------------ ").append(lSep);
- msg.append(Cocoon.NAME).append(" ").append(Cocoon.VERSION).append(lSep);
- msg.append("Copyright (c) ").append(Cocoon.YEAR).append(" Apache Software Foundation. All rights reserved.").append(lSep);
+ msg.append(Constants.NAME).append(" ").append(Constants.VERSION).append(lSep);
+ msg.append("Copyright (c) ").append(Constants.YEAR).append(" Apache Software Foundation. All rights reserved.").append(lSep);
msg.append("------------------------------------------------------------------------ ").append(lSep).append(lSep);
msg.append("Usage: java org.apache.cocoon.Main [options] [targets]").append(lSep).append(lSep);
msg.append("Options: ").append(lSep);
msg.append(CLUtil.describeOptions(Main.options).toString());
- msg.append("Note: the context directory defaults to '").append(Cocoon.DEFAULT_CONTEXT_DIR + "'").append(lSep);
+ msg.append("Note: the context directory defaults to '").append(Constants.DEFAULT_CONTEXT_DIR + "'").append(lSep);
System.out.println(msg.toString());
System.exit(0);
}
private static File getConfigurationFile(File dir) throws Exception {
- log.debug("Trying configuration file at: " + Cocoon.DEFAULT_CONF_FILE);
- File f = new File(dir, Cocoon.DEFAULT_CONF_FILE);
+ log.debug("Trying configuration file at: " + Constants.DEFAULT_CONF_FILE);
+ File f = new File(dir, Constants.DEFAULT_CONF_FILE);
if (f.canRead()) return f;
- log.debug("Trying configuration file at: " + System.getProperty("user.dir") + File.separator + Cocoon.DEFAULT_CONF_FILE);
- f = new File(System.getProperty("user.dir") + File.separator + Cocoon.DEFAULT_CONF_FILE);
+ log.debug("Trying configuration file at: " + System.getProperty("user.dir") + File.separator + Constants.DEFAULT_CONF_FILE);
+ f = new File(System.getProperty("user.dir") + File.separator + Constants.DEFAULT_CONF_FILE);
if (f.canRead()) return f;
- log.debug("Trying configuration file at: /usr/local/etc/" + Cocoon.DEFAULT_CONF_FILE);
- f = new File("/usr/local/etc/" + Cocoon.DEFAULT_CONF_FILE);
+ log.debug("Trying configuration file at: /usr/local/etc/" + Constants.DEFAULT_CONF_FILE);
+ f = new File("/usr/local/etc/" + Constants.DEFAULT_CONF_FILE);
if (f.canRead()) return f;
log.error("Could not find the configuration file.");
@@ -380,7 +380,7 @@
"<html><head><title>Page Not Available</title></head>" +
"<body><h1 align=\"center\">Page Not Available</h1>" +
"<body><p align=\"center\">Generated by " +
- Cocoon.COMPLETE_NAME +
+ Constants.COMPLETE_NAME +
"</p></body></html>"
);
out.close();
@@ -388,7 +388,7 @@
private String mangle(String uri) {
log.debug("mangle(\"" + uri + "\")");
- if (uri.charAt(uri.length() - 1) == '/') uri += Cocoon.INDEX_URI;
+ if (uri.charAt(uri.length() - 1) == '/') uri += Constants.INDEX_URI;
uri = uri.replace('"', '\'');
uri = uri.replace('?', '_');
log.debug(uri);
1.1.2.8 +3 -3 xml-cocoon/src/org/apache/cocoon/Attic/Notifier.java
Index: Notifier.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Notifier.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- Notifier.java 2001/01/31 15:48:35 1.1.2.7
+++ Notifier.java 2001/02/15 20:28:29 1.1.2.8
@@ -32,7 +32,7 @@
*
* @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/01/31 15:48:35 $
+ * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/15 20:28:29 $
*/
public class Notifier {
@@ -82,8 +82,8 @@
*/
public static void notify(Notificable n, ContentHandler ch) throws SAXException {
- final String PREFIX = Cocoon.ERROR_NAMESPACE_PREFIX;
- final String URI = Cocoon.ERROR_NAMESPACE_URI;
+ final String PREFIX = Constants.ERROR_NAMESPACE_PREFIX;
+ final String URI = Constants.ERROR_NAMESPACE_URI;
String buf;
1.1.2.6 +2 -2 xml-cocoon/src/org/apache/cocoon/Attic/Roles.java
Index: Roles.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Roles.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- Roles.java 2001/02/12 13:30:42 1.1.2.5
+++ Roles.java 2001/02/15 20:28:31 1.1.2.6
@@ -12,15 +12,15 @@
* Created this interface to specify the Avalon role names.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/02/12 13:30:42 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/02/15 20:28:31 $
*/
public interface Roles {
- String COCOON = "org.apache.cocoon.Cocoon";
String PARSER = "org.apache.cocoon.components.parser.Parser";
String PROCESSOR = "org.apache.cocoon.Processor";
String STORE = "org.apache.cocoon.components.store.Store";
+ String REPOSITORY = "org.apache.cocoon.components.store.Repository";
String MARKUP_LANGUAGE = "org.apache.cocoon.components.language.markup.MarkupLanguageSelector";
String PROGRAMMING_LANGUAGE = "org.apache.cocoon.components.language.programming.ProgrammingLanguageSelector";
No revision
No revision
1.1.2.25 +142 -190 xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java
Index: ProgramGeneratorImpl.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java,v
retrieving revision 1.1.2.24
retrieving revision 1.1.2.25
diff -u -r1.1.2.24 -r1.1.2.25
--- ProgramGeneratorImpl.java 2001/02/12 13:30:43 1.1.2.24
+++ ProgramGeneratorImpl.java 2001/02/15 20:28:45 1.1.2.25
@@ -12,241 +12,193 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.FileNotFoundException;
-
import org.apache.avalon.Modifiable;
-
import org.apache.avalon.Component;
import org.apache.avalon.Composer;
import org.apache.avalon.ComponentManager;
+import org.apache.avalon.Context;
+import org.apache.avalon.Contextualizable;
import org.apache.avalon.Configurable;
import org.apache.avalon.Configuration;
import org.apache.avalon.ConfigurationException;
import org.apache.avalon.ComponentSelector;
import org.apache.avalon.ThreadSafe;
-
import org.apache.avalon.Parameters;
-
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.Roles;
-
import org.apache.cocoon.components.store.MemoryStore;
import org.apache.cocoon.components.store.FilesystemStore;
-
import org.apache.cocoon.components.language.LanguageException;
import org.apache.cocoon.components.language.markup.MarkupLanguage;
import org.apache.cocoon.components.language.programming.CodeFormatter;
import org.apache.cocoon.components.language.programming.ProgrammingLanguage;
-
import org.apache.cocoon.util.IOUtils;
-
import org.apache.log.Logger;
import org.apache.avalon.Loggable;
-
import org.w3c.dom.Document;
import org.w3c.dom.Document;
-
import org.xml.sax.InputSource;
import org.xml.sax.EntityResolver;
import org.xml.sax.SAXException;
/**
* The default implementation of <code>ProgramGenerator</code>
- *
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.24 $ $Date: 2001/02/12 13:30:43 $
+ * @version CVS $Revision: 1.1.2.25 $ $Date: 2001/02/15 20:28:45 $
*/
-public class ProgramGeneratorImpl
- implements ProgramGenerator, Composer, Configurable, ThreadSafe, Loggable
-{
-
+public class ProgramGeneratorImpl implements ProgramGenerator, Contextualizable, Composer, Configurable, ThreadSafe, Loggable {
private Logger log;
- /** The auto-reloading option */
- protected boolean autoReload = true;
- /** The in-memory store */
- protected MemoryStore cache = new MemoryStore();
+ /** The auto-reloading option */
+ protected boolean autoReload = true;
- /** The component manager */
- protected ComponentManager manager = null;
+ /** The in-memory store */
+ protected MemoryStore cache = new MemoryStore();
- /** The markup language component selector */
- protected ComponentSelector markupSelector;
-
- /** The programming language component selector */
- protected ComponentSelector languageSelector;
-
- /** The working directory */
- protected File workDir;
-
- public void setLogger(Logger logger) {
- if (this.log == null) {
- this.log = logger;
- }
- }
-
- /**
- * Set the global component manager. This metod also sets the
- * <code>ComponentSelector</code> used as language factory for both
- * markup and programming languages.
- *
- * @param manager The global component manager
- */
- public void compose(ComponentManager manager) {
- if ((this.manager == null) && (manager != null)) {
- this.manager = manager;
-
- try {
- this.markupSelector = (ComponentSelector) this.manager.lookup(Roles.MARKUP_LANGUAGE);
-
- this.languageSelector = (ComponentSelector) this.manager.lookup(Roles.PROGRAMMING_LANGUAGE);
-
- this.workDir = ((Cocoon) this.manager.lookup(Roles.COCOON)).getWorkDir();
- } catch (Exception e) {
- log.warn("Could not lookup Component", e);
- }
- }
- }
-
- /**
- * Set the sitemap-provided configuration. This method sets the persistent
- * code repository and the auto-reload option
- *
- * @param conf The configuration information
- * @exception ConfigurationException Not thrown here
- */
- public void configure(Configuration conf)
- throws ConfigurationException
- {
- Parameters params = Parameters.fromConfiguration(conf);
- this.autoReload = params.getParameterAsBoolean("auto-reload", autoReload);
- }
-
- /**
- * Load a program built from an XML document written in a
- * <code>MarkupLanguage</code>
- *
- * @param file The input document's <code>File</code>
- * @param markupLanguage The <code>MarkupLanguage</code> in which the input
- * document is written
- * @param programmingLanguage The <code>ProgrammingLanguage</code> in which
- * the program must be written
- * @return The loaded program instance
- * @exception Exception If an error occurs during generation or loading
- */
- public Object load(
- File file, String markupLanguageName, String programmingLanguageName,
- EntityResolver resolver
- ) throws Exception {
- // Get markup and programming languages
- MarkupLanguage markupLanguage = (MarkupLanguage)
- this.markupSelector.select(markupLanguageName);
-
- ProgrammingLanguage programmingLanguage = (ProgrammingLanguage)
- this.languageSelector.select(programmingLanguageName);
-
- programmingLanguage.setLanguageName(programmingLanguageName);
-
- // Create filesystem store
- FilesystemStore repository = new FilesystemStore(this.workDir);
-
- // Set filenames
- String filename = IOUtils.getFullFilename(file);
- String normalizedName = repository.normalizedFilename(filename);
- String sourceExtension = programmingLanguage.getSourceExtension();
-
- // Ensure no 2 requests for the same file overlap
- Object program = null;
- Object programInstance = null;
-
- synchronized(filename.intern()) {
- // Attempt to load program object from cache
- program = this.cache.get(filename);
+ /** The repository store */
+ FilesystemStore repository;
- try {
- if (program == null) {
- /*
- FIXME: Passing null as encoding may result in invalid
- recompilation under certain circumstances!
- */
- program = programmingLanguage.load(
- normalizedName, this.workDir, null
- );
+ /** The component manager */
+ protected ComponentManager manager = null;
+
+ /** The markup language component selector */
+ protected ComponentSelector markupSelector;
+
+ /** The programming language component selector */
+ protected ComponentSelector languageSelector;
+
+ /** The working directory */
+ protected File workDir;
- // Store loaded program in cache
- this.cache.store(filename, program);
+ public void setLogger(Logger logger) {
+ if (this.log == null) {
+ this.log = logger;
}
+ }
- // Instantiate program
- programInstance = programmingLanguage.instantiate(program);
- if (programInstance instanceof Loggable) {
- ((Loggable)programInstance).setLogger(this.log);
+ public void contextualize(Context appContext) {
+ this.workDir = (File) appContext.get(Constants.CONTEXT_WORK_DIR);
+ try {
+ this.repository = new FilesystemStore(this.workDir);
+ } catch (IOException ioe) {
+ log.error("Could not get the Work Directory", ioe);
}
- if (programInstance instanceof Composer) {
- ((Composer)programInstance).compose(this.manager);
+ }
+
+ /**
+ * Set the global component manager. This metod also sets the
+ * <code>ComponentSelector</code> used as language factory for both markup and programming languages.
+ * @param manager The global component manager
+ */
+ public void compose(ComponentManager manager) {
+ if ((this.manager == null) && (manager != null)) {
+ this.manager = manager;
+ try {
+ this.markupSelector = (ComponentSelector)this.manager.lookup(Roles.MARKUP_LANGUAGE);
+ this.languageSelector = (ComponentSelector)this.manager.lookup(Roles.PROGRAMMING_LANGUAGE);
+ } catch (Exception e) {
+ log.warn("Could not lookup Component", e);
+ }
}
- } catch (LanguageException e) { log.debug("Language Exception", e); }
+ }
+
+ /**
+ * Set the sitemap-provided configuration. This method sets the persistent code repository and the auto-reload option
+ * @param conf The configuration information
+ * @exception ConfigurationException Not thrown here
+ */
+ public void configure(Configuration conf) throws ConfigurationException {
+ Parameters params = Parameters.fromConfiguration(conf);
+ this.autoReload = params.getParameterAsBoolean("auto-reload", autoReload);
+ }
+
+ /**
+ * Load a program built from an XML document written in a <code>MarkupLanguage</code>
+ * @param file The input document's <code>File</code>
+ * @param markupLanguage The <code>MarkupLanguage</code> in which the input document is written
+ * @param programmingLanguage The <code>ProgrammingLanguage</code> in which the program must be written
+ * @return The loaded program instance
+ * @exception Exception If an error occurs during generation or loading
+ */
+ public Object load(File file, String markupLanguageName, String programmingLanguageName,
+ EntityResolver resolver) throws Exception {
+ // Get markup and programming languages
+ MarkupLanguage markupLanguage = (MarkupLanguage)this.markupSelector.select(markupLanguageName);
+ ProgrammingLanguage programmingLanguage =
+ (ProgrammingLanguage)this.languageSelector.select(programmingLanguageName);
+ programmingLanguage.setLanguageName(programmingLanguageName);
+ // Create filesystem store
+ // Set filenames
+ String filename = IOUtils.getFullFilename(file);
+ String normalizedName = repository.normalizedFilename(filename);
+ String sourceExtension = programmingLanguage.getSourceExtension();
+ // Ensure no 2 requests for the same file overlap
+ Object program = null;
+ Object programInstance = null;
+ synchronized(filename.intern()) {
+ // Attempt to load program object from cache
+ program = this.cache.get(filename);
+ try {
+ if (program == null) {
+ /*
+ FIXME: Passing null as encoding may result in invalid
+ recompilation under certain circumstances!
+ */
+
+ program = programmingLanguage.load(normalizedName, this.workDir, null);
+ // Store loaded program in cache
+ this.cache.store(filename, program);
+ }
+ // Instantiate program
+ programInstance = programmingLanguage.instantiate(program);
+ if (programInstance instanceof Loggable) {
+ ((Loggable)programInstance).setLogger(this.log);
+ }
+ if (programInstance instanceof Composer) {
+ ((Composer)programInstance).compose(this.manager);
+ }
+ } catch (LanguageException e) { log.debug("Language Exception", e); }
/*
FIXME: It's the program (not the instance) that must
be queried for changes!!!
*/
- if (
- this.autoReload &&
- programInstance != null &&
- programInstance instanceof Modifiable &&
- ((Modifiable) programInstance).modifiedSince(file.lastModified())
- )
- {
- // Unload program
- programmingLanguage.unload(
- program, normalizedName, this.workDir
- );
-
- // Invalidate previous program/instance pair
- program = null;
- programInstance = null;
- }
-
- if (program == null) {
- // Generate code
- String code = markupLanguage.generateCode(
- new InputSource(new FileReader(file)), normalizedName, programmingLanguage, resolver
- );
-
- String encoding = markupLanguage.getEncoding();
-
- // Format source code if applicable
- CodeFormatter codeFormatter = programmingLanguage.getCodeFormatter();
- if (codeFormatter != null) {
- code = codeFormatter.format(code, encoding);
- }
- // Store generated code
- String sourceFilename = filename + "." + sourceExtension;
- repository.store(sourceFilename, code);
-
- // Verify source file generation was successful
- File sourceFile = (File) repository.get(sourceFilename);
- if (sourceFile == null) {
- throw new IOException(
- "Error creating source file: " + sourceFilename
- );
- }
-
- // [Compile]/Load generated program
- program = programmingLanguage.load(
- normalizedName, this.workDir, encoding
- );
-
- // Store generated program in cache
- this.cache.store(filename, program);
- }
-
- // Instantiate
- programInstance = programmingLanguage.instantiate(program);
-
+ if (this.autoReload && programInstance != null && programInstance instanceof Modifiable &&
+ ((Modifiable)programInstance).modifiedSince(file.lastModified())) {
+ // Unload program
+ programmingLanguage.unload(program, normalizedName, this.workDir);
+ // Invalidate previous program/instance pair
+ program = null;
+ programInstance = null;
+ }
+ if (program == null) {
+ // Generate code
+ String code = markupLanguage.generateCode(
+ new InputSource(
+ new FileReader(file)), normalizedName, programmingLanguage, resolver);
+ String encoding = markupLanguage.getEncoding();
+ // Format source code if applicable
+ CodeFormatter codeFormatter = programmingLanguage.getCodeFormatter();
+ if (codeFormatter != null) {
+ code = codeFormatter.format(code, encoding);
+ }
+ // Store generated code
+ String sourceFilename = filename + "." + sourceExtension;
+ repository.store(sourceFilename, code);
+ // Verify source file generation was successful
+ File sourceFile = (File)repository.get(sourceFilename);
+ if (sourceFile == null) {
+ throw new IOException("Error creating source file: " + sourceFilename);
+ }
+ // [Compile]/Load generated program
+ program = programmingLanguage.load(normalizedName, this.workDir, encoding);
+ // Store generated program in cache
+ this.cache.store(filename, program);
+ }
+ // Instantiate
+ programInstance = programmingLanguage.instantiate(program);
+ }
+ return programInstance;
}
-
- return programInstance;
- }
}
No revision
No revision
1.1.2.7 +34 -34 xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPRequestHelper.java
Index: XSPRequestHelper.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPRequestHelper.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- XSPRequestHelper.java 2000/12/14 13:36:49 1.1.2.6
+++ XSPRequestHelper.java 2001/02/15 20:28:53 1.1.2.7
@@ -16,21 +16,21 @@
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.SAXException;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
/**
* The <code>HttpServletRequest</code> object helper
*
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/12/14 13:36:49 $
+ * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/15 20:28:53 $
*/
public class XSPRequestHelper extends XSPObjectHelper {
/**
* Assign values to the object's namespace uri and prefix
*/
static {
- URI = Cocoon.XSP_REQUEST_URI;
- PREFIX = Cocoon.XSP_REQUEST_PREFIX;
+ URI = Constants.XSP_REQUEST_URI;
+ PREFIX = Constants.XSP_REQUEST_PREFIX;
}
/**
@@ -231,24 +231,24 @@
* @param defaultValue Value to substitute in absence of a parameter value
*/
public static String getSessionAttribute(
- HttpServletRequest request,
- String name,
- String defaultValue) {
-
- HttpSession session = request.getSession(false);
- String value = null;
-
- if (session != null) {
- value = (String) session.getAttribute(name);
- }
-
- if (value == null) {
- value = defaultValue;
- }
+ HttpServletRequest request,
+ String name,
+ String defaultValue) {
+
+ HttpSession session = request.getSession(false);
+ String value = null;
- return value;
- }
+ if (session != null) {
+ value = (String) session.getAttribute(name);
+ }
+ if (value == null) {
+ value = defaultValue;
+ }
+
+ return value;
+ }
+
/**
* Output the given session attribute value or a user-provided default if
* none was specified.
@@ -260,21 +260,21 @@
* @exception SAXException If a SAX error occurs
*/
public static void getSessionAttribute(
- HttpServletRequest request,
- ContentHandler contentHandler,
- String name,
- String defaultValue
+ HttpServletRequest request,
+ ContentHandler contentHandler,
+ String name,
+ String defaultValue
)
- throws SAXException
+ throws SAXException
{
- AttributesImpl attr = new AttributesImpl();
- addAttribute(attr, "name", name);
+ AttributesImpl attr = new AttributesImpl();
+ addAttribute(attr, "name", name);
- elementData(
- contentHandler,
- "attribute",
- getSessionAttribute(request, name, defaultValue),
- attr
- );
- }
+ elementData(
+ contentHandler,
+ "attribute",
+ getSessionAttribute(request, name, defaultValue),
+ attr
+ );
+ }
}
1.1.2.9 +4 -4 xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPResponseHelper.java
Index: XSPResponseHelper.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPResponseHelper.java,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- XSPResponseHelper.java 2000/12/18 16:55:14 1.1.2.8
+++ XSPResponseHelper.java 2001/02/15 20:28:57 1.1.2.9
@@ -16,7 +16,7 @@
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.SAXException;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.log.LogKit;
@@ -24,15 +24,15 @@
* The XSP <code>HttpResponse</code> object helper
*
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/12/18 16:55:14 $
+ * @version CVS $Revision: 1.1.2.9 $ $Date: 2001/02/15 20:28:57 $
*/
public class XSPResponseHelper extends XSPObjectHelper {
/**
* Assign values to the object's namespace uri and prefix
*/
static {
- URI = Cocoon.XSP_RESPONSE_URI;
- PREFIX = Cocoon.XSP_RESPONSE_PREFIX;
+ URI = Constants.XSP_RESPONSE_URI;
+ PREFIX = Constants.XSP_RESPONSE_PREFIX;
}
/**
No revision
No revision
1.1.2.14 +7 -16 xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/CompiledProgrammingLanguage.java
Index: CompiledProgrammingLanguage.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/CompiledProgrammingLanguage.java,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -r1.1.2.13 -r1.1.2.14
--- CompiledProgrammingLanguage.java 2000/12/20 13:49:24 1.1.2.13
+++ CompiledProgrammingLanguage.java 2001/02/15 20:29:04 1.1.2.14
@@ -12,9 +12,9 @@
import java.io.File;
import org.apache.avalon.Parameters;
import org.apache.avalon.Composer;
-import org.apache.avalon.Component;
-import org.apache.avalon.ComponentManager;
-import org.apache.cocoon.Cocoon;
+import org.apache.avalon.Context;
+import org.apache.avalon.Contextualizable;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.Roles;
import org.apache.cocoon.util.ClassUtils;
import org.apache.cocoon.components.language.LanguageException;
@@ -23,15 +23,12 @@
* A compiled programming language. This class extends <code>AbstractProgrammingLanguage</code> adding support for compilation
* and object program files
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.13 $ $Date: 2000/12/20 13:49:24 $
+ * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/02/15 20:29:04 $
*/
-public abstract class CompiledProgrammingLanguage extends AbstractProgrammingLanguage implements Composer {
+public abstract class CompiledProgrammingLanguage extends AbstractProgrammingLanguage implements Contextualizable {
/** The compiler */
protected Class compilerClass;
- /** The component manager */
- protected ComponentManager manager;
-
/** The local classpath */
protected String classpath;
@@ -57,14 +54,8 @@
* Set the global component manager
* @param manager The global component manager
*/
- public void compose(ComponentManager manager) {
- this.manager = manager;
- try {
- log.debug("Looking up " + Roles.COCOON);
- this.classpath = ((Cocoon)this.manager.lookup(Roles.COCOON)).getClasspath();
- } catch (Exception e) {
- log.error("Could not find component", e);
- }
+ public void contextualize(Context context) {
+ this.classpath = (String) context.get(Constants.CONTEXT_CLASSPATH);
}
/**
No revision
No revision
1.1.2.22 +12 -12 xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/JavaLanguage.java
Index: JavaLanguage.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/JavaLanguage.java,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -u -r1.1.2.21 -r1.1.2.22
--- JavaLanguage.java 2001/02/07 12:15:08 1.1.2.21
+++ JavaLanguage.java 2001/02/15 20:29:10 1.1.2.22
@@ -32,13 +32,15 @@
* The Java programming language processor
*
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
- * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/02/07 12:15:08 $
+ * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/02/15 20:29:10 $
*/
-public class JavaLanguage extends CompiledProgrammingLanguage implements ThreadSafe {
+public class JavaLanguage extends CompiledProgrammingLanguage implements ThreadSafe, Composer {
/** The class loader */
private ClassLoaderManager classLoaderManager;
+ //private ComponentManager manager;
+
/**
* Return the language name
*
@@ -90,13 +92,11 @@
* @param manager The global component manager
*/
public void compose(ComponentManager manager) {
- super.compose(manager);
-
if (this.classLoaderManager == null) {
try {
log.debug("Looking up " + Roles.CLASS_LOADER);
this.classLoaderManager =
- (ClassLoaderManager) this.manager.lookup(Roles.CLASS_LOADER);
+ (ClassLoaderManager) manager.lookup(Roles.CLASS_LOADER);
} catch (Exception e) {
log.error("Could not find component", e);
}
@@ -161,13 +161,13 @@
String systemClasspath = System.getProperty("java.class.path");
String systemExtDirs = System.getProperty("java.ext.dirs");
- String systemExtClasspath = null;
-
- try {
- systemExtClasspath = expandDirs(systemExtDirs);
- } catch (Exception e) {
- log.warn("Could not expand Directory:" + systemExtDirs, e);
- }
+ String systemExtClasspath = null;
+
+ try {
+ systemExtClasspath = expandDirs(systemExtDirs);
+ } catch (Exception e) {
+ log.warn("Could not expand Directory:" + systemExtDirs, e);
+ }
compiler.setClasspath(
baseDirectory.getCanonicalPath() +
No revision
No revision
1.1.2.8 +3 -3 xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/CommandLineRequest.java
Index: CommandLineRequest.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/CommandLineRequest.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- CommandLineRequest.java 2000/12/11 15:06:05 1.1.2.7
+++ CommandLineRequest.java 2001/02/15 20:29:18 1.1.2.8
@@ -8,7 +8,7 @@
package org.apache.cocoon.environment.commandline;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import java.io.BufferedReader;
import java.io.IOException;
@@ -29,7 +29,7 @@
* Creates a specific servlet request simulation from command line usage.
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/12/11 15:06:05 $
+ * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/15 20:29:18 $
*/
/*
@@ -141,7 +141,7 @@
public String getContentType() { return null; }
public String getProtocol() { return "cli"; }
public String getScheme() { return "cli"; }
- public String getServerName() { return Cocoon.COMPLETE_NAME; }
+ public String getServerName() { return Constants.COMPLETE_NAME; }
public int getServerPort() { return -1; }
public String getRemoteAddr() { return "127.0.0.1"; }
public String getRemoteHost() { return "localhost"; }
1.1.2.11 +5 -5 xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/FileSavingEnvironment.java
Index: FileSavingEnvironment.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/FileSavingEnvironment.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- FileSavingEnvironment.java 2001/02/15 00:59:03 1.1.2.10
+++ FileSavingEnvironment.java 2001/02/15 20:29:23 1.1.2.11
@@ -17,14 +17,14 @@
import java.net.MalformedURLException;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.environment.AbstractEnvironment;
/**
* This environment is used to save the requested file to disk.
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/02/15 00:59:03 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/02/15 20:29:23 $
*/
public class FileSavingEnvironment extends AbstractCommandLineEnvironment {
@@ -33,9 +33,9 @@
throws MalformedURLException {
super(uri, null, context, stream);
getLogger().debug("FileSavingEnvironment: uri=" + uri);
- this.objectModel.put(Cocoon.LINK_OBJECT, links);
- this.objectModel.put(Cocoon.REQUEST_OBJECT, new CommandLineRequest(null, uri, null, attributes, parameters));
- this.objectModel.put(Cocoon.RESPONSE_OBJECT, new CommandLineResponse());
+ this.objectModel.put(Constants.LINK_OBJECT, links);
+ this.objectModel.put(Constants.REQUEST_OBJECT, new CommandLineRequest(null, uri, null, attributes, parameters));
+ this.objectModel.put(Constants.RESPONSE_OBJECT, new CommandLineResponse());
}
}
1.1.2.11 +6 -6 xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/LinkSamplingEnvironment.java
Index: LinkSamplingEnvironment.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/LinkSamplingEnvironment.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- LinkSamplingEnvironment.java 2001/02/15 00:59:03 1.1.2.10
+++ LinkSamplingEnvironment.java 2001/02/15 20:29:25 1.1.2.11
@@ -26,7 +26,7 @@
import java.net.MalformedURLException;
import org.apache.cocoon.Main;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.environment.AbstractEnvironment;
@@ -34,7 +34,7 @@
* This environment is sample the links of the resource.
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/02/15 00:59:03 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/02/15 20:29:25 $
*/
public class LinkSamplingEnvironment extends AbstractCommandLineEnvironment {
@@ -43,17 +43,17 @@
public LinkSamplingEnvironment(String uri, File contextFile, Map attributes, Map parameters)
throws MalformedURLException, IOException {
- super(uri, Cocoon.LINK_VIEW, contextFile, new ByteArrayOutputStream());
+ super(uri, Constants.LINK_VIEW, contextFile, new ByteArrayOutputStream());
getLogger().debug("LinkSamplingEnvironment: uri=" + uri);
- this.objectModel.put(Cocoon.REQUEST_OBJECT, new CommandLineRequest(null, uri, null, attributes, parameters));
- this.objectModel.put(Cocoon.RESPONSE_OBJECT, new CommandLineResponse());
+ this.objectModel.put(Constants.REQUEST_OBJECT, new CommandLineRequest(null, uri, null, attributes, parameters));
+ this.objectModel.put(Constants.RESPONSE_OBJECT, new CommandLineResponse());
}
/**
* Set the ContentType
*/
public void setContentType(String contentType) {
- if (!Cocoon.LINK_CONTENT_TYPE.equals(contentType)) {
+ if (Constants.LINK_CONTENT_TYPE.equals(contentType) == false) {
this.skip = true;
}
}
No revision
No revision
1.1.2.20 +5 -7 xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java
Index: HttpEnvironment.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -u -r1.1.2.19 -r1.1.2.20
--- HttpEnvironment.java 2001/02/15 00:59:05 1.1.2.19
+++ HttpEnvironment.java 2001/02/15 20:29:33 1.1.2.20
@@ -19,9 +19,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.avalon.ComponentManager;
-
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.environment.AbstractEnvironment;
import org.xml.sax.InputSource;
@@ -51,16 +49,16 @@
HttpServletResponse response,
ServletContext servletContext)
throws MalformedURLException, IOException {
- super(uri, request.getParameter(Cocoon.VIEW_PARAM), servletContext.getRealPath("/"), request.getParameter(Cocoon.ACTION_PARAM));
+ super(uri, request.getParameter(Constants.VIEW_PARAM), servletContext.getRealPath("/"), request.getParameter(Constants.ACTION_PARAM));
this.request = new HttpRequest (request, this);
this.servletRequest = request;
this.response = new HttpResponse (response);
this.servletResponse = response;
this.servletContext = servletContext;
this.outputStream = response.getOutputStream();
- this.objectModel.put(Cocoon.REQUEST_OBJECT, this.request);
- this.objectModel.put(Cocoon.RESPONSE_OBJECT, this.response);
- this.objectModel.put(Cocoon.CONTEXT_OBJECT, this.servletContext);
+ this.objectModel.put(Constants.REQUEST_OBJECT, this.request);
+ this.objectModel.put(Constants.RESPONSE_OBJECT, this.response);
+ this.objectModel.put(Constants.CONTEXT_OBJECT, this.servletContext);
}
/**
No revision
No revision
1.1.2.8 +6 -6 xml-cocoon/src/org/apache/cocoon/generation/Attic/ServletGenerator.java
Index: ServletGenerator.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/ServletGenerator.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- ServletGenerator.java 2001/02/11 19:13:19 1.1.2.7
+++ ServletGenerator.java 2001/02/15 20:29:42 1.1.2.8
@@ -19,7 +19,7 @@
import org.apache.avalon.Parameters;
import org.apache.avalon.Poolable;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
import org.xml.sax.EntityResolver;
@@ -28,7 +28,7 @@
/**
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/11 19:13:19 $
+ * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/02/15 20:29:42 $
*/
public abstract class ServletGenerator extends ComposerGenerator
implements Composer, Poolable {
@@ -37,11 +37,11 @@
protected HttpServletResponse response=null;
protected ServletContext context=null;
- public void setup(EntityResolver resolver, Map objectModel, String src, Parameters par)
+ public void setup(EntityResolver resolver, Map objectModel, String src, Parameters par)
throws ProcessingException, SAXException, IOException {
super.setup(resolver, objectModel, src, par);
- this.request = (HttpServletRequest) objectModel.get(Cocoon.REQUEST_OBJECT);
- this.response = (HttpServletResponse) objectModel.get(Cocoon.RESPONSE_OBJECT);
- this.context = (ServletContext) objectModel.get(Cocoon.CONTEXT_OBJECT);
+ this.request = (HttpServletRequest) objectModel.get(Constants.REQUEST_OBJECT);
+ this.response = (HttpServletResponse) objectModel.get(Constants.RESPONSE_OBJECT);
+ this.context = (ServletContext) objectModel.get(Constants.CONTEXT_OBJECT);
}
}
No revision
No revision
1.1.2.14 +4 -4 xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java
Index: ResourceReader.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -r1.1.2.13 -r1.1.2.14
--- ResourceReader.java 2001/02/12 13:30:45 1.1.2.13
+++ ResourceReader.java 2001/02/15 20:29:50 1.1.2.14
@@ -22,7 +22,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletContext;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.ResourceNotFoundException;
import org.apache.cocoon.Roles;
@@ -36,7 +36,7 @@
/**
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/02/12 13:30:45 $
+ * @version CVS $Revision: 1.1.2.14 $ $Date: 2001/02/15 20:29:50 $
*
* The <code>ResourceReader</code> component is used to serve binary data
* in a sitemap pipeline. It makes use of HTTP Headers to determine if
@@ -64,8 +64,8 @@
* Generates the requested resource.
*/
public void generate() throws IOException, ProcessingException {
- HttpServletRequest req = (HttpServletRequest) objectModel.get(Cocoon.REQUEST_OBJECT);
- HttpServletResponse res = (HttpServletResponse) objectModel.get(Cocoon.RESPONSE_OBJECT);
+ HttpServletRequest req = (HttpServletRequest) objectModel.get(Constants.REQUEST_OBJECT);
+ HttpServletResponse res = (HttpServletResponse) objectModel.get(Constants.RESPONSE_OBJECT);
URLFactory urlFactory = null;
try {
No revision
No revision
1.1.2.2 +5 -5 xml-cocoon/src/org/apache/cocoon/selection/helpers/Attic/CodedSelectorHelper.java
Index: CodedSelectorHelper.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/selection/helpers/Attic/CodedSelectorHelper.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- CodedSelectorHelper.java 2000/12/04 12:07:00 1.1.2.1
+++ CodedSelectorHelper.java 2001/02/15 20:29:58 1.1.2.2
@@ -7,7 +7,7 @@
*****************************************************************************/
package org.apache.cocoon.selection.helpers;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import java.util.Map;
@@ -24,7 +24,7 @@
* variables for developer ease.
*
* @author <a href="mailto:Marcus.Crafter@osa.de">Marcus Crafter</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/12/04 12:07:00 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/02/15 20:29:58 $
*/
public abstract class CodedSelectorHelper
{
@@ -35,11 +35,11 @@
protected void initialize(Map objectModel)
{
context = (ServletContext)
- objectModel.get(Cocoon.CONTEXT_OBJECT);
+ objectModel.get(Constants.CONTEXT_OBJECT);
request = (HttpServletRequest)
- objectModel.get(Cocoon.REQUEST_OBJECT);
+ objectModel.get(Constants.REQUEST_OBJECT);
response = (HttpServletResponse)
- objectModel.get(Cocoon.RESPONSE_OBJECT);
+ objectModel.get(Constants.RESPONSE_OBJECT);
session = request.getSession();
}
No revision
No revision
1.1.2.5 +3 -3 xml-cocoon/src/org/apache/cocoon/serialization/Attic/LinkSerializer.java
Index: LinkSerializer.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/LinkSerializer.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- LinkSerializer.java 2000/10/01 00:18:45 1.1.2.4
+++ LinkSerializer.java 2001/02/15 20:30:08 1.1.2.5
@@ -12,7 +12,7 @@
import java.io.PrintStream;
import java.io.IOException;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -21,7 +21,7 @@
/**
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/10/01 00:18:45 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/02/15 20:30:08 $
*/
public class LinkSerializer extends ExtendedXLinkPipe implements Serializer {
@@ -40,7 +40,7 @@
* Get the mime-type of the output of this <code>Component</code>.
*/
public String getMimeType() {
- return Cocoon.LINK_CONTENT_TYPE;
+ return Constants.LINK_CONTENT_TYPE;
}
public void simpleLink(String href, String role, String arcrole, String title, String show, String actuate, String uri, String name, String raw, Attributes attr)
No revision
No revision
1.1.4.57 +4 -4 xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
retrieving revision 1.1.4.56
retrieving revision 1.1.4.57
diff -u -r1.1.4.56 -r1.1.4.57
--- CocoonServlet.java 2001/02/14 18:20:14 1.1.4.56
+++ CocoonServlet.java 2001/02/15 20:30:17 1.1.4.57
@@ -60,7 +60,7 @@
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
* @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.4.56 $ $Date: 2001/02/14 18:20:14 $
+ * @version CVS $Revision: 1.1.4.57 $ $Date: 2001/02/15 20:30:17 $
*/
public class CocoonServlet extends HttpServlet {
@@ -283,7 +283,7 @@
// This is more scalable
long start = new Date().getTime();
- Cocoon cocoon = getCocoon(req.getPathInfo(), req.getParameter(Cocoon.RELOAD_PARAM));
+ Cocoon cocoon = getCocoon(req.getPathInfo(), req.getParameter(Constants.RELOAD_PARAM));
// Check if cocoon was initialized
if (this.cocoon == null) {
@@ -380,7 +380,7 @@
String timeString = processTime(end - start);
log.info("'" + uri + "' " + timeString);
- String showTime = req.getParameter(Cocoon.SHOWTIME_PARAM);
+ String showTime = req.getParameter(Constants.SHOWTIME_PARAM);
if ((showTime != null) && !showTime.equalsIgnoreCase("no")) {
boolean hide = showTime.equalsIgnoreCase("hide");
@@ -433,7 +433,7 @@
private String processTime(long time) throws IOException {
StringBuffer out = new StringBuffer("Processed by ")
- .append(Cocoon.COMPLETE_NAME)
+ .append(Constants.COMPLETE_NAME)
.append(" in ");
if (time > hour) {
No revision
No revision
1.1.2.12 +3 -3 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/LinkTranslator.java
Index: LinkTranslator.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/LinkTranslator.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- LinkTranslator.java 2000/10/19 14:44:19 1.1.2.11
+++ LinkTranslator.java 2001/02/15 20:30:28 1.1.2.12
@@ -22,7 +22,7 @@
import org.apache.avalon.Parameters;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.xml.xlink.ExtendedXLinkPipe;
import org.apache.cocoon.transformation.Transformer;
@@ -30,7 +30,7 @@
/**
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/10/19 14:44:19 $
+ * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/02/15 20:30:28 $
*/
public class LinkTranslator extends ExtendedXLinkPipe implements Transformer {
@@ -43,7 +43,7 @@
*/
public void setup(EntityResolver resolver, Map objectModel, String src, Parameters par)
throws ProcessingException, SAXException, IOException {
- this.links = (Map) objectModel.get(Cocoon.LINK_OBJECT);
+ this.links = (Map) objectModel.get(Constants.LINK_OBJECT);
}
public void simpleLink(String href, String role, String arcrole, String title, String show, String actuate, String uri, String name, String raw, Attributes attr)
No revision
No revision
1.1.2.6 +9 -9 xml-cocoon/src/org/apache/cocoon/transformation/Attic/TraxTransformer.java
Index: TraxTransformer.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/TraxTransformer.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- TraxTransformer.java 2001/02/15 13:26:06 1.1.2.5
+++ TraxTransformer.java 2001/02/15 20:30:38 1.1.2.6
@@ -30,7 +30,7 @@
import org.apache.avalon.Parameters;
import org.apache.avalon.Loggable;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.Roles;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.store.Store;
@@ -58,7 +58,7 @@
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
* @author <a href="mailto:cziegeler@sundn.de">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/02/15 13:26:06 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/02/15 20:30:38 $
*/
public class TraxTransformer extends ContentHandlerWrapper
implements Transformer, Composer, Poolable, Recyclable, Configurable {
@@ -161,7 +161,7 @@
throws SAXException, ProcessingException, IOException {
/** The Request object */
- HttpServletRequest request = (HttpServletRequest) objectModel.get(Cocoon.REQUEST_OBJECT);
+ HttpServletRequest request = (HttpServletRequest) objectModel.get(Constants.REQUEST_OBJECT);
// Check the stylesheet uri
String xsluri = src;
@@ -270,14 +270,14 @@
public void recycle()
{
- //FIXME: Patch for Xalan2J, to stop transform threads if
- // there is a failure in the pipeline.
+ //FIXME: Patch for Xalan2J, to stop transform threads if
+ // there is a failure in the pipeline.
try {
- Class clazz =
+ Class clazz =
Class.forName("org.apache.xalan.stree.SourceTreeHandler");
- Class paramTypes[] =
+ Class paramTypes[] =
new Class[]{ Exception.class };
- Object params[] =
+ Object params[] =
new Object[] { new SAXException("Dummy Exception") };
if(clazz.isInstance(transformerHandler)) {
Method method = clazz.getMethod("setExceptionThrown",paramTypes);
@@ -287,6 +287,6 @@
log.debug("Exception in recycle:", e);
}
this.transformerHandler = null;
- super.recycle();
+ super.recycle();
}
}
1.1.2.11 +3 -3 xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java
Index: XTTransformer.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- XTTransformer.java 2001/02/12 13:30:46 1.1.2.10
+++ XTTransformer.java 2001/02/15 20:30:42 1.1.2.11
@@ -22,7 +22,7 @@
import org.apache.avalon.Modifiable;
import org.apache.avalon.Parameters;
-import org.apache.cocoon.Cocoon;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.Roles;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.xml.XMLConsumer;
@@ -71,7 +71,7 @@
* This Transformer use the XT processor.
*
* @author <a href="mailto:ssahuc@imediation.com">Sahuc Sebastien</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/02/12 13:30:46 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/02/15 20:30:42 $
*/
public class XTTransformer extends DocumentHandlerWrapper
implements Transformer, Composer, Loggable {
@@ -119,7 +119,7 @@
throws SAXException, ProcessingException, IOException {
/** The Request object */
- HttpServletRequest request = (HttpServletRequest) objectModel.get(Cocoon.REQUEST_OBJECT);
+ HttpServletRequest request = (HttpServletRequest) objectModel.get(Constants.REQUEST_OBJECT);
if (request == null) {
throw new ProcessingException ("Missing request object in objectModel");
}
No revision
No revision
1.1.2.6 +1 -2 xml-cocoon/src/org/apache/cocoon/util/Attic/RoleUtils.java
Index: RoleUtils.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/RoleUtils.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- RoleUtils.java 2001/02/12 13:30:47 1.1.2.5
+++ RoleUtils.java 2001/02/15 20:30:50 1.1.2.6
@@ -19,7 +19,7 @@
* role aliases and the real Avalon role names.
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/02/12 13:30:47 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/02/15 20:30:50 $
*/
public class RoleUtils {
@@ -30,7 +30,6 @@
static {
HashMap setup = new HashMap();
- setup.put("cocoon", Roles.COCOON);
setup.put("parser", Roles.PARSER);
setup.put("processor", Roles.PROCESSOR);
setup.put("store", Roles.STORE);