You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@locus.apache.org on 2000/09/27 18:16:37 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/transformation AbstractTransformer.java LogTransformer.java XLinkTranslator.java XTTransformer.java XalanTransformer.java

stefano     00/09/27 09:16:34

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Constants.java
                        Main.java Notifier.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
               src/org/apache/cocoon/components/language/programming/java
                        Tag: xml-cocoon2 AbstractJavaCompiler.java
                        Jikes.java
               src/org/apache/cocoon/environment/commandline Tag:
                        xml-cocoon2 FileSavingEnvironment.java
                        LinkSamplingEnvironment.java
               src/org/apache/cocoon/serialization Tag: xml-cocoon2
                        AbstractSerializer.java FOPSerializer.java
                        HTMLSerializer.java SVGSerializer.java
                        TextSerializer.java XLinkSerializer.java
                        XMLSerializer.java
               src/org/apache/cocoon/transformation Tag: xml-cocoon2
                        AbstractTransformer.java LogTransformer.java
                        XLinkTranslator.java XTTransformer.java
                        XalanTransformer.java
  Added:       src/org/apache/cocoon/serialization Tag: xml-cocoon2
                        AbstractTextSerializer.java
  Log:
  cocoon 2.0a3
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +6 -5      xml-cocoon/src/org/apache/cocoon/Attic/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Constants.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- Constants.java	2000/09/22 20:27:23	1.1.2.4
  +++ Constants.java	2000/09/27 16:14:43	1.1.2.5
  @@ -10,7 +10,7 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/09/22 20:27:23 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/09/27 16:14:43 $
    */
   
   public interface Constants {
  @@ -24,10 +24,11 @@
       public static final String SHOWTIME_PARAM = "cocoon-showtime";
       public static final String VIEW_PARAM     = "cocoon-view";
   
  -    public static final String TEMPDIR_PROPERTY  = "org.apache.cocoon.properties.tempdir";
  -    public static final String DEFAULT_CONF_FILE = "cocoon.xconf";
  -    public static final String DEFAULT_DEST_DIR  = "./site";
  -    public static final String DEFAULT_WORK_DIR  = "./work";
  +    public static final String TEMPDIR_PROPERTY    = "org.apache.cocoon.properties.tempdir";
  +    public static final String DEFAULT_CONTEXT_DIR = "./webapp";
  +    public static final String DEFAULT_DEST_DIR    = "./site";
  +    public static final String DEFAULT_WORK_DIR    = "./work";
  +    public static final String DEFAULT_CONF_FILE   = "cocoon.xconf";
   
       public static final String PARSER_PROPERTY = "org.apache.cocoon.components.parser.Parser";
       public static final String DEFAULT_PARSER  = "org.apache.cocoon.components.parser.XercesParser";
  
  
  
  1.1.4.8   +105 -93   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.7
  retrieving revision 1.1.4.8
  diff -u -r1.1.4.7 -r1.1.4.8
  --- Main.java	2000/09/22 22:17:58	1.1.4.7
  +++ Main.java	2000/09/27 16:14:47	1.1.4.8
  @@ -23,6 +23,7 @@
   import java.util.HashMap;
   
   import org.apache.cocoon.util.IOUtils;
  +import org.apache.cocoon.util.JavaArchiveFilter;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.environment.commandline.LinkSamplingEnvironment;
   import org.apache.cocoon.environment.commandline.FileSavingEnvironment;
  @@ -32,16 +33,16 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.4.7 $ $Date: 2000/09/22 22:17:58 $
  + * @version CVS $Revision: 1.1.4.8 $ $Date: 2000/09/27 16:14:47 $
    */
   
   public class Main {
   
       public static void main(String[] args) throws Exception {
   
  -        String destDir  = Cocoon.DEFAULT_DEST_DIR;
  -        String confFile = Cocoon.DEFAULT_CONF_FILE;
  -        String workDir  = Cocoon.DEFAULT_WORK_DIR;
  +        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++) {
  @@ -49,38 +50,33 @@
   
               if (arg.equals("-h") || arg.equals("--help")) {
                   printUsage();
  -                return;
               } else if (arg.equals("-v") || arg.equals("--version")) {
                   printVersion();
  -                return;
  -            } else if (arg.equals("-d") || arg.equals("--destdir")) {
  +            } else if (arg.equals("-d") || arg.equals("--destDir")) {
                   try {
                       destDir = args[i + 1];
                       i++;
                   } catch (ArrayIndexOutOfBoundsException e) {
  -                    System.out.println("You must specify a destination dir when " +
  -                        "using the -d/--destdir argument");
  -                    return;
  +                    error("Careful, you must specify a destination dir when " +
  +                        "using the -d/--destDir argument");
                   }
  -            } else if (arg.equals("-w") || arg.equals("--workdir")) {
  +            } else if (arg.equals("-w") || arg.equals("--workDir")) {
                   try {
                       workDir = args[i + 1];
                       i++;
                   } catch (ArrayIndexOutOfBoundsException e) {
  -                    System.out.println("You must specify a destination dir when " +
  -                        "using the -w/--workdir argument");
  -                    return;
  +                    error("Careful, you must specify a destination dir when " +
  +                        "using the -w/--workDir argument");
                   }
  -            } else if (arg.equals("-c") || arg.equals("--conf")) {
  +            } else if (arg.equals("-c") || arg.equals("--contextDir")) {
                   try {
  -                    confFile = args[i + 1];
  +                    contextDir = args[i + 1];
                       i++;
                   } catch (ArrayIndexOutOfBoundsException e) {
  -                    System.out.println("You must specify a configuration file when " +
  -                        "using the -c/--conf argument");
  -                    return;
  +                    error("Careful, you must specify a configuration file when " +
  +                        "using the -c/--contextDir argument");
                   }
  -            } else if (arg.equals("-l") || arg.equals("--logfile")) {
  +            } else if (arg.equals("-l") || arg.equals("--logFile")) {
                   try {
                       String logFile = args[i + 1];
                       i++;
  @@ -88,44 +84,49 @@
                       System.setOut(out);
                       System.setErr(out);
                   } catch (IOException e) {
  -                    System.out.println("Cannot write on the specified log file. " +
  -                        "Make sure the path exists and you have write permissions.");
  -                    return;
  +                    error("Cannot write on the specified log file. " +
  +                        "Please, make sure the path exists and you have write permissions.");
                   } catch (ArrayIndexOutOfBoundsException e) {
  -                    System.out.println("You must specify a log file when " +
  -                        "using the -l/--logfile argument");
  -                    return;
  +                    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!
  -                System.out.println("[fatal error] Unknown argument: " + arg + "\n");
  -                printUsage();
  -                return;
  +                error("Sorry, cannot recognize the argument: " + arg + "\n");
               } else {
  -                // if it's no other arg, it must be the target
  +                // if it's no other arg, it must be the starting URI
                   targets.add(arg);
               }
   
           }
   
  +        if (targets.size() == 0) {
  +            error("Please, specify at least one starting URI.");
  +        }
  +        
           try {
               File dest = getDir(destDir, "destination");
               File work = getDir(workDir, "working");
  -            File conf = getConfigurationFile(confFile);
  -            File root = conf.getParentFile();
  -            Main main = new Main(new Cocoon(conf, null, work.toString()), conf, dest);
  -            System.out.println("[main] Starting...");
  +            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("Note: Cocoon is compiling the sitemaps, this might take a while...");
  +            main.warmup();
  +            log("Starting processing...");
               main.process(targets);
  -            System.out.println("[main] Done.");
  +            log("Done");
           } catch (Exception e) {
  -            System.out.println("[fatal error] Exception caught (" + e.getClass().getName() + "): " + e.getMessage() + "\n");
  -            printUsage();
  +            error("Exception caught (" + e.getClass().getName() + "): " + e.getMessage() + "\n");
  +            e.printStackTrace(System.err);
           }
       }
   
  -    /**
  -     * Prints the usage of how to use this class to System.out
  -     */
  +    private static void printVersion() {
  +        System.out.println(Cocoon.VERSION);
  +        System.exit(0);
  +    }
  +
       private static void printUsage() {
           String lSep = System.getProperty("line.separator");
           StringBuffer msg = new StringBuffer();
  @@ -137,39 +138,36 @@
           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/--conf    <file>    use given file as configurations" + lSep);
  -        msg.append("  -d/--destdir <dir>     use given dir as destination" + lSep + lSep);
  -        msg.append("  -w/--workdir <dir>     use given dir as working directory" + lSep + lSep);
  -        msg.append("Note: if the configuration file is not specified, it will default to" + lSep);
  -        msg.append("'" + Cocoon.DEFAULT_CONF_FILE + "' in the current working directory, then in the user directory" + lSep);
  -        msg.append("and finally in the '/usr/local/etc/' directory before giving up." + 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("Note: the context directory defaults to '" + Cocoon.DEFAULT_CONTEXT_DIR + "'" + lSep);
           System.out.println(msg.toString());
  +        System.exit(1);
       }
  -    
  -    private static void printVersion() {
  -        System.out.println(Cocoon.VERSION);
  -    }
   
  -    private static File getConfigurationFile(String file) throws Exception {
  +    public static void log(String msg) {
  +        System.out.println("[log] " + msg);
  +    }
   
  -        File f;
  +    public static void warning(String msg) {
  +        System.out.println("[warning] " + msg);
  +    }
   
  -        // look for the indicated file
  -        if (file != null) {
  -            f = new File(file);
  -            if (f.canRead()) return f;
  -        }
  +    public static void error(String msg) {
  +        System.err.println("[error] " + msg);
  +        System.exit(1);
  +    }
  +    
  +    private static File getConfigurationFile(File dir) throws Exception {
   
  -        // look in the current working directory
  -        f = new File(Cocoon.DEFAULT_CONF_FILE);
  +        File f = new File(dir, Cocoon.DEFAULT_CONF_FILE);
           if (f.canRead()) return f;
  -
  -        // then in the user directory
  +        
           f = new File(System.getProperty("user.dir") + File.separator + Cocoon.DEFAULT_CONF_FILE);
           if (f.canRead()) return f;
   
  -        // finally in the /usr/local/etc/ directory (for Unix systems).
           f = new File("/usr/local/etc/" + Cocoon.DEFAULT_CONF_FILE);
           if (f.canRead()) return f;
   
  @@ -196,31 +194,37 @@
   
           return d;
       }
  -
  +    
       // -----------------------------------------------------------------------
       
       private Cocoon cocoon;
       private File destDir;
  -    private File root;
  +    private File context;
   
       /**
        * Creates the Main class
        */
  -    public Main(Cocoon cocoon, File root, File destDir) {
  +    public Main(Cocoon cocoon, File context, File destDir) {
           this.cocoon = cocoon;
  -        this.root = root;
  +        this.context = context;
           this.destDir = destDir;
       }
   
       /**
  +     * Warms up the engine by accessing the root.
  +     */
  +    public void warmup() throws Exception {
  +        cocoon.process(new LinkSamplingEnvironment("/", context));
  +    }
  +
  +    /**
        * Process the URI list and process them all independently.
        */
       public void process(Collection uris) throws Exception {
           Iterator i = uris.iterator();
           while (i.hasNext()) {
               String uri = (String) i.next();
  -            System.out.println("[main] starting from: " + uri);
  -            this.processURI(uri);
  +            this.processURI(uri, "");
           }
       }
   
  @@ -242,60 +246,66 @@
        *  <li>then the file name of the translated URI is returned</li>
        * </ul>
        */
  -    public File processURI(String uri) throws Exception {
  -        System.out.println("[main] processing: " + uri);
  -        
  +    public File processURI(String uri, String level) throws Exception {
           Collection links = getLinks(uri);
           Map translatedLinks = new HashMap(links.size());
           Iterator i = links.iterator();
           while (i.hasNext()) {
               String link = (String) i.next();
  -            translatedLinks.put(link, processURI(link));
  +            translatedLinks.put(link, processURI(link, "  " + level));
           }
           
           File outputFile = getFile(uri);
  -        FileOutputStream output = new FileOutputStream(getFile(uri));
  +        String outputName = outputFile.getPath();
  +        FileOutputStream output = new FileOutputStream(outputFile);
           String type = getPage(uri, translatedLinks, output);
           output.close();
  +
  +        String ext = getExtension(uri);
  +        String defaultExt = getDefaultExtension(type);
           
  -        if (!matchesExtension(uri, type)) {
  -            outputFile.renameTo(getFile(uri, type));
  +        if (!ext.equals(defaultExt)) {
  +            File newFile = getFile(uri + "." + defaultExt);
  +            outputFile.renameTo(newFile);
  +            outputName = newFile.getPath();
           }
  +
  +        log(level + uri + " [" + type + "] --> " + outputName);
           
           return outputFile;
       }        
       
       Collection getLinks(String uri) throws Exception {
  -        LinkSamplingEnvironment env = new LinkSamplingEnvironment(uri);
  +        LinkSamplingEnvironment env = new LinkSamplingEnvironment(uri, context);
           cocoon.process(env);
           return env.getLinks();
       }
   
       String getPage(String uri, Map links, OutputStream stream) throws Exception {
  -        FileSavingEnvironment env = new FileSavingEnvironment(uri, root, links, stream);
  +        FileSavingEnvironment env = new FileSavingEnvironment(uri, context, links, stream);
           cocoon.process(env);
           return env.getContentType();
       }
       
  -    File getFile(String uri) {
  -        return new File(destDir, uri);
  +    File getFile(String file) {
  +        File f = new File(destDir, file);
  +        File parent = f.getParentFile();
  +        if (parent != null) parent.mkdirs();
  +        return f;
       }
       
  -    File getFile(String uri, String type) {
  -        return new File(destDir, uri + File.separator + getExtension(type));
  -    }
  -    
  -    boolean matchesExtension(String uri, String type) {
  -        int dotindex = uri.lastIndexOf('.');
  -        int slashindex = uri.indexOf('/', dotindex);
  -        if ((dotindex != -1) && (slashindex == -1)) {
  -            String ext = uri.substring(dotindex);
  -            return type.equals(getExtension(type));
  +    String getExtension(String file) {
  +        int lastDot = file.lastIndexOf('.');
  +        if (lastDot > -1) file = file.substring(lastDot + 1);
  +        int lastSlash = file.lastIndexOf('/');
  +        if (lastSlash > -1) {
  +            return file.substring(lastSlash + 1);
  +        } else {
  +            return file;
           }
  -        return false;
       }
  -    
  -    String getExtension(String type) {
  +
  +    String getDefaultExtension(String type) {
           if ("text/html".equals(type)) {
               return "html";
           } else if ("text/xml".equals(type)) {
  @@ -305,6 +315,8 @@
           } else if ("text/vnd.wap.wml".equals(type)) {
               return "wml";
           } else if ("image/jpg".equals(type)) {
  +            return "jpg";
  +        } else if ("image/jpeg".equals(type)) {
               return "jpg";
           } else if ("image/png".equals(type)) {
               return "png";
  
  
  
  1.1.2.4   +26 -46    xml-cocoon/src/org/apache/cocoon/Attic/Notifier.java
  
  Index: Notifier.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Notifier.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- Notifier.java	2000/09/22 20:19:03	1.1.2.3
  +++ Notifier.java	2000/09/27 16:14:50	1.1.2.4
  @@ -32,7 +32,7 @@
    *
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/09/22 20:19:03 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/09/27 16:14:50 $
    */
    
   public class Notifier {
  @@ -44,55 +44,35 @@
   
           StringBuffer sb = new StringBuffer();
   
  -        String contentType = req.getContentType();
  +        // FIXME (SM) how can we send the error with the proper content type?
  +        
  +        res.setContentType("text/html");
  +        sb.append("<html><head><title>" + n.getTitle() + "</title>");
  +        sb.append("<STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} ");
  +        sb.append("BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;} ");
  +        sb.append("B{color : white;background-color : #0086b2;} ");
  +        sb.append("HR{color : #0086b2;} ");
  +        sb.append("--></STYLE> ");
  +        sb.append("</head><body>");
  +        sb.append("<h1>Cocoon 2 - " + n.getTitle() + "</h1>");
  +        sb.append("<HR size=\"1\" noshade>");
  +        sb.append("<p><b>type</b> " + n.getType() + "</p>");
  +        sb.append("<p><b>message</b> <u>" + n.getMessage() + "</u></p>");
  +        sb.append("<p><b>description</b> <u>" + n.getDescription() + "</u></p>");
  +        sb.append("<p><b>sender</b> " + n.getSender() + "</p>");
  +        sb.append("<p><b>source</b> " + n.getSource() + "</p>");
   
  -        if ("text/html".equals(contentType)) {
  -            res.setContentType("text/html");
  -            sb.append("<html><head><title>" + n.getTitle() + "</title>");
  -            sb.append("<STYLE><!--H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} ");
  -            sb.append("BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;} ");
  -            sb.append("B{color : white;background-color : #0086b2;} ");
  -            sb.append("HR{color : #0086b2;} ");
  -            sb.append("--></STYLE> ");
  -            sb.append("</head><body>");
  -            sb.append("<h1>Cocoon 2 - " + n.getTitle() + "</h1>");
  -            sb.append("<HR size=\"1\" noshade>");
  -            sb.append("<p><b>type</b> " + n.getType() + "</p>");
  -            sb.append("<p><b>message</b> <u>" + n.getMessage() + "</u></p>");
  -            sb.append("<p><b>description</b> <u>" + n.getDescription() + "</u></p>");
  -            sb.append("<p><b>sender</b> " + n.getSender() + "</p>");
  -            sb.append("<p><b>source</b> " + n.getSource() + "</p>");
  -
  -            HashMap extraDescriptions = n.getExtraDescriptions();
  -            Iterator keyIter = extraDescriptions.keySet().iterator();
  -
  -            while (keyIter.hasNext()) {
  -                String key = (String) keyIter.next();
  -
  -                sb.append("<p><b>" + key + "</b><pre>" + extraDescriptions.get(key) + "</pre></p>");
  -            }
  -
  -            sb.append("<HR size=\"1\" noshade>");
  -            sb.append("</body></html>");
  -        } else {
  -            res.setContentType("text/xml");
  -            sb.append("<notify type=\"" + n.getType() + "\" sender=\"" + n.getSender() + "\">");
  -            sb.append("<title>" + n.getTitle() + "</title>");
  -            sb.append("<source>" + n.getSource() + "</source>");
  -            sb.append("<message>" + n.getMessage() + "</message>");
  -            sb.append("<description>" + n.getDescription() + "</description>");
  -
  -            HashMap extraDescriptions = n.getExtraDescriptions();
  -            Iterator keyIter = extraDescriptions.keySet().iterator();
  +        HashMap extraDescriptions = n.getExtraDescriptions();
  +        Iterator keyIter = extraDescriptions.keySet().iterator();
   
  -            while (keyIter.hasNext()) {
  -                String key = (String) keyIter.next();
  +        while (keyIter.hasNext()) {
  +            String key = (String) keyIter.next();
   
  -                sb.append("<extra description=\"" + key + "\">" + extraDescriptions.get(key) + "</extra>");
  -            }
  -
  -            sb.append("</notify>");
  +            sb.append("<p><b>" + key + "</b><pre>" + extraDescriptions.get(key) + "</pre></p>");
           }
  +
  +        sb.append("<HR size=\"1\" noshade>");
  +        sb.append("</body></html>");
   
           res.getOutputStream().print(sb.toString());
       }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.37  +5 -5      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.36
  retrieving revision 1.1.2.37
  diff -u -r1.1.2.36 -r1.1.2.37
  --- sitemap.xsl	2000/09/10 11:36:15	1.1.2.36
  +++ sitemap.xsl	2000/09/27 16:15:00	1.1.2.37
  @@ -11,7 +11,7 @@
   
   <!--
    * @author &lt;a href="mailto:Giacomo.Pati@pwr.ch"&gt;Giacomo Pati&lt;/a&gt;
  - * @version CVS $Revision: 1.1.2.36 $ $Date: 2000/09/10 11:36:15 $
  + * @version CVS $Revision: 1.1.2.37 $ $Date: 2000/09/27 16:15:00 $
   -->
   
   <!-- Sitemap Core logicsheet for the Java language -->
  @@ -132,7 +132,7 @@
             </xsl:call-template>
           </xsl:variable>
           <xsl:value-of select="java:getClassSource($factory-loader,string($factory),string($matcher-name),string(@pattern),$config)"/>
  -        private List <xsl:value-of select="$matcher-name"/> (String pattern, Map objectModel) {
  +        private List <xsl:value-of select="$matcher-name"/> (String pattern, Environment environment) {
             <xsl:value-of select="java:getMethodSource($factory-loader,string($factory),string($matcher-name),string(@pattern),$config)"/>
           }
         </xsl:for-each>
  @@ -156,7 +156,7 @@
           </xsl:variable>
           <xsl:if test="not(preceding::map:when[@test = $this-test])">
             <xsl:value-of select="java:getClassSource($factory-loader,string($factory),string(@test),string($selector-name),$config)"/>
  -          private boolean <xsl:value-of select="$selector-name"/> (String pattern, Map objectModel) {
  +          private boolean <xsl:value-of select="$selector-name"/> (String pattern, Environment environment) {
               <xsl:value-of select="java:getMethodSource($factory-loader,string($factory),string(@test),string($selector-name),$config)"/>
             }
           </xsl:if>
  @@ -363,7 +363,7 @@
           </xsl:choose>
         </xsl:for-each>
       </xsl:variable>
  -    if ((list = <xsl:value-of select="$matcher-name"/> ("<xsl:value-of select="$pattern-value"/>", objectModel)) != null) {
  +    if ((list = <xsl:value-of select="$matcher-name"/> ("<xsl:value-of select="$pattern-value"/>", environment)) != null) {
         listOfLists.add (list);
         <xsl:apply-templates/>
         listOfLists.remove (list);
  @@ -409,7 +409,7 @@
         <xsl:if test="position() > 1">
           else
         </xsl:if>
  -      if (<xsl:value-of select="$selector-name"/> ("<xsl:value-of select="$test-value"/>", objectModel)) {
  +      if (<xsl:value-of select="$selector-name"/> ("<xsl:value-of select="$test-value"/>", environment)) {
          <xsl:apply-templates/>
         }
       </xsl:for-each>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +6 -1      xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/AbstractJavaCompiler.java
  
  Index: AbstractJavaCompiler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/AbstractJavaCompiler.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- AbstractJavaCompiler.java	2000/08/21 17:41:46	1.1.2.5
  +++ AbstractJavaCompiler.java	2000/09/27 16:15:06	1.1.2.6
  @@ -17,7 +17,7 @@
   /**
    * This class implements the functionality common to all Java compilers.
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.1.2.5 $ $Date: 2000/08/21 17:41:46 $
  + * @version $Revision: 1.1.2.6 $ $Date: 2000/09/27 16:15:06 $
    * @since 2.0
    */
   public abstract class AbstractJavaCompiler implements LanguageCompiler {
  @@ -25,23 +25,28 @@
      * The source program filename
      */
     protected String    file;
  +  
     /**
      * The name of the directory containing the source program file
      */
     protected String    srcDir;
  +  
     /**
      * The name of the directory to contain the resulting object program file
      */
     protected String    destDir;
  +  
     /**
      * The classpath to be used for compilation
      */
     protected String    classpath;
  +  
     /**
      * The encoding of the source program or <code>null</code> to use the
      * platform's default encoding
      */
     protected String    encoding = null;
  +  
     /**
      * The input stream to output compilation errors
      */
  
  
  
  1.1.2.5   +151 -91   xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/Jikes.java
  
  Index: Jikes.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/Jikes.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- Jikes.java	2000/08/21 17:41:46	1.1.2.4
  +++ Jikes.java	2000/09/27 16:15:14	1.1.2.5
  @@ -1,11 +1,11 @@
   /*****************************************************************************
  - * Copyright (C) The Apache Software Foundation. All rights reserved.      *
  + * 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.                                      *
  + * the LICENSE file.                                                         *
    *****************************************************************************/
  - 
  +
   package org.apache.cocoon.components.language.programming.java;
   
   import java.io.*;
  @@ -14,98 +14,158 @@
   
   /**
    * This class wraps IBM's <i>Jikes</i> Java compiler
  + * NOTE: inspired by the Apache Jasper implementation.
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.1.2.4 $ $Date: 2000/08/21 17:41:46 $
  + * @version $Revision: 1.1.2.5 $ $Date: 2000/09/27 16:15:14 $
    * @since 2.0
    */
   
   public class Jikes extends AbstractJavaCompiler {
  -  /**
  -  * Compile a source file yielding a loadable class file.
  -  *
  -  * @param filename The object program base file name
  -  * @param baseDirectory The directory containing the object program file
  -  * @param encoding The encoding expected in the source file or
  -  * <code>null</code> if it is the platform's default encoding
  -  * @exception LanguageException If an error occurs during compilation
  -  */
  -   public boolean compile() throws IOException {
  -      List args = new ArrayList();
  -      // command line name
  -      args.add("jikes");
  -      // indicate Emacs output mode must be used
  -      args.add("+D");
  -
  -      Process p = Runtime.getRuntime().exec(toStringArray(fillArguments(args)));
  -
  -      errors = p.getInputStream();
  -      
  -      try {
  -        p.waitFor();
  -        return (p.exitValue() == 0);
  -      } catch(InterruptedException somethingHappened) {
  -        return false;
  -      }
  -   }
  -   
  -  /**
  -   * Parse the compiler error stream to produce a list of
  -   * <code>CompilerError</code>s
  -   *
  -   * @param errors The error stream
  -   * @return The list of compiler error messages
  -   * @exception IOException If an error occurs during message collection
  -   */
  -   protected List parseStream(BufferedReader input) throws IOException {
  -      List errors = null;
  -      String line = null;
  -      StringBuffer buffer = new StringBuffer();
  -
  -      while (true) {
  -        // cleanup the buffer
  -        buffer.delete(0, buffer.length());
  -
  -        // first line is not space-starting        
  -        if (line == null) line = input.readLine();
  -        if (line == null) return errors;
  -        buffer.append(line);
  -
  -        // all other space-starting lines are one error
  -        while (true) {        
  -           line = input.readLine();
  -           if ((line == null) || (line.charAt(0) != ' ')) break;
  -           buffer.append(line);
  -           buffer.append('\n');
  +
  +    static final int OUTPUT_BUFFER_SIZE = 1024;
  +    static final int BUFFER_SIZE = 512;
  +
  +    class StreamPumper extends Thread {
  +
  +        private BufferedInputStream stream;
  +        private boolean endOfStream = false;
  +        private boolean stopSignal  = false;
  +        private int SLEEP_TIME = 5;
  +        private OutputStream out;
  +
  +        public StreamPumper(BufferedInputStream is, OutputStream out) {
  +            this.stream = is;
  +            this.out = out;
  +        }
  +
  +        public void pumpStream() throws IOException {
  +            byte[] buf = new byte[BUFFER_SIZE];
  +            if (!endOfStream) {
  +                int bytesRead = stream.read(buf, 0, BUFFER_SIZE);
  +
  +                if (bytesRead > 0) {
  +                    out.write(buf, 0, bytesRead);
  +                } else if (bytesRead == -1) {
  +                    endOfStream = true;
  +                }
  +            }
  +        }
  +
  +        public void run() {
  +            try {
  +                while (!endOfStream) {
  +                    pumpStream();
  +                    sleep(SLEEP_TIME);
  +                }
  +            } catch (Exception e) {
  +            }
  +        }
  +    }
  +
  +    /**
  +     * Execute the compiler
  +     */
  +    public boolean compile() throws IOException {
  +
  +        List args = new ArrayList();
  +        // command line name
  +        args.add("jikes");
  +        // indicate Emacs output mode must be used
  +        args.add("+E");
  +        // avoid warnings
  +        args.add("--nowarn");
  +
  +        int exitValue;
  +        ByteArrayOutputStream tmpErr = new ByteArrayOutputStream(OUTPUT_BUFFER_SIZE);
  +
  +        try {
  +            Process p = Runtime.getRuntime().exec(toStringArray(fillArguments(args)));
  +
  +            BufferedInputStream compilerErr = new BufferedInputStream(p.getErrorStream());
  +
  +            StreamPumper errPumper = new StreamPumper(compilerErr, tmpErr);
  +
  +            errPumper.start();
  +
  +            p.waitFor();
  +            exitValue = p.exitValue();
  +
  +            // Wait until the complete error stream has been read
  +            errPumper.join();
  +            compilerErr.close();
  +
  +            p.destroy();
  +
  +            tmpErr.close();
  +            this.errors = new ByteArrayInputStream(tmpErr.toByteArray());
  +
  +        } catch (InterruptedException somethingHappened) {
  +            return false;
  +        }
  +
  +        // Jikes returns 0 even when there are some types of errors.
  +        // Check if any error output as well
  +        return ((exitValue == 0) && (tmpErr.size() > 0));
  +    }
  +
  +    /**
  +     * Parse the compiler error stream to produce a list of
  +     * <code>CompilerError</code>s
  +     *
  +     * @param errors The error stream
  +     * @return The list of compiler error messages
  +     * @exception IOException If an error occurs during message collection
  +     */
  +    protected List parseStream(BufferedReader input) throws IOException {
  +        List errors = null;
  +        String line = null;
  +        StringBuffer buffer = new StringBuffer();
  +
  +        while (true) {
  +            // cleanup the buffer
  +            buffer.delete(0, buffer.length());
  +
  +            // first line is not space-starting
  +            if (line == null) line = input.readLine();
  +            if (line == null) return errors;
  +            buffer.append(line);
  +
  +            // all other space-starting lines are one error
  +            while (true) {
  +                line = input.readLine();
  +                if ((line == null) || (line.charAt(0) != ' ')) break;
  +                buffer.append(line);
  +                buffer.append('\n');
  +            }
  +
  +            // if error is found create the vector
  +            if (errors == null) errors = new ArrayList();
  +
  +            // add the error bean
  +            errors.add(parseError(buffer.toString()));
           }
  -        
  -        // if error is found create the vector
  -        if (errors == null) errors = new ArrayList();
  -        
  -        // add the error bean
  -        errors.add(parseError(buffer.toString()));
  -      }
  -   }
  -   
  -  /**
  -   * Parse an individual compiler error message
  -   *
  -   * @param error The error text
  -   * @return A mssaged <code>CompilerError</code>
  -   */
  -   private CompilerError parseError(String error) {
  -      StringTokenizer tokens = new StringTokenizer(error, ":");
  -      String file = tokens.nextToken();
  -      int startline = Integer.parseInt(tokens.nextToken());
  -      int startcolumn = Integer.parseInt(tokens.nextToken());
  -      int endline = Integer.parseInt(tokens.nextToken());
  -      int endcolumn = Integer.parseInt(tokens.nextToken());
  -      String type = tokens.nextToken().trim().toLowerCase();
  -      String message = tokens.nextToken().trim();
  -      
  -      return new CompilerError(file, type.equals("error"), startline, startcolumn, endline, endcolumn, message);
  -   }
  -   
  -   public String toString() {
  -      return "IBM Jikes Compiler";
  -   }
  +    }
  +
  +    /**
  +     * Parse an individual compiler error message
  +     *
  +     * @param error The error text
  +     * @return A mssaged <code>CompilerError</code>
  +     */
  +    private CompilerError parseError(String error) {
  +        StringTokenizer tokens = new StringTokenizer(error, ":");
  +        String file = tokens.nextToken();
  +        int startline = Integer.parseInt(tokens.nextToken());
  +        int startcolumn = Integer.parseInt(tokens.nextToken());
  +        int endline = Integer.parseInt(tokens.nextToken());
  +        int endcolumn = Integer.parseInt(tokens.nextToken());
  +        String type = tokens.nextToken().trim().toLowerCase();
  +        String message = tokens.nextToken().trim();
  +
  +        return new CompilerError(file, type.equals("error"), startline, startcolumn, endline, endcolumn, message);
  +    }
  +
  +    public String toString() {
  +        return "IBM Jikes Compiler";
  +    }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +5 -0      xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/FileSavingEnvironment.java
  
  Index: FileSavingEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/FileSavingEnvironment.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- FileSavingEnvironment.java	2000/09/03 17:45:46	1.1.2.3
  +++ FileSavingEnvironment.java	2000/09/27 16:15:23	1.1.2.4
  @@ -27,6 +27,11 @@
       
       public FileSavingEnvironment(String uri, File context, Map links, OutputStream stream)
       throws MalformedURLException {
  +        // FIXME (SM) the "LINK_TRANSLATING_VIEW" cannot work since this is NOT
  +        // something a resource view can do.
  +        // So for now, there is no link translation taking place bacause the
  +        // sitemap doesn't know "where" to translate the links.
  +        // I'm still researching on this... for now, no translation takes place.
           super(uri, Cocoon.LINK_TRANSLATING_VIEW, context);
           this.stream = stream;
           this.objectModel.put(Cocoon.LINK_TRANSLATED_NAME, links);
  
  
  
  1.1.2.4   +29 -42    xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/LinkSamplingEnvironment.java
  
  Index: LinkSamplingEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/commandline/Attic/LinkSamplingEnvironment.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- LinkSamplingEnvironment.java	2000/09/25 14:59:39	1.1.2.3
  +++ LinkSamplingEnvironment.java	2000/09/27 16:15:25	1.1.2.4
  @@ -17,21 +17,26 @@
   import java.io.File;
   import java.io.IOException;
   import java.io.OutputStream;
  +import java.io.BufferedReader;
  +import java.io.InputStreamReader;
  +import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
   
  +
   import java.net.MalformedURLException;
   
   import org.apache.cocoon.Cocoon;
  +import org.apache.cocoon.Main;
   import org.apache.cocoon.environment.AbstractEnvironment;
   
   public class LinkSamplingEnvironment extends AbstractEnvironment {
   
  -    private LineLister links;
  +    private ByteArrayOutputStream stream;
       
  -    public LinkSamplingEnvironment(String uri) 
  -    throws MalformedURLException {
  -        super(uri, Cocoon.LINK_VIEW, "");
  -        this.links = new LineLister();
  +    public LinkSamplingEnvironment(String uri, File context) 
  +    throws MalformedURLException, IOException {
  +        super(uri, Cocoon.LINK_VIEW, context);
  +        this.stream = new ByteArrayOutputStream();
       }
   
       /** 
  @@ -39,8 +44,8 @@
        */ 
       public void setContentType(String contentType) {
           if (!Cocoon.LINK_CONTENT_TYPE.equals(contentType)) {
  -            throw new RuntimeException("The link MIME type doesn't match."
  -                + " Make sure you used the appropriate 'link' serialier");
  +            // fixme (SM) this static method sucks!!
  +            Main.warning("The link MIMEtype doesn't match. A probable error occurred into the pipeline");
           }
       }
    
  @@ -48,7 +53,7 @@
        * Get the OutputStream 
        */ 
       public OutputStream getOutputStream() throws IOException {
  -        return this.links;
  +        return this.stream;
       }
   
       /**
  @@ -61,42 +66,24 @@
       /** 
        * Indicates if other links are present.
        */ 
  -    public Collection getLinks() {
  -        return this.links.list();
  -    }
  -    
  -    /**
  -     * This class parses the output stream and generates a list
  -     * out of the lines received.
  -     */
  -    class LineLister extends ByteArrayOutputStream {
  +    public Collection getLinks() throws IOException {
   
  -        private boolean linkable = false;
  -        
  -        private List links = new ArrayList();
  -        
  -        public void write(int c) {
  -            if (!linkable && (c == '+')) {
  -                linkable = true;
  -                return;
  +        // FIXME (SM) I'm sure there is a much faster and less memory consuming
  +        // way of doing this, but I'm lazy and I don't care at this point.
  +        // Anyway the parsing is very easy:
  +        // + http://host/to-be-processed
  +        // - http://host/not-to-be-processed
  +        // with +/- at char(0), space at char(1), url starting at char(2)
  +         
  +        ArrayList list = new ArrayList();
  +        BufferedReader buffer = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(stream.toByteArray())));
  +        while (true) {
  +            String line = buffer.readLine();
  +            if (line == null) break;
  +            if (line.charAt(0) == '+') {
  +                list.add(line.substring(2));
               }
  -            if (linkable && (c == ' ')) {
  -                return;
  -            }
  -            if (c == '\n') {
  -                if (linkable) links.add(this.toString());
  -                reset();
  -            }
  -            super.write(c);
  -        }
  -        
  -        public Collection list() {
  -            return links;
  -        }
  -        
  -        public void reset() {
  -            super.reset();
  -            linkable = false;
           }
  +        return list;
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.8   +4 -61     xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractSerializer.java
  
  Index: AbstractSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractSerializer.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- AbstractSerializer.java	2000/09/05 17:27:28	1.1.2.7
  +++ AbstractSerializer.java	2000/09/27 16:15:33	1.1.2.8
  @@ -8,81 +8,24 @@
    
   package org.apache.cocoon.serialization;
   
  -import java.io.BufferedOutputStream;
   import java.io.OutputStream;
   
  -import org.apache.xml.serialize.SerializerFactory;
  -import org.apache.xml.serialize.Method;
  -import org.apache.xml.serialize.OutputFormat;
  +import org.apache.cocoon.xml.AbstractXMLPipe;
   
  -import org.apache.avalon.Configurable;
  -import org.apache.avalon.Configuration;
  -import org.apache.avalon.ConfigurationException;
  -
  -import org.apache.cocoon.sitemap.SitemapOutputComponent;
  -import org.apache.cocoon.xml.XMLConsumerBridge;
  -
   /**
    * @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.1.2.7 $ $Date: 2000/09/05 17:27:28 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/09/27 16:15:33 $
    */
  -public abstract class AbstractSerializer extends XMLConsumerBridge 
  -implements Serializer, Configurable {
  + 
  +public abstract class AbstractSerializer extends AbstractXMLPipe implements Serializer {
   
       /**
  -     * The <code>OutputFormat</code> used by this serializer.
  -     */    
  -    protected OutputFormat format;
  -    
  -    /**
        * The <code>OutputStream</code> used by this serializer.
        */    
       protected OutputStream output;
   
  -    /** 
  -     * Set the configurations for this serializer. 
  -     */
  -    public void setConfiguration(Configuration conf) 
  -      throws ConfigurationException {
  -
  -        format = new OutputFormat();
  -        format.setPreserveSpace(true);
  -
  -        Configuration encoding = conf.getConfiguration("encoding");
  -        if (encoding != null) {
  -            format.setEncoding(encoding.getValue());
  -        }
  -
  -        Configuration doctypePublic = conf.getConfiguration("doctype-public");
  -        Configuration doctypeSystem = conf.getConfiguration("doctype-system");
  -        if (doctypeSystem != null) {
  -            format.setDoctype((doctypePublic != null) ? doctypePublic.getValue() : null, doctypeSystem.getValue());
  -        }
  -
  -        Configuration indent = conf.getConfiguration("indent");
  -        if (indent != null) {
  -            format.setIndenting(true);
  -            format.setIndent(indent.getValueAsInt());
  -        }
  -
  -        Configuration preserveSpace = conf.getConfiguration("preserve-space");
  -        if (preserveSpace != null) {
  -            format.setPreserveSpace(preserveSpace.getValueAsBoolean());
  -        }
  -
  -        Configuration declaration = conf.getConfiguration("xml-declaration");
  -        if (declaration != null) {
  -            format.setOmitXMLDeclaration(!declaration.getValueAsBoolean());
  -        }
  -        
  -        Configuration lineWidth = conf.getConfiguration("line-width");
  -        if (lineWidth != null) {
  -            format.setLineWidth(lineWidth.getValueAsInt());
  -        }        
  -    }
  -        
       /**
        * Set the <code>OutputStream</code> where the XML should be serialized.
        */
  
  
  
  1.1.2.6   +2 -5      xml-cocoon/src/org/apache/cocoon/serialization/Attic/FOPSerializer.java
  
  Index: FOPSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/FOPSerializer.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- FOPSerializer.java	2000/09/25 14:57:23	1.1.2.5
  +++ FOPSerializer.java	2000/09/27 16:15:37	1.1.2.6
  @@ -15,13 +15,10 @@
   import org.apache.fop.apps.Driver;
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.apps.Version;
  -
   import org.apache.fop.messaging.MessageListener;
   import org.apache.fop.messaging.MessageHandler;
   import org.apache.fop.messaging.MessageEvent;
   
  -import org.apache.cocoon.xml.XMLConsumerBridge;
  -
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   
  @@ -31,10 +28,10 @@
    * @author <a href="mailto:giacomo.pati@pwr.ch">Giacomo Pati</a>
    *         (PWR Organisation &amp; Entwicklung)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/09/25 14:57:23 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/09/27 16:15:37 $
    *
    */
  -public class FOPSerializer extends XMLConsumerBridge implements Serializer, MessageListener {
  +public class FOPSerializer extends AbstractSerializer implements MessageListener {
   
       /**
        * The FOP driver 
  
  
  
  1.1.2.8   +2 -2      xml-cocoon/src/org/apache/cocoon/serialization/Attic/HTMLSerializer.java
  
  Index: HTMLSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/HTMLSerializer.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- HTMLSerializer.java	2000/09/25 14:58:11	1.1.2.7
  +++ HTMLSerializer.java	2000/09/27 16:15:39	1.1.2.8
  @@ -19,10 +19,10 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/09/25 14:58:11 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/09/27 16:15:39 $
    */
   
  -public class HTMLSerializer extends AbstractSerializer {
  +public class HTMLSerializer extends AbstractTextSerializer {
   
       private SerializerFactory factory;
       
  
  
  
  1.1.2.11  +8 -7      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.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- SVGSerializer.java	2000/09/25 14:58:13	1.1.2.10
  +++ SVGSerializer.java	2000/09/27 16:15:43	1.1.2.11
  @@ -1,10 +1,11 @@
  -/***************************************************************************** * 
  -Copyright (C) 1999 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 wich has been included  with this distribution in * * the 
  -LICENSE file.                                                         * 
  -*****************************************************************************/ 
  +/*****************************************************************************
  + * Copyright (C) 1999 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 wich has been included  with this distribution in *
  + * the LICENSE file.                                                         * 
  + *****************************************************************************/ 
  + 
   package org.apache.cocoon.serialization;
   
   import org.apache.cocoon.*;
  
  
  
  1.1.2.4   +2 -2      xml-cocoon/src/org/apache/cocoon/serialization/Attic/TextSerializer.java
  
  Index: TextSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/TextSerializer.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- TextSerializer.java	2000/09/25 14:58:15	1.1.2.3
  +++ TextSerializer.java	2000/09/27 16:15:46	1.1.2.4
  @@ -19,10 +19,10 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/09/25 14:58:15 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/09/27 16:15:46 $
    */
   
  -public class TextSerializer extends AbstractSerializer {
  +public class TextSerializer extends AbstractTextSerializer {
   
       private SerializerFactory factory;
       
  
  
  
  1.1.2.3   +7 -8      xml-cocoon/src/org/apache/cocoon/serialization/Attic/XLinkSerializer.java
  
  Index: XLinkSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/XLinkSerializer.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- XLinkSerializer.java	2000/09/25 14:58:16	1.1.2.2
  +++ XLinkSerializer.java	2000/09/27 16:15:49	1.1.2.3
  @@ -14,16 +14,17 @@
   
   import org.apache.cocoon.Cocoon;
   
  +import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   
  -import org.apache.cocoon.xml.xlink.XLinkConsumerBridge;
  +import org.apache.cocoon.xml.xlink.XLinkPipe;
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/09/25 14:58:16 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/09/27 16:15:49 $
    */
   
  -public class XLinkSerializer extends XLinkConsumerBridge implements Serializer {
  +public class XLinkSerializer extends XLinkPipe implements Serializer {
   
       private PrintStream out;
       
  @@ -42,14 +43,12 @@
           return Cocoon.LINK_CONTENT_TYPE;
       }
       
  -    // XLinkHandler implementation
  -    
  -    public void simpleLink(String href, String role, String arcrole, String title, String show, String actuate, String uri, String name, String raw) 
  +    public void simpleLink(String href, String role, String arcrole, String title, String show, String actuate, String uri, String name, String raw, Attributes attr) 
       throws SAXException {
           encode(href, role, out);
       }
  -    
  -    public void startLocator(String href, String role, String title, String label, String uri, String name, String raw)
  +
  +    public void startLocator(String href, String role, String title, String label, String uri, String name, String raw, Attributes attr)
       throws SAXException {
           encode(href, role, out);
       }
  
  
  
  1.1.2.8   +2 -2      xml-cocoon/src/org/apache/cocoon/serialization/Attic/XMLSerializer.java
  
  Index: XMLSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/XMLSerializer.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- XMLSerializer.java	2000/09/25 14:58:17	1.1.2.7
  +++ XMLSerializer.java	2000/09/27 16:15:51	1.1.2.8
  @@ -19,10 +19,10 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/09/25 14:58:17 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/09/27 16:15:51 $
    */
   
  -public class XMLSerializer extends AbstractSerializer {
  +public class XMLSerializer extends AbstractTextSerializer {
   
       private SerializerFactory factory;
       
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +73 -0     xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractTextSerializer.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +4 -176    xml-cocoon/src/org/apache/cocoon/transformation/Attic/AbstractTransformer.java
  
  Index: AbstractTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/AbstractTransformer.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- AbstractTransformer.java	2000/09/05 17:26:23	1.1.2.6
  +++ AbstractTransformer.java	2000/09/27 16:16:12	1.1.2.7
  @@ -5,188 +5,16 @@
    * version 1.1, a copy of which has been included  with this distribution in *
    * the LICENSE file.                                                         *
    *****************************************************************************/
  -package org.apache.cocoon.transformation;
   
  -import org.apache.cocoon.xml.AbstractXMLProducer;
  +package org.apache.cocoon.transformation;
   
  -import org.xml.sax.Attributes;
  -import org.xml.sax.Locator;
  -import org.xml.sax.SAXException;
  +import org.apache.cocoon.xml.AbstractXMLPipe;
   
   /**
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/09/05 17:26:23 $
  + * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/09/27 16:16:12 $
    */
  -public abstract class AbstractTransformer extends AbstractXMLProducer
  -implements Transformer {
  -
  -    /** Wether we are forwarding XML data or not. */
  -    private boolean canReset=true;
  -
  -    /**
  -     * Receive an object for locating the origin of SAX document events.
  -     */
  -    public void setDocumentLocator(Locator locator) {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.setDocumentLocator(locator);
  -    }
  -
  -    /**
  -     * Receive notification of the beginning of a document.
  -     */
  -    public void startDocument()
  -    throws SAXException {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.startDocument();
  -        this.canReset=false;
  -    }
  -
  -    /**
  -     * Receive notification of the end of a document.
  -     */
  -    public void endDocument()
  -    throws SAXException {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.endDocument();
  -        this.canReset=true;
  -    }
  -
  -    /**
  -     * Begin the scope of a prefix-URI Namespace mapping.
  -     */
  -    public void startPrefixMapping(String prefix, String uri)
  -    throws SAXException {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.startPrefixMapping(prefix,uri);
  -    }
  -
  -    /**
  -     * End the scope of a prefix-URI mapping.
  -     */
  -    public void endPrefixMapping(String prefix)
  -    throws SAXException {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.endPrefixMapping(prefix);
  -    }
  -
  -    /**
  -     * Receive notification of the beginning of an element.
  -     */
  -    public void startElement(String uri, String loc, String raw, Attributes a)
  -    throws SAXException {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.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 (super.contentHandler!=null)
  -            super.contentHandler.endElement(uri,loc,raw);
  -    }
  -
  -    /**
  -     * Receive notification of character data.
  -     */
  -    public void characters(char ch[], int start, int len)
  -    throws SAXException {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.characters(ch,start,len);
  -    }
  -
  -    /**
  -     * Receive notification of ignorable whitespace in element content.
  -     */
  -    public void ignorableWhitespace(char ch[], int start, int len)
  -    throws SAXException {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.ignorableWhitespace(ch,start,len);
  -    }
  -
  -    /**
  -     * Receive notification of a processing instruction.
  -     */
  -    public void processingInstruction(String target, String data)
  -    throws SAXException {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.processingInstruction(target,data);
  -    }
  -
  -    /**
  -     * Receive notification of a skipped entity.
  -     */
  -    public void skippedEntity(String name)
  -    throws SAXException {
  -        if (super.contentHandler!=null)
  -            super.contentHandler.skippedEntity(name);
  -    }
  -
  -    /**
  -     * Report the start of DTD declarations, if any.
  -     */
  -    public void startDTD(String name, String publicId, String systemId)
  -    throws SAXException {
  -        if (super.lexicalHandler!=null)
  -            super.lexicalHandler.startDTD(name,publicId,systemId);
  -    }
  -
  -    /**
  -     * Report the end of DTD declarations.
  -     */
  -    public void endDTD()
  -    throws SAXException {
  -        if (super.lexicalHandler!=null)
  -            super.lexicalHandler.endDTD();
  -    }
  -
  -    /**
  -     * Report the beginning of an entity.
  -     */
  -    public void startEntity(String name)
  -    throws SAXException {
  -        if (super.lexicalHandler!=null)
  -            super.lexicalHandler.startEntity(name);
  -    }
  -
  -    /**
  -     * Report the end of an entity.
  -     */
  -    public void endEntity(String name)
  -    throws SAXException {
  -        if (super.lexicalHandler!=null)
  -            super.lexicalHandler.endEntity(name);
  -    }
  -
  -    /**
  -     * Report the start of a CDATA section.
  -     */
  -    public void startCDATA()
  -    throws SAXException {
  -        if (super.lexicalHandler!=null)
  -            super.lexicalHandler.startCDATA();
  -    }
  -
  -    /**
  -     * Report the end of a CDATA section.
  -     */
  -    public void endCDATA()
  -    throws SAXException {
  -        if (super.lexicalHandler!=null)
  -            super.lexicalHandler.endCDATA();
  -    }
  -
   
  -    /**
  -     * Report an XML comment anywhere in the document.
  -     */
  -    public void comment(char ch[], int start, int len)
  -    throws SAXException {
  -        if (super.lexicalHandler!=null)
  -            super.lexicalHandler.comment(ch,start,len);
  -    }
  -}
  +public abstract class AbstractTransformer extends AbstractXMLPipe implements Transformer {}
  
  
  
  1.1.2.6   +1 -2      xml-cocoon/src/org/apache/cocoon/transformation/Attic/LogTransformer.java
  
  Index: LogTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/LogTransformer.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- LogTransformer.java	2000/09/02 21:12:40	1.1.2.5
  +++ LogTransformer.java	2000/09/27 16:16:16	1.1.2.6
  @@ -10,7 +10,6 @@
   import org.apache.avalon.utils.Parameters;
   
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.xml.AbstractXMLProducer;
   
   import org.xml.sax.Attributes;
   import org.xml.sax.Locator;
  @@ -45,7 +44,7 @@
    * 
    * @author <a href="mailto:giacomo.pati@pwr.ch">Giacomo Pati</a>
    *         (PWR Organisation &amp; Entwicklung)
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/09/02 21:12:40 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/09/27 16:16:16 $
    *
    */
   public class LogTransformer extends AbstractTransformer {
  
  
  
  1.1.2.2   +3 -3      xml-cocoon/src/org/apache/cocoon/transformation/Attic/XLinkTranslator.java
  
  Index: XLinkTranslator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XLinkTranslator.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- XLinkTranslator.java	2000/09/25 14:51:56	1.1.2.1
  +++ XLinkTranslator.java	2000/09/27 16:16:19	1.1.2.2
  @@ -22,14 +22,14 @@
   
   import org.apache.cocoon.Cocoon;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.xml.xlink.XLinkConsumerBridge;
  +import org.apache.cocoon.xml.xlink.XLinkPipe;
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/09/25 14:51:56 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/09/27 16:16:19 $
    */
   
  -public class XLinkTranslator extends XLinkConsumerBridge implements Transformer {
  +public class XLinkTranslator extends XLinkPipe implements Transformer {
   
       private Map links;
       
  
  
  
  1.1.2.2   +3 -3      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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- XTTransformer.java	2000/09/05 17:26:52	1.1.2.1
  +++ XTTransformer.java	2000/09/27 16:16:22	1.1.2.2
  @@ -24,8 +24,8 @@
   
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.xml.XMLConsumer;
  -import org.apache.cocoon.xml.dom.DocumentHandlerAdapter;
  -import org.apache.cocoon.xml.dom.DocumentHandlerWrapper;
  +import org.apache.cocoon.xml.DocumentHandlerAdapter;
  +import org.apache.cocoon.xml.DocumentHandlerWrapper;
   import org.apache.cocoon.transformation.Transformer;
   import org.apache.cocoon.components.store.Store;
   
  @@ -65,7 +65,7 @@
    * This Transformer use the XT processor.
    * 
    * @author <a href="mailto:ssahuc@imediation.com">Sahuc Sebastien</a>
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/09/05 17:26:52 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/09/27 16:16:22 $
    */
   public class XTTransformer extends DocumentHandlerWrapper
   implements Transformer, Composer {
  
  
  
  1.1.2.9   +40 -41    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.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- XalanTransformer.java	2000/09/05 17:26:52	1.1.2.8
  +++ XalanTransformer.java	2000/09/27 16:16:24	1.1.2.9
  @@ -23,8 +23,8 @@
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.store.Store;
   import org.apache.cocoon.xml.XMLConsumer;
  -import org.apache.cocoon.xml.dom.DocumentHandlerAdapter;
  -import org.apache.cocoon.xml.dom.DocumentHandlerWrapper;
  +import org.apache.cocoon.xml.DocumentHandlerAdapter;
  +import org.apache.cocoon.xml.DocumentHandlerWrapper;
   
   import org.apache.xalan.xslt.StylesheetRoot;
   import org.apache.xalan.xslt.XSLTInputSource;
  @@ -41,11 +41,11 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/09/05 17:26:52 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/09/27 16:16:24 $
    */
   public class XalanTransformer extends DocumentHandlerWrapper
   implements Transformer, Composer {
  -    
  +
       /** The store service instance */
       private Store store = null;
   
  @@ -61,7 +61,7 @@
       }
   
       /**
  -     * Set the <code>EntityResolver</code>, the <code>Map</code> with 
  +     * Set the <code>EntityResolver</code>, the <code>Map</code> with
        * the object model, the source and sitemap
        * <code>Parameters</code> used to process the request.
        */
  @@ -69,13 +69,10 @@
       throws SAXException, ProcessingException, IOException {
   
           /** The Request object */
  -        HttpServletRequest request = (HttpServletRequest)objectModel.get("request");
  -        if (request == null) {
  -            throw new ProcessingException ("Missing request object in obejctModel");
  -        }
  -        
  +        HttpServletRequest request = (HttpServletRequest) objectModel.get("request");
  +
           // Check the stylesheet uri
  -        String xsluri = src; 
  +        String xsluri = src;
           if (xsluri == null) {
               throw new ProcessingException("Stylesheet URI can't be null");
           }
  @@ -89,14 +86,16 @@
           // Create the processor and set it as this documenthandler
           this.processor = XSLTProcessorFactory.getProcessor();
           this.processor.setStylesheet(stylesheet);
  -		Enumeration enum = request.getParameterNames();
  -		while (enum.hasMoreElements()) {
  -			String name = (String) enum.nextElement();
  -			if (isValidXSLTParameterName(name)) {
  -				String value = request.getParameter(name);
  -				processor.setStylesheetParam(name, this.processor.createXString(value));
  -			}
  -		}
  +        if (request != null) {
  +            Enumeration parameters = request.getParameterNames();
  +            while (parameters.hasMoreElements()) {
  +                String name = (String) parameters.nextElement();
  +                if (isValidXSLTParameterName(name)) {
  +                    String value = request.getParameter(name);
  +                    processor.setStylesheetParam(name, this.processor.createXString(value));
  +                }
  +            }
  +        }
   
           this.setDocumentHandler(this.processor);
       }
  @@ -134,26 +133,26 @@
       public void setLexicalHandler(LexicalHandler lexical) {
       }
   
  -    // FIXME (SM): this method may be a hotspot for requests with many 
  -    //             parameters we should try to optimize it further 
  -	static boolean isValidXSLTParameterName(String name) {
  -		StringCharacterIterator iter = new StringCharacterIterator(name);
  -		char c = iter.first();
  -		if (!(Character.isLetter(c) || c == '_')) {
  -			return false;
  -		} else {
  -			c = iter.next();
  -		}
  -		while (c != iter.DONE) {
  -			if (!(Character.isLetterOrDigit(c) ||
  -				c == '-' ||
  -				c == '_' ||
  -				c == '.')) {
  -				return false;
  -			} else {
  -				c = iter.next();
  -			}
  -		}
  -		return true;
  -	}
  +    // FIXME (SM): this method may be a hotspot for requests with many
  +    //             parameters we should try to optimize it further
  +    static boolean isValidXSLTParameterName(String name) {
  +        StringCharacterIterator iter = new StringCharacterIterator(name);
  +        char c = iter.first();
  +        if (!(Character.isLetter(c) || c == '_')) {
  +            return false;
  +        } else {
  +            c = iter.next();
  +        }
  +        while (c != iter.DONE) {
  +            if (!(Character.isLetterOrDigit(c) ||
  +                c == '-' ||
  +                c == '_' ||
  +                c == '.')) {
  +                return false;
  +            } else {
  +                c = iter.next();
  +            }
  +        }
  +        return true;
  +    }
   }