X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fxsltd%2Fxaland-java%2Fxaland.java;fp=helm%2Fxsltd%2Fxaland-java%2Fxaland.java;h=0000000000000000000000000000000000000000;hb=1696761e4b8576e8ed81caa905fd108717019226;hp=b32106cf075952dec83e232816e05c912a99f031;hpb=5325734bc2e4927ed7ec146e35a6f0f2b49f50c1;p=helm.git diff --git a/helm/xsltd/xaland-java/xaland.java b/helm/xsltd/xaland-java/xaland.java deleted file mode 100644 index b32106cf0..000000000 --- a/helm/xsltd/xaland-java/xaland.java +++ /dev/null @@ -1,105 +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 org.apache.xalan.xslt.*; -import java.net.*; -import java.io.*; - -public class xaland { - public static void main(String argv[]) throws java.io.IOException, java.net.MalformedURLException, org.xml.sax.SAXException - { - 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]; - - XSLTProcessor theory_processor = - XSLTProcessorFactory.getProcessor(new org.apache.xalan.xpath.xdom.XercesLiaison()); - StylesheetRoot theory_style1 = - theory_processor.processStylesheet(theory_xsl1); - theory_processor.reset(); - StylesheetRoot theory_style2 = - theory_processor.processStylesheet(theory_xsl2); - theory_processor.setStylesheet(theory_style2); - - XSLTProcessor processor = - XSLTProcessorFactory.getProcessor(new org.apache.xalan.xpath.xdom.XercesLiaison()); - StylesheetRoot style1 = processor.processStylesheet(xsl1); - processor.reset(); - StylesheetRoot style2 = processor.processStylesheet(xsl2); - processor.setStylesheet(style2); - - 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")) { - processor.setDocumentHandler(style2.getSAXSerializer(fout)); - XSLTResultTarget content = new XSLTResultTarget(processor); - style1.process(new XSLTInputSource(input), content); - } else if (mode.equals("theory")) { - theory_processor.setDocumentHandler( - theory_style2.getSAXSerializer(fout)); - XSLTResultTarget content = - new XSLTResultTarget(theory_processor); - theory_style1.process(new XSLTInputSource(input), content); - } - } - - InetAddress address = InetAddress.getLocalHost(); - DatagramSocket socket2 = new DatagramSocket(); - - byte buf[] = new byte[0]; - DatagramPacket packet2 = new DatagramPacket(buf,0,address,port2); - - socket2.send(packet2); - } - } -}