giacomo 01/06/08 13:28:34
Modified: . build.xml
src/org/apache/cocoon Cocoon.java cocoon.roles
src/org/apache/cocoon/components/language/generator
GeneratorSelector.java ProgramGenerator.java
ProgramGeneratorImpl.java
src/org/apache/cocoon/components/language/markup/sitemap/java
sitemap.xsl
src/org/apache/cocoon/components/pipeline
AbstractEventPipeline.java
AbstractStreamPipeline.java
CachingEventPipeline.java
CachingStreamPipeline.java EventPipeline.java
StreamPipeline.java
src/org/apache/cocoon/environment/commandline
AbstractCommandLineEnvironment.java
src/org/apache/cocoon/environment/http HttpRequest.java
src/org/apache/cocoon/generation FileGenerator.java
ServerPagesGenerator.java
src/org/apache/cocoon/sitemap AbstractSitemap.java
ContentAggregator.java ErrorNotifier.java
Handler.java LinkTranslator.java Manager.java
PatternException.java Sitemap.java
SitemapComponentSelector.java
SitemapModelComponent.java
SitemapOutputComponent.java XSLTFactoryLoader.java
src/org/apache/cocoon/util IOUtils.java
Added: lib avalon-excalibur-4.0b3.jar
avalon-framework-4.0b3.jar logkit-1.0b2.jar
src/org/apache/cocoon/sitemap SitemapRedirector.java
sitemap.roles
Removed: lib avalon-excalibur-4.0b1.jar
avalon-framework-4.0b1.jar logkit-1.0b1.jar
Log:
Synchronized HEAD branch with cocoon_20_branch.
Set a tag cocoon_20_branch_mergepoint
Revision Changes Path
1.14 +1 -0 xml-cocoon2/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/build.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -u -r1.13 -r1.14
--- build.xml 2001/06/07 08:46:46 1.13
+++ build.xml 2001/06/08 20:28:07 1.14
@@ -635,6 +635,7 @@
<copy todir="${dist.dir}/src">
<fileset dir="${src.dir}"/>
</copy>
+
<copy todir="${dist.dir}/webapp">
<fileset dir="${build.war}"/>
</copy>
1.2 +303 -0 xml-cocoon2/lib/avalon-excalibur-4.0b3.jar
<<Binary file>>
1.2 +118 -0 xml-cocoon2/lib/avalon-framework-4.0b3.jar
<<Binary file>>
1.2 +102 -0 xml-cocoon2/lib/logkit-1.0b2.jar
<<Binary file>>
1.10 +73 -37 xml-cocoon2/src/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -u -r1.9 -r1.10
--- Cocoon.java 2001/06/05 08:05:13 1.9
+++ Cocoon.java 2001/06/08 20:28:11 1.10
@@ -42,9 +42,10 @@
import org.apache.cocoon.environment.Source;
import org.apache.cocoon.serialization.Serializer;
import org.apache.cocoon.sitemap.Manager;
+import org.apache.cocoon.sitemap.AbstractSitemap;
import org.apache.cocoon.util.ClassUtils;
import org.apache.cocoon.util.NetUtils;
-import org.apache.avalon.excalibur.component.DefaultComponentManager;
+import org.apache.avalon.excalibur.component.ExcaliburComponentManager;
import org.apache.avalon.excalibur.component.DefaultRoleManager;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -54,7 +55,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
(Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.9 $ $Date: 2001/06/05 08:05:13 $
+ * @version CVS $Revision: 1.10 $ $Date: 2001/06/08 20:28:11 $
*/
public class Cocoon extends AbstractLoggable implements ThreadSafe,
Component, Initializable, Disposable, Modifiable, Processor, Contextualizable {
/** The application context */
@@ -85,7 +86,7 @@
private boolean reloadSitemapAsynchron = true;
/** The component manager. */
- public DefaultComponentManager componentManager;
+ private ExcaliburComponentManager componentManager;
/** flag for disposed or not */
private boolean disposed = false;
@@ -111,7 +112,7 @@
}
public void initialize() throws Exception {
- this.componentManager = new DefaultComponentManager();
+ this.componentManager = new
ExcaliburComponentManager((ClassLoader)this.context.get(Constants.CONTEXT_CLASS_LOADER));
this.componentManager.setLogger(getLogger());
this.componentManager.contextualize(this.context);
@@ -120,9 +121,12 @@
// If one need to use a different parser, set the given system
property
String parser = System.getProperty(Constants.PARSER_PROPERTY,
Constants.DEFAULT_PARSER);
getLogger().debug("Using parser: " + parser);
+ ExcaliburComponentManager startupManager = new
ExcaliburComponentManager((ClassLoader)this.context.get(Constants.CONTEXT_CLASS_LOADER));
+ startupManager.setLogger(getLogger());
+ startupManager.contextualize(this.context);
try {
- this.componentManager.addComponent(Roles.PARSER,
ClassUtils.loadClass(parser), null);
+ startupManager.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);
@@ -141,17 +145,44 @@
getLogger().debug("Classpath = " + classpath);
getLogger().debug("Work directory = " + workDir.getCanonicalPath());
- this.configure();
+ startupManager.initialize();
+
+ Configuration conf = this.configure(startupManager);
+ startupManager.dispose();
+
+ this.componentManager.initialize();
+
+ getLogger().debug("Setting up the sitemap.");
+ // Create the sitemap
+ Configuration sconf = conf.getChild("sitemap");
+ this.sitemapManager = new Manager();
+ this.sitemapManager.setLogger(getLogger());
+ this.sitemapManager.contextualize(this.context);
+ 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());
+ }
+ String value = sconf.getAttribute("check-reload", "yes");
+ this.checkSitemapReload = !(value != null &&
value.equalsIgnoreCase("no") == true);
+ value = sconf.getAttribute("reload-method", "asynchron");
+ this.reloadSitemapAsynchron = !(value != null &&
value.equalsIgnoreCase("synchron") == true);
+ getLogger().debug("Sitemap location = " + this.sitemapFileName);
+ getLogger().debug("Checking sitemap reload = " +
this.checkSitemapReload);
+ getLogger().debug("Reloading sitemap asynchron = " +
this.reloadSitemapAsynchron);
}
/** Configure this <code>Cocoon</code> instance. */
- public void configure() throws ConfigurationException, ContextException {
+ public Configuration configure(ExcaliburComponentManager startupManager)
throws ConfigurationException, ContextException {
Parser p = null;
Configuration roleConfig = null;
+ Configuration sitemapConfig = null;
try {
this.configurationFile.refresh();
- p = (Parser)this.componentManager.lookup(Roles.PARSER);
+ p = (Parser)startupManager.lookup(Roles.PARSER);
SAXConfigurationHandler b = new SAXConfigurationHandler();
InputStream inputStream =
ClassUtils.getResource("org/apache/cocoon/cocoon.roles").openStream();
InputSource is = new InputSource(inputStream);
@@ -163,7 +194,7 @@
getLogger().error("Could not configure Cocoon environment", e);
throw new ConfigurationException("Error trying to load
configurations", e);
} finally {
- if (p != null) this.componentManager.release(p);
+ if (p != null) startupManager.release(p);
}
DefaultRoleManager drm = new DefaultRoleManager();
@@ -172,8 +203,29 @@
roleConfig = null;
try {
- p = (Parser)this.componentManager.lookup(Roles.PARSER);
+ this.configurationFile.refresh();
+ p = (Parser)startupManager.lookup(Roles.PARSER);
SAXConfigurationHandler b = new SAXConfigurationHandler();
+ InputStream inputStream =
ClassUtils.getResource("org/apache/cocoon/sitemap/sitemap.roles").openStream();
+ InputSource is = new InputSource(inputStream);
+ is.setSystemId(this.configurationFile.getSystemId());
+ p.setContentHandler(b);
+ p.parse(is);
+ sitemapConfig = b.getConfiguration();
+ } catch (Exception e) {
+ getLogger().error("Could not configure Cocoon environment", e);
+ throw new ConfigurationException("Error trying to load
configurations", e);
+ } finally {
+ if (p != null) startupManager.release(p);
+ }
+
+ DefaultRoleManager sitemapRoleManager = new DefaultRoleManager();
+ sitemapRoleManager.setLogger(getLogger());
+ sitemapRoleManager.configure(sitemapConfig);
+
+ try {
+ p = (Parser)startupManager.lookup(Roles.PARSER);
+ SAXConfigurationHandler b = new SAXConfigurationHandler();
InputSource is = this.configurationFile.getInputSource();
p.setContentHandler(b);
p.parse(is);
@@ -182,11 +234,13 @@
getLogger().error("Could not configure Cocoon environment", e);
throw new ConfigurationException("Error trying to load
configurations",e);
} finally {
- if (p != null) this.componentManager.release(p);
+ if (p != null) startupManager.release(p);
}
Configuration conf = this.configuration;
+ AbstractSitemap.setRoleManager(sitemapRoleManager, conf);
+
getLogger().debug("Root configuration: " + conf.getName());
if (! "cocoon".equals(conf.getName())) {
throw new ConfigurationException("Invalid configuration file\n"
+ conf.toString());
@@ -199,7 +253,7 @@
String userRoles = conf.getAttribute("user-roles", "");
if ("".equals(userRoles) == false) {
try {
- p = (Parser)this.componentManager.lookup(Roles.PARSER);
+ p = (Parser)startupManager.lookup(Roles.PARSER);
SAXConfigurationHandler b = new SAXConfigurationHandler();
org.apache.cocoon.environment.Context context =
(org.apache.cocoon.environment.Context)
this.context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
@@ -213,7 +267,7 @@
getLogger().error("Could not configure Cocoon environment",
e);
throw new ConfigurationException("Error trying to load
configurations", e);
} finally {
- if (p != null) this.componentManager.release(p);
+ if (p != null) startupManager.release(p);
}
DefaultRoleManager urm = new DefaultRoleManager(drm);
@@ -227,26 +281,8 @@
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();
- this.sitemapManager.setLogger(getLogger());
- this.sitemapManager.contextualize(this.context);
- 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());
- }
- String value = sconf.getAttribute("check-reload", "yes");
- this.checkSitemapReload = !(value != null &&
value.equalsIgnoreCase("no") == true);
- value = sconf.getAttribute("reload-method", "asynchron");
- this.reloadSitemapAsynchron = !(value != null &&
value.equalsIgnoreCase("synchron") == true);
- getLogger().debug("Sitemap location = " + this.sitemapFileName);
- getLogger().debug("Checking sitemap reload = " +
this.checkSitemapReload);
- getLogger().debug("Reloading sitemap asynchron = " +
this.reloadSitemapAsynchron);
+
+ return conf;
}
/** Queries the class to estimate its ergodic period termination. */
@@ -290,7 +326,7 @@
public boolean process(Environment environment)
throws Exception {
if (disposed) throw new IllegalStateException("You cannot process a
Disposed Cocoon engine.");
- return this.sitemapManager.invoke(environment, "",
this.sitemapFileName,
+ return this.sitemapManager.invoke(this.componentManager,
environment, "", this.sitemapFileName,
this.checkSitemapReload, this.reloadSitemapAsynchron);
}
@@ -301,7 +337,7 @@
public boolean process(Environment environment, StreamPipeline pipeline,
EventPipeline eventPipeline)
throws Exception {
if (disposed) throw new IllegalStateException("You cannot process a
Disposed Cocoon engine.");
- return this.sitemapManager.invoke(environment, "",
this.sitemapFileName,
+ return this.sitemapManager.invoke(this.componentManager,
environment, "", this.sitemapFileName,
this.checkSitemapReload, this.reloadSitemapAsynchron,
pipeline, eventPipeline);
}
@@ -321,7 +357,7 @@
String programmingLanguage = "java";
getLogger().debug("Sitemap regeneration begin:" +
sitemapFileName);
- CompiledComponent smap = (CompiledComponent)
programGenerator.load(sitemapFileName, markupLanguage, programmingLanguage,
environment);
+ CompiledComponent smap =
programGenerator.load(this.componentManager, sitemapFileName, markupLanguage,
programmingLanguage, environment);
getLogger().debug("Sitemap regeneration complete");
if (smap != null) {
@@ -355,7 +391,7 @@
String markupLanguage = "xsp";
String programmingLanguage = "java";
- CompiledComponent xsp = (CompiledComponent)
programGenerator.load(fileName, markupLanguage, programmingLanguage,
environment);
+ CompiledComponent xsp =
programGenerator.load(this.componentManager, fileName, markupLanguage,
programmingLanguage, environment);
getLogger().debug("XSP generation complete:" + xsp);
this.componentManager.release(programGenerator);
1.7 +7 -47 xml-cocoon2/src/org/apache/cocoon/cocoon.roles
Index: cocoon.roles
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/cocoon.roles,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- cocoon.roles 2001/05/28 12:01:14 1.6
+++ cocoon.roles 2001/06/08 20:28:12 1.7
@@ -26,11 +26,11 @@
<role
name="org.apache.cocoon.components.language.markup.MarkupLanguageSelector"
shorthand="markup-languages"
-
default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
+
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
<role
name="org.apache.cocoon.components.language.programming.ProgrammingLanguageSelector"
shorthand="programming-languages"
-
default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
+
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>
<role
name="org.apache.cocoon.components.language.generator.ProgramGenerator"
shorthand="program-generator"
@@ -40,10 +40,6 @@
shorthand="classloader"
default-class="org.apache.cocoon.components.classloader.ClassLoaderManagerImpl"/>
- <role name="org.apache.avalon.excalibur.pool.PoolController"
- shorthand="pool-controller"
-
default-class="org.apache.avalon.excalibur.component.DefaultComponentPoolController"/>
-
<role name="org.apache.cocoon.components.saxconnector.SAXConnector"
shorthand="sax-connector"
default-class="org.apache.cocoon.components.saxconnector.NullSAXConnector"/>
@@ -53,52 +49,16 @@
<role
name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
shorthand="datasources"
-
default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector">
+
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
<hint shorthand="jdbc"
class="org.apache.avalon.excalibur.datasource.JdbcDataSource"/>
<hint shorthand="j2ee"
class="org.apache.excalibur.datasource.J2eeDataSource"/>
-</role>
+ </role>
<role name="org.apache.cocoon.components.url.URLFactory"
shorthand="url-factory"
default-class="org.apache.cocoon.components.url.URLFactoryImpl"/>
-
- <role name="org.apache.cocoon.components.pipeline.StreamPipeline"
- shorthand="stream-pipeline"
-
default-class="org.apache.cocoon.components.pipeline.NonCachingStreamPipeline"/>
-
- <role name="org.apache.cocoon.components.pipeline.EventPipeline"
- shorthand="event-pipeline"
-
default-class="org.apache.cocoon.components.pipeline.NonCachingEventPipeline"/>
-
- <role name="org.apache.cocoon.acting.ActionSelector"
- shorthand="action"
-
default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
-
- <role name="org.apache.cocoon.selection.SelectorSelector"
- shorthand="selector"
-
default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
-
- <role name="org.apache.cocoon.matching.MatcherSelector"
- shorthand="matcher"
-
default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
-
- <role name="org.apache.cocoon.generation.GeneratorSelector"
- shorthand="generator"
-
default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
-
- <role name="org.apache.cocoon.transformation.TransformerSelector"
- shorthand="transformer"
-
default-class="org.apache.avalon.excalibur.component.DefaultComponentSelector"/>
-
- <role name="org.apache.cocoon.serialization.SerializerSelector"
- shorthand="serializer"
- default-class="org.apache.cocoon.sitemap.SitemapComponentSelector"/>
-
- <role name="org.apache.cocoon.reading.ReaderSelector"
- shorthand="reader"
- default-class="org.apache.cocoon.sitemap.SitemapComponentSelector"/>
-<role name="org.apache.cocoon.components.sax.XMLSerializer"
+ <role name="org.apache.cocoon.components.sax.XMLSerializer"
shorthand="xml-serializer"
default-class="org.apache.cocoon.components.sax.XMLByteStreamCompiler"/>
@@ -106,11 +66,11 @@
shorthand="xml-deserializer"
default-class="org.apache.cocoon.components.sax.XMLByteStreamInterpreter"/>
-<role name="org.apache.cocoon.caching.EventCache"
+ <role name="org.apache.cocoon.caching.EventCache"
shorthand="event-cache"
default-class="org.apache.cocoon.caching.EventMemoryCache"/>
-<role name="org.apache.cocoon.caching.StreamCache"
+ <role name="org.apache.cocoon.caching.StreamCache"
shorthand="stream-cache"
default-class="org.apache.cocoon.caching.StreamMemoryCache"/>
1.2 +65 -8
xml-cocoon2/src/org/apache/cocoon/components/language/generator/GeneratorSelector.java
Index: GeneratorSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/generator/GeneratorSelector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- GeneratorSelector.java 2001/05/09 20:49:49 1.1
+++ GeneratorSelector.java 2001/06/08 20:28:14 1.2
@@ -12,26 +12,48 @@
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
import org.apache.cocoon.Constants;
import org.apache.cocoon.Roles;
import org.apache.cocoon.components.classloader.ClassLoaderManager;
import org.apache.cocoon.util.ClassUtils;
-import org.apache.avalon.excalibur.component.DefaultComponentSelector;
+import org.apache.avalon.excalibur.component.ExcaliburComponentSelector;
+import org.apache.avalon.excalibur.component.ComponentHandler;
+import org.apache.avalon.excalibur.component.RoleManager;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* This interface is the common base of all Compiled Components. This
* includes Sitemaps and XSP Pages
*
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/05/09 20:49:49 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/06/08 20:28:14 $
*/
-public class GeneratorSelector extends DefaultComponentSelector implements
Disposable {
+public class GeneratorSelector extends ExcaliburComponentSelector implements
Disposable {
private ClassLoaderManager classManager;
/** The component manager */
protected ComponentManager manager = null;
+ protected Context context = null;
+
+ protected RoleManager roles = null;
+
+ protected Map componentHandlers = new HashMap();
+
+ public void contextualize(Context context) {
+ super.contextualize(context);
+ this.context = context;
+ }
+
+ public void setRoleManager(RoleManager roleMgr) {
+ super.setRoleManager(roleMgr);
+ this.roles = roleMgr;
+ }
+
public void compose (ComponentManager manager) throws ComponentException
{
super.compose(manager);
this.manager = manager;
@@ -54,8 +76,23 @@
return super.select(hint);
} catch (Exception e) {
// if it isn't loaded, it may already be compiled...
- this.addGenerator(hint);
- return super.select(hint);
+ try {
+ ComponentHandler handler = (ComponentHandler)
this.componentHandlers.get(hint);
+
+ if (handler == null) {
+ this.addGenerator(hint);
+ handler = (ComponentHandler)
this.componentHandlers.get(hint);
+
+ if (handler == null) {
+ throw new ComponentException("Could not find
component for hint: " + hint);
+ }
+ }
+
+ return (Component) handler.get();
+ } catch (Exception ce) {
+ getLogger().debug("Could not access component for hint: " +
hint, ce);
+ throw new ComponentException("Could not access component for
hint: " + hint, ce);
+ }
}
}
@@ -68,11 +105,31 @@
throw new ComponentException("Could not add component for class:
" + className, e);
}
- this.addGenerator(hint, generator);
+ this.addGenerator(this.manager, hint, generator);
}
- public void addGenerator(Object hint, Class generator) throws
ComponentException {
- super.addComponent(hint, generator, new DefaultConfiguration("",
"GeneratorSelector"));
+ public void addGenerator(ComponentManager newManager, Object hint, Class
generator) throws ComponentException {
+ try
+ {
+ final ComponentHandler handler =
+ ComponentHandler.getComponentHandler( generator,
+ new
DefaultConfiguration("", "GeneratorSelector"),
+ newManager,
+ this.context,
+ this.roles );
+
+ handler.setLogger( getLogger() );
+ handler.initialize();
+ this.componentHandlers.put( hint, handler );
+ getLogger().debug( "Adding " + generator.getName() + " for " +
hint.toString() );
+ }
+ catch( final Exception e )
+ {
+ final String message =
+ "Could not set up Component for hint: " + hint;
+ getLogger().error( message, e);
+ throw new ComponentException( message, e );
+ }
}
public void dispose() {
1.4 +7 -2
xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGenerator.java
Index: ProgramGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGenerator.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- ProgramGenerator.java 2001/05/25 14:25:58 1.3
+++ ProgramGenerator.java 2001/06/08 20:28:14 1.4
@@ -9,6 +9,7 @@
import java.io.File;
import org.apache.avalon.framework.component.Component;
+import org.apache.avalon.framework.component.ComponentManager;
import org.apache.cocoon.environment.SourceResolver;
/**
@@ -16,13 +17,14 @@
* documents writeen in a <code>MarkupLanguage</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.3 $ $Date: 2001/05/25 14:25:58 $
+ * @version CVS $Revision: 1.4 $ $Date: 2001/06/08 20:28:14 $
*/
public interface ProgramGenerator extends Component {
/**
* Load a program built from an XML document written in a
* <code>MarkupLanguage</code>
*
+ * @param newManager The ComponentManager that it will be loaded with.
* @param file The input document's <code>File</code>
* @param markupLanguage The <code>MarkupLanguage</code> in which the input
* document is written
@@ -32,7 +34,10 @@
* @exception Exception If an error occurs during generation or loading
*/
CompiledComponent load(
- String fileName, String markupLanguage, String programmingLanguage,
+ ComponentManager newManager,
+ String fileName,
+ String markupLanguage,
+ String programmingLanguage,
SourceResolver resolver
) throws Exception;
1.6 +16 -9
xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
Index: ProgramGeneratorImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -u -r1.5 -r1.6
--- ProgramGeneratorImpl.java 2001/05/31 17:37:50 1.5
+++ ProgramGeneratorImpl.java 2001/06/08 20:28:14 1.6
@@ -48,7 +48,7 @@
/**
* The default implementation of <code>ProgramGenerator</code>
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.5 $ $Date: 2001/05/31 17:37:50 $
+ * @version CVS $Revision: 1.6 $ $Date: 2001/06/08 20:28:14 $
*/
public class ProgramGeneratorImpl extends AbstractLoggable
implements ProgramGenerator, Contextualizable, Composable, Configurable,
ThreadSafe, Disposable {
@@ -122,7 +122,8 @@
* @return The loaded program instance
* @exception Exception If an error occurs during generation or loading
*/
- public CompiledComponent load(String fileName,
+ public CompiledComponent load(ComponentManager newManager,
+ String fileName,
String markupLanguageName,
String programmingLanguageName,
SourceResolver resolver)
@@ -155,13 +156,18 @@
markupLanguage =
(MarkupLanguage)this.markupSelector.select(markupLanguageName);
programmingLanguage =
(ProgrammingLanguage)this.languageSelector.select(programmingLanguageName);
programmingLanguage.setLanguageName(programmingLanguageName);
- program = generateResource(fileName, normalizedName,
markupLanguage, programmingLanguage, resolver);
+ program = this.generateResource(newManager, fileName,
normalizedName, markupLanguage, programmingLanguage, resolver);
} catch (LanguageException le) {
getLogger().debug("Language Exception", le);
throw new ProcessingException("Language Exception", le);
} finally {
- this.markupSelector.release(markupLanguage);
- this.languageSelector.release(programmingLanguage);
+ if (this.markupSelector != null) {
+ this.markupSelector.release(markupLanguage);
+ }
+
+ if (this.languageSelector != null) {
+ this.languageSelector.release(programmingLanguage);
+ }
}
try {
@@ -203,7 +209,7 @@
markupLanguage =
(MarkupLanguage)this.markupSelector.select(markupLanguageName);
programmingLanguage =
(ProgrammingLanguage)this.languageSelector.select(programmingLanguageName);
programmingLanguage.setLanguageName(programmingLanguageName);
- program = generateResource(fileName, normalizedName,
markupLanguage, programmingLanguage, resolver);
+ program = this.generateResource(newManager, fileName,
normalizedName, markupLanguage, programmingLanguage, resolver);
} catch (LanguageException le) {
getLogger().debug("Language Exception", le);
throw new ProcessingException("Language Exception", le);
@@ -219,7 +225,8 @@
return programInstance;
}
- private Class generateResource(String fileName,
+ private Class generateResource(ComponentManager newManager,
+ String fileName,
String normalizedName,
MarkupLanguage markupLanguage,
ProgrammingLanguage programmingLanguage,
@@ -242,14 +249,14 @@
// [Compile]/Load generated program
Class program = programmingLanguage.load(normalizedName,
this.workDir, markupLanguage.getEncoding());
// Store generated program in cache
- this.cache.addGenerator(normalizedName, program);
+ this.cache.addGenerator(newManager, normalizedName, program);
if
(markupLanguage.getClass().getName().equals(SitemapMarkupLanguage.class.getName()))
{
try {
select("sitemap");
} catch (Exception e) {
// If the root sitemap has not been compiled, add an alias
here.
- this.cache.addGenerator("sitemap", program);
+ this.cache.addGenerator(newManager, "sitemap", program);
}
}
1.13 +44 -20
xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -u -r1.12 -r1.13
--- sitemap.xsl 2001/06/08 19:55:47 1.12
+++ sitemap.xsl 2001/06/08 20:28:15 1.13
@@ -92,6 +92,7 @@
import org.apache.cocoon.sitemap.ErrorNotifier;
import org.apache.cocoon.sitemap.ContentAggregator;
import org.apache.cocoon.sitemap.Manager;
+ import org.apache.cocoon.sitemap.SitemapRedirector;
import org.apache.cocoon.components.language.markup.xsp.XSPRequestHelper;
import
org.apache.cocoon.components.language.markup.xsp.XSPResponseHelper;
@@ -100,7 +101,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo
Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin
Loritsch</a>
- * @version CVS $Id: sitemap.xsl,v 1.12 2001/06/08 19:55:47 giacomo Exp $
+ * @version CVS $Id: sitemap.xsl,v 1.13 2001/06/08 20:28:15 giacomo Exp $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap
{
static final String LOCATION = "<xsl:value-of
select="translate(@file-path, '/', '.')"/>.<xsl:value-of select="@file-name"/>";
@@ -191,6 +192,7 @@
configurer.configActions();
configurer = null;
+ this.manager.initialize();
/* catch any exception thrown by a component during configuration */
} catch (Exception e) {
getLogger().warn(e.getMessage(), e);
@@ -291,6 +293,7 @@
Map map = null;
Parameters param = null;
Map objectModel = environment.getObjectModel();
+ SitemapRedirector redirector = new SitemapRedirector(environment);
<xsl:apply-templates select="./*"/>
return internalRequest;
}
@@ -312,6 +315,7 @@
eventPipeline.setSitemap(this);
Map map = null;
Parameters param = null;
+ SitemapRedirector redirector = new SitemapRedirector(environment);
<xsl:apply-templates select="./*"/>
return internalRequest;
}
@@ -328,7 +332,7 @@
* @return Wether the request has been processed or not
* @exception Exception If an error occurs during request evaluation
and production
*/
- private Map action_set_<xsl:value-of select="translate(@name, '- ',
'__')"/> (String cocoon_action, List listOfMaps, Environment environment, Map
objectModel, String src, Parameters param)
+ private Map action_set_<xsl:value-of select="translate(@name, '- ',
'__')"/> (SitemapRedirector redirector, String cocoon_action, List listOfMaps,
Environment environment, Map objectModel, String src, Parameters param)
throws Exception {
Map map;
Map allMap = null;
@@ -409,6 +413,7 @@
Map map;
Parameters param;
Map objectModel = environment.getObjectModel();
+ SitemapRedirector redirector = new SitemapRedirector(environment);
String cocoon_view = environment.getView();
String cocoon_action = environment.getAction();
@@ -609,10 +614,10 @@
<xsl:with-param name="param">param</xsl:with-param>
</xsl:apply-templates>
- <!-- modification end -->
-
- <!-- Modified 20010510 L.Sutic Changed to pass sitemap parameters. -->
+ <!-- modification end -->
+ <!-- Modified 20010510 L.Sutic Changed to pass sitemap parameters. -->
+
<!-- break on error when old parameter syntax exists -->
<xsl:if test="parameter">
<xsl:call-template name="error">
@@ -620,7 +625,7 @@
</xsl:call-template>
</xsl:if>
- <!-- test if we have to define parameters for this action -->
+ <!-- test if we have to define parameters for this action -->
<xsl:if test="count(map:parameter)>0">
param = new Parameters ();
</xsl:if>
@@ -641,10 +646,10 @@
<xsl:apply-templates select="map:parameter">
<xsl:with-param name="param">param</xsl:with-param>
</xsl:apply-templates>
+
+ <!-- modification end -->
- <!-- modification end -->
-
-
+
<!-- loop through all the when cases -->
<xsl:for-each select="./map:when">
@@ -671,7 +676,7 @@
</xsl:variable>
<!-- Modified 20010509 L.Sutic Changed to pass sitemap parameters. -->
- <!-- gets the string how the selector is to be invoced in java code -->
+ <!-- gets the string how the selector is to be invoked in java code -->
<xsl:variable name="selector-name">
<!-- check if we have a selector definition in this sitemap
otherwise get it from the parent -->
<xsl:choose>
@@ -759,15 +764,25 @@
<!-- generate the invocation of the act method of the action component
-->
<xsl:choose>
<xsl:when
test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and
local-name() != 'parameter']">
- if ((map = <xsl:value-of select="$action-name"/>
((Redirector)environment, environment, objectModel,
substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of
select="$component-param"/>)) != null) {
+ if ((map = <xsl:value-of select="$action-name"/> (redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) !=
null) {
+ if (redirector.hasRedirected()) {
+ return true;
+ }
getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
listOfMaps.add (map);
<xsl:apply-templates/>
listOfMaps.remove(listOfMaps.size()-1);
}
+ if (redirector.hasRedirected()) {
+ return true;
+ }
</xsl:when>
<xsl:otherwise>
- map = <xsl:value-of select="$action-name"/>
((Redirector)environment, environment, objectModel,
substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of
select="$component-param"/>);
+ map = <xsl:value-of select="$action-name"/> (redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
+
+ if (redirector.hasRedirected()) {
+ return true;
+ }
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!-- match="map:[EMAIL PROTECTED]" -->
@@ -791,7 +806,7 @@
</xsl:call-template>
</xsl:variable>
- <!-- gets the string how the action is to be invoced in java code -->
+ <!-- gets the string how the action is to be invoked in java code -->
<xsl:variable name="action-name">
((Action)this.actions.select("<xsl:value-of
select="$action-type"/>")).act
</xsl:variable>
@@ -812,7 +827,7 @@
<!-- generate the invocation of the act method of the action component
-->
<xsl:choose>
<xsl:when
test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and
local-name() != 'parameter']">
- if ((map = <xsl:value-of select="$action-name"/>
((Redirector)environment, environment, objectModel,
substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of
select="$component-param"/>)) != null) {
+ if ((map = <xsl:value-of select="$action-name"/> (redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) !=
null) {
getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
listOfMaps.add (map);
<xsl:apply-templates/>
@@ -820,7 +835,7 @@
}
</xsl:when>
<xsl:otherwise>
- map = <xsl:value-of select="$action-name"/>
((Redirector)environment, environment, objectModel,
substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of
select="$component-param"/>);
+ map = <xsl:value-of select="$action-name"/> (redirector,
environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!-- match="map:[EMAIL PROTECTED]" mode="set" -->
@@ -844,7 +859,7 @@
</xsl:call-template>
</xsl:variable>
- <!-- gets the string how the action is to be invoced in java code -->
+ <!-- gets the string how the action is to be invoked in java code -->
<xsl:variable name="action-name">
action_set_<xsl:value-of select="$action-set"/>
</xsl:variable>
@@ -881,15 +896,24 @@
<!-- generate the invocation of the act method of the action component
-->
<xsl:choose>
<xsl:when
test="./*[namespace-uri()='http://apache.org/cocoon/sitemap/1.0' and
local-name() != 'parameter']">
- if ((map = <xsl:value-of select="$action-name"/> (cocoon_action,
listOfMaps, environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>)) !=
null) {
+ if ((map = <xsl:value-of select="$action-name"/> (redirector,
cocoon_action, listOfMaps, environment, objectModel,
substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of
select="$component-param"/>)) != null) {
+ if (redirector.hasRedirected()) {
+ return true;
+ }
getLogger().debug("Action <xsl:value-of
select="translate($action-name,'"',' ')"/>");
listOfMaps.add (map);
<xsl:apply-templates/>
listOfMaps.remove(listOfMaps.size()-1);
}
+ if (redirector.hasRedirected()) {
+ return true;
+ }
</xsl:when>
<xsl:otherwise>
- map = <xsl:value-of select="$action-name"/> (cocoon_action,
listOfMaps, environment, objectModel, substitute(listOfMaps,<xsl:value-of
select="$action-source"/>), <xsl:value-of select="$component-param"/>);
+ map = <xsl:value-of select="$action-name"/> (redirector,
cocoon_action, listOfMaps, environment, objectModel,
substitute(listOfMaps,<xsl:value-of select="$action-source"/>), <xsl:value-of
select="$component-param"/>);
+ if (redirector.hasRedirected()) {
+ return true;
+ }
</xsl:otherwise>
</xsl:choose>
</xsl:template> <!-- match="map:[EMAIL PROTECTED]" -->
@@ -1010,9 +1034,9 @@
<!-- generate the code to invoke the sitemapManager which handles
delegation of control to sub sitemaps -->
if (internalRequest)
- return sitemapManager.invoke (environment,
substitute(listOfMaps,"<xsl:value-of select="@uri-prefix"/>"),
substitute(listOfMaps,"<xsl:value-of select="@src"/>"), <xsl:value-of
select="$check-reload"/>, <xsl:value-of select="$reload-method"/>, pipeline,
eventPipeline);
+ return sitemapManager.invoke (this.manager, environment,
substitute(listOfMaps,"<xsl:value-of select="@uri-prefix"/>"),
substitute(listOfMaps,"<xsl:value-of select="@src"/>"), <xsl:value-of
select="$check-reload"/>, <xsl:value-of select="$reload-method"/>, pipeline,
eventPipeline);
else
- if(true)return sitemapManager.invoke (environment,
substitute(listOfMaps,"<xsl:value-of select="@uri-prefix"/>"),
substitute(listOfMaps,"<xsl:value-of select="@src"/>"), <xsl:value-of
select="$check-reload"/>, <xsl:value-of select="$reload-method"/>);
+ if(true)return sitemapManager.invoke (this.manager, environment,
substitute(listOfMaps,"<xsl:value-of select="@uri-prefix"/>"),
substitute(listOfMaps,"<xsl:value-of select="@src"/>"), <xsl:value-of
select="$check-reload"/>, <xsl:value-of select="$reload-method"/>);
</xsl:template> <!-- match="map:mount" -->
<!-- generate the code to redirect a request -->
1.7 +2 -5
xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java
Index: AbstractEventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- AbstractEventPipeline.java 2001/06/08 19:49:47 1.6
+++ AbstractEventPipeline.java 2001/06/08 20:28:16 1.7
@@ -35,7 +35,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED] Ziegeler">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.6 $ $Date: 2001/06/08 19:49:47 $
+ * @version CVS $Revision: 1.7 $ $Date: 2001/06/08 20:28:16 $
*/
public abstract class AbstractEventPipeline
extends AbstractXMLProducer
@@ -126,10 +126,7 @@
} catch ( ProcessingException e ) {
throw e;
} catch ( Exception e ) {
- throw new ProcessingException(
- "Failed to execute pipeline.",
- e
- );
+ throw e;
}
return true;
}
1.5 +3 -3
xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractStreamPipeline.java
Index: AbstractStreamPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/AbstractStreamPipeline.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- AbstractStreamPipeline.java 2001/06/08 19:49:48 1.4
+++ AbstractStreamPipeline.java 2001/06/08 20:28:16 1.5
@@ -34,7 +34,7 @@
* resource
* </UL>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.4 $ $Date: 2001/06/08 19:49:48 $
+ * @version CVS $Revision: 1.5 $ $Date: 2001/06/08 20:28:16 $
*/
public abstract class AbstractStreamPipeline extends AbstractLoggable
implements StreamPipeline, Disposable {
protected EventPipeline eventPipeline;
@@ -130,14 +130,14 @@
try {
this.eventPipeline.process(environment);
} catch ( ProcessingException e ) {
- throw e;
+ throw e;
} catch ( Exception e ) {
+ getLogger().debug("Exception in process", e);
throw new ProcessingException(
"Failed to execute pipeline.",
e
);
}
-
return true;
}
}
1.9 +2 -5
xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingEventPipeline.java
Index: CachingEventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingEventPipeline.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -u -r1.8 -r1.9
--- CachingEventPipeline.java 2001/06/08 19:49:48 1.8
+++ CachingEventPipeline.java 2001/06/08 20:28:17 1.9
@@ -52,7 +52,7 @@
* does not cache! (If it would cache, the response would be cached twice!)
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.8 $ $Date: 2001/06/08 19:49:48 $
+ * @version CVS $Revision: 1.9 $ $Date: 2001/06/08 20:28:17 $
*/
public final class CachingEventPipeline
extends AbstractEventPipeline
@@ -227,10 +227,7 @@
} catch ( ProcessingException e ) {
throw e;
} catch ( Exception e ) {
- throw new ProcessingException(
- "Failed to execute pipeline.",
- e
- );
+ throw e;
}
}
} finally {
1.5 +2 -1
xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingStreamPipeline.java
Index: CachingStreamPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/CachingStreamPipeline.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- CachingStreamPipeline.java 2001/06/08 19:49:48 1.4
+++ CachingStreamPipeline.java 2001/06/08 20:28:17 1.5
@@ -45,7 +45,7 @@
* </ul>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.4 $ $Date: 2001/06/08 19:49:48 $
+ * @version CVS $Revision: 1.5 $ $Date: 2001/06/08 20:28:17 $
*/
public class CachingStreamPipeline extends AbstractStreamPipeline {
@@ -363,6 +363,7 @@
e
);
}
+
return true;
}
}
1.3 +1 -1
xml-cocoon2/src/org/apache/cocoon/components/pipeline/EventPipeline.java
Index: EventPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/EventPipeline.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- EventPipeline.java 2001/05/31 16:12:38 1.2
+++ EventPipeline.java 2001/06/08 20:28:17 1.3
@@ -18,7 +18,7 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/31 16:12:38 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/06/08 20:28:17 $
*/
public interface EventPipeline extends Component, Composable, Recyclable,
Processor {
void setGenerator (String role, String source, Parameters param,
Exception e) throws Exception;
1.3 +1 -1
xml-cocoon2/src/org/apache/cocoon/components/pipeline/StreamPipeline.java
Index: StreamPipeline.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/pipeline/StreamPipeline.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- StreamPipeline.java 2001/05/31 16:12:39 1.2
+++ StreamPipeline.java 2001/06/08 20:28:17 1.3
@@ -20,7 +20,7 @@
* <CODE>Serializer</CODE> and let them produce the character stream
* </UL>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/31 16:12:39 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/06/08 20:28:17 $
*/
public interface StreamPipeline extends Component, Composable, Recyclable,
Processor {
1.3 +2 -2
xml-cocoon2/src/org/apache/cocoon/environment/commandline/AbstractCommandLineEnvironment.java
Index: AbstractCommandLineEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/commandline/AbstractCommandLineEnvironment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- AbstractCommandLineEnvironment.java 2001/06/07 11:03:21 1.2
+++ AbstractCommandLineEnvironment.java 2001/06/08 20:28:19 1.3
@@ -20,10 +20,10 @@
* This environment is used to save the requested file to disk.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/06/07 11:03:21 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/06/08 20:28:19 $
*/
-public abstract class AbstractCommandLineEnvironment
+public abstract class AbstractCommandLineEnvironment
extends AbstractEnvironment
implements Redirector {
1.2 +2 -9
xml-cocoon2/src/org/apache/cocoon/environment/http/HttpRequest.java
Index: HttpRequest.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/http/HttpRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- HttpRequest.java 2001/05/09 20:49:45 1.1
+++ HttpRequest.java 2001/06/08 20:28:20 1.2
@@ -25,7 +25,7 @@
* to provide request information for HTTP servlets.
*
* @author <a href="mailto:[EMAIL PROTECTED],org">Giacomo Pati</a>
- * @version CVS $Id: HttpRequest.java,v 1.1 2001/05/09 20:49:45 giacomo Exp $
+ * @version CVS $Id: HttpRequest.java,v 1.2 2001/06/08 20:28:20 giacomo Exp $
*/
public class HttpRequest implements Request {
@@ -159,15 +159,8 @@
return this.req.getServletPath();
}
- private HttpSession cachedSession = null;
public Session getSession(boolean create) {
- if (this.cachedSession == null) {
- javax.servlet.http.HttpSession session =
this.req.getSession(create);
- if (session != null) {
- this.cachedSession = new HttpSession(session);
- }
- }
- return this.cachedSession;
+ return new HttpSession(this.req.getSession(create));
}
public Session getSession() {
1.11 +2 -1
xml-cocoon2/src/org/apache/cocoon/generation/FileGenerator.java
Index: FileGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/FileGenerator.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -u -r1.10 -r1.11
--- FileGenerator.java 2001/06/08 19:52:58 1.10
+++ FileGenerator.java 2001/06/08 20:28:21 1.11
@@ -9,6 +9,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.FileNotFoundException;
import java.util.Map;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
@@ -38,7 +39,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.10 $ $Date: 2001/06/08 19:52:58 $
+ * @version CVS $Revision: 1.11 $ $Date: 2001/06/08 20:28:21 $
*/
public class FileGenerator extends ComposerGenerator
implements Cacheable, Recyclable {
1.8 +2 -2
xml-cocoon2/src/org/apache/cocoon/generation/ServerPagesGenerator.java
Index: ServerPagesGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/generation/ServerPagesGenerator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -u -r1.7 -r1.8
--- ServerPagesGenerator.java 2001/06/04 11:00:19 1.7
+++ ServerPagesGenerator.java 2001/06/08 20:28:21 1.8
@@ -47,7 +47,7 @@
* delegating actual SAX event generation.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.7 $ $Date: 2001/06/04 11:00:19 $
+ * @version CVS $Revision: 1.8 $ $Date: 2001/06/08 20:28:21 $
*/
public class ServerPagesGenerator
extends ServletGenerator
@@ -150,7 +150,7 @@
try {
generator = (XSPGenerator)
- programGenerator.load(super.source, this.markupLanguage,
this.programmingLanguage, this.resolver);
+ programGenerator.load(this.manager, super.source,
this.markupLanguage, this.programmingLanguage, this.resolver);
} catch (Exception e) {
getLogger().warn("ServerPagesGenerator.generate()", e);
throw new ResourceNotFoundException(e.getMessage(), e);
1.5 +187 -108
xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java
Index: AbstractSitemap.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- AbstractSitemap.java 2001/05/31 17:38:49 1.4
+++ AbstractSitemap.java 2001/06/08 20:28:23 1.5
@@ -5,9 +5,9 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -15,44 +15,44 @@
import java.util.List;
import java.util.Map;
import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.AbstractLoggable;
import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.Processor;
import org.apache.cocoon.Roles;
import org.apache.cocoon.components.classloader.RepositoryClassLoader;
import org.apache.cocoon.components.pipeline.EventPipeline;
import org.apache.cocoon.components.pipeline.StreamPipeline;
import org.apache.cocoon.components.url.URLFactory;
import org.apache.cocoon.environment.Environment;
-import org.apache.cocoon.environment.Request;
import org.apache.cocoon.util.ClassUtils;
-import org.apache.avalon.excalibur.component.DefaultComponentSelector;
-import org.xml.sax.SAXException;
+import org.apache.avalon.excalibur.component.ExcaliburComponentManager;
+import org.apache.avalon.excalibur.component.RoleManager;
+import org.apache.avalon.excalibur.component.DefaultRoleManager;
/**
* Base class for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.4 $ $Date: 2001/05/31 17:38:49 $
+ * @version CVS $Revision: 1.5 $ $Date: 2001/06/08 20:28:23 $
*/
public abstract class AbstractSitemap extends AbstractLoggable implements
Sitemap, Disposable, ThreadSafe {
private Context context;
-
private static final int BYTE_ARRAY_SIZE = 1024;
+ private static RoleManager roleManager;
+ private static Configuration defaultConfig;
/** The component manager instance */
- protected ComponentManager manager;
+ protected ExcaliburComponentManager manager;
/** The sitemap manager instance */
protected Manager sitemapManager;
@@ -62,37 +62,93 @@
/** The creation date */
protected static long dateCreated = -1L;
-
- protected DefaultComponentSelector generators;
- protected DefaultComponentSelector transformers;
+ protected SitemapComponentSelector generators;
+ protected SitemapComponentSelector transformers;
protected SitemapComponentSelector serializers;
protected SitemapComponentSelector readers;
- protected DefaultComponentSelector actions;
- protected DefaultComponentSelector matchers;
- protected DefaultComponentSelector selectors;
+ protected SitemapComponentSelector actions;
+ protected SitemapComponentSelector matchers;
+ protected SitemapComponentSelector selectors;
+
+ /**
+ * Set the role manager
+ */
+ public static void setRoleManager(RoleManager roles, Configuration
config) {
+ if (AbstractSitemap.roleManager == null) {
+ AbstractSitemap.roleManager = roles;
+ AbstractSitemap.defaultConfig = config;
+ }
+ }
/**
* Set the current <code>ComponentManager</code> instance used by this
* <code>Composable</code>.
*/
- public void compose(ComponentManager manager) throws ComponentException
{
- this.manager = manager;
+ public void compose(ComponentManager manager) throws ComponentException {
+ this.manager = new ExcaliburComponentManager(manager);
+ this.manager.setLogger(getLogger());
+ this.manager.contextualize(this.context);
+ this.manager.setRoleManager(AbstractSitemap.roleManager);
try {
- this.urlFactory = (URLFactory)
this.manager.lookup(Roles.URL_FACTORY);
- this.generators = (DefaultComponentSelector)
this.manager.lookup(Roles.GENERATORS);
- this.transformers = (DefaultComponentSelector)
this.manager.lookup(Roles.TRANSFORMERS);
- this.serializers = (SitemapComponentSelector)
this.manager.lookup(Roles.SERIALIZERS);
- this.readers = (SitemapComponentSelector)
this.manager.lookup(Roles.READERS);
- this.actions = (DefaultComponentSelector)
this.manager.lookup(Roles.ACTIONS);
- this.matchers = (DefaultComponentSelector)
this.manager.lookup(Roles.MATCHERS);
- this.selectors = (DefaultComponentSelector)
this.manager.lookup(Roles.SELECTORS);
+ this.manager.configure(AbstractSitemap.defaultConfig);
+ this.urlFactory = (URLFactory)manager.lookup(Roles.URL_FACTORY);
+
+ // Create Sitemap Selectors
+ this.generators = new SitemapComponentSelector();
+ this.transformers = new SitemapComponentSelector();
+ this.serializers = new SitemapComponentSelector();
+ this.readers = new SitemapComponentSelector();
+ this.actions = new SitemapComponentSelector();
+ this.matchers = new SitemapComponentSelector();
+ this.selectors = new SitemapComponentSelector();
+
+ // Set Parent Sitemap Selectors
+ try {
+ this.generators.setParentSelector((SitemapComponentSelector)
this.manager.lookup(Roles.GENERATORS));
+
this.transformers.setParentSelector((SitemapComponentSelector)
this.manager.lookup(Roles.TRANSFORMERS));
+
this.serializers.setParentSelector((SitemapComponentSelector)
this.manager.lookup(Roles.SERIALIZERS));
+ this.readers.setParentSelector((SitemapComponentSelector)
this.manager.lookup(Roles.READERS));
+ this.actions.setParentSelector((SitemapComponentSelector)
this.manager.lookup(Roles.ACTIONS));
+ this.matchers.setParentSelector((SitemapComponentSelector)
this.manager.lookup(Roles.MATCHERS));
+ this.selectors.setParentSelector((SitemapComponentSelector)
this.manager.lookup(Roles.SELECTORS));
+ } catch (ComponentException ce) {
+ /* we are ignoring those exceptions. We just want
+ * to ensure that the selectors get initialized
+ * properly
+ */
+ }
+
+ // Setup the Selectors
+ this.setupSelector(this.generators);
+ this.setupSelector(this.transformers);
+ this.setupSelector(this.serializers);
+ this.setupSelector(this.readers);
+ this.setupSelector(this.actions);
+ this.setupSelector(this.matchers);
+ this.setupSelector(this.selectors);
+
+ // Add the Selectors
+ this.manager.addComponentInstance(Roles.GENERATORS,
this.generators);
+ this.manager.addComponentInstance(Roles.TRANSFORMERS,
this.transformers);
+ this.manager.addComponentInstance(Roles.SERIALIZERS,
this.serializers);
+ this.manager.addComponentInstance(Roles.READERS, this.readers);
+ this.manager.addComponentInstance(Roles.ACTIONS, this.actions);
+ this.manager.addComponentInstance(Roles.MATCHERS, this.matchers);
+ this.manager.addComponentInstance(Roles.SELECTORS,
this.selectors);
} catch (Exception e) {
getLogger().error("cannot obtain the Component", e);
- throw new ComponentException ("cannot obtain the URLFactory", e);
+ throw new ComponentException("cannot obtain the URLFactory", e);
}
}
+ private void setupSelector(SitemapComponentSelector selector) throws
Exception {
+ selector.setLogger(getLogger());
+ selector.contextualize(this.context);
+ selector.setRoleManager(AbstractSitemap.roleManager);
+ selector.compose(this.manager);
+ }
+
public void contextualize(Context context) throws ContextException {
this.context = context;
}
@@ -115,58 +171,61 @@
* @param request The request whose data must be inspected to assert
whether
* dynamically generated content has changed
* @return Whether content has changes for this request's data
- *//*
+ */
+
+ /*
public boolean hasContentChanged(Request request) {
- return true;
+ return true;
}
+ */
- /**
- * Loads a class specified in a sitemap component definition and
- * initialize it
- */
- public void load_component(int type, Object hint, String classURL,
Configuration configuration, String mime_type)
- throws Exception {
- Class clazz;
- //FIXME(GP): Is it true that a class name containing a colon should
be an URL?
- if (classURL.indexOf(':') > 1) {
- URL url = urlFactory.getURL(classURL);
- byte [] b = getByteArrayFromStream(url.openStream());
- clazz =
((RepositoryClassLoader)ClassUtils.getClassLoader()).defineClass(b);
- } else {
- clazz = ClassUtils.loadClass(classURL);
- }
- if (!Component.class.isAssignableFrom(clazz)) {
- throw new IllegalAccessException ("Object " + classURL + " is
not a Component");
- }
-
- switch (type) {
- case Sitemap.GENERATOR:
- this.generators.addComponent(hint, clazz, configuration);
- break;
- case Sitemap.TRANSFORMER:
- this.transformers.addComponent(hint, clazz, configuration);
- break;
- case Sitemap.SERIALIZER:
- this.serializers.addSitemapComponent(hint, clazz,
configuration, mime_type);
- break;
- case Sitemap.READER:
- this.readers.addSitemapComponent(hint, clazz, configuration,
mime_type);
- break;
- case Sitemap.ACTION:
- this.actions.addComponent(hint, clazz, configuration);
- break;
- case Sitemap.MATCHER:
- this.matchers.addComponent(hint, clazz, configuration);
- break;
- case Sitemap.SELECTOR:
- this.selectors.addComponent(hint, clazz, configuration);
- break;
- }
+ /**
+ * Loads a class specified in a sitemap component definition and
+ * initialize it
+ */
+
+ public void load_component(int type, Object hint, String classURL,
Configuration configuration,
+ String mime_type) throws Exception {
+ Class clazz = null;
+ //FIXME(GP): Is it true that a class name containing a colon
should be an URL?
+ if (classURL.indexOf(':') > 1) {
+ URL url = urlFactory.getURL(classURL);
+ byte[] b = getByteArrayFromStream(url.openStream());
+ clazz =
((RepositoryClassLoader)ClassUtils.getClassLoader()).defineClass(b);
+ } else {
+ clazz = ClassUtils.loadClass(classURL);
+ }
+ if (!Component.class.isAssignableFrom(clazz)) {
+ throw new IllegalAccessException("Object " + classURL + " is
not a Component");
+ }
+ switch (type) {
+ case Sitemap.GENERATOR:
+ this.generators.addComponent(hint, clazz, configuration);
+ break;
+ case Sitemap.TRANSFORMER:
+ this.transformers.addComponent(hint, clazz,
configuration);
+ break;
+ case Sitemap.SERIALIZER:
+ this.serializers.addSitemapComponent(hint, clazz,
configuration, mime_type);
+ break;
+ case Sitemap.READER:
+ this.readers.addSitemapComponent(hint, clazz,
configuration, mime_type);
+ break;
+ case Sitemap.ACTION:
+ this.actions.addComponent(hint, clazz, configuration);
+ break;
+ case Sitemap.MATCHER:
+ this.matchers.addComponent(hint, clazz, configuration);
+ break;
+ case Sitemap.SELECTOR:
+ this.selectors.addComponent(hint, clazz, configuration);
+ break;
+ }
}
- private byte [] getByteArrayFromStream (InputStream stream) {
+ private byte[] getByteArrayFromStream(InputStream stream) {
List list = new ArrayList();
- byte [] b = new byte[BYTE_ARRAY_SIZE];
+ byte[] b = new byte[BYTE_ARRAY_SIZE];
int last = 0;
try {
while ((last = stream.read(b)) == BYTE_ARRAY_SIZE) {
@@ -174,12 +233,13 @@
b = new byte[BYTE_ARRAY_SIZE];
}
} catch (IOException ioe) {
- getLogger().error ("cannot read class byte stream", ioe);
+ getLogger().error("cannot read class byte stream", ioe);
}
list.add(b);
- b = new byte [(list.size()-1) * BYTE_ARRAY_SIZE + last];
+ int listSize = list.size();
+ b = new byte[(listSize - 1) * BYTE_ARRAY_SIZE + last];
int i;
- for (i = 0; i < list.size()-1; i++) {
+ for (i = 0; i < listSize - 1; i++) {
System.arraycopy(list.get(i), 0, b, i * BYTE_ARRAY_SIZE,
BYTE_ARRAY_SIZE);
}
System.arraycopy(list.get(i), 0, b, i * BYTE_ARRAY_SIZE, last);
@@ -190,10 +250,10 @@
* Replaces occurences of xpath like expressions in an argument String
* with content from a List of Maps
*/
- protected String substitute (List list, String expr)
- throws PatternException, NumberFormatException {
- if (expr == null)
+ protected String substitute(List list, String expr) throws
PatternException, NumberFormatException {
+ if (expr == null) {
return null;
+ }
StringBuffer result = new StringBuffer();
String s = null;
int j = 0;
@@ -206,22 +266,27 @@
while (ii <= expr.length() && (i = expr.indexOf('{', ii)) != -1)
{
result.append(expr.substring(ii, i));
j = expr.indexOf('}', i);
- if (j < i)
- throw new PatternException ("invalid expression in
\""+expr+"\"");
- ii = j+1;
- if (j == -1)
- throw new PatternException ("invalid expression in URL
"+expr);
+ if (j < i) {
+ throw new PatternException("invalid expression in \"" +
expr + "\"");
+ }
+ ii = j + 1;
+ if (j == -1) {
+ throw new PatternException("invalid expression in URL "
+ expr);
+ }
k = list.size() - 1;
- s = expr.substring (i+1,j);
- for (l = -1; (l = s.indexOf("../",l+1)) != -1; k--);
+ s = expr.substring(i + 1, j);
+ l = -1;
+ while ((l = s.indexOf("../", l + 1)) != -1) {
+ k--;
+ }
m = s.lastIndexOf('/');
if (m == -1) {
result.append((String)((Map)list.get(k)).get(s));
} else {
-
result.append((String)((Map)list.get(k)).get(s.substring(m+1)));
+
result.append((String)((Map)list.get(k)).get(s.substring(m + 1)));
}
- getLogger().debug("substitute evaluated value for " + (m ==
-1 ? s : s.substring(m+1))
- + " as " + (String)((Map)list.get(k)).get(m == -1 ? s
: s.substring(m+1)));
+ getLogger().debug("substitute evaluated value for " + ((m ==
-1) ? s : s.substring(m + 1)) + " as " +
+ (String)((Map)list.get(k)).get((m == -1) ? s :
s.substring(m + 1)));
}
if (ii < expr.length()) {
result.append(expr.substring(ii));
@@ -229,10 +294,8 @@
return (result.toString());
} catch (Exception e) {
getLogger().error("AbstractSitemap:substitute()", e);
- throw new PatternException
- ("error occurred during evaluation of expression \""
- +expr+"\" at position "+(i+1)+"\n"
- + e.getMessage());
+ throw new PatternException("error occurred during evaluation of
expression \"" + expr + "\" at position " +
+ (i + 1) + "\n" + e.getMessage());
}
}
@@ -240,16 +303,14 @@
* Constructs a resource for the <code>Environment</code> arguments.
* This method is supplied by the generated Sitemap.
*/
- public abstract boolean process (Environment environment)
- throws Exception;
+ public abstract boolean process(Environment environment) throws
Exception;
/**
* Constructs a resource for the <code>Environment</code> arguments.
* This method is supplied by the generated Sitemap.
*/
- public abstract boolean process (Environment environment, StreamPipeline
pipeline, EventPipeline eventPipeline)
- throws Exception;
-
+ public abstract boolean process(Environment environment, StreamPipeline
pipeline,
+ EventPipeline eventPipeline) throws Exception;
/**
* Invokes a method of this class using Java Reflection
@@ -264,27 +325,45 @@
try {
getLogger().debug("Dynamically invoking " + methodName);
java.lang.reflect.Method method =
this.getClass().getDeclaredMethod(methodName, argTypes);
- return ((Boolean) method.invoke(this, argValues)).booleanValue();
+ return ((Boolean)method.invoke(this, argValues)).booleanValue();
} catch (NoSuchMethodException e) {
getLogger().error("AbstractSitemap:invokeMethod()", e);
int prefix = methodName.indexOf("_");
- throw new Exception ("Sitemap: " +
methodName.substring(0,prefix) + " '" + methodName.substring(prefix + 1) + "'
not found");
+ throw new Exception("Sitemap: " + methodName.substring(0,
prefix) + " '" +
+ methodName.substring(prefix + 1) + "' not found");
} catch (Exception e) {
getLogger().error("AbstractSitemap:invokeMethod()", e);
throw e;
}
}
+
/**
* dispose
*/
public void dispose() {
- if (this.urlFactory!=null)
manager.release((Component)this.urlFactory);
- if (this.generators!=null)
manager.release((Component)this.generators);
- if (this.transformers!=null)
manager.release((Component)this.transformers);
- if (this.serializers!=null)
manager.release((Component)this.serializers);
- if (this.readers!=null) manager.release((Component)this.readers);
- if (this.actions!=null) manager.release((Component)this.actions);
- if (this.matchers!=null) manager.release((Component)this.matchers);
- if (this.selectors!=null)
manager.release((Component)this.selectors);
+ if (this.urlFactory != null) {
+ manager.release((Component)this.urlFactory);
+ }
+ if (this.generators != null) {
+ manager.release((Component)this.generators);
+ }
+ if (this.transformers != null) {
+ manager.release((Component)this.transformers);
+ }
+ if (this.serializers != null) {
+ manager.release((Component)this.serializers);
+ }
+ if (this.readers != null) {
+ manager.release((Component)this.readers);
+ }
+ if (this.actions != null) {
+ manager.release((Component)this.actions);
+ }
+ if (this.matchers != null) {
+ manager.release((Component)this.matchers);
+ }
+ if (this.selectors != null) {
+ manager.release((Component)this.selectors);
+ }
}
}
1.6 +36 -37
xml-cocoon2/src/org/apache/cocoon/sitemap/ContentAggregator.java
Index: ContentAggregator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/ContentAggregator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -u -r1.5 -r1.6
--- ContentAggregator.java 2001/05/31 17:38:51 1.5
+++ ContentAggregator.java 2001/06/08 20:28:24 1.6
@@ -42,11 +42,9 @@
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Id: ContentAggregator.java,v 1.5 2001/05/31 17:38:51
bloritsch Exp $
+ * @version CVS $Id: ContentAggregator.java,v 1.6 2001/06/08 20:28:24
giacomo Exp $
*/
-
-public class ContentAggregator extends ContentHandlerWrapper
- implements Generator, Cacheable, Composable {
+public class ContentAggregator extends ContentHandlerWrapper implements
Generator, Cacheable, Composable {
/** the current sitemap */
protected Sitemap sitemap;
@@ -120,7 +118,8 @@
public String namespace;
public String prefix;
boolean stripRootElement;
- public Part (String uri, String element, String namespace, String
stripRoot, String prefix) {
+
+ public Part(String uri, String element, String namespace, String
stripRoot, String prefix) {
this.uri = uri;
this.element = element;
this.namespace = namespace;
@@ -161,7 +160,7 @@
ep.process(this.environment);
} catch (Exception e) {
getLogger().error("ContentAggregator: cannot process
event pipeline for URI " + part.uri, e);
- throw new ProcessingException ("ContentAggregator:
cannot process event pipeline for URI " + part.uri, e);
+ throw new ProcessingException("ContentAggregator: cannot
process event pipeline for URI " + part.uri, e);
} finally {
this.manager.release(ep);
this.environment.popURI();
@@ -190,20 +189,20 @@
pipeline =
(StreamPipeline)this.manager.lookup(Roles.STREAM_PIPELINE);
} catch (ComponentException cme) {
getLogger().error("ContentAggregator: could not lookup
pipeline components", cme);
- throw new ProcessingException ("could not lookup
pipeline components", cme);
+ throw new ProcessingException("could not lookup pipeline
components", cme);
}
try {
pipeline.setEventPipeline(eventPipeline);
} catch (Exception cme) {
getLogger().error("ContentAggregator: could not set
event pipeline on stream pipeline", cme);
- throw new ProcessingException ("could not set event
pipeline on stream pipeline", cme);
+ throw new ProcessingException("could not set event
pipeline on stream pipeline", cme);
}
try {
this.environment.pushURI(part.uri);
this.sitemap.process(this.environment, pipeline,
eventPipeline);
} catch (Exception cme) {
getLogger().error("ContentAggregator: could not process
pipeline", cme);
- throw new ProcessingException ("could not process
pipeline", cme);
+ throw new ProcessingException("could not process
pipeline", cme);
} finally {
this.manager.release(pipeline);
this.environment.popURI();
@@ -219,12 +218,12 @@
* @return The generated key hashes the src
*/
public long generateKey() {
- try{
+ try {
collectParts();
long key = 0;
for (int i = 0; i < this.partEventPipelines.size(); i++) {
EventPipeline ep =
(EventPipeline)this.partEventPipelines.get(i);
- if(ep instanceof CacheableEventPipeline){
+ if (ep instanceof CacheableEventPipeline) {
((XMLProducer)ep).setConsumer(this);
PipelineCacheKey pck =
((CacheableEventPipeline)ep).generateKey(environment);
if (pck == null) {
@@ -232,12 +231,12 @@
} else {
key += HashUtil.hash(pck.toString());
}
- }else{
+ } else {
return 0;
}
}
return key;
- }catch(Exception e){
+ } catch (Exception e) {
getLogger().error("ContentAggregator: could not generateKey", e);
return 0;
}
@@ -250,25 +249,27 @@
* component is currently not cacheable.
*/
public CacheValidity generateValidity() {
- try{
+ try {
collectParts();
final AggregatedCacheValidity v = new AggregatedCacheValidity();
for (int i = 0; i < this.parts.size(); i++) {
EventPipeline ep =
(EventPipeline)this.partEventPipelines.get(i);
- if(ep instanceof CacheableEventPipeline){
+ if (ep instanceof CacheableEventPipeline) {
Map map =
((CacheableEventPipeline)ep).generateValidity(environment);
- if(map == null)
+ if (map == null) {
return null;
- for(Iterator j=map.values().iterator(); j.hasNext();){
+ }
+ Iterator j = map.values().iterator();
+ while (j.hasNext()) {
CacheValidity epv = (CacheValidity)j.next();
v.add(epv);
}
- }else{
+ } else {
return null;
}
}
return v;
- }catch(Exception e){
+ } catch (Exception e) {
getLogger().error("ContentAggregator: could not
generateValidity", e);
return null;
}
@@ -291,8 +292,8 @@
public void addPart(String uri, String element, String namespace, String
stripRootElement, String prefix) {
this.parts.add(new Part(uri, element, namespace, stripRootElement,
prefix));
- getLogger().debug("ContentAggregator: part uri='" + uri + "'
element='" + element + "' ns='" + namespace
- + "' stripRootElement='" + stripRootElement + "'
prefix='" + prefix + "'");
+ getLogger().debug("ContentAggregator: part uri='" + uri + "'
element='" + element + "' ns='" + namespace +
+ "' stripRootElement='" + stripRootElement + "' prefix='" +
prefix + "'");
}
/**
@@ -325,7 +326,7 @@
/**
* Recycle the producer by removing references
*/
- public void recycle () {
+ public void recycle() {
super.recycle();
this.sitemap = null;
this.resolver = null;
@@ -348,12 +349,12 @@
* Set the <code>SourceResolver</code>, object model <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the
request.
*/
- public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par)
- throws ProcessingException, SAXException, IOException {
- this.resolver=resolver;
- this.objectModel=objectModel;
- this.source=src;
- this.parameters=par;
+ public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par) throws ProcessingException,
+ SAXException, IOException {
+ this.resolver = resolver;
+ this.objectModel = objectModel;
+ this.source = src;
+ this.parameters = par;
}
private String pushNS(String ns) {
@@ -362,14 +363,14 @@
}
private String popNS() {
- int last = currentNS.size()-1;
+ int last = currentNS.size() - 1;
String ns = (String)currentNS.get(last);
currentNS.remove(last);
return ns;
}
private String getNS() {
- int last = currentNS.size()-1;
+ int last = currentNS.size() - 1;
return (String)currentNS.get(last);
}
@@ -393,16 +394,15 @@
/**
* Ignore start and end document events
*/
- public void startDocument () throws SAXException {
+ public void startDocument() throws SAXException {
}
- public void endDocument () throws SAXException {
+ public void endDocument() throws SAXException {
}
- public void startElement (String namespaceURI, String localName,
- String qName, Attributes atts) throws SAXException {
+ public void startElement(String namespaceURI, String localName, String
qName, Attributes atts) throws SAXException {
String ns = namespaceURI;
- if (ns ==null || ns.equals("")) {
+ if (ns == null || ns.equals("")) {
ns = (String)this.getNS();
}
this.pushNS(ns);
@@ -414,8 +414,7 @@
}
}
- public void endElement (String namespaceURI, String localName,
- String qName) throws SAXException {
+ public void endElement(String namespaceURI, String localName, String
qName) throws SAXException {
if (rootElementIndex != currentNS.size()) {
this.documentHandler.endElement((String)this.popNS(), localName,
qName);
} else {
1.3 +2 -7
xml-cocoon2/src/org/apache/cocoon/sitemap/ErrorNotifier.java
Index: ErrorNotifier.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/ErrorNotifier.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- ErrorNotifier.java 2001/05/10 21:17:02 1.2
+++ ErrorNotifier.java 2001/06/08 20:28:24 1.3
@@ -5,15 +5,13 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
-import java.util.Enumeration;
-import java.util.Hashtable;
import org.apache.avalon.excalibur.pool.Recyclable;
import org.apache.cocoon.Notification;
import org.apache.cocoon.Notifier;
import org.apache.cocoon.generation.ComposerGenerator;
-import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
/**
@@ -22,10 +20,9 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
* @created 31 July 2000
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/10 21:17:02 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/06/08 20:28:24 $
*/
public class ErrorNotifier extends ComposerGenerator implements Recyclable {
-
/**
* The <code>Notification</code> to report.
*/
@@ -69,6 +66,4 @@
super.recycle();
this.notification = null;
}
-
}
-
1.10 +178 -186 xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Handler.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -u -r1.9 -r1.10
--- Handler.java 2001/05/31 19:10:08 1.9
+++ Handler.java 2001/06/08 20:28:25 1.10
@@ -5,12 +5,10 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
-import java.io.File;
import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URL;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentManager;
@@ -21,6 +19,7 @@
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.AbstractLoggable;
+import org.apache.avalon.excalibur.component.RoleManager;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.Processor;
import org.apache.cocoon.Roles;
@@ -33,8 +32,6 @@
import org.apache.cocoon.environment.FactoryURLResolver;
import org.apache.cocoon.environment.URLResolver;
import org.apache.cocoon.environment.Source;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
/**
* Handles the manageing and stating of one <code>Sitemap</code>
@@ -42,230 +39,225 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.9 $ $Date: 2001/05/31 19:10:08 $
+ * @version CVS $Revision: 1.10 $ $Date: 2001/06/08 20:28:25 $
*/
-public class Handler extends AbstractLoggable
-implements Runnable, Configurable, Composable, Contextualizable, Processor,
Disposable {
-
- private Context context;
+public class Handler extends AbstractLoggable implements Runnable,
Configurable, Composable,
+ Contextualizable, Processor, Disposable {
+ private Context context;
/** the configuration */
- private Configuration conf;
+ private Configuration conf;
/** the component manager */
- private ComponentManager manager;
+ private ComponentManager manager;
/** the source of this sitemap */
- private String sourceFileName;
- private Source source;
+ private String sourceFileName;
+ private Source source;
/** the URLFactory */
- private URLFactory urlFactory;
+ private URLFactory urlFactory;
/** The URLResolver for the sitemap components */
- private URLResolver urlResolver;
+ private URLResolver urlResolver;
/** the last error */
- private Exception exception;
+ private Exception exception;
/** the managed sitemap */
-
- private Sitemap sitemap = null;
- private boolean check_reload = true;
+ private Sitemap sitemap = null;
+ private boolean check_reload = true;
/** the regenerating thread */
- private Thread regeneration;
- private volatile boolean isRegenerationRunning = false;
- private Environment environment;
+ private Thread regeneration;
+ private volatile boolean isRegenerationRunning = false;
+ private Environment environment;
/** the sitemaps base path */
- private String basePath;
+ private String basePath;
- public void compose (ComponentManager manager) {
- this.manager = manager;
- try {
- urlFactory = (URLFactory) manager.lookup(Roles.URL_FACTORY);
- this.urlResolver = new FactoryURLResolver(urlFactory);
- } catch (Exception e) {
- getLogger().error ("cannot obtain URLFactory", e);
- }
- }
-
- public void configure (Configuration conf) {
- this.conf = conf;
- }
-
- public void contextualize (Context context) throws ContextException {
- this.context = context;
- }
-
- protected Handler (String sourceFileName, boolean check_reload)
- throws FileNotFoundException {
- this.check_reload = check_reload;
- this.sourceFileName = sourceFileName;
- }
-
- protected boolean available () {
- return (sitemap != null);
- }
-
- protected boolean hasChanged () {
- if (available()) {
- if (check_reload) {
- this.source.refresh();
- return sitemap.modifiedSince(this.source.getLastModified());
- }
- return false;
- }
- return true;
- }
-
- protected boolean isRegenerating () {
- return isRegenerationRunning;
- }
-
- protected void regenerateAsynchronously (Environment environment)
- throws Exception {
- if (this.sourceFileName.charAt(this.sourceFileName.length() - 1) ==
'/') {
- this.sourceFileName = this.sourceFileName + "sitemap.xmap";
- }
- try {
- environment.setURLResolver(this.urlResolver);
- this.source = environment.resolve(this.sourceFileName);
- } finally {
- environment.setURLResolver(null);
- }
-
- if (!this.isRegenerationRunning) {
- isRegenerationRunning = true;
- regeneration = new Thread (this);
- /* HACK for reducing class loader problems.
*/
- /* example: xalan extensions fail if someone adds xalan jars in
tomcat3.2.1/lib */
+ public void compose(ComponentManager manager) {
+ this.manager = manager;
try {
-
regeneration.setContextClassLoader(Thread.currentThread().getContextClassLoader());
- } catch (Exception e){}
- this.environment = environment;
-
- /* clear old exception if any */
- this.exception = null;
-
- /* start the thread */
- regeneration.start();
- }
- }
-
- protected void regenerate (Environment environment)
- throws Exception {
- getLogger().debug("Beginning sitemap regeneration");
-
- this.regenerateAsynchronously(environment);
-
- if (regeneration != null) {
- this.regeneration.join();
- }
-
- throwEventualException();
- }
-
- public boolean process (Environment environment)
- throws Exception {
- checkSanity();
- try {
- environment.setURLResolver(this.urlResolver);
- return sitemap.process(environment);
- } finally {
- environment.setURLResolver(null);
- }
- }
-
- public boolean process (Environment environment, StreamPipeline
pipeline, EventPipeline eventPipeline)
- throws Exception {
- checkSanity();
- try {
- environment.setURLResolver(this.urlResolver);
- return sitemap.process(environment, pipeline, eventPipeline);
- } finally {
- environment.setURLResolver(null);
- }
- }
-
- private void checkSanity () throws Exception {
- throwEventualException();
- if (sitemap == null) {
- getLogger().fatalError("Sitemap is not set for the Handler!!!!");
- throw new RuntimeException("The Sitemap is null, this should
never be!");
- }
- }
-
- public void setBasePath (String basePath) {
- this.basePath = basePath;
- }
+ urlFactory = (URLFactory)manager.lookup(Roles.URL_FACTORY);
+ this.urlResolver = new FactoryURLResolver(urlFactory);
+ } catch (Exception e) {
+ getLogger().error("cannot obtain URLFactory", e);
+ }
+ }
- /** Generate the Sitemap class */
- public void run() {
- Sitemap smap;
+ public void configure(Configuration conf) {
+ this.conf = conf;
+ }
+
+ public void contextualize(Context context) throws ContextException {
+ this.context = context;
+ }
+
+ protected Handler(String sourceFileName, boolean check_reload)
throws FileNotFoundException {
+ this.check_reload = check_reload;
+ this.sourceFileName = sourceFileName;
+ }
- String markupLanguage = "sitemap";
- String programmingLanguage = "java";
+ protected boolean available() {
+ return (sitemap != null);
+ }
- ProgramGenerator programGenerator = null;
- try {
- /* FIXME: Workaround -- set the logger XSLTFactoryLoader used to
generate source
- * within the sitemap generation phase.
- * Needed because we never have the opportunity to handle the
lifecycle of the
- * XSLTFactoryLoader, since it is created by the Xalan engine.
- */
- XSLTFactoryLoader.setLogger(getLogger());
+ protected boolean hasChanged() {
+ if (available()) {
+ if (check_reload) {
+ this.source.refresh();
+ return
sitemap.modifiedSince(this.source.getLastModified());
+ }
+ return false;
+ }
+ return true;
+ }
- programGenerator = (ProgramGenerator)
this.manager.lookup(Roles.PROGRAM_GENERATOR);
+ protected boolean isRegenerating() {
+ return isRegenerationRunning;
+ }
+ protected void regenerateAsynchronously(Environment environment)
throws Exception {
+ if (this.sourceFileName.charAt(this.sourceFileName.length() - 1)
== '/') {
+ this.sourceFileName = this.sourceFileName + "sitemap.xmap";
+ }
try {
environment.setURLResolver(this.urlResolver);
- smap = (Sitemap) programGenerator.load(this.sourceFileName,
markupLanguage, programmingLanguage, environment);
+ this.source = environment.resolve(this.sourceFileName);
} finally {
environment.setURLResolver(null);
}
+ if (!this.isRegenerationRunning) {
+ isRegenerationRunning = true;
+ regeneration = new Thread(this);
+
+ /* HACK for reducing class loader problems. */
+
+ /* example: xalan extensions fail if someone adds xalan jars
in tomcat3.2.1/lib */
+
+ try {
+
regeneration.setContextClassLoader(Thread.currentThread().getContextClassLoader());
+ } catch (Exception e) {
+ }
+ this.environment = environment;
+
+ /* clear old exception if any */
+
+ this.exception = null;
+
+ /* start the thread */
- if (this.sitemap != null) {
- programGenerator.release((CompiledComponent) this.sitemap);
+ regeneration.start();
}
+ }
- this.sitemap = smap;
- getLogger().debug("Sitemap regeneration complete");
+ protected void regenerate(Environment environment) throws Exception {
+ getLogger().debug("Beginning sitemap regeneration");
+ this.regenerateAsynchronously(environment);
+ if (regeneration != null) {
+ this.regeneration.join();
+ }
+ throwEventualException();
+ }
- if (this.sitemap != null) {
- getLogger().debug("The sitemap has been successfully
compiled!");
- } else {
- getLogger().debug("No errors, but the sitemap has not been
set.");
+ public boolean process(Environment environment) throws Exception {
+ checkSanity();
+ try {
+ environment.setURLResolver(this.urlResolver);
+ return sitemap.process(environment);
+ } finally {
+ environment.setURLResolver(null);
}
- } catch (Throwable t) {
- getLogger().error("Error compiling sitemap", t);
+ }
- if (t instanceof Exception) {
- this.exception = (Exception) t;
+ public boolean process(Environment environment, StreamPipeline
pipeline,
+ EventPipeline eventPipeline) throws Exception {
+ checkSanity();
+ try {
+ environment.setURLResolver(this.urlResolver);
+ return sitemap.process(environment, pipeline,
eventPipeline);
+ } finally {
+ environment.setURLResolver(null);
+ }
+ }
+
+ private void checkSanity() throws Exception {
+ throwEventualException();
+ if (sitemap == null) {
+ getLogger().fatalError("Sitemap is not set for the
Handler!!!!");
+ throw new RuntimeException("The Sitemap is null, this should
never be!");
}
- } finally {
- if(programGenerator != null)
this.manager.release(programGenerator);
- this.regeneration = null;
- this.environment = null;
- this.isRegenerationRunning = false;
}
- }
- public void throwEventualException() throws Exception {
- if (this.exception != null)
- throw new ProcessingException("Exception in
Handler",this.exception);
- }
+ public void setBasePath(String basePath) {
+ this.basePath = basePath;
+ }
- public Exception getException() {
- return this.exception;
- }
+ /** Generate the Sitemap class */
+ public void run() {
+ Sitemap smap = null;
+ String markupLanguage = "sitemap";
+ String programmingLanguage = "java";
+ ProgramGenerator programGenerator = null;
+ try {
+ /* FIXME: Workaround -- set the logger XSLTFactoryLoader
used to generate source
+ * within the sitemap generation phase.
+ * Needed because we never have the opportunity to handle the
lifecycle of the
+ * XSLTFactoryLoader, since it is created by the Xalan engine.
+ */
+
+ XSLTFactoryLoader.setLogger(getLogger());
+ programGenerator =
(ProgramGenerator)this.manager.lookup(Roles.PROGRAM_GENERATOR);
+ try {
+ environment.setURLResolver(this.urlResolver);
+ smap = (Sitemap)programGenerator.load(this.manager,
this.sourceFileName, markupLanguage,
+ programmingLanguage, environment);
+ } finally {
+ environment.setURLResolver(null);
+ }
+ if (this.sitemap != null) {
+
programGenerator.release((CompiledComponent)this.sitemap);
+ }
+ this.sitemap = smap;
+ getLogger().debug("Sitemap regeneration complete");
+ if (this.sitemap != null) {
+ getLogger().debug("The sitemap has been successfully
compiled!");
+ } else {
+ getLogger().debug("No errors, but the sitemap has not
been set.");
+ }
+ } catch (Throwable t) {
+ getLogger().error("Error compiling sitemap", t);
+ if (t instanceof Exception) {
+ this.exception = (Exception)t;
+ }
+ } finally {
+ if (programGenerator != null) {
+ this.manager.release(programGenerator);
+ }
+ this.regeneration = null;
+ this.environment = null;
+ this.isRegenerationRunning = false;
+ }
+ }
+
+ public void throwEventualException() throws Exception {
+ if (this.exception != null) {
+ throw new ProcessingException("Exception in Handler",
this.exception);
+ }
+ }
+
+ public Exception getException() {
+ return this.exception;
+ }
/**
* dispose
*/
- public void dispose() {
- if(urlFactory != null) manager.release((Component)urlFactory);
- this.urlResolver = null;
- }
+ public void dispose() {
+ if (urlFactory != null) {
+ manager.release((Component)urlFactory);
+ }
+ this.urlResolver = null;
+ }
}
1.3 +13 -16
xml-cocoon2/src/org/apache/cocoon/sitemap/LinkTranslator.java
Index: LinkTranslator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/LinkTranslator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- LinkTranslator.java 2001/05/22 14:45:31 1.2
+++ LinkTranslator.java 2001/06/08 20:28:25 1.3
@@ -5,48 +5,45 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import java.io.IOException;
-import java.io.PrintStream;
import java.util.Map;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.transformation.Transformer;
-import org.apache.cocoon.util.NetUtils;
import org.apache.cocoon.xml.xlink.ExtendedXLinkPipe;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/22 14:45:31 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/06/08 20:28:25 $
*/
-
public class LinkTranslator extends ExtendedXLinkPipe implements Transformer
{
-
private Map links;
/**
* Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the
request.
*/
- public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par)
- throws ProcessingException, SAXException, IOException {
- this.links = (Map) objectModel.get(Constants.LINK_OBJECT);
+ public void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par) throws ProcessingException,
+ SAXException, IOException {
+ 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)
- throws SAXException {
- String newHref = (String) this.links.get(href);
- super.simpleLink((newHref != null) ? newHref : href, role, arcrole,
title, show, actuate, uri, name, raw, attr);
+ public void simpleLink(String href, String role, String arcrole, String
title, String show, String actuate, String uri,
+ String name, String raw, Attributes attr) throws SAXException {
+ String newHref = (String)this.links.get(href);
+ super.simpleLink((newHref != null) ? newHref : href, role,
arcrole, title, show, actuate, uri, name, raw, attr);
}
- public void startLocator(String href, String role, String title, String
label, String uri, String name, String raw, Attributes attr)
- throws SAXException {
- String newHref = (String) this.links.get(href);
- super.startLocator((newHref != null) ? newHref : href, role, title,
label, uri, name, raw, attr);
+ public void startLocator(String href, String role, String title, String
label, String uri, String name, String raw,
+ Attributes attr) throws SAXException {
+ String newHref = (String)this.links.get(href);
+ super.startLocator((newHref != null) ? newHref : href, role,
title, label, uri, name, raw, attr);
}
}
1.3 +70 -69 xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java
Index: Manager.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- Manager.java 2001/05/31 17:38:54 1.2
+++ Manager.java 2001/06/08 20:28:25 1.3
@@ -5,11 +5,9 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Iterator;
import org.apache.avalon.framework.component.Component;
@@ -22,14 +20,12 @@
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.AbstractLoggable;
import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.Constants;
+import org.apache.avalon.excalibur.component.RoleManager;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.pipeline.EventPipeline;
import org.apache.cocoon.components.pipeline.StreamPipeline;
import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.sitemap.Handler;
-import org.apache.cocoon.sitemap.XSLTFactoryLoader;
-import org.xml.sax.SAXException;
/**
* This class manages all sub <code>Sitemap</code>s of a <code>Sitemap</code>
@@ -37,10 +33,9 @@
* checking regeneration of the sub <code>Sitemap</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/31 17:38:54 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/06/08 20:28:25 $
*/
public class Manager extends AbstractLoggable implements Component,
Configurable, Composable, Contextualizable, ThreadSafe {
-
private Context context;
/** The vectors of sub sitemaps */
@@ -52,24 +47,34 @@
/** The component manager */
private ComponentManager manager;
+ /** The sitemap role manager */
+ private RoleManager sitemapRoles;
+
+ /**
+ * Set the role manager
+ */
+ public void setRoleManager(RoleManager roles) {
+ this.sitemapRoles = roles;
+ }
+
/** get a configuration
* @param conf the configuration
*/
- public void configure (Configuration conf) {
+ public void configure(Configuration conf) {
this.conf = conf;
}
/** get a context
* @param context the context object
*/
- public void contextualize (Context context) throws ContextException {
+ public void contextualize(Context context) throws ContextException {
this.context = context;
}
/** get a component manager
* @param manager the component manager
*/
- public void compose (ComponentManager manager) {
+ public void compose(ComponentManager manager) {
this.manager = manager;
}
@@ -82,16 +87,13 @@
* @throws Exception there may be several excpetions thrown
* @return states if the requested resource was produced
*/
- public boolean invoke (Environment environment, String uri_prefix,
- String source, boolean check_reload, boolean
reload_asynchron)
- throws Exception {
-
- // get a sitemap handler
- Handler sitemapHandler = getHandler(environment, source,
check_reload, reload_asynchron);
-
- // setup to invoke the processing
- setupProcessing(environment, sitemapHandler, uri_prefix, source);
- return sitemapHandler.process(environment);
+ public boolean invoke(ComponentManager newManager, Environment
environment, String uri_prefix, String source, boolean check_reload,
+ boolean reload_asynchron) throws Exception {
+ // get a sitemap handler
+ Handler sitemapHandler = getHandler(newManager, environment,
source, check_reload, reload_asynchron);
+ // setup to invoke the processing
+ setupProcessing(environment, sitemapHandler, uri_prefix, source);
+ return sitemapHandler.process(environment);
}
/** invokes the sitemap handler to process a request
@@ -103,17 +105,13 @@
* @throws Exception there may be several excpetions thrown
* @return states if the requested resource was produced
*/
- public boolean invoke (Environment environment, String uri_prefix,
- String source, boolean check_reload, boolean
reload_asynchron,
- StreamPipeline pipeline, EventPipeline
eventPipeline)
- throws Exception {
-
- // get a sitemap handler
- Handler sitemapHandler = getHandler(environment, source,
check_reload, reload_asynchron);
-
- // setup to invoke the processing
- setupProcessing(environment, sitemapHandler, uri_prefix, source);
- return sitemapHandler.process(environment, pipeline, eventPipeline);
+ public boolean invoke(ComponentManager newManager, Environment
environment, String uri_prefix, String source, boolean check_reload,
+ boolean reload_asynchron, StreamPipeline pipeline, EventPipeline
eventPipeline) throws Exception {
+ // get a sitemap handler
+ Handler sitemapHandler = getHandler(newManager, environment,
source, check_reload, reload_asynchron);
+ // setup to invoke the processing
+ setupProcessing(environment, sitemapHandler, uri_prefix, source);
+ return sitemapHandler.process(environment, pipeline,
eventPipeline);
}
/** has the sitemap changed
@@ -123,7 +121,7 @@
Handler sitemapHandler = null;
Iterator iter = sitemaps.values().iterator();
while (iter.hasNext()) {
- sitemapHandler = (Handler) iter.next();
+ sitemapHandler = (Handler)iter.next();
if ((sitemapHandler != null) && (sitemapHandler.hasChanged())) {
return true;
}
@@ -131,51 +129,54 @@
return false;
}
- /** make sure the uri_prefix ends with a slash */
- private String getPrefix (String uri_prefix) {
- if (uri_prefix.length() > 0)
- return (uri_prefix.charAt(uri_prefix.length() - 1) == '/' ?
uri_prefix : uri_prefix + "/");
- else
+ /**
+ * make sure the uri_prefix ends with a slash
+ *
+ * NOTE: Together 5 marks this as unused. If verified, we need to
remove it.
+ */
+ /*
+ private String getPrefix(String uri_prefix) {
+ if (uri_prefix.length() > 0) {
+ return ((uri_prefix.charAt(uri_prefix.length() - 1) == '/') ?
uri_prefix : uri_prefix + "/");
+ } else {
return uri_prefix;
+ }
}
+ */
- private Handler getHandler(final Environment environment,
- final String source,
- final boolean check_reload,
- final boolean reload_asynchron)
- throws Exception {
- Handler sitemapHandler = (Handler) sitemaps.get(source);
-
- if (sitemapHandler != null) {
- if (sitemapHandler.available()) {
- if (check_reload
- && sitemapHandler.hasChanged()
- && !sitemapHandler.isRegenerating()) {
- if (reload_asynchron == true) {
- sitemapHandler.regenerateAsynchronously(environment);
- } else {
- sitemapHandler.regenerate(environment);
+ private Handler getHandler(final ComponentManager newManager, final
Environment environment, final String source, final boolean check_reload,
+ final boolean reload_asynchron) throws Exception {
+ Handler sitemapHandler = (Handler)sitemaps.get(source);
+ if (sitemapHandler != null) {
+ if (sitemapHandler.available()) {
+ if (check_reload && sitemapHandler.hasChanged() &&
!sitemapHandler.isRegenerating()) {
+ if (reload_asynchron) {
+
sitemapHandler.regenerateAsynchronously(environment);
+ } else {
+ sitemapHandler.regenerate(environment);
+ }
}
+ } else {
+ sitemapHandler.regenerate(environment);
}
} else {
+ sitemapHandler = new Handler(source, check_reload);
+ sitemapHandler.contextualize(this.context);
+ sitemapHandler.setLogger(getLogger());
+ sitemapHandler.compose(newManager);
+ sitemapHandler.configure(this.conf);
sitemapHandler.regenerate(environment);
+ sitemaps.put(source, sitemapHandler);
}
- } else {
- sitemapHandler = new Handler(source, check_reload);
- sitemapHandler.contextualize(this.context);
- sitemapHandler.setLogger(getLogger());
- sitemapHandler.compose(this.manager);
- sitemapHandler.configure(this.conf);
- sitemapHandler.regenerate(environment);
- sitemaps.put(source, sitemapHandler);
- }
- return sitemapHandler;
+ return sitemapHandler;
}
- private void setupProcessing (Environment environment, Handler
sitemapHandler, String uri_prefix, String source)
- throws Exception {
- environment.changeContext(uri_prefix, source);
- if (! sitemapHandler.available())
- throw new ProcessingException("The sitemap handler's sitemap is
not available.", sitemapHandler.getException());
+ private void setupProcessing(Environment environment, Handler
sitemapHandler, String uri_prefix,
+ String source) throws Exception {
+ environment.changeContext(uri_prefix, source);
+ if (!sitemapHandler.available()) {
+ throw new ProcessingException("The sitemap handler's sitemap
is not available.",
+ sitemapHandler.getException());
+ }
}
}
1.2 +2 -2
xml-cocoon2/src/org/apache/cocoon/sitemap/PatternException.java
Index: PatternException.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/PatternException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- PatternException.java 2001/05/09 20:49:36 1.1
+++ PatternException.java 2001/06/08 20:28:26 1.2
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
/**
@@ -14,10 +15,9 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1 $ $Date: 2001/05/09 20:49:36 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/06/08 20:28:26 $
*/
public class PatternException extends Exception {
-
/**
* Construct a new <code>PatternException</code> instance.
*/
1.2 +3 -3 xml-cocoon2/src/org/apache/cocoon/sitemap/Sitemap.java
Index: Sitemap.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Sitemap.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- Sitemap.java 2001/05/09 20:49:37 1.1
+++ Sitemap.java 2001/06/08 20:28:26 1.2
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import org.apache.avalon.framework.component.ComponentManager;
@@ -20,7 +21,7 @@
* Base interface for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/05/09 20:49:37 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/06/08 20:28:26 $
*/
public interface Sitemap extends CompiledComponent, Configurable,
Contextualizable, Processor {
int GENERATOR = 1;
@@ -40,6 +41,5 @@
* Process the given <code>Environment</code> assebling
* a <code>StreamPipeline</code> and an <code>EventPipeline</code>
*/
- boolean process(Environment environment, StreamPipeline pipeline,
EventPipeline eventPipeline)
- throws Exception;
+ boolean process(Environment environment, StreamPipeline pipeline,
EventPipeline eventPipeline) throws Exception;
}
1.3 +43 -11
xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapComponentSelector.java
Index: SitemapComponentSelector.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapComponentSelector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- SitemapComponentSelector.java 2001/05/22 14:45:35 1.2
+++ SitemapComponentSelector.java 2001/06/08 20:28:26 1.3
@@ -8,38 +8,70 @@
package org.apache.cocoon.sitemap;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.Map;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.excalibur.component.DefaultComponentSelector;
+import org.apache.avalon.excalibur.component.ExcaliburComponentSelector;
/** Default component manager for Cocoon's sitemap components.
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Id: SitemapComponentSelector.java,v 1.2 2001/05/22 14:45:35
cziegeler Exp $
+ * @version CVS $Id: SitemapComponentSelector.java,v 1.3 2001/06/08 20:28:26
giacomo Exp $
*/
-public class SitemapComponentSelector extends DefaultComponentSelector {
- HashMap mime_types;
+public class SitemapComponentSelector extends ExcaliburComponentSelector {
+ private Map mime_types;
+ private ComponentSelector parentSelector;
+ private boolean initialized = false;
/** The conctructors (same as the Avalon ComponentManager)
*/
- public SitemapComponentSelector () {
+ public SitemapComponentSelector() {
super();
this.mime_types = new HashMap();
}
+ public void setParentSelector(ComponentSelector newSelector) {
+ if ((! this.initialized) && this.parentSelector == null) {
+ this.parentSelector = newSelector;
+ }
+ }
+
+ public Component select(Object hint) throws ComponentException {
+ Component component = null;
+
+ try {
+ component = super.select(hint);
+ } catch (ComponentException ce) {
+ if (this.parentSelector != null) {
+ component = this.parentSelector.select(hint);
+ } else {
+ throw ce;
+ }
+ }
+
+ return component;
+ }
+
+ public void initialize() {
+ super.initialize();
+ this.mime_types = Collections.unmodifiableMap(this.mime_types);
+ this.initialized = true;
+ }
+
public String getMimeTypeForRole(String role) {
- return (String) this.mime_types.get(role);
+ return (String)this.mime_types.get(role);
}
- protected void addSitemapComponent(Object hint, Class component,
Configuration conf, String mime_type)
- throws ComponentException,
- ConfigurationException {
- super.addComponent(hint, component, conf);
- this.mime_types.put(hint, mime_type);
+ protected void addSitemapComponent(Object hint, Class component,
Configuration conf, String mime_type) throws ComponentException,
+ ConfigurationException {
+ super.addComponent(hint, component, conf);
+ this.mime_types.put(hint, mime_type);
}
}
1.3 +4 -4
xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapModelComponent.java
Index: SitemapModelComponent.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapModelComponent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- SitemapModelComponent.java 2001/05/22 14:45:42 1.2
+++ SitemapModelComponent.java 2001/06/08 20:28:27 1.3
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import java.io.IOException;
@@ -19,14 +20,13 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/22 14:45:42 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/06/08 20:28:27 $
*/
public interface SitemapModelComponent extends Component {
-
/**
* Set the <code>SourceResolver</code>, objectModel <code>Map</code>,
* the source and sitemap <code>Parameters</code> used to process the
request.
*/
- void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par)
- throws ProcessingException, SAXException, IOException;
+ void setup(SourceResolver resolver, Map objectModel, String src,
Parameters par) throws ProcessingException,
+ SAXException, IOException;
}
1.2 +2 -2
xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapOutputComponent.java
Index: SitemapOutputComponent.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapOutputComponent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- SitemapOutputComponent.java 2001/05/09 20:49:37 1.1
+++ SitemapOutputComponent.java 2001/06/08 20:28:27 1.2
@@ -5,6 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
*
* the LICENSE file.
*
*****************************************************************************/
+
package org.apache.cocoon.sitemap;
import java.io.IOException;
@@ -14,10 +15,9 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/05/09 20:49:37 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/06/08 20:28:27 $
*/
public interface SitemapOutputComponent extends Component {
-
/**
* Set the <code>OutputStream</code> where the requested resource should
* be serialized.
1.3 +48 -50
xml-cocoon2/src/org/apache/cocoon/sitemap/XSLTFactoryLoader.java
Index: XSLTFactoryLoader.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/XSLTFactoryLoader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- XSLTFactoryLoader.java 2001/05/18 20:50:12 1.2
+++ XSLTFactoryLoader.java 2001/06/08 20:28:28 1.3
@@ -25,29 +25,27 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/18 20:50:12 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/06/08 20:28:28 $
*/
-
public class XSLTFactoryLoader {
protected static Logger log;
-
private HashMap obj = new HashMap();
- public String getClassSource(String className, String prefix, String
pattern, NodeList conf)
- throws ClassNotFoundException, InstantiationException,
IllegalAccessException, Exception {
- Object factory = obj.get(className);
- if (factory == null) factory = ClassUtils.newInstance(className);
- obj.put(className, factory);
-
- if (factory instanceof Loggable) {
- ((Loggable)factory).setLogger(this.log);
- }
- if (factory instanceof CodeFactory) {
- return ((CodeFactory) factory).generateClassSource(prefix,
pattern, conf);
- }
-
- throw new Exception ("Wrong class \"" + factory.getClass().getName()
- + "\". Should implement the CodeFactory
interface");
+ public String getClassSource(String className, String prefix, String
pattern, NodeList conf) throws ClassNotFoundException,
+ InstantiationException, IllegalAccessException, Exception {
+ Object factory = obj.get(className);
+ if (factory == null) {
+ factory = ClassUtils.newInstance(className);
+ }
+ obj.put(className, factory);
+ if (factory instanceof Loggable) {
+ ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
+ }
+ if (factory instanceof CodeFactory) {
+ return ((CodeFactory)factory).generateClassSource(prefix,
pattern, conf);
+ }
+ throw new Exception("Wrong class \"" +
factory.getClass().getName() +
+ "\". Should implement the CodeFactory interface");
}
public static void setLogger(Logger logger) {
@@ -55,45 +53,45 @@
log = logger;
}
}
-
- public String getParameterSource(String className, NodeList conf)
- throws ClassNotFoundException, InstantiationException,
IllegalAccessException, Exception {
- Object factory = obj.get(className);
- if (factory == null) factory = ClassUtils.newInstance(className);
- obj.put (className, factory);
- if (factory instanceof Loggable) {
- ((Loggable)factory).setLogger(this.log);
- }
- if (factory instanceof CodeFactory) {
- return ((CodeFactory) factory).generateParameterSource(conf);
- }
-
- throw new Exception ("Wrong class \"" + factory.getClass().getName()
- + "\". Should implement the CodeFactory
interface");
+ public String getParameterSource(String className, NodeList conf) throws
ClassNotFoundException, InstantiationException,
+ IllegalAccessException, Exception {
+ Object factory = obj.get(className);
+ if (factory == null) {
+ factory = ClassUtils.newInstance(className);
+ }
+ obj.put(className, factory);
+ if (factory instanceof Loggable) {
+ ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
+ }
+ if (factory instanceof CodeFactory) {
+ return ((CodeFactory)factory).generateParameterSource(conf);
+ }
+ throw new Exception("Wrong class \"" +
factory.getClass().getName() +
+ "\". Should implement the CodeFactory interface");
}
-
- public String getMethodSource(String className, NodeList conf)
- throws ClassNotFoundException, InstantiationException,
IllegalAccessException, Exception {
- Object factory = obj.get(className);
- if (factory == null) factory = ClassUtils.newInstance(className);
- obj.put (className, factory);
-
- if (factory instanceof Loggable) {
- ((Loggable)factory).setLogger(this.log);
- }
- if (factory instanceof CodeFactory) {
- return ((CodeFactory) factory).generateMethodSource(conf);
- }
- throw new Exception ("Wrong class \"" + factory.getClass().getName()
- + "\". Should implement the CodeFactory
interface");
+ public String getMethodSource(String className, NodeList conf) throws
ClassNotFoundException, InstantiationException,
+ IllegalAccessException, Exception {
+ Object factory = obj.get(className);
+ if (factory == null) {
+ factory = ClassUtils.newInstance(className);
+ }
+ obj.put(className, factory);
+ if (factory instanceof Loggable) {
+ ((Loggable)factory).setLogger(XSLTFactoryLoader.log);
+ }
+ if (factory instanceof CodeFactory) {
+ return ((CodeFactory)factory).generateMethodSource(conf);
+ }
+ throw new Exception("Wrong class \"" +
factory.getClass().getName() +
+ "\". Should implement the CodeFactory interface");
}
- public boolean isFactory (String className) {
+ public boolean isFactory(String className) {
boolean result = false;
try {
- result = ClassUtils.implementsInterface (className,
CodeFactory.class.getName());
+ result = ClassUtils.implementsInterface(className,
CodeFactory.class.getName());
} catch (ClassNotFoundException e) {
log.debug("ClassNotFoundException in XSLTFactoryLoader.isFactory
checking for " + className, e);
} catch (Exception e) {
1.2 +46 -0
xml-cocoon2/src/org/apache/cocoon/sitemap/SitemapRedirector.java
1.2 +39 -0 xml-cocoon2/src/org/apache/cocoon/sitemap/sitemap.roles
1.3 +4 -4 xml-cocoon2/src/org/apache/cocoon/util/IOUtils.java
Index: IOUtils.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/util/IOUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- IOUtils.java 2001/05/25 14:25:59 1.2
+++ IOUtils.java 2001/06/08 20:28:33 1.3
@@ -20,7 +20,7 @@
import java.text.Collator;
import java.util.Arrays;
import java.util.Locale;
-import org.apache.log.LogKit;
+import org.apache.log.Hierarchy;
/**
* A collection of <code>File</code>, <code>URL</code> and filename
@@ -28,7 +28,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.2 $ $Date: 2001/05/25 14:25:59 $
+ * @version CVS $Revision: 1.3 $ $Date: 2001/06/08 20:28:33 $
*/
public class IOUtils {
@@ -242,7 +242,7 @@
try {
return file.getCanonicalPath();
} catch (Exception e) {
- LogKit.getLoggerFor("cocoon").debug("IOUtils.getFullFilename", e);
+
Hierarchy.getDefaultHierarchy().getLoggerFor("cocoon").debug("IOUtils.getFullFilename",
e);
return file.getAbsolutePath();
}
}
@@ -283,7 +283,7 @@
filePath = filePath.substring(directoryPath.length());
}
} catch (Exception e){
- LogKit.getLoggerFor("cocoon").debug("IOUtils.getContextFilePath",
e);
+
Hierarchy.getDefaultHierarchy().getLoggerFor("cocoon").debug("IOUtils.getContextFilePath",
e);
}
return filePath;
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]