]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/xsltd/xaland-java2/xaland2.java
This commit was manufactured by cvs2svn to create branch
[helm.git] / helm / xsltd / xaland-java2 / xaland2.java
diff --git a/helm/xsltd/xaland-java2/xaland2.java b/helm/xsltd/xaland-java2/xaland2.java
deleted file mode 100644 (file)
index fc5e20b..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright (C) 2000, HELM Team.
-// 
-// This file is part of HELM, an Hypertextual, Electronic
-// Library of Mathematics, developed at the Computer Science
-// Department, University of Bologna, Italy.
-// 
-// HELM is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-// 
-// HELM is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with HELM; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-// 
-// For details, see the HELM World-Wide-Web page,
-// http://cs.unibo.it/helm/.
-
-import java.net.*;
-import java.io.*;
-
-// Imported TraX classes
-import org.apache.trax.Processor;
-import org.apache.trax.Templates;
-import org.apache.trax.Transformer;
-import org.apache.trax.Result;
-import org.apache.trax.ProcessorException;
-import org.apache.trax.ProcessorFactoryException;
-import org.apache.trax.TransformException;
-
-// Imported SAX classes
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.Parser;
-import org.xml.sax.helpers.ParserAdapter;
-import org.xml.sax.helpers.XMLReaderFactory;
-import org.xml.sax.XMLReader;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.ext.LexicalHandler;
-
-// Imported DOM classes
-import org.w3c.dom.Node;
-
-// Imported Serializer classes
-import org.apache.serialize.OutputFormat;
-import org.apache.serialize.Serializer;
-import org.apache.serialize.SerializerFactory;
-
-// Imported JAVA API for XML Parsing 1.0 classes
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-
-public class xaland2 {
-   public static void main(String argv[]) throws  IOException, MalformedURLException, SAXException, ParserConfigurationException
-   {
-      int port    = Integer.parseInt(argv[0]);
-      int port2   = Integer.parseInt(argv[1]);
-      String xsl1 = argv[2];
-      String xsl2 = argv[3];
-      String theory_xsl1 = argv[4];
-      String theory_xsl2 = argv[5];
-
-      Processor theory_processor = Processor.newInstance("xslt");
-      Templates theory_style1 = theory_processor.process(new InputSource(theory_xsl1));
-      Transformer theory_transformer1 = theory_style1.newTransformer();
-
-      Templates theory_style2 = theory_processor.process(new InputSource(theory_xsl2));
-      Transformer theory_transformer2 = theory_style2.newTransformer();
-
-
-      Processor processor = Processor.newInstance("xslt");
-      Templates style1 = processor.process(new InputSource(xsl1));
-      Transformer transformer1 = style1.newTransformer();
-
-      Templates style2 = processor.process(new InputSource(xsl2));
-      Transformer transformer2 = style2.newTransformer();
-
-
-      DatagramSocket socket = new DatagramSocket(port);
-
-      System.out.println("Demon activated on input port " + port +
-       " and output port " + port2);
-      while(true) {
-         System.out.print("Ready...");
-
-         /* Warning: the packet must be a fresh one! */
-         DatagramPacket packet = new DatagramPacket(new byte[1024],1024);
-         socket.receive(packet);
-         byte data[] = packet.getData();
-         int datalen = packet.getLength();
-         String received = new String(data,0,datalen);
-
-         int first = received.indexOf(' ');
-         int last  = received.lastIndexOf(' ');
-         String mode = received.substring(0,first);
-         String input = received.substring(first+1,last);
-         String output = received.substring(last+1);
-
-         System.out.println("request received! Parameters are");
-         System.out.println("Mode: " + mode + " ");
-         System.out.println("Input file: \"" + input + "\"");
-         System.out.println("Output file: \"" + output  + "\"\n");
-
-         if ((new File(output)).exists()) {
-            System.out.println("Using cached version\n");
-         } else {
-            FileOutputStream fout = new FileOutputStream(output);
-            if (mode.equals("cic")) {
-               XMLReader reader = XMLReaderFactory.createXMLReader();
-               ContentHandler chandler = transformer1.getInputContentHandler();
-               reader.setContentHandler(chandler);
-               if (chandler instanceof LexicalHandler)
-                reader.setProperty("http://xml.org/sax/properties/lexical-handler", chandler);
-               else
-                reader.setProperty("http://xml.org/sax/properties/lexical-handler", null);
-
-               transformer1.setContentHandler(transformer2.getInputContentHandler());
-               Serializer serializer = SerializerFactory.getSerializer("xml");
-               serializer.setOutputStream(fout);
-               transformer2.setContentHandler(serializer.asContentHandler());
-
-               reader.parse(input);
-            } else if (mode.equals("theory")) {
-               XMLReader reader = XMLReaderFactory.createXMLReader();
-               ContentHandler chandler = theory_transformer1.getInputContentHandler();
-               reader.setContentHandler(chandler);
-               if (chandler instanceof LexicalHandler)
-                reader.setProperty("http://xml.org/sax/properties/lexical-handler", chandler);
-               else
-                reader.setProperty("http://xml.org/sax/properties/lexical-handler", null);
-
-               theory_transformer1.setContentHandler(theory_transformer2.getInputContentHandler());
-               Serializer serializer = SerializerFactory.getSerializer("xml");
-               serializer.setOutputStream(fout);
-               theory_transformer2.setContentHandler(serializer.asContentHandler());
-
-               reader.parse(input);
-             }
-         }
-
-         InetAddress address = InetAddress.getLocalHost();
-         DatagramSocket socket2 = new DatagramSocket();
-
-         byte buf[] = new byte[0];
-         DatagramPacket packet2 = new DatagramPacket(buf,0,address,port2);
-
-         socket2.send(packet2);
-      }
-   }
-}