crossley 02/01/16 22:15:24 Modified: src/java/org/apache/cocoon/components/resolver ResolverImpl.java Resolver.java Added: src/java/org/apache/cocoon/components/resolver package.html Log: Try to comply with Code Conventions for Java. Add initial package-level description for Javadoc. Revision Changes Path 1.2 +51 -45 xml-cocoon2/src/java/org/apache/cocoon/components/resolver/ResolverImpl.java Index: ResolverImpl.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/resolver/ResolverImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ResolverImpl.java 3 Jan 2002 12:31:13 -0000 1.1 +++ ResolverImpl.java 17 Jan 2002 06:15:24 -0000 1.2 @@ -25,29 +25,30 @@ import org.apache.cocoon.Constants; import org.xml.sax.InputSource; import org.xml.sax.SAXException; - import java.io.IOException; /** - * A component that uses catalogs for resolving Entities. This implementation - * uses the XML Entity and URI Resolvers from + * 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 + * http://xml.apache.org/cocoon/userdocs/concepts/catalog.html * - * The catalog is by default loaded from "/resources/entities/catalog". + * 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.1 $ $Date: 2002/01/03 12:31:13 $ + * @author <a href="mailto:[EMAIL PROTECTED]">David Crossley</a> + * @version CVS $Revision: 1.2 $ $Date: 2002/01/17 06:15:24 $ */ public class ResolverImpl extends AbstractLoggable - implements Resolver, Contextualizable, Composable, Parameterizable, ThreadSafe, Disposable { + implements Resolver, Contextualizable, Composable, Parameterizable, + ThreadSafe, Disposable { /** The catalog resolver */ protected CatalogResolver catalogResolver = new CatalogResolver(); @@ -60,10 +61,12 @@ /** Contextualize this class */ public void contextualize(Context context) - throws ContextException { - this.context = (org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); + throws ContextException { + this.context = (org.apache.cocoon.environment.Context) + context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT); } + /** * Set the configuration. Load the system catalog and apply any * parameters that may have been specified in cocoon.xconf @@ -71,49 +74,52 @@ * @exception ConfigurationException */ public void parameterize(Parameters params) throws ParameterException { - // Over-ride the debug level that is set by CatalogManager.properties + + /* Over-ride debug level that is set by CatalogManager.properties */ int debugLevel = Debug.getDebug(); String verbosity = params.getParameter("verbosity", ""); if (verbosity != "") { - if (this.getLogger().isDebugEnabled() == true) { - this.getLogger().debug("Setting Catalog resolver verbosity level to " - + verbosity); - } - int verbosityLevel = 0; - try { - verbosityLevel = Integer.parseInt(verbosity); - Debug.setDebug(verbosityLevel); - } catch (NumberFormatException ce1) { - this.getLogger().warn("Trouble setting Catalog verbosity", ce1); - } + if (this.getLogger().isDebugEnabled() == true) { + this.getLogger().debug("Setting Catalog resolver " + + "verbosity level to " + verbosity); + } + int verbosityLevel = 0; + try { + verbosityLevel = Integer.parseInt(verbosity); + Debug.setDebug(verbosityLevel); + } catch (NumberFormatException ce1) { + this.getLogger().warn("Trouble setting Catalog verbosity", + ce1); + } } - // Load the built-in catalog. + /* Load the built-in catalog */ String catalogFile = params.getParameter("catalog", - "/resources/entities/catalog"); + "/resources/entities/catalog"); try { - String catalogURL = this.context.getResource(catalogFile).toExternalForm(); + String catalogURL = + this.context.getResource(catalogFile).toExternalForm(); if (this.getLogger().isDebugEnabled() == true) { - this.getLogger().debug("System OASIS Catalog URL is " - + catalogURL); + this.getLogger().debug("System OASIS Catalog URL is " + + catalogURL); } catalogResolver.getCatalog().parseCatalog(catalogURL); } catch (Exception e) { this.getLogger().warn("Could not get Catalog URL", e); } - // Load a single additional local catalog + /* Load a single additional local catalog */ String localCatalogFile = params.getParameter("local-catalog", ""); if (localCatalogFile != "") { - try { - if (this.getLogger().isDebugEnabled() == true) { - this.getLogger().debug("Additional Catalog is " - + localCatalogFile); + try { + if (this.getLogger().isDebugEnabled() == true) { + this.getLogger().debug("Additional Catalog is " + + localCatalogFile); + } + catalogResolver.getCatalog().parseCatalog(localCatalogFile); + } catch (Exception e) { + this.getLogger().warn("Could not get local Catalog file", e); } - catalogResolver.getCatalog().parseCatalog(localCatalogFile); - } catch (Exception e) { - this.getLogger().warn("Could not get local Catalog file", e); - } } } @@ -161,21 +167,21 @@ * or Reader for the InputSource. * @see org.xml.sax.InputSource */ - public InputSource resolveEntity(String publicId, - String systemId) + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { - InputSource altInputSource = catalogResolver.resolveEntity(publicId,systemId); - if (altInputSource != null) { - if (this.getLogger().isDebugEnabled() == true) { - this.getLogger().debug("Resolved catalog entity: " + publicId + " " - + altInputSource.getSystemId()); + InputSource altInputSource = catalogResolver.resolveEntity(publicId, + systemId); + if (altInputSource != null) { + if (this.getLogger().isDebugEnabled() == true) { + this.getLogger().debug("Resolved catalog entity: " + + publicId + " " + altInputSource.getSystemId()); + } } - } - return altInputSource; + return altInputSource; } /** - * dispose + * Dispose */ public void dispose() { } 1.2 +5 -6 xml-cocoon2/src/java/org/apache/cocoon/components/resolver/Resolver.java Index: Resolver.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/resolver/Resolver.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Resolver.java 3 Jan 2002 12:31:13 -0000 1.1 +++ Resolver.java 17 Jan 2002 06:15:24 -0000 1.2 @@ -11,14 +11,14 @@ import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; - import java.io.IOException; /** - * A component that uses catalogs for resolving Entities. + * A component that uses catalogs for resolving entities. * * @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a> - * @version CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:13 $ + * @author <a href="mailto:[EMAIL PROTECTED]">David Crossley</a> + * @version CVS $Revision: 1.2 $ $Date: 2002/01/17 06:15:24 $ */ public interface Resolver extends Component, EntityResolver { @@ -58,7 +58,6 @@ * or Reader for the InputSource. * @see org.xml.sax.InputSource */ - InputSource resolveEntity(String publicId, - String systemId) - throws SAXException, IOException; + InputSource resolveEntity(String publicId, String systemId) + throws SAXException, IOException; } 1.1 xml-cocoon2/src/java/org/apache/cocoon/components/resolver/package.html Index: package.html =================================================================== <html> <head> <title>Catalog Entity Resolver</title> </head> <body> <h1>Catalog Entity Resolver</h1> <p> A component that uses catalogs for resolving external entities. It sets the entity resolver onto the hook provided by the SAX parser, and then handles the resolveEntity() requests. </p> <p> This implementation uses the XML Entity and URI Resolvers published by Norman Walsh. </p> </body>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]