You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by di...@apache.org on 2001/09/05 14:40:41 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/components/resolver ResolverImpl.java

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:dims@yahoo.com">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:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org