cziegeler    01/09/07 07:13:06

  Modified:    src/org/apache/cocoon/components/resolver ResolverImpl.java
  Log:
  The location of the catalog is now configurable
  
  Revision  Changes    Path
  1.3       +24 -15    
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
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResolverImpl.java 2001/09/05 12:40:41     1.2
  +++ ResolverImpl.java 2001/09/07 14:13:06     1.3
  @@ -36,8 +36,14 @@
    * published by Sun's Norman Walsh. More information on the catalogs can be found at
    * http://www.oasis-open.org/committees/entity/spec.html
    *
  + * The catalog is by default loaded from "/resources/entities/catalog".
  + * This can be configured by the "catalog" parameter in the cocoon.xconf:
  + * <resolver>
  + *   <parameter name="catalog" value="mycatalog"/>
  + * </resolver>
  + *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Davanum Srinivas</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/09/05 12:40:41 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/09/07 14:13:06 $
    */
   public class ResolverImpl extends AbstractLoggable
           implements Resolver, Contextualizable, Composable, Configurable, 
ThreadSafe, Disposable {
  @@ -48,32 +54,35 @@
       /** The component manager */
       protected ComponentManager manager = null;
   
  +    /** The context */
  +    protected org.apache.cocoon.environment.Context context;
  +
       /** 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);
  -             }
  +    public void contextualize(Context context)
  +    throws ContextException {
  +        this.context = (org.apache.cocoon.environment.Context) 
context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
       }
   
       /**
  -     * Set the sitemap-provided configuration.
  +     * Set the configuration.
        * @param conf The configuration information
        * @exception ConfigurationException
        */
       public void configure(Configuration conf) throws ConfigurationException {
           Parameters params = Parameters.fromConfiguration(conf);
  +        // Load the built-in catalog.
  +        String catalogFile = params.getParameter("catalog", 
"/resources/entities/catalog");
  +        try {
  +            String catalogURL = this.context.getRealPath(catalogFile);
  +            getLogger().debug("Catalog URL is " + catalogURL);
  +            catalogResolver.getCatalog().parseCatalog(catalogURL);
  +        } catch (Exception e) {
  +            getLogger().warn("Could not get Catalog URL", e);
  +        }
       }
   
       /**
  -     * Set the global component manager. This metod also sets the
  -     * <code>ComponentSelector</code> used as language factory for both markup and 
programming languages.
  +     * Set the global component manager.
        * @param manager The global component manager
        */
       public void compose(ComponentManager manager) throws ComponentException {
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to