You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2004/06/11 23:37:04 UTC
cvs commit: cocoon-2.1/src/java/org/apache/cocoon Cocoon.java Constants.java
vgritsenko 2004/06/11 14:37:04
Modified: src/java/org/apache/cocoon Cocoon.java Constants.java
Log:
Restore exception handling. Error namespace URI must end on 2.1
Revision Changes Path
1.27 +30 -31 cocoon-2.1/src/java/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Cocoon.java 27 May 2004 13:14:36 -0000 1.26
+++ Cocoon.java 11 Jun 2004 21:37:04 -0000 1.27
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -71,7 +71,6 @@
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceResolver;
import org.apache.excalibur.source.impl.URLSource;
-import org.apache.excalibur.xml.impl.XercesParser;
import org.apache.excalibur.xml.sax.SAXParser;
import org.xml.sax.InputSource;
@@ -99,7 +98,7 @@
private ThreadManager threads;
private CommandManager commands;
-
+
/** The application context */
private Context context;
@@ -138,16 +137,16 @@
/** The source resolver */
protected SourceResolver sourceResolver;
-
+
/** The environment helper */
protected EnvironmentHelper environmentHelper;
/** A service manager (wrapper) */
protected ServiceManager serviceManager;
-
+
/** An optional Avalon Component that is called before and after processing all requests. */
- protected RequestListener requestListener;
-
+ protected RequestListener requestListener;
+
/**
* Creates a new <code>Cocoon</code> instance.
*
@@ -178,33 +177,33 @@
public void contextualize(Context context) throws ContextException {
if (this.context == null) {
this.context = new ComponentContext(context);
-
+
try {
DefaultContext setup = (DefaultContext)this.context;
this.threads = new TPCThreadManager();
-
+
Parameters params = new Parameters();
params.setParameter("threads-per-processor", "1");
params.setParameter("sleep-time", "100");
params.setParameter("block-timeout", "1000");
params.setParameter("force-shutdown", "true");
params.makeReadOnly();
-
+
ContainerUtil.enableLogging(this.threads, getLogger().getChildLogger("thread.manager"));
ContainerUtil.parameterize(this.threads, params);
ContainerUtil.initialize(this.threads);
-
+
this.commands = new CommandManager();
ContainerUtil.enableLogging(this.commands, getLogger().getChildLogger("thread.manager"));
this.threads.register(this.commands);
-
+
setup.put(Queue.ROLE, this.commands.getCommandSink());
-
+
setup.makeReadOnly();
} catch (Exception e) {
getLogger().error("Could not set up the Command Manager", e);
}
-
+
this.classpath = (String)context.get(Constants.CONTEXT_CLASSPATH);
this.workDir = (File)context.get(Constants.CONTEXT_WORK_DIR);
try {
@@ -284,11 +283,11 @@
} catch (Exception e) {
throw new ConfigurationException("Could not load parser " + parser, e);
}
-
+
ContainerUtil.initialize(startupManager);
-
+
this.configure(startupManager);
-
+
ContainerUtil.dispose(startupManager);
startupManager = null;
@@ -315,14 +314,14 @@
}
this.serviceManager = new ComponentManagerWrapper(this.componentManager);
-
+
this.environmentHelper = new EnvironmentHelper(
(String) this.context.get(ContextHelper.CONTEXT_ROOT_URL));
ContainerUtil.enableLogging(this.environmentHelper, getLogger());
ContainerUtil.service(this.environmentHelper, this.serviceManager);
this.sourceResolver = (SourceResolver)this.componentManager.lookup(SourceResolver.ROLE);
-
+
if (this.componentManager.hasComponent(RequestListener.ROLE)){
this.requestListener = (RequestListener) this.componentManager.lookup(RequestListener.ROLE);
}
@@ -486,21 +485,21 @@
this.commands = null;
ContainerUtil.dispose(this.threads);
this.threads = null;
-
+
if ( this.componentManager != null ) {
if ( this.requestListener!=null ){
this.componentManager.release(this.requestListener);
}
this.componentManager.release(this.threadSafeProcessor);
this.threadSafeProcessor = null;
-
+
this.componentManager.release(this.sourceResolver);
this.sourceResolver = null;
ContainerUtil.dispose(this.componentManager);
- this.componentManager = null;
+ this.componentManager = null;
}
-
+
this.context = null;
this.disposed = true;
}
@@ -624,7 +623,7 @@
this.debug(environment, false);
}
-
+
if (this.requestListener != null) {
try {
requestListener.onRequestStart(environment);
@@ -633,7 +632,7 @@
getLogger().error("Error encountered monitoring request start: " + e.getMessage());
}
}
-
+
if (this.threadSafeProcessor != null) {
result = this.threadSafeProcessor.process(environment);
if (this.requestListener != null) {
@@ -683,7 +682,7 @@
if (getLogger().isDebugEnabled()) {
--activeRequestCount;
}
-
+
// TODO (CZ): This is only for testing - remove it later on
EnvironmentHelper.checkEnvironment(getLogger());
}
@@ -730,7 +729,7 @@
public Map getComponentConfigurations() {
return Collections.EMPTY_MAP;
}
-
+
/**
* Return this (Cocoon is always at the root of the processing chain).
* @since 2.1.1
@@ -745,7 +744,7 @@
public int getActiveRequestCount() {
return activeRequestCount;
}
-
+
/* (non-Javadoc)
* @see org.apache.cocoon.Processor#getEnvironmentHelper()
*/
1.15 +7 -7 cocoon-2.1/src/java/org/apache/cocoon/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/Constants.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Constants.java 9 Jun 2004 09:41:16 -0000 1.14
+++ Constants.java 11 Jun 2004 21:37:04 -0000 1.15
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -233,7 +233,7 @@
public static final String DEFAULT_CONF_FILE = "cocoon.xconf";
/** The namespace URI for the Error/Exception XML */
- public static final String ERROR_NAMESPACE_URI = "http://apache.org/cocoon/error/" + CONF_VERSION;
+ public static final String ERROR_NAMESPACE_URI = "http://apache.org/cocoon/error/2.1";
/** The namespace prefix for the Error/Exception XML */
public static final String ERROR_NAMESPACE_PREFIX = "error";
@@ -265,14 +265,14 @@
/** Application <code>Context</code> Key for the default encoding */
public static final String CONTEXT_DEFAULT_ENCODING = "default-encoding";
-
+
/**
* Should descriptors be reloaded?
*
* FIXME(GP): Isn't this Action specific only?
*/
public static final boolean DESCRIPTOR_RELOADABLE_DEFAULT = true;
-
+
}