dims 01/09/05 05:40:41
Modified: src/org/apache/cocoon/components/resolver ResolverImpl.java
Log:
Patch for loading catalog programatically. built-in catalog is loaded whether
entries in the CatalogManager.properties is valid or not.
Revision Changes Path
1.2 +15 -1
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ResolverImpl.java 2001/08/20 12:36:59 1.1
+++ ResolverImpl.java 2001/09/05 12:40:41 1.2
@@ -21,11 +21,15 @@
import org.apache.avalon.framework.logger.AbstractLoggable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.Constants;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
/**
* 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/
@@ -33,7 +37,7 @@
* http://www.oasis-open.org/committees/entity/spec.html
*
* @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
- * @version CVS $Revision: 1.1 $ $Date: 2001/08/20 12:36:59 $
+ * @version CVS $Revision: 1.2 $ $Date: 2001/09/05 12:40:41 $
*/
public class ResolverImpl extends AbstractLoggable
implements Resolver, Contextualizable, Composable, Configurable,
ThreadSafe, Disposable {
@@ -46,6 +50,16 @@
/** Contextualize this class */
public void contextualize(Context context) throws ContextException {
+ // Load the built-in catalog.
+ org.apache.cocoon.environment.Context ctx =
+ (org.apache.cocoon.environment.Context)
context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
+ try {
+ String catalogURL =
ctx.getRealPath("/resources/entities/catalog");
+ getLogger().debug("Catalog URL is " + catalogURL);
+ catalogResolver.getCatalog().parseCatalog(catalogURL);
+ } catch (Exception e) {
+ getLogger().warn("Could not get Catalog URL", e);
+ }
}
/**
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]