crossley 01/11/02 05:33:06
Modified: src/org/apache/cocoon/components/resolver Tag:
cocoon_20_branch ResolverImpl.java
Log:
Accept entity catalog parameters from xconf and sync with 2.1
Revision Changes Path
No revision
No revision
1.2.2.5 +42 -8
xml-cocoon2/src/org/apache/cocoon/components/resolver/ResolverImpl.java
Index: ResolverImpl.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/resolver/ResolverImpl.java,v
retrieving revision 1.2.2.4
retrieving revision 1.2.2.5
diff -u -r1.2.2.4 -r1.2.2.5
--- ResolverImpl.java 2001/10/11 08:56:08 1.2.2.4
+++ ResolverImpl.java 2001/11/02 13:33:06 1.2.2.5
@@ -7,6 +7,7 @@
*****************************************************************************/
package org.apache.cocoon.components.resolver;
+import com.sun.resolver.helpers.Debug;
import com.sun.resolver.tools.CatalogResolver;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.ComponentException;
@@ -29,10 +30,12 @@
/**
- * A component that uses catalogs for resolving Entities. This implementation uses
the
- * XML Entity and URI Resolvers from http://www.sun.com/xml/developers/resolver/
- * published by Sun's Norman Walsh. More information on the catalogs can be found at
- * http://www.oasis-open.org/committees/entity/spec.html
+ * A component that uses catalogs for resolving Entities. This implementation
+ * uses the XML Entity and URI Resolvers from
+ * http://www.sun.com/xml/developers/resolver/
+ * published by Sun's Norman Walsh. More information on the catalogs can be
+ * found at
+ * http://xml.apache.org/cocoon2/catalog.html
*
* The catalog is by default loaded from "/resources/entities/catalog".
* This can be configured by the "catalog" parameter in the cocoon.xconf:
@@ -41,7 +44,7 @@
* </resolver>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Revision: 1.2.2.4 $ $Date: 2001/10/11 08:56:08 $
+ * @version CVS $Revision: 1.2.2.5 $ $Date: 2001/11/02 13:33:06 $
*/
public class ResolverImpl extends AbstractLoggable
implements Resolver, Contextualizable, Composable, Configurable,
ThreadSafe, Disposable {
@@ -62,20 +65,51 @@
}
/**
- * Set the configuration.
+ * Set the configuration. Load the system catalog and apply any
+ * parameters that may have been specified in cocoon.xconf
* @param conf The configuration information
* @exception ConfigurationException
*/
public void configure(Configuration conf) throws ConfigurationException {
Parameters params = Parameters.fromConfiguration(conf);
+
+ // Over-ride the debug level that is set by CatalogManager.properties
+ int debugLevel = Debug.getDebug();
+ // getLogger().debug("Current Catalog verbosity level is "
+ // + debugLevel);
+ String verbosity = params.getParameter("verbosity", "");
+ if (verbosity != "") {
+ getLogger().debug("Setting Catalog verbosity level to "
+ + verbosity);
+ int verbosityLevel = 0;
+ try {
+ verbosityLevel = Integer.parseInt(verbosity);
+ Debug.setDebug(verbosityLevel);
+ } catch (NumberFormatException ce1) {
+ getLogger().warn("Trouble setting Catalog verbosity", ce1);
+ }
+ }
+
// Load the built-in catalog.
- String catalogFile = params.getParameter("catalog",
"/resources/entities/catalog");
+ String catalogFile = params.getParameter("catalog",
+ "/resources/entities/catalog");
try {
String catalogURL = this.context.getRealPath(catalogFile);
- getLogger().debug("Catalog URL is " + catalogURL);
+ getLogger().debug("System Catalog URL is " + catalogURL);
catalogResolver.getCatalog().parseCatalog(catalogURL);
} catch (Exception e) {
getLogger().warn("Could not get Catalog URL", e);
+ }
+
+ // Load a single additional local catalog
+ String localCatalogFile = params.getParameter("local-catalog", "");
+ if (localCatalogFile != "") {
+ try {
+ getLogger().debug("Additional Catalog is " + localCatalogFile);
+ catalogResolver.getCatalog().parseCatalog(localCatalogFile);
+ } catch (Exception e) {
+ getLogger().warn("Could not get local Catalog file", e);
+ }
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]