You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@locus.apache.org on 2000/11/10 23:38:57 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/xml/dom DOMBuilder.java

bloritsch    00/11/10 14:38:56

  Modified:    lib      Tag: xml-cocoon2 avalonapi.jar
               src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
                        CocoonComponentSelector.java
                        DefaultComponentManager.java Main.java
               src/org/apache/cocoon/acting Tag: xml-cocoon2
                        HelloAction.java
               src/org/apache/cocoon/components/image Tag: xml-cocoon2
                        JAIJPEGEncoder.java JAIPNGEncoder.java
                        JPEGEncoder.java PNGEncoder.java
               src/org/apache/cocoon/components/language/generator Tag:
                        xml-cocoon2 ProgramGeneratorImpl.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
               src/org/apache/cocoon/components/language/markup/xsp Tag:
                        xml-cocoon2 XSPGenerator.java
               src/org/apache/cocoon/components/language/programming Tag:
                        xml-cocoon2 AbstractProgrammingLanguage.java
                        CompiledProgrammingLanguage.java
               src/org/apache/cocoon/components/language/programming/java
                        Tag: xml-cocoon2 JavaLanguage.java
               src/org/apache/cocoon/components/store Tag: xml-cocoon2
                        FilesystemStore.java
               src/org/apache/cocoon/generation Tag: xml-cocoon2
                        FileGenerator.java ServerPagesGenerator.java
               src/org/apache/cocoon/serialization Tag: xml-cocoon2
                        SVGSerializer.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
               src/org/apache/cocoon/transformation Tag: xml-cocoon2
                        AbstractDOMTransformer.java SQLTransformer.java
                        XIncludeTransformer.java XTTransformer.java
                        XalanTransformer.java
               src/org/apache/cocoon/xml Tag: xml-cocoon2
                        AbstractXMLConsumer.java AbstractXMLProducer.java
                        ContentHandlerWrapper.java
               src/org/apache/cocoon/xml/dom Tag: xml-cocoon2
                        DOMBuilder.java
  Log:
  Updated the avalonapi.jar which includes the logging facility, and better
  exception handling.  Also integrated the org.apache.avalon.util.cli command
  line parsing utility.  Incorporated many logging calls.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +354 -138  xml-cocoon/lib/Attic/avalonapi.jar
  
  	<<Binary file>>
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.36  +30 -8     xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.4.2.35
  retrieving revision 1.4.2.36
  diff -u -r1.4.2.35 -r1.4.2.36
  --- Cocoon.java	2000/11/08 20:34:46	1.4.2.35
  +++ Cocoon.java	2000/11/10 22:38:52	1.4.2.36
  @@ -36,6 +36,9 @@
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.DefaultComponentManager;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   import org.xml.sax.SAXException;
   import org.xml.sax.InputSource;
   
  @@ -43,11 +46,13 @@
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4.2.35 $ $Date: 2000/11/08 20:34:46 $
  + * @version CVS $Revision: 1.4.2.36 $ $Date: 2000/11/10 22:38:52 $
    */
   public class Cocoon
     implements Component, Configurable, ComponentManager, Modifiable, Processor, Constants {
   
  +    private Logger log = LogKit.getLoggerFor("cocoon");
  +
       /** The table of role-class */
       private HashMap components = new HashMap();
   
  @@ -82,15 +87,19 @@
        * Create a new <code>Cocoon</code> instance.
        */
       protected Cocoon() throws ConfigurationException {
  +        log.debug("New Cocoon object.");
           // Set the system properties needed by Xalan2.
           setSystemProperties();
   
           // Setup the default parser, for parsing configuration.
           // If one need to use a different parser, set the given system property
           String parser = System.getProperty(PARSER_PROPERTY, DEFAULT_PARSER);
  +        log.debug("Using parser: " + parser);
  +
           try {
               this.componentManager.addComponent(Roles.PARSER, ClassUtils.loadClass(parser),null);
           } catch ( Exception e ) {
  +            log.error("Could not load parser, Cocoon object not created.", e);
               throw new ConfigurationException("Could not load parser " + parser + ": " + e.getMessage());
           }
           this.componentManager.addComponentInstance(Roles.COCOON, this);
  @@ -101,24 +110,28 @@
        * the specified file.
        */
       public Cocoon(File configurationFile, String classpath, String workDir)
  -    throws SAXException, IOException, ConfigurationException {
  +    throws SAXException, IOException, ConfigurationException,
  +    ComponentNotFoundException, ComponentNotAccessibleException {
           this();
   
           this.classpath = classpath;
  +        log.debug("Classpath = " + classpath);
   
           this.workDir = workDir;
  +        log.debug("Work directory = " + workDir);
   
           this.configurationFile = configurationFile;
           if (!configurationFile.isFile()) {
  +            log.error("Could not open configuration file, Cocoon object not created");
               throw new FileNotFoundException(configurationFile.toString());
           }
   
           Parser p = (Parser) this.lookup(Roles.PARSER);
           ConfigurationBuilder b = new ConfigurationBuilder();
  -	String path = this.configurationFile.getPath();
  +        String path = this.configurationFile.getPath();
           InputSource is = new InputSource(new FileReader(path));
  -	is.setSystemId(path);
  -	b.setXMLReader(p.getXMLReader());
  +            is.setSystemId(path);
  +        b.setXMLReader(p.getXMLReader());
           this.configure(b.build(is));
           this.root = this.configurationFile.getParentFile().toURL();
       }
  @@ -128,6 +141,7 @@
        * @param root The new Cocoon root.
        */
       public void setRoot(URL root) {
  +        log.debug("Root URL set to: " + root.toExternalForm());
           this.root = root;
       }
   
  @@ -155,14 +169,18 @@
   
           this.configuration = conf;
   
  +        log.debug("Root configuration: " + conf.getName());
           if (!"cocoon".equals(conf.getName())) {
               throw new ConfigurationException("Invalid configuration file\n" + conf.toString());
           }
  +
  +        log.debug("Configuration version: " + conf.getAttribute("version"));
           if (!CONF_VERSION.equals(conf.getAttribute("version"))) {
               throw new ConfigurationException("Invalid configuration schema version. Must be '"
                   + CONF_VERSION + "'."/*, conf*/);
           }
   
  +        log.debug("Setting up components...");
           // Set components
           Iterator e = conf.getChildren("component");
           while (e.hasNext()) {
  @@ -170,18 +188,19 @@
               String role = co.getAttribute("role");
               String className = co.getAttribute("class");
               try {
  +                log.debug("Adding component (" + role + " = " + className + ")");
                   componentManager.addComponent(role,ClassUtils.loadClass(className),co);
               } catch ( Exception ex ) {
  +                log.error("Could not load class " + className, ex);
                   throw new ConfigurationException("Could not get class " + className
  -                    + " for role " + role + ": " + ex.getMessage()/*,
  -                    (Configuration)e*/
  -                );
  +                    + " for role " + role + ": " + ex.getMessage());
               }
           }
   
           // Create the sitemap
           Configuration sconf = conf.getChild("sitemap");
           if (sconf == null) {
  +            log.error("Sitemap location is not specified");
               throw new ConfigurationException("No sitemap configuration");
           }
           this.sitemapManager = new Manager(null);
  @@ -189,8 +208,11 @@
           this.sitemapManager.configure(conf);
           this.sitemapFileName = sconf.getAttribute("file");
           if (this.sitemapFileName == null) {
  +            log.error("No sitemap file name");
               throw new ConfigurationException("No sitemap file name\n" + conf.toString());
           }
  +
  +        log.debug("Sitemap location = " + this.sitemapFileName);
       }
   
       /**
  
  
  
  1.1.2.3   +3 -2      xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java
  
  Index: CocoonComponentSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/CocoonComponentSelector.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- CocoonComponentSelector.java	2000/10/23 19:29:52	1.1.2.2
  +++ CocoonComponentSelector.java	2000/11/10 22:38:52	1.1.2.3
  @@ -31,7 +31,7 @@
   /** Default component manager for Cocoon's non sitemap components.
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/10/23 19:29:52 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/11/10 22:38:52 $
    */
   public class CocoonComponentSelector implements ComponentSelector, Composer {
       /** Hashmap of all components which this ComponentManager knows about.
  @@ -154,7 +154,8 @@
        * @param componentClass the class to retrieve an instance of.
        * @return and instance of the component.
        */
  -    private Component getThreadsafeComponent(Class componentClass) {
  +    private Component getThreadsafeComponent(Class componentClass)
  +    throws ComponentNotAccessibleException {
           Component component = (Component)threadSafeInstances.get(componentClass);
   
           if ( component == null ) {
  
  
  
  1.1.2.3   +28 -5     xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java
  
  Index: DefaultComponentManager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- DefaultComponentManager.java	2000/10/19 14:42:37	1.1.2.2
  +++ DefaultComponentManager.java	2000/11/10 22:38:52	1.1.2.3
  @@ -30,11 +30,17 @@
   import org.apache.cocoon.util.ComponentPoolController;
   import org.apache.cocoon.CocoonComponentSelector;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   /** Default component manager for Cocoon's non sitemap components.
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/10/19 14:42:37 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/11/10 22:38:52 $
    */
   public class DefaultComponentManager implements ComponentManager {
  +
  +    protected Logger log = LogKit.getLoggerFor("cocoon");
  +
       /** Hashmap of all components which this ComponentManager knows about.
        */
       private Map components;
  @@ -74,6 +80,7 @@
           Component component;
   
           if ( role == null ) {
  +	    log.debug("Attempted to retrieve a component with a null Role");
               throw new ComponentNotFoundException("Attempted to retrieve component will null roll.");
           }
   
  @@ -81,16 +88,20 @@
           Class componentClass = (Class)this.components.get(role);
   
           if ( componentClass == null ) {
  +	    log.debug("componentClass for " + role + " is null");
               component = (Component)this.instances.get(role);
               if ( component == null ) {
  +	        log.error(role + " could not be found");
                   throw new ComponentNotFoundException("Could not find component for role '" + role + "'.");
               } else {
  +	        log.error(role + " instance was found");
                   // we found an individual instance of a component.
                   return component;
               }
           }
   
           if ( !Component.class.isAssignableFrom(componentClass) ) {
  +	    log.error("The object found is not a Component");
               throw new ComponentNotAccessibleException(
                   "Component with role '" + role + "' (" + componentClass.getName() + ")does not implement Component.",
                   null
  @@ -99,18 +110,23 @@
   
           // Work out what class of component we're dealing with.
           if ( ThreadSafe.class.isAssignableFrom(componentClass) ) {
  +	    log.debug(role + " is ThreadSafe");
               component = getThreadsafeComponent(componentClass);
           } else if ( Poolable.class.isAssignableFrom(componentClass) ) {
  +	    log.debug(role + " is Poolable");
               component = getPooledComponent(componentClass);
           } else if ( SingleThreaded.class.isAssignableFrom(componentClass) ) {
  +	    log.debug(role + " is SingleThreaded");
               try {
                   component = (Component)componentClass.newInstance();
               } catch ( InstantiationException e ) {
  +	        log.error("Could not create new instance of SingleThreaded " + role, e);
                   throw new ComponentNotAccessibleException(
                       "Could not instantiate component " + componentClass.getName() + ": " + e.getMessage(),
                       e
                   );
               } catch ( IllegalAccessException e ) {
  +	        log.error("Could not access class " + componentClass.getName(), e);
                   throw new ComponentNotAccessibleException(
                       "Could not access class " + componentClass.getName() + ": " + e.getMessage(),
                       e
  @@ -121,14 +137,17 @@
               /* The component doesn't implement any of the Avalon marker
                * classes, treat as normal.
                */
  +	    log.debug(role + " is a normal Component");
               try {
                   component = (Component)componentClass.newInstance();
               } catch ( InstantiationException e ) {
  +	        log.error("Could not create new instance of class " + componentClass.getName(), e);
                   throw new ComponentNotAccessibleException(
                       "Could not instantiate component " + componentClass.getName() + ": " + e.getMessage(),
                       e
                   );
               } catch ( IllegalAccessException e ) {
  +	        log.error("Could not access class " + componentClass.getName(), e);
                   throw new ComponentNotAccessibleException(
                       "Could not access class " + componentClass.getName() + ": " + e.getMessage(),
                       e
  @@ -144,7 +163,8 @@
        * @param componentClass the class to retrieve an instance of.
        * @return and instance of the component.
        */
  -    private Component getThreadsafeComponent(Class componentClass) {
  +    private Component getThreadsafeComponent(Class componentClass)
  +    throws ComponentNotAccessibleException {
           Component component = (Component)threadSafeInstances.get(componentClass);
   
           if ( component == null ) {
  @@ -229,7 +249,8 @@
        * @param component the class of this component.
        * @param Configuration the configuration for this component.
        */
  -    public void addComponent(String role, Class component, Configuration config) {
  +    public void addComponent(String role, Class component, Configuration config)
  +    throws ConfigurationException {
           if (component.equals(CocoonComponentSelector.class)) {
               CocoonComponentSelector selector = new CocoonComponentSelector();
               Iterator instances = config.getChildren("component-instance");
  @@ -240,10 +261,12 @@
                   Configuration current = (Configuration) instances.next();
                   Object hint = current.getAttribute("name");
                   String className = (String) current.getAttribute("class");
  -
  -                try {
  +		log.debug("Adding new Component " + className +
  +		              " for hint: " + hint);
  +	        try {
                       selector.addComponent(hint, ClassUtils.loadClass(className), current);
                   } catch (Exception e) {
  +		    log.error("The component instance for \"" + hint + "\" has an invalid class name.", e);
                       throw new ConfigurationException("The component instance for '" + hint + "' has an invalid class name.");
                   }
               }
  
  
  
  1.1.4.13  +161 -99   xml-cocoon/src/org/apache/cocoon/Attic/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Main.java,v
  retrieving revision 1.1.4.12
  retrieving revision 1.1.4.13
  diff -u -r1.1.4.12 -r1.1.4.13
  --- Main.java	2000/10/06 21:25:27	1.1.4.12
  +++ Main.java	2000/11/10 22:38:52	1.1.4.13
  @@ -15,6 +15,8 @@
   import java.io.PrintStream;
   import java.io.OutputStream;
   
  +import java.net.MalformedURLException;
  +
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.List;
  @@ -22,6 +24,11 @@
   import java.util.Map;
   import java.util.HashMap;
   
  +import org.apache.avalon.util.cli.CLArgsParser;
  +import org.apache.avalon.util.cli.CLOption;
  +import org.apache.avalon.util.cli.CLOptionDescriptor;
  +import org.apache.avalon.util.cli.CLUtil;
  +
   import org.apache.cocoon.util.IOUtils;
   import org.apache.cocoon.util.NetUtils;
   import org.apache.cocoon.util.MIMEUtils;
  @@ -30,97 +37,167 @@
   import org.apache.cocoon.environment.commandline.LinkSamplingEnvironment;
   import org.apache.cocoon.environment.commandline.FileSavingEnvironment;
   
  +import org.apache.log.LogKit;
  +import org.apache.log.Logger;
  +import org.apache.log.Priority;
   
   /**
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.4.12 $ $Date: 2000/10/06 21:25:27 $
  + * @version CVS $Revision: 1.1.4.13 $ $Date: 2000/11/10 22:38:52 $
    */
   
   public class Main {
   
  +    protected static Logger log = null;
  +
  +    protected static final int HELP_OPT =        'h';
  +    protected static final int VERSION_OPT =     'v';
  +    protected static final int LOG_URL_OPT =     'l';
  +    protected static final int LOG_LEVEL_OPT =   'u';
  +    protected static final int CONTEXT_DIR_OPT = 'c';
  +    protected static final int DEST_DIR_OPT =    'd';
  +    protected static final int WORK_DIR_OPT =    'w';
  +
  +    protected static final CLOptionDescriptor [] options = new CLOptionDescriptor [] {
  +        new CLOptionDescriptor("help",
  +                               CLOptionDescriptor.ARGUEMENT_OPTIONAL,
  +                               HELP_OPT,
  +                               "print this message and exit"),
  +        new CLOptionDescriptor("version",
  +                               CLOptionDescriptor.ARGUEMENT_OPTIONAL,
  +                               VERSION_OPT,
  +                               "print the version information and exit"),
  +        new CLOptionDescriptor("logUrl",
  +                               CLOptionDescriptor.ARGUEMENT_OPTIONAL,
  +                               LOG_URL_OPT,
  +                               "use given file/URL for log"),
  +        new CLOptionDescriptor("logLevel",
  +                               CLOptionDescriptor.ARGUEMENT_OPTIONAL,
  +                               LOG_LEVEL_OPT,
  +                               "choose the minimum log level for logging (DEBUG, INFO, WARN, ERROR, FATAL_ERROR)"),
  +        new CLOptionDescriptor("contextDir",
  +                               CLOptionDescriptor.ARGUEMENT_OPTIONAL,
  +                               CONTEXT_DIR_OPT,
  +                               "use given dir as context"),
  +        new CLOptionDescriptor("destDir",
  +                               CLOptionDescriptor.ARGUEMENT_OPTIONAL,
  +                               DEST_DIR_OPT,
  +                               "use given dir as destination"),
  +        new CLOptionDescriptor("workDir",
  +                               CLOptionDescriptor.ARGUEMENT_OPTIONAL,
  +                               WORK_DIR_OPT,
  +                               "use given dir as working directory")
  +    };
  +
  +
       public static void main(String[] args) throws Exception {
   
           String destDir = Cocoon.DEFAULT_DEST_DIR;
           String contextDir = Cocoon.DEFAULT_CONTEXT_DIR;
           String workDir = Cocoon.DEFAULT_WORK_DIR;
           List targets = new ArrayList();
  -        
  -        for (int i = 0; i < args.length; i++) {
  -            String arg = args[i];
  -
  -            if (arg.equals("-h") || arg.equals("--help")) {
  -                printUsage();
  -            } else if (arg.equals("-v") || arg.equals("--version")) {
  -                printVersion();
  -            } else if (arg.equals("-d") || arg.equals("--destDir")) {
  -                try {
  -                    destDir = args[i + 1];
  -                    i++;
  -                } catch (ArrayIndexOutOfBoundsException e) {
  -                    error("Careful, you must specify a destination dir when " +
  +        CLArgsParser parser = new CLArgsParser(args, options);
  +        String logUrl = "";
  +        String unprocessed[];
  +        String logLevel = "DEBUG";
  +
  +        LogKit.setGlobalPriority(Priority.DEBUG);
  +
  +        List clOptions = parser.getArguements();
  +        int size = clOptions.size();
  +
  +        for (int i = 0; i < size; i++) {
  +            CLOption option = (CLOption) clOptions.get(i);
  +
  +            switch (option.getId()) {
  +                case 0:
  +                    LogKit.log("Sorry, cannot recognize the argument: \'" + option.getId() + "\'\n");
  +                    break;
  +
  +                case Main.HELP_OPT:
  +                    printUsage();
  +                    break;
  +
  +                case Main.VERSION_OPT:
  +                    printVersion();
  +                    break;
  +
  +                case Main.DEST_DIR_OPT:
  +                    destDir = option.getArguement();
  +                    break;
  +
  +                case Main.WORK_DIR_OPT:
  +                    workDir = option.getArguement();
  +                    break;
  +
  +                case Main.CONTEXT_DIR_OPT:
  +                    contextDir = option.getArguement();
  +                    break;
  +
  +                case Main.LOG_URL_OPT:
  +                    logUrl = option.getArguement();
  +                    break;
  +
  +                case Main.LOG_LEVEL_OPT:
  +                    logLevel = option.getArguement();
  +                    break;
  +            }
  +        }
  +
  +        unprocessed = parser.getUnparsedArgs();
  +        for (int i = 0; i < unprocessed.length; i++) {
  +            targets.add(unprocessed[i]);
  +        }
  +
  +        try {
  +            log = LogKit.createLogger("cocoon", logUrl, logLevel);
  +        } catch (MalformedURLException mue) {
  +            LogKit.log("Cannot write on the specified log file. " +
  +                        "Please, make sure the path exists and you have write permissions.",
  +                        mue);
  +            System.exit(1);
  +        }
  +
  +        if (destDir.equals("")) {
  +            log.fatalError("Careful, you must specify a destination dir when " +
                           "using the -d/--destDir argument");
  -                }
  -            } else if (arg.equals("-w") || arg.equals("--workDir")) {
  -                try {
  -                    workDir = args[i + 1];
  -                    i++;
  -                } catch (ArrayIndexOutOfBoundsException e) {
  -                    error("Careful, you must specify a destination dir when " +
  -                        "using the -w/--workDir argument");
  -                }
  -            } else if (arg.equals("-c") || arg.equals("--contextDir")) {
  -                try {
  -                    contextDir = args[i + 1];
  -                    i++;
  -                } catch (ArrayIndexOutOfBoundsException e) {
  -                    error("Careful, you must specify a configuration file when " +
  +            System.exit(1);
  +        }
  +
  +        if (contextDir.equals("")) {
  +            log.error("Careful, you must specify a configuration file when " +
                           "using the -c/--contextDir argument");
  -                }
  -            } else if (arg.equals("-l") || arg.equals("--logFile")) {
  -                try {
  -                    String logFile = args[i + 1];
  -                    i++;
  -                    PrintStream out = new PrintStream(new FileOutputStream(logFile));
  -                    System.setOut(out);
  -                    System.setErr(out);
  -                } catch (IOException e) {
  -                    error("Cannot write on the specified log file. " +
  -                        "Please, make sure the path exists and you have write permissions.");
  -                } catch (ArrayIndexOutOfBoundsException e) {
  -                    error("Careful, you must specify a log file when " +
  -                        "using the -l/--logFile argument");
  -                }
  -            } else if (arg.startsWith("-")) {
  -                // we don't have any more args to recognize!
  -                error("Sorry, cannot recognize the argument: " + arg + "\n");
  -            } else {
  -                // if it's no other arg, it must be the starting URI
  -                targets.add(arg);
  -            }
  +            System.exit(1);
  +        }
   
  +        if (workDir.equals("")) {
  +            log.error("Careful, you must specify a destination dir when " +
  +                        "using the -w/--workDir argument");
  +            System.exit(1);
           }
   
           if (targets.size() == 0) {
  -            error("Please, specify at least one starting URI.");
  +            log.error("Please, specify at least one starting URI.");
  +            System.exit(1);
           }
  -        
  +
           try {
               File dest = getDir(destDir, "destination");
               File work = getDir(workDir, "working");
               File context = getDir(contextDir, "context");
               File conf = getConfigurationFile(context);
               Main main = new Main(new Cocoon(conf, null, work.toString()), context, dest);
  -            log("Warming up...");
  -            log(" [Cocoon might need to compile the sitemaps, this might take a while]");
  +            log.info("Warming up...");
  +            log.info(" [Cocoon might need to compile the sitemaps, this might take a while]");
               main.warmup();
  -            log("...ready, let's go:");
  +            log.info("...ready, let's go:");
               main.process(targets);
  -            log("Done");
  +            log.info("Done");
           } catch (Exception e) {
  -            error("Exception caught (" + e.getClass().getName() + "): " + e.getMessage() + "\n");
  -            e.printStackTrace();
  +            log.fatalError("Exception caught ", e);
  +            System.exit(1);
           }
       }
   
  @@ -138,35 +215,17 @@
           msg.append("------------------------------------------------------------------------ " + lSep + lSep);
           msg.append("Usage: java org.apache.cocoon.Main [options] [targets]" + lSep + lSep);
           msg.append("Options: " + lSep);
  -        msg.append("  -h/--help              print this message and exit" + lSep);
  -        msg.append("  -v/--version           print the version information and exit" + lSep);
  -        msg.append("  -l/--logFile <file>    use given file for log" + lSep);
  -        msg.append("  -c/--contextDir <file> use given dir as context" + lSep);
  -        msg.append("  -d/--destDir <dir>     use given dir as destination" + lSep);
  -        msg.append("  -w/--workDir <dir>     use given dir as working directory" + lSep + lSep);
  +        msg.append(CLUtil.describeOptions(Main.options).toString());
           msg.append("Note: the context directory defaults to '" + Cocoon.DEFAULT_CONTEXT_DIR + "'" + lSep);
           System.out.println(msg.toString());
  -        System.exit(1);
  -    }
  -
  -    public static void log(String msg) {
  -        System.out.println("[log] " + msg);
  -    }
  -
  -    public static void warning(String msg) {
  -        System.out.println("[warning] " + msg);
  +        System.exit(0);
       }
   
  -    public static void error(String msg) {
  -        System.err.println("[error] " + msg);
  -        System.exit(1);
  -    }
  -    
       private static File getConfigurationFile(File dir) throws Exception {
   
           File f = new File(dir, Cocoon.DEFAULT_CONF_FILE);
           if (f.canRead()) return f;
  -        
  +
           f = new File(System.getProperty("user.dir") + File.separator + Cocoon.DEFAULT_CONF_FILE);
           if (f.canRead()) return f;
   
  @@ -196,9 +255,9 @@
   
           return d;
       }
  -    
  +
       // -----------------------------------------------------------------------
  -    
  +
       private Cocoon cocoon;
       private File destDir;
       private File context;
  @@ -243,20 +302,20 @@
        *  <li>after the complete list of links is translated, the link-translating
        *      view of the resource is called to obtain a link-translated version
        *      of the resource with the given link map</li>
  -     *  <li>the resource is saved on disk and the URI MIME type is checked for 
  +     *  <li>the resource is saved on disk and the URI MIME type is checked for
        *      consistency with the URI and, if the extension is inconsistent
        *      or absent, the file is renamed</li>
        *  <li>then the file name of the translated URI is returned</li>
        * </ul>
        */
       public String processURI(String uri, int level) throws Exception {
  -        log(leaf(level) + uri);
  +        log.info("Processing URI: " + leaf(level) + uri);
   
           Collection links = this.getLinks(uri);
           Map translatedLinks = new HashMap(links.size());
           Iterator i = links.iterator();
           while (i.hasNext()) {
  -            log(tree(level));
  +            log.info(tree(level));
               String path = NetUtils.getPath(uri);
               String relativeLink = (String) i.next();
               String absoluteLink = NetUtils.normalize(NetUtils.absolutize(path, relativeLink));
  @@ -264,7 +323,7 @@
               String translatedRelativeLink = NetUtils.relativize(path, translatedAbsoluteLink);
               translatedLinks.put(relativeLink, translatedRelativeLink);
           }
  -        
  +
           String filename = mangle(uri);
           File file = IOUtils.createFile(destDir, filename);
           FileOutputStream output = new FileOutputStream(file);
  @@ -273,7 +332,7 @@
   
           String ext = NetUtils.getExtension(filename);
           String defaultExt = MIMEUtils.getDefaultExtension(type);
  -        
  +
           if ((ext == null) || (!ext.equals(defaultExt))) {
               filename += defaultExt;
               File newFile = IOUtils.createFile(destDir, filename);
  @@ -281,36 +340,39 @@
               file = newFile;
           }
   
  -        log(tree(level));
  +        log.info(tree(level));
   
           if (type == null) {
  -            log(leaf(level + 1) + "[broken link]--> " + filename);
  +            log.warn(leaf(level + 1) + "[broken link]--> " + filename);
               resourceUnavailable(file);
           } else {
  -            log(leaf(level + 1) + "[" + type + "]--> " + filename);
  +            log.info(leaf(level + 1) + "[" + type + "]--> " + filename);
           }
  -        
  +
           return filename;
  -    }        
  +    }
   
       void resourceUnavailable(File file) throws IOException {
           PrintStream out = new PrintStream(new FileOutputStream(file));
           out.println(
              "<html><head><title>Page Not Available</title></head>" +
              "<body><h1 align=\"center\">Page Not Available</h1>" +
  -           "<body><p align=\"center\">Generated by " + 
  +           "<body><p align=\"center\">Generated by " +
              Cocoon.COMPLETE_NAME +
              "</p></body></html>"
           );
  -        out.close();        
  +        out.close();
       }
  -    
  +
       String mangle(String uri) {
  +        log.debug("mangle(\"" + uri + "\")");
           if (uri.charAt(uri.length() - 1) == '/') uri += Cocoon.INDEX_URI;
           uri = uri.replace('"', '\'');
  -        return uri.replace('?','_');
  +        uri = uri.replace('?', '_');
  +        log.debug(uri);
  +        return uri;
       }
  -    
  +
       String leaf(int level) {
           if (level == 0) return "";
           return tree(level - 2) + "+--";
  @@ -323,7 +385,7 @@
           }
           return buffer.toString();
       }
  -    
  +
       Collection getLinks(String uri) throws Exception {
           HashMap parameters = new HashMap();
           String deparameterizedURI = NetUtils.deparameterize(uri, parameters);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +10 -4     xml-cocoon/src/org/apache/cocoon/acting/Attic/HelloAction.java
  
  Index: HelloAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/HelloAction.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- HelloAction.java	2000/10/30 18:37:41	1.1.2.3
  +++ HelloAction.java	2000/11/10 22:38:52	1.1.2.4
  @@ -17,15 +17,21 @@
   import org.apache.avalon.Component;
   import org.apache.avalon.Parameters;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   import org.xml.sax.SAXException;
   import org.xml.sax.EntityResolver;
   
   /**
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/10/30 18:37:41 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/11/10 22:38:52 $
    */
   public class HelloAction implements Action {
  +
  +    private Logger log = LogKit.getLoggerFor("cocoon");
  +
       /**
        * A simple Action that logs if the <code>Session</code> object
        * has been created
  @@ -48,12 +54,12 @@
               } else {
                   if (session != null) {
                       if (session.isNew()) {
  -                        System.out.println("Session is new");
  +                        log.debug("Session is new");
                       } else {
  -                        System.out.println("Session is old");
  +                        log.debug("Session is old");
                       }
                   } else {
  -                    System.out.println("A session object was not created");
  +                    log.debug("A session object was not created");
                   }
               }
           }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +26 -21    xml-cocoon/src/org/apache/cocoon/components/image/Attic/JAIJPEGEncoder.java
  
  Index: JAIJPEGEncoder.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/image/Attic/JAIJPEGEncoder.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- JAIJPEGEncoder.java	2000/10/19 14:42:56	1.1.2.4
  +++ JAIJPEGEncoder.java	2000/11/10 22:38:53	1.1.2.5
  @@ -16,6 +16,9 @@
   import com.sun.media.jai.codec.JPEGEncodeParam;
   import com.sun.media.jai.codec.ImageCodec;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   /**
    * A JPEG Image Encoder.  This class delegates the actual compression to
    * the codecs supplied with the Java Advanced Imaging API.
  @@ -25,36 +28,38 @@
    */
   public class JAIJPEGEncoder implements ImageEncoder, Configurable {
   
  +    private Logger log = LogKit.getLoggerFor("cocoon");
  +
       /** The quality level. The default is 0.75 (high quality) */
       private float quality;
   
       public void configure(Configuration conf) throws ConfigurationException {
  -		// Using the passed Configuration, generate a far more friendly Parameters object.
  -		Parameters p = Parameters.fromConfiguration(conf);
  -		quality = p.getParameterAsFloat("quality", 0.75f);
  -		//System.err.println("Quality set to " + quality);
  +        // Using the passed Configuration, generate a far more friendly Parameters object.
  +        Parameters p = Parameters.fromConfiguration(conf);
  +        quality = p.getParameterAsFloat("quality", 0.75f);
  +        log.debug("Quality set to " + quality);
       }
   
       public String getMimeType() {
  -		return "image/jpeg";
  +        return "image/jpeg";
       }
   
       public void encode(BufferedImage image, OutputStream out) throws IOException {
  -		// The JPEG encoder requires 3 band byte-based images, so create a new image
  -		// TODO: find a faster way of doing this
  -		int w = image.getWidth();
  -		int h = image.getHeight();
  -		BufferedImage noalpha = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
  -		Raster raster = image.getRaster().createChild(0, 0, w, h, 0, 0, new int[] {0, 1, 2});
  -		noalpha.setData(raster);
  -
  -		JPEGEncodeParam param = new JPEGEncodeParam();
  -		param.setQuality(quality);
  -		com.sun.media.jai.codec.ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG", out, param);
  -		if (encoder != null) {
  -			encoder.encode(noalpha);
  -		} else {
  -			throw new RuntimeException("JPEG Encoder not found");
  -		}
  +        // The JPEG encoder requires 3 band byte-based images, so create a new image
  +        // TODO: find a faster way of doing this
  +        int w = image.getWidth();
  +        int h = image.getHeight();
  +        BufferedImage noalpha = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
  +        Raster raster = image.getRaster().createChild(0, 0, w, h, 0, 0, new int[] {0, 1, 2});
  +        noalpha.setData(raster);
  +
  +        JPEGEncodeParam param = new JPEGEncodeParam();
  +        param.setQuality(quality);
  +        com.sun.media.jai.codec.ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG", out, param);
  +        if (encoder != null) {
  +            encoder.encode(noalpha);
  +        } else {
  +            throw new RuntimeException("JPEG Encoder not found");
  +        }
       }
   }
  
  
  
  1.1.2.5   +25 -20    xml-cocoon/src/org/apache/cocoon/components/image/Attic/JAIPNGEncoder.java
  
  Index: JAIPNGEncoder.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/image/Attic/JAIPNGEncoder.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- JAIPNGEncoder.java	2000/10/19 14:42:57	1.1.2.4
  +++ JAIPNGEncoder.java	2000/11/10 22:38:53	1.1.2.5
  @@ -5,7 +5,7 @@
    * version 1.1, a copy of which has been included  with this distribution in *
    * the LICENSE file.                                                         *
    *****************************************************************************/
  - 
  +
   package org.apache.cocoon.components.image;
   
   import org.apache.avalon.*;
  @@ -16,6 +16,9 @@
   import com.sun.media.jai.codec.PNGEncodeParam;
   import com.sun.media.jai.codec.ImageCodec;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   /**
    * A PNG Image Encoder.  This class delegates the actual compression to
    * the codecs supplied with the Java Advanced Imaging API.
  @@ -26,34 +29,36 @@
    */
   public class JAIPNGEncoder implements ImageEncoder, Configurable {
   
  +    private Logger log = LogKit.getLoggerFor("cocoon");
  +
       private boolean interlaced;
       private boolean alpha;
   
       public void configure(Configuration conf) throws ConfigurationException {
  -		// Using the passed Configuration, generate a far more friendly Parameters object.
  -		Parameters p = Parameters.fromConfiguration(conf);
  -		interlaced = p.getParameterAsBoolean("interlaced", true);
  -		alpha = p.getParameterAsBoolean("alpha", true);
  -		// TODO: colour depth
  -        //System.err.println("Interlaced set to " + interlaced);
  +        // Using the passed Configuration, generate a far more friendly Parameters object.
  +        Parameters p = Parameters.fromConfiguration(conf);
  +        interlaced = p.getParameterAsBoolean("interlaced", true);
  +        alpha = p.getParameterAsBoolean("alpha", true);
  +        // TODO: colour depth
  +        log.debug("Interlaced set to " + interlaced);
       }
   
       public String getMimeType() {
  -		return "image/png";
  +        return "image/png";
       }
   
       public void encode(BufferedImage image, OutputStream out) throws IOException {
  -		PNGEncodeParam param = PNGEncodeParam.getDefaultEncodeParam(image);
  -		// Set the alpha (defaults to on)
  -		if (!alpha)
  -			param.unsetTransparency();
  -	
  -		// Encode the image (damn class name collisions!)
  -		com.sun.media.jai.codec.ImageEncoder encoder = ImageCodec.createImageEncoder("PNG", out, param);
  -		if (encoder != null) {
  -			encoder.encode(image);
  -		} else {
  -			throw new RuntimeException("PNG Encoder not found");
  -		}
  +        PNGEncodeParam param = PNGEncodeParam.getDefaultEncodeParam(image);
  +        // Set the alpha (defaults to on)
  +        if (!alpha)
  +            param.unsetTransparency();
  +
  +        // Encode the image (damn class name collisions!)
  +        com.sun.media.jai.codec.ImageEncoder encoder = ImageCodec.createImageEncoder("PNG", out, param);
  +        if (encoder != null) {
  +            encoder.encode(image);
  +        } else {
  +            throw new RuntimeException("PNG Encoder not found");
  +        }
       }
   }
  
  
  
  1.1.2.5   +27 -22    xml-cocoon/src/org/apache/cocoon/components/image/Attic/JPEGEncoder.java
  
  Index: JPEGEncoder.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/image/Attic/JPEGEncoder.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- JPEGEncoder.java	2000/10/19 14:42:58	1.1.2.4
  +++ JPEGEncoder.java	2000/11/10 22:38:53	1.1.2.5
  @@ -15,6 +15,9 @@
   import java.awt.image.*;
   import com.sun.image.codec.jpeg.*;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   /**
    * A JPEG Image Encoder.  This class delegates the actual compression to
    * Sun's JPEG codec (supplied with Sun's JDK).
  @@ -25,39 +28,41 @@
    */
   public class JPEGEncoder implements ImageEncoder, Configurable {
   
  +    private Logger log = LogKit.getLoggerFor("cocoon");
  +
       /** The quality level. The default is 0.75 (high quality) */
       private float quality;
       /** Force baseline flag.  The default is true; */
       private boolean baseline;
   
       public void configure(Configuration conf) throws ConfigurationException {
  -		// Using the passed Configuration, generate a far more friendly Parameters object.
  -		Parameters p = Parameters.fromConfiguration(conf);
  -		quality = p.getParameterAsFloat("quality", 0.75f);
  -		baseline = p.getParameterAsBoolean("baseline", true);
  -		//System.err.println("JPEG Encoder[quality: " + quality + ", baseline: " + baseline + "]");
  +        // Using the passed Configuration, generate a far more friendly Parameters object.
  +        Parameters p = Parameters.fromConfiguration(conf);
  +        quality = p.getParameterAsFloat("quality", 0.75f);
  +        baseline = p.getParameterAsBoolean("baseline", true);
  +        log.debug("JPEG Encoder[quality: " + quality + ", baseline: " + baseline + "]");
       }
   
       public String getMimeType() {
  -		return "image/jpeg";
  +        return "image/jpeg";
       }
   
       public void encode(BufferedImage image, OutputStream out) throws IOException {
  -		// The JPEG encoder requires 3 band byte-based images, so create a new image
  -		// TODO: find a faster way of doing this
  -		int w = image.getWidth();
  -		int h = image.getHeight();
  -		BufferedImage noalpha = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
  -		Raster raster = image.getRaster().createChild(0, 0, w, h, 0, 0, new int[] {0, 1, 2});
  -		noalpha.setData(raster);
  -
  -		// Get an instance of the JPEG compression parameters
  -		JPEGEncodeParam jpar=JPEGCodec.getDefaultJPEGEncodeParam(noalpha);
  -		// Configure the quality
  -		jpar.setQuality(quality, baseline);
  -		// Get a JPEG encoder
  -		JPEGImageEncoder jenc=JPEGCodec.createJPEGEncoder(out,jpar);
  -		// And output the image
  -		jenc.encode(noalpha);
  +        // The JPEG encoder requires 3 band byte-based images, so create a new image
  +        // TODO: find a faster way of doing this
  +        int w = image.getWidth();
  +        int h = image.getHeight();
  +        BufferedImage noalpha = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
  +        Raster raster = image.getRaster().createChild(0, 0, w, h, 0, 0, new int[] {0, 1, 2});
  +        noalpha.setData(raster);
  +
  +        // Get an instance of the JPEG compression parameters
  +        JPEGEncodeParam jpar=JPEGCodec.getDefaultJPEGEncodeParam(noalpha);
  +        // Configure the quality
  +        jpar.setQuality(quality, baseline);
  +        // Get a JPEG encoder
  +        JPEGImageEncoder jenc=JPEGCodec.createJPEGEncoder(out,jpar);
  +        // And output the image
  +        jenc.encode(noalpha);
       }
   }
  
  
  
  1.1.2.5   +18 -13    xml-cocoon/src/org/apache/cocoon/components/image/Attic/PNGEncoder.java
  
  Index: PNGEncoder.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/image/Attic/PNGEncoder.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- PNGEncoder.java	2000/10/19 14:43:01	1.1.2.4
  +++ PNGEncoder.java	2000/11/10 22:38:53	1.1.2.5
  @@ -8,7 +8,7 @@
   
   package org.apache.cocoon.components.image;
   
  -import org.apache.cocoon.Parameters;
  +import org.apache.avalon.Parameters;
   import org.apache.avalon.*;
   import java.io.OutputStream;
   import java.io.IOException;
  @@ -16,6 +16,9 @@
   import com.sun.image.codec.jpeg.*;
   import com.keypoint.PngEncoder;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   /**
    * A Portable Network Graphics (PNG) Image Encoder.  This class delegates the
    * actual compression to J. David Eisenberg's PngEncoder package.
  @@ -26,29 +29,31 @@
    */
   public class PNGEncoder implements ImageEncoder, Configurable {
   
  +    private Logger log = LogKit.getLoggerFor("cocoon");
  +
       /** Compression level for gzip (default: 7) */
       private int compression;
       /** Whether to encode the alpha channel (default: yes) */
       private boolean alpha;
   
       public void configure(Configuration conf) throws ConfigurationException {
  -		// Using the passed Configuration, generate a far more friendly Parameters object.
  -		Parameters p = Parameters.fromConfiguration(conf);
  -		compression = p.getParameterAsInteger("compression", 7);
  -		alpha = p.getParameterAsBoolean("alpha", true);
  -		//System.err.println("PNG Encoder[compression: " + compression + ", alpha: " + alpha + "]");
  +        // Using the passed Configuration, generate a far more friendly Parameters object.
  +        Parameters p = Parameters.fromConfiguration(conf);
  +        compression = p.getParameterAsInteger("compression", 7);
  +        alpha = p.getParameterAsBoolean("alpha", true);
  +        log.debug("PNG Encoder[compression: " + compression + ", alpha: " + alpha + "]");
       }
   
       public String getMimeType() {
  -		return "image/png";
  +        return "image/png";
       }
   
       public void encode(BufferedImage image, OutputStream out) throws IOException {
  -		// Get an instance of the compressor
  -		PngEncoder enc = new PngEncoder(image, alpha);
  -		// Set the compression ratio
  -		enc.setCompressionLevel(compression);
  -		// Encode and output
  -		out.write(enc.pngEncode());
  +        // Get an instance of the compressor
  +        PngEncoder enc = new PngEncoder(image, alpha);
  +        // Set the compression ratio
  +        enc.setCompressionLevel(compression);
  +        // Encode and output
  +        out.write(enc.pngEncode());
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.15  +18 -5     xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java,v
  retrieving revision 1.1.2.14
  retrieving revision 1.1.2.15
  diff -u -r1.1.2.14 -r1.1.2.15
  --- ProgramGeneratorImpl.java	2000/10/19 20:21:15	1.1.2.14
  +++ ProgramGeneratorImpl.java	2000/11/10 22:38:53	1.1.2.15
  @@ -38,6 +38,9 @@
   
   import org.apache.cocoon.util.IOUtils;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   import org.w3c.dom.Document;
   import org.w3c.dom.Document;
   
  @@ -49,11 +52,13 @@
    * The default implementation of <code>ProgramGenerator</code>
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.14 $ $Date: 2000/10/19 20:21:15 $
  + * @version CVS $Revision: 1.1.2.15 $ $Date: 2000/11/10 22:38:53 $
    */
   public class ProgramGeneratorImpl
     implements ProgramGenerator, Composer, Configurable
   {
  +
  +    private Logger log = LogKit.getLoggerFor("cocoon");
     /** The auto-reloading option */
     protected boolean autoReload = true;
   
  @@ -80,10 +85,18 @@
      * @param manager The global component manager
      */
     public void compose(ComponentManager manager) {
  -    this.manager = manager;
  -    this.markupSelector = (ComponentSelector) this.manager.lookup(Roles.MARKUP_LANGUAGE);
  -    this.languageSelector = (ComponentSelector) this.manager.lookup(Roles.PROGRAMMING_LANGUAGE);
  -    this.workDir = ((Cocoon) this.manager.lookup(Roles.COCOON)).getWorkDir();
  +      this.manager = manager;
  +
  +      try {
  +          log.debug("Lookup " + Roles.MARKUP_LANGUAGE);
  +          this.markupSelector = (ComponentSelector) this.manager.lookup(Roles.MARKUP_LANGUAGE);
  +	  log.debug("Lookup " + Roles.PROGRAMMING_LANGUAGE);
  +          this.languageSelector = (ComponentSelector) this.manager.lookup(Roles.PROGRAMMING_LANGUAGE);
  +	  log.debug("Lookup " + Roles.COCOON);
  +          this.workDir = ((Cocoon) this.manager.lookup(Roles.COCOON)).getWorkDir();
  +      } catch (Exception e) {
  +          log.error("Could not lookup Component", e);
  +      }
     }
   
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.61  +2 -2      xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
  retrieving revision 1.1.2.60
  retrieving revision 1.1.2.61
  diff -u -r1.1.2.60 -r1.1.2.61
  --- sitemap.xsl	2000/11/06 13:49:30	1.1.2.60
  +++ sitemap.xsl	2000/11/10 22:38:53	1.1.2.61
  @@ -77,7 +77,7 @@
        *
        * @author &lt;a href="mailto:Giacomo.Pati@pwr.ch"&gt;Giacomo Pati&lt;/a&gt;
        * @author &lt;a href="mailto:bloritsch@apache.org"&gt;Berin Loiritsch&lt;/a&gt;
  -     * @version CVS $Revision: 1.1.2.60 $ $Date: 2000/11/06 13:49:30 $
  +     * @version CVS $Revision: 1.1.2.61 $ $Date: 2000/11/10 22:38:53 $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static {
  @@ -202,7 +202,7 @@
             load_component ("!transformer:link-translator!", "org.apache.cocoon.sitemap.LinkTranslator", new DefaultConfiguration(""), null);
   
             <!-- Configure generators -->
  -          <xsl:call-template name="config-components">
  +	  <xsl:call-template name="config-components">
               <xsl:with-param name="name">generator</xsl:with-param>
               <xsl:with-param name="components"
                   select="/map:sitemap/map:components/map:generators/map:generator"/>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +11 -2     xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPGenerator.java
  
  Index: XSPGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPGenerator.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- XSPGenerator.java	2000/10/19 14:43:30	1.1.2.9
  +++ XSPGenerator.java	2000/11/10 22:38:54	1.1.2.10
  @@ -12,17 +12,21 @@
   import org.apache.avalon.ComponentManager;
   import org.apache.cocoon.components.parser.Parser;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   import org.apache.cocoon.generation.AbstractServerPage;
   
   /**
    * Base class for XSP-generated <code>ServerPagesGenerator</code> classes
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/10/19 14:43:30 $
  + * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/11/10 22:38:54 $
    */
   public abstract class XSPGenerator extends AbstractServerPage {
   
     protected Parser parser;
  +  protected Logger log = LogKit.getLoggerFor("cocoon");
   
     /**
      * Set the current <code>ComponentManager</code> instance used by this
  @@ -33,6 +37,11 @@
     public void compose(ComponentManager manager) {
       super.compose(manager);
   
  -    this.parser = (Parser) this.manager.lookup(Roles.PARSER);
  +    try {
  +        log.debug("Looking up " + Roles.PARSER);
  +        this.parser = (Parser) this.manager.lookup(Roles.PARSER);
  +    } catch (Exception e) {
  +        log.error("Can't find component", e);
  +    }
     }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +14 -3     xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/AbstractProgrammingLanguage.java
  
  Index: AbstractProgrammingLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/AbstractProgrammingLanguage.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- AbstractProgrammingLanguage.java	2000/10/19 14:43:35	1.1.2.6
  +++ AbstractProgrammingLanguage.java	2000/11/10 22:38:54	1.1.2.7
  @@ -18,17 +18,22 @@
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.components.language.LanguageException;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   /**
    * Base implementation of <code>ProgrammingLanguage</code>. This class sets the
    * <code>CodeFormatter</code> instance and deletes source program files after
    * unloading.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/10/19 14:43:35 $
  + * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/11/10 22:38:54 $
    */
   public abstract class AbstractProgrammingLanguage
     implements ProgrammingLanguage, Configurable
   {
  +  protected Logger log = LogKit.getLoggerFor("cocoon");
  +
     /** The source code formatter */
     protected Class codeFormatter;
   
  @@ -39,8 +44,10 @@
      */
     public void configure(Configuration conf) throws ConfigurationException {
         try {
  +          log.debug("Setting the parameters");
             this.setParameters( Parameters.fromConfiguration(conf) );
         } catch (Exception e) {
  +          log.error("Could not set Parameters", e);
             throw new ConfigurationException("Could not get parameters because: " +
                                              e.getMessage());
         }
  @@ -60,7 +67,9 @@
         if (className != null) {
           this.codeFormatter = ClassUtils.loadClass(className);
         }
  -    } catch (Exception e) { }
  +    } catch (Exception e) {
  +       log.error("Error with \"code-formatter\" parameter", e);
  +    }
     }
   
     /**
  @@ -73,7 +82,9 @@
       if (this.codeFormatter != null) {
         try {
           return (CodeFormatter) this.codeFormatter.newInstance();
  -      } catch (Exception e) { }
  +      } catch (Exception e) {
  +          log.error("Error instantiating CodeFormatter", e);
  +      }
       }
   
       return null;
  
  
  
  1.1.2.9   +7 -2      xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/CompiledProgrammingLanguage.java
  
  Index: CompiledProgrammingLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/CompiledProgrammingLanguage.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- CompiledProgrammingLanguage.java	2000/10/19 14:43:36	1.1.2.8
  +++ CompiledProgrammingLanguage.java	2000/11/10 22:38:54	1.1.2.9
  @@ -26,7 +26,7 @@
    * and object program files
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/10/19 14:43:36 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/11/10 22:38:54 $
    */
   public abstract class CompiledProgrammingLanguage
     extends AbstractProgrammingLanguage
  @@ -73,7 +73,12 @@
      */
     public void compose(ComponentManager manager) {
       this.manager = manager;
  -    this.classpath = ((Cocoon) this.manager.lookup(Roles.COCOON)).getClasspath();
  +    try {
  +        log.debug("Looking up " + Roles.COCOON);
  +        this.classpath = ((Cocoon) this.manager.lookup(Roles.COCOON)).getClasspath();
  +    } catch (Exception e) {
  +        log.error("Could not find component", e);
  +    }
     }
   
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.11  +8 -3      xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/JavaLanguage.java
  
  Index: JavaLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/JavaLanguage.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- JavaLanguage.java	2000/10/19 14:43:40	1.1.2.10
  +++ JavaLanguage.java	2000/11/10 22:38:54	1.1.2.11
  @@ -30,7 +30,7 @@
    * The Java programming language processor
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/10/19 14:43:40 $
  + * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/11/10 22:38:54 $
    */
   public class JavaLanguage extends CompiledProgrammingLanguage {
   
  @@ -91,8 +91,13 @@
       super.compose(manager);
   
       if (this.classLoaderManager == null) {
  -      this.classLoaderManager =
  -        (ClassLoaderManager) this.manager.lookup(Roles.CLASS_LOADER);
  +      try {
  +          log.debug("Looking up " + Roles.CLASS_LOADER);
  +          this.classLoaderManager =
  +            (ClassLoaderManager) this.manager.lookup(Roles.CLASS_LOADER);
  +      } catch (Exception e) {
  +          log.error("Could not find component", e);
  +      }
       }
     }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +15 -10    xml-cocoon/src/org/apache/cocoon/components/store/Attic/FilesystemStore.java
  
  Index: FilesystemStore.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/store/Attic/FilesystemStore.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- FilesystemStore.java	2000/08/21 17:54:02	1.1.2.4
  +++ FilesystemStore.java	2000/11/10 22:38:54	1.1.2.5
  @@ -5,13 +5,18 @@
   
   import org.apache.cocoon.util.IOUtils;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   import java.io.IOException;
   
   public class FilesystemStore implements Store {
     /** The directory repository */
     protected File directoryFile;
     protected volatile String directoryPath;
  -  
  +
  +  private Logger log = LogKit.getLoggerFor("cocoon");
  +
     /**
      * Constructor
      */
  @@ -31,8 +36,8 @@
         /* Create it anew */
         if (!this.directoryFile.mkdir()) {
           throw new IOException(
  -	  "Error creating store directory '" + this.directoryPath + "': "
  -	);
  +      "Error creating store directory '" + this.directoryPath + "': "
  +    );
         }
       }
   
  @@ -68,13 +73,13 @@
   
       return null;
     }
  -  
  +
     /**
      * Store the given object in a persistent state.
      * 1) Null values generate empty directories.
      * 2) String values are dumped to text files
      * 3) Object values are serialized
  -   */ 
  +   */
     public void store(Object key, Object value) {
       try {
         File file = fileFromKey(key);
  @@ -89,7 +94,7 @@
         if (value == null) { /* Directory */
           if (file.exists()) {
             if (!file.delete()) { /* FAILURE */
  -           // System.err.println("File cannot be deleted: " + file.toString());
  +           log.error("File cannot be deleted: " + file.toString());
              return;
             }
           }
  @@ -107,7 +112,7 @@
   
     /**
      * Holds the given object in a volatile state.
  -   */ 
  +   */
     public void hold(Object key, Object value) {
       this.store(key, value);
       File file = (File) this.get(key);
  @@ -115,7 +120,7 @@
         file.deleteOnExit();
       }
     }
  -  
  +
     /**
      * Remove the object associated to the given key.
      */
  @@ -125,7 +130,7 @@
         file.delete();
       }
     }
  -  
  +
     /**
      * Indicates if the given key is associated to a contained object.
      */
  @@ -136,7 +141,7 @@
       }
       return file.exists();
     }
  -  
  +
     /**
      * Returns the list of stored files as an Enumeration of Files
      */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.9   +14 -6     xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java
  
  Index: FileGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- FileGenerator.java	2000/10/19 14:43:48	1.1.2.8
  +++ FileGenerator.java	2000/11/10 22:38:54	1.1.2.9
  @@ -13,12 +13,14 @@
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.Roles;
   import org.xml.sax.SAXException;
  +import org.apache.avalon.ComponentNotFoundException;
  +import org.apache.avalon.ComponentNotAccessibleException;
   
   /**
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/10/19 14:43:48 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/11/10 22:38:54 $
    */
   public class FileGenerator extends ComposerGenerator implements Poolable {
   
  @@ -26,10 +28,16 @@
        * Generate XML data.
        */
       public void generate()
  -    throws IOException, SAXException {
  -        Parser parser=(Parser)this.manager.lookup(Roles.PARSER);
  -        parser.setContentHandler(this.contentHandler);
  -        parser.setLexicalHandler(this.lexicalHandler);
  -        parser.parse(super.resolver.resolveEntity(null,this.source));
  +    throws IOException, SAXException, ProcessingException {
  +        try {
  +            log.debug("Looking up " + Roles.PARSER);
  +            Parser parser=(Parser)this.manager.lookup(Roles.PARSER);
  +
  +            parser.setContentHandler(this.contentHandler);
  +            parser.setLexicalHandler(this.lexicalHandler);
  +            parser.parse(super.resolver.resolveEntity(null,this.source));
  +	} catch (Exception e) {
  +	   log.error("Could not get parser", e);
  +	}
       }    
   }
  
  
  
  1.1.2.7   +8 -3      xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java
  
  Index: ServerPagesGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/ServerPagesGenerator.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- ServerPagesGenerator.java	2000/10/19 14:43:50	1.1.2.6
  +++ ServerPagesGenerator.java	2000/11/10 22:38:54	1.1.2.7
  @@ -34,7 +34,7 @@
    * delegating actual SAX event generation.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/10/19 14:43:50 $
  + * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/11/10 22:38:54 $
    */
   public class ServerPagesGenerator
     extends ServletGenerator
  @@ -55,8 +55,13 @@
       super.compose(manager);
   
       if (programGenerator == null) {
  -      programGenerator = (ProgramGenerator)
  -        this.manager.lookup(Roles.PROGRAM_GENERATOR);
  +      log.debug("Looking up " + Roles.PROGRAM_GENERATOR);
  +      try {
  +          programGenerator = (ProgramGenerator)
  +              this.manager.lookup(Roles.PROGRAM_GENERATOR);
  +      } catch (Exception e) {
  +          log.error("Could not find ProgramGenerator", e);
  +      }
       }
     }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.13  +11 -4     xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVGSerializer.java
  
  Index: SVGSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/SVGSerializer.java,v
  retrieving revision 1.1.2.12
  retrieving revision 1.1.2.13
  diff -u -r1.1.2.12 -r1.1.2.13
  --- SVGSerializer.java	2000/10/19 14:44:14	1.1.2.12
  +++ SVGSerializer.java	2000/11/10 22:38:54	1.1.2.13
  @@ -60,19 +60,26 @@
       public void configure(Configuration conf) throws ConfigurationException {
           this.config = conf;
   
  -        // First, get a DOM parser for the DOM Builder to work with.
  -        super.factory= (Parser) this.manager.lookup(Roles.PARSER);
  +        try {
  +	    log.debug("Looking up " + Roles.PARSER);
  +            // First, get a DOM parser for the DOM Builder to work with.
  +            super.factory= (Parser) this.manager.lookup(Roles.PARSER);
  +	} catch (Exception e) {
  +	    log.error("Could not find component", e);
  +	}
   
           // What image encoder do I use?
           String enc = this.config.getChild("encoder").getValue();
           if (enc == null) {
  -            throw new ConfigurationException("No Image Encoder specified."/*, conf*/);
  +            throw new ConfigurationException("No Image Encoder specified.");
           }
           
           try {
  +	    log.debug("Selecting " + Roles.IMAGE_ENCODER + ": " + enc);
   	    ComponentSelector selector = (ComponentSelector) this.manager.lookup(Roles.IMAGE_ENCODER);
               this.encoder = (ImageEncoder) selector.select(enc);
  -        } catch (ComponentNotFoundException e) {
  +        } catch (Exception e) {
  +	    log.error("Could not select " + Roles.IMAGE_ENCODER, e);
               throw new ConfigurationException("The ImageEncoder '" 
                   + enc + "' cannot be found. Check your component configuration in the sitemap"/*, conf*/);
           }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.25  +27 -10    xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
  retrieving revision 1.1.4.24
  retrieving revision 1.1.4.25
  diff -u -r1.1.4.24 -r1.1.4.25
  --- CocoonServlet.java	2000/10/30 19:01:08	1.1.4.24
  +++ CocoonServlet.java	2000/11/10 22:38:55	1.1.4.25
  @@ -14,6 +14,9 @@
   import java.io.IOException;
   import java.io.PrintWriter;
   
  +import java.net.MalformedURLException;
  +import java.net.URL;
  +
   import javax.servlet.ServletConfig;
   import javax.servlet.ServletContext;
   import javax.servlet.ServletException;
  @@ -32,6 +35,10 @@
   import org.apache.cocoon.Notification;
   import org.apache.cocoon.environment.http.HttpEnvironment;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +import org.apache.log.Priority;
  +
   
   /**
    * This is the entry point for Cocoon execution as an HTTP Servlet.
  @@ -40,11 +47,13 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
  - * @version CVS $Revision: 1.1.4.24 $ $Date: 2000/10/30 19:01:08 $
  + * @version CVS $Revision: 1.1.4.25 $ $Date: 2000/11/10 22:38:55 $
    */
  - 
  +
   public class CocoonServlet extends HttpServlet {
   
  +    private Logger log = null;
  +
       final long second = 1000;
       final long minute = 60 * second;
       final long hour   = 60 * minute;
  @@ -62,13 +71,21 @@
        */
       public void init(ServletConfig conf) throws ServletException {
   
  +        try {
  +            log = LogKit.createLogger("cocoon", new URL("file:../logs/cocoon.log"), Priority.INFO);
  +        } catch (MalformedURLException mue) {
  +            LogKit.log("Could not set up Cocoon Logger, will use screen instead", mue);
  +        }
  +
  +        LogKit.setGlobalPriority(Priority.INFO);
  +
           super.init(conf);
   
           this.context = conf.getServletContext();
   
           // WARNING (SM): the line below BREAKS the Servlet API portability of
           // web applications.
  -        // This is a hack to go around java compiler design problems that 
  +        // This is a hack to go around java compiler design problems that
           // do not allow applications to force their own classloader to the
           // compiler during compilation.
           // We look for a specific Tomcat attribute so we are bound to Tomcat
  @@ -82,7 +99,7 @@
           // (I don't know if any do) or, for other servlet containers, you have
           // to extract all the libraries and place them in the system classpath
           // or the compilation of sitemaps and XSP will fail.
  -        // I know this sucks, but I don't have the energy to write a java 
  +        // I know this sucks, but I don't have the energy to write a java
           // compiler to fix this :(
           this.classpath = (String) context.getAttribute(Cocoon.CATALINA_SERVLET_CLASSPATH);
           if (this.classpath == null) {
  @@ -90,7 +107,7 @@
           }
   
           this.workDir = ((File) this.context.getAttribute("javax.servlet.context.tempdir")).toString();
  -        
  +
           String configFileName = conf.getInitParameter("configurations");
           if (configFileName == null) {
               throw new ServletException("Servlet initialization argument 'configurations' not specified");
  @@ -160,8 +177,8 @@
   
           if (uri.length() == 0) {
               /* empty relative URI
  -                 -> HTTP-redirect from /cocoon to /cocoon/ to avoid 
  -                    StringIndexOutOfBoundsException when calling 
  +                 -> HTTP-redirect from /cocoon to /cocoon/ to avoid
  +                    StringIndexOutOfBoundsException when calling
                       "".charAt(0)
                  else process URI normally
               */
  @@ -178,7 +195,7 @@
   
               if (!this.cocoon.process(env)) {
   
  -                // FIXME (NKB) It is not true that !this.cocoon.process(env) 
  +                // FIXME (NKB) It is not true that !this.cocoon.process(env)
                   // means only SC_NOT_FOUND
                   res.setStatus(res.SC_NOT_FOUND);
   
  @@ -230,9 +247,9 @@
               return null;
           }
       }
  -    
  +
       private void showTime(ServletOutputStream out, boolean hide, long time) throws IOException {
  -        
  +
           out.print((hide) ? "<!-- " : "<p>");
   
           out.print("Processed by " + Cocoon.COMPLETE_NAME + " in ");
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +7 -2      xml-cocoon/src/org/apache/cocoon/transformation/Attic/AbstractDOMTransformer.java
  
  Index: AbstractDOMTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/AbstractDOMTransformer.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- AbstractDOMTransformer.java	2000/10/31 21:07:45	1.1.2.3
  +++ AbstractDOMTransformer.java	2000/11/10 22:38:55	1.1.2.4
  @@ -60,8 +60,13 @@
   	public void compose(ComponentManager manager) {
   		this.manager = manager;
   		// Get a parser and use it as a DOM factory
  -		Parser p = (Parser)manager.lookup(Roles.PARSER);
  -		super.factory = (DOMFactory)p;
  +		try {
  +		    log.debug("Looking up " + Roles.PARSER);
  +		    Parser p = (Parser)manager.lookup(Roles.PARSER);
  +		    super.factory = (DOMFactory)p;
  +		} catch (Exception e) {
  +		    log.error("Could not find component", e);
  +		}
   	}
   
       /**
  
  
  
  1.1.2.12  +39 -46    xml-cocoon/src/org/apache/cocoon/transformation/Attic/SQLTransformer.java
  
  Index: SQLTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/SQLTransformer.java,v
  retrieving revision 1.1.2.11
  retrieving revision 1.1.2.12
  diff -u -r1.1.2.11 -r1.1.2.12
  --- SQLTransformer.java	2000/10/19 14:44:34	1.1.2.11
  +++ SQLTransformer.java	2000/11/10 22:38:55	1.1.2.12
  @@ -25,6 +25,9 @@
   import org.apache.cocoon.xml.XMLProducer;
   import org.apache.cocoon.util.ClassUtils;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   import org.xml.sax.ContentHandler;
   import org.xml.sax.EntityResolver;
   import org.xml.sax.Attributes;
  @@ -38,12 +41,12 @@
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
    * @author <a href="mailto:giacomo.pati@pwr.ch">Giacomo Pati</a>
    *         (PWR Organisation & Entwicklung)
  - * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/10/19 14:44:34 $ $Author: bloritsch $
  + * @version CVS $Revision: 1.1.2.12 $ $Date: 2000/11/10 22:38:55 $ $Author: bloritsch $
    */
   
   public class SQLTransformer extends AbstractTransformer {
   
  -    protected boolean debug = true;
  +    private Logger log = LogKit.getLoggerFor("cocoon");
   
       /** The SQL namespace **/
       public static final String my_uri = "http://apache.org/cocoon/SQL";
  @@ -96,34 +99,31 @@
       /** BEGIN SitemapComponent methods **/
   
       public void setup(EntityResolver resolver, Map objectModel,
  -                      String source, Parameters parameters) 
  +                      String source, Parameters parameters)
       throws ProcessingException, SAXException, IOException {
           current_state = STATE_OUTSIDE;
   
           // Check the driver
           String parameter = parameters.getParameter("driver",null);
           if (parameter != null) {
  -            if (debug) {
  -                System.err.println("DRIVER: "+parameter);
  -            }
  +            log.debug("DRIVER: "+parameter);
  +
               default_properties.setProperty("driver",parameter);
           }
   
           // Check the dburl
           parameter = parameters.getParameter("dburl",null);
           if (parameter != null) {
  -            if (debug) {
  -                System.err.println("DBURL: "+parameter);
  -            }
  +            log.debug("DBURL: "+parameter);
  +
               default_properties.setProperty("dburl",parameter);
           }
   
           // Check the username
           parameter = parameters.getParameter("username",null);
           if (parameter != null) {
  -            if (debug) {
  -                System.err.println("USERNAME: "+parameter);
  -            }
  +            log.debug("USERNAME: "+parameter);
  +
               default_properties.setProperty("username",parameter);
           }
   
  @@ -206,7 +206,7 @@
                   current_state = STATE_INSIDE_QUERY_ELEMENT;
                   String isupdate =
                       attributes.getValue("", MAGIC_UPDATE_ATTRIBUTE);
  -		if (isupdate != null && !isupdate.equalsIgnoreCase("false"))
  +        if (isupdate != null && !isupdate.equalsIgnoreCase("false"))
                       getCurrentQuery().setUpdate(true);
                   break;
               default:
  @@ -220,10 +220,9 @@
                   if (current_value.length() > 0) {
                       getCurrentQuery().addQueryPart(
                         current_value.toString());
  -                    if (debug) {
  -                        System.err.println("QUERY IS \""+
  +                    log.debug("QUERY IS \""+
                                              current_value.toString() + "\"");
  -                    }
  +
                       current_value.setLength(0);
                   }
                   current_state = STATE_INSIDE_EXECUTE_QUERY_ELEMENT;
  @@ -238,11 +237,10 @@
               case STATE_INSIDE_VALUE_ELEMENT:
                   getCurrentQuery().setParameter(current_name,
                                                  current_value.toString());
  -                if (debug) {
  -                    System.err.println("SETTING VALUE ELEMENT name {"+
  +                log.debug("SETTING VALUE ELEMENT name {"+
                                          current_name + "} value {"+
                                          current_value.toString() + "}");
  -                }
  +
                   current_state = STATE_INSIDE_EXECUTE_QUERY_ELEMENT;
                   break;
               default:
  @@ -285,16 +283,14 @@
                                                  MAGIC_ANCESTOR_VALUE_NAME_ATTRIBUTE + " attribute");
                   }
                   AncestorValue av = new AncestorValue(level, name);
  -                if (debug) {
  -                    System.err.println("ANCESTOR VALUE "+level + " "+name);
  -                }
  +                log.debug("ANCESTOR VALUE "+level + " "+name);
  +
                   if (current_value.length() > 0) {
                       getCurrentQuery().addQueryPart(
                         current_value.toString());
  -                    if (debug) {
  -                        System.err.println("QUERY IS \""+
  +                    log.debug("QUERY IS \""+
                                              current_value.toString() + "\"");
  -                    }
  +
                       current_value.setLength(0);
                   }
                   getCurrentQuery().addQueryPart(av);
  @@ -322,8 +318,8 @@
       /** BEGIN SAX ContentHandler handlers **/
   
       public void setDocumentLocator(Locator locator) {
  -        System.err.println("PUBLIC ID"+locator.getPublicId());
  -        System.err.println("SYSTEM ID"+locator.getSystemId());
  +        log.info("PUBLIC ID"+locator.getPublicId());
  +        log.info("SYSTEM ID"+locator.getSystemId());
           if (super.contentHandler != null)
               super.contentHandler.setDocumentLocator(locator);
       }
  @@ -333,10 +329,9 @@
           if (!uri.equals(my_uri)) {
               super.startElement(uri, name, raw, attributes);
               return;
  -        }
  -        if (debug) {
  -            System.err.println("RECEIVED START ELEMENT "+name);
           }
  +        log.debug("RECEIVED START ELEMENT "+name);
  +
           if (name.equals(MAGIC_EXECUTE_QUERY)) {
               startExecuteQueryElement();
           } else if (name.equals(MAGIC_QUERY)) {
  @@ -354,10 +349,9 @@
               super.endElement(uri, name, raw);
               return;
           }
  -        if (debug) {
  -            System.err.println("RECEIVED END ELEMENT "+name + "("+uri +
  +        log.debug("RECEIVED END ELEMENT "+name + "("+uri +
                                  ")");
  -        }
  +
           if (name.equals(MAGIC_EXECUTE_QUERY)) {
               endExecuteQueryElement();
           } else if (name.equals(MAGIC_QUERY)) {
  @@ -377,10 +371,9 @@
                   current_state != STATE_INSIDE_QUERY_ELEMENT) {
               super.characters(ary, start, length);
           }
  -        if (debug) {
  -            System.err.println("RECEIVED CHARACTERS: "+
  +        log.debug("RECEIVED CHARACTERS: "+
                                  new String(ary, start, length));
  -        }
  +
           current_value.append(ary, start, length);
       }
   
  @@ -443,11 +436,11 @@
           /** And the results' metadata **/
           protected ResultSetMetaData md = null;
   
  -	/** If this query is actually an update (insert, update, delete) **/
  -	protected boolean isupdate = false;
  +    /** If this query is actually an update (insert, update, delete) **/
  +    protected boolean isupdate = false;
   
  -	/** If it is an update/etc, the return value (num rows modified) **/
  -	protected int rv = -1;
  +    /** If it is an update/etc, the return value (num rows modified) **/
  +    protected int rv = -1;
   
           /** The parts of the query **/
           protected Vector query_parts = new Vector();
  @@ -541,9 +534,9 @@
           protected boolean next() throws SQLException {
               try {
                   // if rv is not -1, then an SQL insert, update, etc, has
  -		// happened (see JDBC docs - return codes for executeUpdate)
  -	        if (rv != -1)
  -		    return true;
  +        // happened (see JDBC docs - return codes for executeUpdate)
  +            if (rv != -1)
  +            return true;
                   if (rs == null || !rs.next()) {
                       close();
                       return false;
  @@ -560,7 +553,7 @@
                   if (rs != null)
                       rs.close();
                   st.close();
  -            } finally { 
  +            } finally {
                   conn.close();
               }
           }
  @@ -572,7 +565,7 @@
           protected void serializeRow() throws SQLException, SAXException {
               AttributesImpl attr = new AttributesImpl();
   
  -	    if (!isupdate) {
  +        if (!isupdate) {
                   for (int i = 1; i <= md.getColumnCount(); i++) {
                       transformer.start(md.getColumnName(i).toLowerCase(), attr);
                       try {
  @@ -588,7 +581,7 @@
                   transformer.data(String.valueOf(rv));
                   transformer.end("returncode");
                   rv = -1; // we only want the return code shown once.
  -	    }
  +        }
           }
   
       }
  
  
  
  1.1.2.11  +24 -15    xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java
  
  Index: XIncludeTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- XIncludeTransformer.java	2000/11/01 20:19:05	1.1.2.10
  +++ XIncludeTransformer.java	2000/11/10 22:38:55	1.1.2.11
  @@ -35,6 +35,9 @@
   import org.apache.cocoon.xml.dom.DOMStreamer;
   import org.apache.xpath.XPathAPI;
   
  +import org.apache.log.LogKit;
  +import org.apache.log.Logger;
  +
   /**
    * My first pass at an XInclude transformation. Currently it should set the base URI
    * from the SAX Locator's system id but allow it to be overridden by xml:base
  @@ -43,11 +46,11 @@
    * by the SAX event FSM yet.
    *
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
  - * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/11/01 20:19:05 $ $Author: dims $
  + * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/11/10 22:38:55 $ $Author: bloritsch $
    */
   public class XIncludeTransformer extends AbstractTransformer implements Composer {
   
  -    protected boolean debug = false;
  +    protected Logger log = LogKit.getLoggerFor("cocoon");
   
       protected ComponentManager manager = null;
   
  @@ -82,9 +85,9 @@
               throws ProcessingException, SAXException, IOException {}
       /*
           try {
  -            System.err.println("SOURCE: "+source);
  +            log.debug("SOURCE: "+source);
               base_xmlbase_uri = new URL(source);
  -            System.err.println("SOURCE URI: "+base_xmlbase_uri.toString());
  +            log.debug("SOURCE URI: "+base_xmlbase_uri.toString());
           } catch (MalformedURLException e) {
               throw new ProcessingException(e.getMessage());
           }
  @@ -163,7 +166,7 @@
       }
   
       protected void processXIncludeElement(String href, String parse) throws SAXException,MalformedURLException,IOException {
  -        if (debug) { System.err.println("Processing XInclude element: href="+href+", parse="+parse); }
  +        log.debug("Processing XInclude element: href="+href+", parse="+parse);
           URL url;
           String suffix;
           int index = href.indexOf('#');
  @@ -174,11 +177,11 @@
               url = new URL(current_xmlbase_uri,href.substring(0,index));
               suffix = href.substring(index+1);
           }
  -        if (debug) { System.err.println("URL: "+url+"\nSuffix: "+suffix); }
  +        log.debug("URL: "+url+"\nSuffix: "+suffix);
           Object object = url.getContent();
  -        if (debug) { System.err.println("Object: "+object); }
  +        log.debug("Object: "+object);
           if (parse.equals("text")) {
  -            if (debug) { System.err.println("Parse type is text"); }
  +            log.debug("Parse type is text");
               if (object instanceof Reader) {
                   Reader reader = (Reader)object;
                   int read;
  @@ -202,8 +205,15 @@
                   }
               }
           } else if (parse.equals("xml")) {
  -            if (debug) { System.err.println("Parse type is XML"); }
  -            Parser parser = (Parser)manager.lookup(Roles.PARSER);
  +            log.debug("Parse type is XML");
  +	    Parser parser = null;
  +	    try {
  +	        log.debug("Looking up " + Roles.PARSER);
  +                parser = (Parser)manager.lookup(Roles.PARSER);
  +	    } catch (Exception e) {
  +	        log.error("Could not find component", e);
  +		return;
  +	    }
               InputSource input;
               if (object instanceof Reader) {
                   input = new InputSource((Reader)object);
  @@ -214,7 +224,7 @@
               }
               if (suffix.startsWith("xpointer(") && suffix.endsWith(")")) {
                   String xpath = suffix.substring(9,suffix.length()-1);
  -                if (debug) { System.err.println("XPath is "+xpath); }
  +                log.debug("XPath is "+xpath);
                   DOMBuilder builder = new DOMBuilder(parser);
                   parser.setContentHandler(builder);
                   parser.setLexicalHandler(builder);
  @@ -228,7 +238,6 @@
                   }
               } else {
                   XIncludeContentHandler xinclude_handler = new XIncludeContentHandler(super.contentHandler,super.lexicalHandler);
  -                xinclude_handler.debug = debug;
                   parser.setContentHandler(xinclude_handler);
                   parser.setLexicalHandler(xinclude_handler);
                   parser.parse(input);
  @@ -252,12 +261,12 @@
           }
   
           public void startDocument() {
  -            if (debug) { System.err.println("Internal start document received"); }
  +            log.debug("Internal start document received");
               /** We don't pass start document on to the "real" handler **/
           }
   
           public void endDocument() {
  -            if (debug) { System.err.println("Internal end document received"); }
  +            log.debug("Internal end document received");
               /** We don't pass end document on to the "real" handler **/
           }
   
  @@ -273,7 +282,7 @@
   
           public void startElement(String namespace, String name, String raw,
               Attributes attr) throws SAXException {
  -            if (debug) { System.err.println("Internal element received: "+name); }
  +            log.debug("Internal element received: "+name);
               content_handler.startElement(namespace,name,raw,attr);
           }
   
  
  
  
  1.1.2.5   +7 -2      xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java
  
  Index: XTTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XTTransformer.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- XTTransformer.java	2000/10/19 14:44:36	1.1.2.4
  +++ XTTransformer.java	2000/11/10 22:38:55	1.1.2.5
  @@ -67,7 +67,7 @@
    * This Transformer use the XT processor.
    * 
    * @author <a href="mailto:ssahuc@imediation.com">Sahuc Sebastien</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/10/19 14:44:36 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/11/10 22:38:55 $
    */
   public class XTTransformer extends DocumentHandlerWrapper
   implements Transformer, Composer {
  @@ -86,7 +86,12 @@
        * <code>Composer</code>.
        */
       public void compose(ComponentManager manager) {
  -        this.store = (Store) manager.lookup(Roles.STORE);
  +        try {
  +	    log.debug("Looking up " + Roles.STORE);
  +            this.store = (Store) manager.lookup(Roles.STORE);
  +	} catch (Exception e) {
  +	    log.error("Could not find component", e);
  +	}
       }
       
       /**
  
  
  
  1.1.2.21  +10 -3     xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java
  
  Index: XalanTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java,v
  retrieving revision 1.1.2.20
  retrieving revision 1.1.2.21
  diff -u -r1.1.2.20 -r1.1.2.21
  --- XalanTransformer.java	2000/11/10 12:32:01	1.1.2.20
  +++ XalanTransformer.java	2000/11/10 22:38:55	1.1.2.21
  @@ -17,6 +17,7 @@
   import javax.servlet.http.HttpServletRequest;
   
   import org.apache.avalon.Component;
  +import org.apache.avalon.ConfigurationException;
   import org.apache.avalon.ComponentManager;
   import org.apache.avalon.Composer;
   import org.apache.avalon.Configurable;
  @@ -52,7 +53,7 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@sundn.de">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.20 $ $Date: 2000/11/10 12:32:01 $
  + * @version CVS $Revision: 1.1.2.21 $ $Date: 2000/11/10 22:38:55 $
    */
   public class XalanTransformer extends ContentHandlerWrapper
   implements Transformer, Composer, Poolable, Configurable {
  @@ -128,7 +129,8 @@
       /**
        * Configure this transformer.
        */
  -    public void configure(Configuration conf) {
  +    public void configure(Configuration conf)
  +    throws ConfigurationException {
           if (conf != null) {
               Configuration child = conf.getChild("use-cache");
               if (child != null) {
  @@ -142,7 +144,12 @@
        * <code>Composer</code>.
        */
       public void compose(ComponentManager manager) {
  -        this.store = (Store) manager.lookup(Roles.STORE);
  +        try {
  +	    log.debug("Looking up " + Roles.STORE);
  +            this.store = (Store) manager.lookup(Roles.STORE);
  +	} catch (Exception e) {
  +	    log.error("Could not find component", e);
  +	}
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +6 -1      xml-cocoon/src/org/apache/cocoon/xml/Attic/AbstractXMLConsumer.java
  
  Index: AbstractXMLConsumer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/xml/Attic/AbstractXMLConsumer.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- AbstractXMLConsumer.java	2000/07/29 18:30:43	1.1.2.4
  +++ AbstractXMLConsumer.java	2000/11/10 22:38:56	1.1.2.5
  @@ -13,15 +13,20 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.ext.LexicalHandler;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   /**
    * This abstract class provides default implementation of the methods specified
    * by the <code>XMLConsumer</code> interface.
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/29 18:30:43 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/11/10 22:38:56 $
    */
   public abstract class AbstractXMLConsumer implements XMLConsumer {
  +
  +    protected Logger log = LogKit.getLoggerFor("cocoon");
   
       /**
        * Receive an object for locating the origin of SAX document events.
  
  
  
  1.1.2.6   +6 -1      xml-cocoon/src/org/apache/cocoon/xml/Attic/AbstractXMLProducer.java
  
  Index: AbstractXMLProducer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/xml/Attic/AbstractXMLProducer.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- AbstractXMLProducer.java	2000/09/27 14:33:37	1.1.2.5
  +++ AbstractXMLProducer.java	2000/11/10 22:38:56	1.1.2.6
  @@ -10,15 +10,20 @@
   import org.xml.sax.ContentHandler;
   import org.xml.sax.ext.LexicalHandler;
   
  +import org.apache.log.LogKit;
  +import org.apache.log.Logger;
  +
   /**
    * This abstract class provides default implementation of the methods specified
    * by the <code>XMLProducer</code> interface. 
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/09/27 14:33:37 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/11/10 22:38:56 $
    */
   public abstract class AbstractXMLProducer implements XMLProducer {
  +
  +    protected Logger log = LogKit.getLoggerFor("cocoon");
       
       /** The <code>ContentHandler</code> receiving SAX events. */
       protected ContentHandler contentHandler;
  
  
  
  1.1.2.2   +184 -179  xml-cocoon/src/org/apache/cocoon/xml/Attic/ContentHandlerWrapper.java
  
  Index: ContentHandlerWrapper.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/xml/Attic/ContentHandlerWrapper.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ContentHandlerWrapper.java	2000/10/13 04:18:06	1.1.2.1
  +++ ContentHandlerWrapper.java	2000/11/10 22:38:56	1.1.2.2
  @@ -1,179 +1,184 @@
  -/*****************************************************************************
  - * Copyright (C) The Apache Software Foundation. All rights reserved.        *
  - * ------------------------------------------------------------------------- *
  - * This software is published under the terms of the Apache Software License *
  - * version 1.1, a copy of which has been included  with this distribution in *
  - * the LICENSE file.                                                         *
  - *****************************************************************************/
  - 
  -package org.apache.cocoon.xml;
  -
  -import java.util.Vector;
  -
  -import org.apache.cocoon.xml.AbstractXMLConsumer;
  -import org.apache.avalon.Recyclable;
  -
  -import org.xml.sax.Attributes;
  -import org.xml.sax.ContentHandler;
  -import org.xml.sax.Locator;
  -import org.xml.sax.SAXException;
  -import org.xml.sax.helpers.AttributeListImpl;
  -
  -/**
  - * This class is an utility class &quot;wrapping&quot; around a SAX version 2.0
  - * <code>ContentHandler</code> and forwarding it those events received throug
  - * its <code>XMLConsumers</code> interface.
  - * <br>
  - *
  - * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - *         (Apache Software Foundation, Computer Associates)
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/10/13 04:18:06 $
  - */
  -public class ContentHandlerWrapper extends AbstractXMLConsumer implements Recyclable {
  -
  -    /** The current <code>ContentHandler</code>. */
  -    protected ContentHandler documentHandler=null;
  -
  -    /**
  -     * Create a new <code>DocumentHandlerWrapper</code> instance.
  -     */
  -    public ContentHandlerWrapper() {
  -        super();
  -     }
  -
  -    /**
  -     * Create a new <code>ContentHandlerWrapper</code> instance.
  -     */
  -    public ContentHandlerWrapper(ContentHandler document) {
  -        this();
  -        this.setContentHandler(document);
  -    }
  -
  -    /**
  -     * Set the <code>ContentHandler</code> that will receive XML data.
  -     *
  -     * @exception IllegalStateException If the <code>ContentHandler</code>
  -     *                                  was already set.
  -     */
  -    public void setContentHandler(ContentHandler document)
  -    throws IllegalStateException {
  -        if (this.documentHandler!=null) throw new IllegalStateException();
  -        this.documentHandler=document;
  -    }
  -
  -    public void recycle () {
  -        this.documentHandler = null;
  -    }
  -
  -    /**
  -     * Receive an object for locating the origin of SAX document events.
  -     */
  -    public void setDocumentLocator (Locator locator) {
  -        if (this.documentHandler==null) return;
  -        else this.documentHandler.setDocumentLocator(locator);
  -    }
  -    
  -    /**
  -     * Receive notification of the beginning of a document.
  -     */
  -    public void startDocument ()
  -	throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.startDocument();
  -    }    
  -    
  -    /**
  -     * Receive notification of the end of a document.
  -     */
  -    public void endDocument ()
  -	throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.endDocument();
  -    }    
  -
  -    /**
  -     * Begin the scope of a prefix-URI Namespace mapping.
  -     */
  -    public void startPrefixMapping(String prefix, String uri)
  -    throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.startPrefixMapping(prefix, uri);
  -    }
  -
  -    /**
  -     * End the scope of a prefix-URI mapping.
  -     */
  -    public void endPrefixMapping(String prefix)
  -    throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.endPrefixMapping(prefix);
  -    }
  -
  -    /**
  -     * Receive notification of the beginning of an element.
  -     */
  -    public void startElement(String uri, String loc, String raw, Attributes a)
  -    throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.startElement(uri, loc, raw, a);
  -    }
  -
  -
  -    /**
  -     * Receive notification of the end of an element.
  -     */
  -    public void endElement(String uri, String loc, String raw)
  -    throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.endElement(uri, loc, raw);
  -    }
  -
  -    /**
  -     * Receive notification of character data.
  -     */
  -    public void characters(char ch[], int start, int len)
  -    throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.characters(ch,start,len);
  -    }
  -
  -    /**
  -     * Receive notification of ignorable whitespace in element content.
  -     */
  -    public void ignorableWhitespace(char ch[], int start, int len)
  -    throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.ignorableWhitespace(ch,start,len);
  -    }
  -
  -    /**
  -     * Receive notification of a processing instruction.
  -     */
  -    public void processingInstruction(String target, String data)
  -    throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.processingInstruction(target,data);
  -    }
  -
  -    /**
  -     * Receive notification of a skipped entity.
  -     *
  -     * @param name The name of the skipped entity.  If it is a  parameter
  -     *             entity, the name will begin with '%'.
  -     */
  -    public void skippedEntity(String name)
  -    throws SAXException {
  -        if (this.documentHandler==null)
  -            throw new SAXException("ContentHandler not set");
  -        this.documentHandler.skippedEntity(name);
  -    }
  -}
  +/*****************************************************************************
  + * Copyright (C) The Apache Software Foundation. All rights reserved.        *
  + * ------------------------------------------------------------------------- *
  + * This software is published under the terms of the Apache Software License *
  + * version 1.1, a copy of which has been included  with this distribution in *
  + * the LICENSE file.                                                         *
  + *****************************************************************************/
  + 
  +package org.apache.cocoon.xml;
  +
  +import java.util.Vector;
  +
  +import org.apache.cocoon.xml.AbstractXMLConsumer;
  +import org.apache.avalon.Recyclable;
  +
  +import org.xml.sax.Attributes;
  +import org.xml.sax.ContentHandler;
  +import org.xml.sax.Locator;
  +import org.xml.sax.SAXException;
  +import org.xml.sax.helpers.AttributeListImpl;
  +
  +import org.apache.log.LogKit;
  +import org.apache.log.Logger;
  +
  +/**
  + * This class is an utility class &quot;wrapping&quot; around a SAX version 2.0
  + * <code>ContentHandler</code> and forwarding it those events received throug
  + * its <code>XMLConsumers</code> interface.
  + * <br>
  + *
  + * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  + *         (Apache Software Foundation, Computer Associates)
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/11/10 22:38:56 $
  + */
  +public class ContentHandlerWrapper extends AbstractXMLConsumer implements Recyclable {
  +
  +    protected Logger log = LogKit.getLoggerFor("cocoon");
  +
  +    /** The current <code>ContentHandler</code>. */
  +    protected ContentHandler documentHandler=null;
  +
  +    /**
  +     * Create a new <code>DocumentHandlerWrapper</code> instance.
  +     */
  +    public ContentHandlerWrapper() {
  +        super();
  +     }
  +
  +    /**
  +     * Create a new <code>ContentHandlerWrapper</code> instance.
  +     */
  +    public ContentHandlerWrapper(ContentHandler document) {
  +        this();
  +        this.setContentHandler(document);
  +    }
  +
  +    /**
  +     * Set the <code>ContentHandler</code> that will receive XML data.
  +     *
  +     * @exception IllegalStateException If the <code>ContentHandler</code>
  +     *                                  was already set.
  +     */
  +    public void setContentHandler(ContentHandler document)
  +    throws IllegalStateException {
  +        if (this.documentHandler!=null) throw new IllegalStateException();
  +        this.documentHandler=document;
  +    }
  +
  +    public void recycle () {
  +        this.documentHandler = null;
  +    }
  +
  +    /**
  +     * Receive an object for locating the origin of SAX document events.
  +     */
  +    public void setDocumentLocator (Locator locator) {
  +        if (this.documentHandler==null) return;
  +        else this.documentHandler.setDocumentLocator(locator);
  +    }
  +    
  +    /**
  +     * Receive notification of the beginning of a document.
  +     */
  +    public void startDocument ()
  +	throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.startDocument();
  +    }    
  +    
  +    /**
  +     * Receive notification of the end of a document.
  +     */
  +    public void endDocument ()
  +	throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.endDocument();
  +    }    
  +
  +    /**
  +     * Begin the scope of a prefix-URI Namespace mapping.
  +     */
  +    public void startPrefixMapping(String prefix, String uri)
  +    throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.startPrefixMapping(prefix, uri);
  +    }
  +
  +    /**
  +     * End the scope of a prefix-URI mapping.
  +     */
  +    public void endPrefixMapping(String prefix)
  +    throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.endPrefixMapping(prefix);
  +    }
  +
  +    /**
  +     * Receive notification of the beginning of an element.
  +     */
  +    public void startElement(String uri, String loc, String raw, Attributes a)
  +    throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.startElement(uri, loc, raw, a);
  +    }
  +
  +
  +    /**
  +     * Receive notification of the end of an element.
  +     */
  +    public void endElement(String uri, String loc, String raw)
  +    throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.endElement(uri, loc, raw);
  +    }
  +
  +    /**
  +     * Receive notification of character data.
  +     */
  +    public void characters(char ch[], int start, int len)
  +    throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.characters(ch,start,len);
  +    }
  +
  +    /**
  +     * Receive notification of ignorable whitespace in element content.
  +     */
  +    public void ignorableWhitespace(char ch[], int start, int len)
  +    throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.ignorableWhitespace(ch,start,len);
  +    }
  +
  +    /**
  +     * Receive notification of a processing instruction.
  +     */
  +    public void processingInstruction(String target, String data)
  +    throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.processingInstruction(target,data);
  +    }
  +
  +    /**
  +     * Receive notification of a skipped entity.
  +     *
  +     * @param name The name of the skipped entity.  If it is a  parameter
  +     *             entity, the name will begin with '%'.
  +     */
  +    public void skippedEntity(String name)
  +    throws SAXException {
  +        if (this.documentHandler==null)
  +            throw new SAXException("ContentHandler not set");
  +        this.documentHandler.skippedEntity(name);
  +    }
  +}
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +10 -2     xml-cocoon/src/org/apache/cocoon/xml/dom/Attic/DOMBuilder.java
  
  Index: DOMBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/xml/dom/Attic/DOMBuilder.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- DOMBuilder.java	2000/10/28 10:14:24	1.1.2.3
  +++ DOMBuilder.java	2000/11/10 22:38:56	1.1.2.4
  @@ -31,15 +31,23 @@
   import org.xml.sax.Locator;
   import org.xml.sax.SAXException;
   
  +import org.apache.log.LogKit;
  +import org.apache.log.Logger;
  +
   /**
  - * The <code>DOMBuilder</code> is a utility class that will generate a W3C
  + * The <code>DOMBuilder</code> is a utility cl		Object hint = null;
  +		String className = null;
  +
  +                try {
  +ass that will generate a W3C
    * DOM Document from SAX events.
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/10/28 10:14:24 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/11/10 22:38:56 $
    */
   public class DOMBuilder implements XMLConsumer {
  +    protected Logger log = LogKit.getLoggerFor("cocoon");
       /** The document was not started */
       private static final int S_AVAIL=0;
       /** State between startDTD() and endDTD() */