From: Stefano Zacchiroli Date: Wed, 12 Mar 2003 17:26:25 +0000 (+0000) Subject: removed old java implementation X-Git-Tag: V_0_0_4_2~20 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=3bafb68f57e64d6524a2b7503df0346ec185d6c8;p=helm.git removed old java implementation --- diff --git a/helm/uwobo/ant/ant.jar b/helm/uwobo/ant/ant.jar deleted file mode 100644 index 9a14d89f0..000000000 Binary files a/helm/uwobo/ant/ant.jar and /dev/null differ diff --git a/helm/uwobo/ant/jaxp.jar b/helm/uwobo/ant/jaxp.jar deleted file mode 100644 index 9cfa2319e..000000000 Binary files a/helm/uwobo/ant/jaxp.jar and /dev/null differ diff --git a/helm/uwobo/ant/parser.jar b/helm/uwobo/ant/parser.jar deleted file mode 100644 index eb858322b..000000000 Binary files a/helm/uwobo/ant/parser.jar and /dev/null differ diff --git a/helm/uwobo/antRun b/helm/uwobo/antRun deleted file mode 100755 index 5894f4483..000000000 --- a/helm/uwobo/antRun +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh - -if [ "$JAVA_HOME" != "" ] ; then - $JAVA_HOME/bin/java -cp ant/ant.jar:ant/jaxp.jar:ant/parser.jar:$JAVA_HOME/lib/tools.jar -Dant.home=. $ANT_OPTS org.apache.tools.ant.Main $@ -else - echo "Warning: JAVA_HOME environment variable is not set." -fi - diff --git a/helm/uwobo/antRun.bat b/helm/uwobo/antRun.bat deleted file mode 100644 index e83ce36bd..000000000 --- a/helm/uwobo/antRun.bat +++ /dev/null @@ -1,17 +0,0 @@ -@echo off -set ANT_CMD_LINE_ARGS= - -:setupArgs -if %1a==a goto checkJavaHome -set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 -shift -goto setupArgs - -:checkJavaHome -if not "%JAVA_HOME%" == "" goto runAnt -echo Warning: JAVA_HOME environment variable is not set. - -:runAnt -java -cp ant\ant.jar;ant\jaxp.jar;ant\parser.jar;%JAVA_HOME%\lib\tools.jar -Dant.home=.\ org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS% - -set ANT_CMD_LINE_ARGS= diff --git a/helm/uwobo/build.xml b/helm/uwobo/build.xml deleted file mode 100644 index 634c6233f..000000000 --- a/helm/uwobo/build.xml +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/helm/uwobo/docs/COPYING b/helm/uwobo/docs/COPYING deleted file mode 100644 index d60c31a97..000000000 --- a/helm/uwobo/docs/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program 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. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/helm/uwobo/lib/.cvsignore b/helm/uwobo/lib/.cvsignore deleted file mode 100644 index a31a003c1..000000000 --- a/helm/uwobo/lib/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -helm.war diff --git a/helm/uwobo/lib/servlet.jar b/helm/uwobo/lib/servlet.jar deleted file mode 100644 index 1b70ec102..000000000 Binary files a/helm/uwobo/lib/servlet.jar and /dev/null differ diff --git a/helm/uwobo/lib/xalan.jar b/helm/uwobo/lib/xalan.jar deleted file mode 100644 index 8cc008d60..000000000 Binary files a/helm/uwobo/lib/xalan.jar and /dev/null differ diff --git a/helm/uwobo/lib/xerces.jar b/helm/uwobo/lib/xerces.jar deleted file mode 100644 index 3c7d18ae7..000000000 Binary files a/helm/uwobo/lib/xerces.jar and /dev/null differ diff --git a/helm/uwobo/src/it/unibo/cs/helm/uwobo/Key.java b/helm/uwobo/src/it/unibo/cs/helm/uwobo/Key.java deleted file mode 100644 index 0a31132da..000000000 --- a/helm/uwobo/src/it/unibo/cs/helm/uwobo/Key.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 2001, HELM Team - * - * This file is part of UWOBO, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * UWOBO 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. - * - * UWOBO 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 UWOBO; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the UWOBO World-Wide-Web page, - * http://cs.unibo.it/helm/uwobo - */ - -package it.unibo.cs.helm.uwobo; - -import java.util.*; - -public class Key { - public String name; - public HashMap params; -}; - diff --git a/helm/uwobo/src/it/unibo/cs/helm/uwobo/Server.java b/helm/uwobo/src/it/unibo/cs/helm/uwobo/Server.java deleted file mode 100644 index 293b2b91b..000000000 --- a/helm/uwobo/src/it/unibo/cs/helm/uwobo/Server.java +++ /dev/null @@ -1,423 +0,0 @@ -/* Copyright (C) 2001, HELM Team - * - * This file is part of UWOBO, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * UWOBO 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. - * - * UWOBO 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 UWOBO; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the UWOBO World-Wide-Web page, - * http://cs.unibo.it/helm/uwobo - */ - -package it.unibo.cs.helm.uwobo; - -import java.io.*; -import java.net.URL; -import java.util.*; -import javax.xml.transform.*; -import javax.xml.transform.sax.*; -import javax.xml.transform.stream.*; -import org.apache.xalan.serialize.*; -import org.apache.xalan.xslt.*; -import org.apache.xalan.templates.*; -import org.apache.xalan.transformer.*; -import org.apache.xerces.parsers.*; -import org.xml.sax.*; -import org.xml.sax.ext.*; -import org.xml.sax.helpers.*; - -/** -// This file is part of UWOBO, a small and simple XSLT server. -// -// UWOBO 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. -// -// UWOBO 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 UWOBO; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// For details, send a mail to -* @author Luca Padovani, Riccardo Solmi -*/ - -public class Server { - private static class Style implements Serializable { - public String fileName; - public Templates stylesheet; - }; - - public static final String SERVERNAME = "uwobo-XSLT-server"; - public static final String PACKAGE; - public static final String VERSION; - public static final String DATE; - public static final String TIME; - public static final String SERIALIZATION_DIR; - - static { - Properties props = new Properties(); - try { - InputStream in = Server.class.getResourceAsStream("properties.txt"); - props.load(in); - in.close(); - } catch (IOException ioe) { - System.err.println("Could not load the version information."); - } - - PACKAGE = props.getProperty("PACKAGE"); - VERSION = props.getProperty("VERSION"); - DATE = props.getProperty("DATE"); - TIME = props.getProperty("TIME"); - SERIALIZATION_DIR = props.getProperty("SERIALIZATION_DIR"); - } - - Server() { - if(!SERIALIZATION_DIR.equals("")) { - log("Looking for serialized stylesheets"); - File [] serialized = new File(SERIALIZATION_DIR).listFiles(); - if (serialized == null) { - log("Serialized stylesheets directory \"" + SERIALIZATION_DIR + - "\" not found"); - } else { - for (int i = 0; i < serialized.length ; i++) { - File filename = serialized[i]; - String key = filename.getName(); - log("Found serialized stylesheet " + key); - log("Reloading serialized stylesheet \"" + filename + "\"... "); - FileInputStream istream; - try { - istream = new FileInputStream(filename); - ObjectInputStream p = new ObjectInputStream(istream); - Style style = (Style)p.readObject(); - istream.close(); - hashMap.put(key, style); - } catch (Exception e) {log(e.toString());}; - } - log("Serialized stylesheets loaded!"); - } - } else - log("Stylesheet serialization is off. Set the property SERIALIZATION_DIR to a non-empty value to turn it on."); - - } - - private final HashMap hashMap = new HashMap(); - private static int logCounter = 0; - - private final String compileStylesheet(Style style, String key) throws TransformerConfigurationException, SAXException, IOException { - StreamSource streamsource = - new StreamSource(new URL(style.fileName).openStream()); - streamsource.setSystemId(style.fileName); - Templates templates = - ((SAXTransformerFactory)TransformerFactory.newInstance()) - .newTemplates(streamsource); - style.stylesheet = templates; - File serializationFile = new File(SERIALIZATION_DIR,key); - String res = ""; - if(!SERIALIZATION_DIR.equals("")) { - try { - FileOutputStream ostream = - new FileOutputStream(serializationFile); - ObjectOutputStream p = new ObjectOutputStream(ostream); - p.writeObject(style); - p.flush(); - ostream.close(); - res = - "Stylesheet serialized in \"" + serializationFile + "\""; - log(res); - } catch (FileNotFoundException e) { - res = "Warning: Stylesheet not " + - "serialized. Error opening " + "file \"" + - serializationFile + "\""; - log(res); - res = htmlOfWarning(res); - } - } - return res; - } - - private String getContentType(Templates templates) { - final Properties oprops = templates.getOutputProperties(); - final String encoding = oprops.getProperty(OutputKeys.ENCODING); - final String media = oprops.getProperty(OutputKeys.MEDIA_TYPE); - - if (media != null) { - if (encoding != null) - return media + "; charset=" + encoding; - return media; - } else { - final String method = oprops.getProperty(OutputKeys.METHOD); - if (method.equals("html")) - return "text/html"; - else if (method.equals("text")) - return "text/plain"; - else - return "text/xml"; - } - } - - private final ContentHandler applyStylesheet(Templates stylesheet, HashMap params, ContentHandler saxOutput) - throws TransformerConfigurationException, SAXException - { - TransformerHandler th = ((SAXTransformerFactory)TransformerFactory.newInstance()).newTransformerHandler(stylesheet); - - th.setResult(new SAXResult(saxOutput)); - - if (params != null) { - final Transformer transformer = th.getTransformer(); - Iterator i = params.keySet().iterator(); - while (i.hasNext()) { - final String name = (String) i.next(); - final String value = (String) params.get(name); - transformer.setParameter(name, value); - } - } - - return th; - } - - private final void parseFile(String datasheet, ContentHandler saxOutput) throws SAXException, IOException, Exception { - final XMLReader reader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"); - reader.setFeature("http://xml.org/sax/features/namespaces", true); - reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); - reader.setContentHandler(saxOutput); - if (saxOutput instanceof LexicalHandler) - reader.setProperty("http://xml.org/sax/properties/lexical-handler", (LexicalHandler)saxOutput); - reader.parse(datasheet); - } - - private final ContentHandler saveFile(OutputStream outputStream, Properties props) throws IOException { - final Serializer ser = SerializerFactory.getSerializer(props); - ser.setOutputStream(outputStream); - return ser.asContentHandler(); - } - - public static void log(String msg) { - System.err.println(SERVERNAME + "[" + logCounter++ + "]: " + msg); - } - - public String add(String filename, String key) throws TransformerConfigurationException, SAXException, IOException { - log("processing stylesheet \"" + filename + "\" using key " + key + "... "); - if (hashMap.containsKey(key)) { - Style style = (Style)hashMap.get(key); - if (style.fileName.equals(filename)) { - String msg = - "Warning: Stylesheet already loaded. Request ignored."; - log(msg); - return htmlOfWarning(msg); - } else { - String res = - "Error: There is already a stylesheet with keyword \""+ - key + "\" (aborted)"; - log(res); - return htmlOfError(res); - } - } - - Style style = new Style(); - style.fileName = filename; - String res = compileStylesheet(style,key); - log("done!"); - - hashMap.put(key, style); - return res; - } - - public ArrayList removeAll() throws TransformerConfigurationException, SAXException, IOException { - ArrayList res = new ArrayList(); - String log = ""; - Iterator i = hashMap.keySet().iterator(); - while (i.hasNext()) { - String key = (String)i.next(); - Style style = (Style)hashMap.get(key); - String msg = - "removing \"" + key + " (" + style.fileName + ")"; - res.add(msg); - log(msg); - msg = partialRemove(key,false); - if(!msg.equals("")) - res.add(msg); - } - hashMap.clear(); - return res; - } - - private String partialRemove(String key, boolean removeFromHashTable) { - String res = ""; - Style style = (Style)hashMap.get(key); - if (style != null) { - log("removing \"" + key + " (" + style.fileName + ")"); - if (removeFromHashTable) - hashMap.remove(key); - if(!SERIALIZATION_DIR.equals("")) { - File to_delete = new File(SERIALIZATION_DIR,key); - if (!to_delete.delete()) { - res = "Warning: Serialized stylesheet \"" + - to_delete + "\" to remove not found"; - log(res); - res = htmlOfWarning(res); - } - } - } else { - res = "Error: stylesheet \"" + key + "\" not loaded"; - log(res); - res = htmlOfError(res); - } - return res; - } - - public String remove(String key) { - return partialRemove(key,true); - } - - public String getContentType(String key) { - Style style = (Style)hashMap.get(key); - if (style != null) { - return getContentType(style.stylesheet); - } else { - log("Error, stylesheet \"" + key + "\" not loaded"); - return null; - } - } - - public List list() { - log("listing stylesheets..."); - ArrayList l = new ArrayList(); - Iterator i = hashMap.keySet().iterator(); - while (i.hasNext()) { - String key = (String)i.next(); - Style style = (Style)hashMap.get(key); - l.add(" " + key + " (" + style.fileName + "; " + getContentType(style.stylesheet) + ")"); - System.out.println(" " + key + " (" + style.fileName + ")"); - } - log("done!"); - return l; - } - - private ContentHandler applyRec(final Key[] keys, int idx, final ContentHandler saxOutput) - throws TransformerConfigurationException, SAXException, IOException - { - if (idx < 0) - return saxOutput; - else { - final Style style = (Style) hashMap.get(keys[idx].name); - if (style == null) { - log("cannot apply unknwon stylesheet \"" + keys[idx].name + "\" (aborted)"); - return null; - } - return applyStylesheet(style.stylesheet, keys[idx].params, applyRec(keys, idx - 1, saxOutput)); - } - } - - public void apply(String inFile, OutputStream outputStream, Key[] keys, Properties userProperties) - throws IOException, TransformerConfigurationException, SAXException, Exception - { -/* File outFile = new File(outFilename); - if (outFile.exists()) - System.out.println("Using cached version\n"); - else { -*/ - final Key[] rkeys = new Key[keys.length]; - for (int i = 0; i < keys.length; i++) - rkeys[i] = keys[keys.length - i - 1]; - - Properties outputProperties; - Properties defaultProperties; - String method; - - if (keys.length > 0) { - Style style = (Style) hashMap.get(rkeys[0].name); - if (style == null) { - log("Error, stylesheet \"" + rkeys[0].name + "\" not loaded"); - return; - } - outputProperties = style.stylesheet.getOutputProperties(); - method = userProperties.getProperty("method"); - if (method == null) method = outputProperties.getProperty("method"); - if (method == null) method = "xml"; - defaultProperties = org.apache.xalan.templates.OutputProperties.getDefaultMethodProperties(method); - } else { - method = userProperties.getProperty("method"); - if (method == null) method = "xml"; - outputProperties = org.apache.xalan.templates.OutputProperties.getDefaultMethodProperties(method); - defaultProperties = outputProperties; - } - - for (Enumeration e = userProperties.propertyNames(); e.hasMoreElements(); ) { - String prop = (String) e.nextElement(); - String value = userProperties.getProperty(prop); - if (value.equals("")) { - String defaultValue = defaultProperties.getProperty(prop); - if (defaultValue != null) - outputProperties.setProperty(prop, defaultProperties.getProperty(prop)); - else - outputProperties.remove(prop); - } else { - outputProperties.setProperty(prop, value); - } - } - - parseFile(inFile, applyRec(rkeys, rkeys.length - 1, saveFile(outputStream, outputProperties))); -// } - } - - public ArrayList reloadAll() throws TransformerConfigurationException, SAXException, IOException { - ArrayList res = new ArrayList(); - Iterator i = hashMap.keySet().iterator(); - while (i.hasNext()) { - String key = (String)i.next(); - Style style = (Style)hashMap.get(key); - String msg = - "reloading \"" + key + " (" + style.fileName + ")"; - res.add(msg); - log(msg); - msg = reload(key); - if(!msg.equals("")) - res.add(msg); - } - return res; - } - - public String reload(String key) throws TransformerConfigurationException, SAXException, IOException { - String res = ""; - Style style = (Style)hashMap.get(key); - if (style != null) { - log("reloading \"" + key + "\"... "); - res= compileStylesheet(style,key); - log("done!"); - } else { - res = "Error: stylesheet \"" + key + "\" not loaded"; - log(res); - res = htmlOfError(res); - } - return res; - } - - private String htmlOfWarning(String message) - { - return "" + message+""; - } - - private String htmlOfError(String message) - { - return "" + message+""; - } -} diff --git a/helm/uwobo/src/it/unibo/cs/helm/uwobo/Servlet.java b/helm/uwobo/src/it/unibo/cs/helm/uwobo/Servlet.java deleted file mode 100644 index d259c3f89..000000000 --- a/helm/uwobo/src/it/unibo/cs/helm/uwobo/Servlet.java +++ /dev/null @@ -1,343 +0,0 @@ -/* Copyright (C) 2001, HELM Team - * - * This file is part of UWOBO, developed at the Computer Science - * Department, University of Bologna, Italy. - * - * UWOBO 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. - * - * UWOBO 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 UWOBO; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. - * - * For details, see the UWOBO World-Wide-Web page, - * http://cs.unibo.it/helm/uwobo - */ - -package it.unibo.cs.helm.uwobo; - -import java.io.*; -import java.util.*; -import javax.servlet.*; -import javax.servlet.http.*; -import javax.xml.transform.*; -import org.xml.sax.*; - -// WARNING: next comment is obsolete!!!!! -/* -* -* usage: -* http://hostname/helm/servlet/uwobo/help -* http://hostname/helm/servlet/uwobo/add?bind=key,stylesheet[&bind=key,stylesheet]* -* http://hostname/helm/servlet/uwobo/remove[?keys=key_1,...,key_n] -* http://hostname/helm/servlet/uwobo/list -* http://hostname/helm/servlet/uwobo/reload[?keys=key_1,...,key_n] -* http://hostname/helm/servlet/uwobo/apply?xmluri=xmldata&keys=key_1,...,key_n[¶m.name=value]*[¶m.key.name=value]*[&prop.name=[value]]* -* -* example: -* http://aristotele/helm/servlet/uwobo/add?bind=foo1,file:///D:/Archivio/Progetti/helm/resources/xsl/foo1.xsl -* http://aristotele/helm/servlet/uwobo/add?bind=foo2,file:///D:/Archivio/Progetti/helm/resources/xsl/foo2.xsl -* http://aristotele/helm/servlet/uwobo/apply?xmluri=file:///D:/Archivio/Progetti/helm/resources/xsl/foo.xml&keys=foo1,foo2 -* -* installation notes (Tomcat): -* replace parser.jar and jaxp.jar from /lib with xerces.jar and add xalan.jar -* -* add in conf/server.xml -* -* -* -* add in uriworkermap.properties -* /helm/*=ajp12 -* -* -* @author The HELM team -*/ -public class Servlet extends HttpServlet { - - public static final String[] usage = { - "http://hostname/helm/servlet/uwobo/help", - "http://hostname/helm/servlet/uwobo/add?bind=key,stylesheet[&bind=key,stylesheet]*", - "http://hostname/helm/servlet/uwobo/remove[?keys=key_1,...,key_n]", - "http://hostname/helm/servlet/uwobo/list", - "http://hostname/helm/servlet/uwobo/reload[?keys=key_1,...,key_n]", - "http://hostname/helm/servlet/uwobo/apply?xmluri=xmldata&keys=key_1,...,key_n[¶m.name=value]*[¶m.key.name=value]*[&prop.name=[value]]*" - }; - public static final String help; - - static { - StringBuffer sb = new StringBuffer(); - sb.append("
    "); - for (int i=0; i").append(usage[i]).append(""); - sb.append("
"); - help = sb.toString(); - } - - private Server server; - - public void init(ServletConfig config) - throws ServletException - { - super.init(config); - - System.out.println("UWOBO init"); - server = new Server(); - } - - private static String[] split(final String s, final String delim) - { - String[] res = {null}; - if (s == null) return res; - StringTokenizer st = new StringTokenizer(s, delim); - res = new String[st.countTokens()]; - for (int i = 0; i < res.length; i++) res[i] = st.nextToken(); - return res; - } - - private static String[] split2(final String s, final String delim) - { - String[] res = new String[2]; - StringTokenizer st = new StringTokenizer(s); - res[0] = st.nextToken(delim); res[1] = st.nextToken("").substring(1); - return res; - } - - private void html_open(HttpServletResponse resp, ServletOutputStream out) - throws IOException - { - resp.setContentType("text/html"); - out.println("

" + server.PACKAGE + " servlet

"); - } - - private void html_close(ServletOutputStream out) - throws IOException - { - out.println("

done

"); - out.close(); - } - - private String msg_out(String message) - { - return message+"
"; - } - - private String exc_out(String message, Exception e) - { - if (message == null) - { - message = e.getClass().getName(); - message = message.substring(message.lastIndexOf('.')+1); - } - String local = e.getLocalizedMessage(); - local = local.substring(local.lastIndexOf(':')+1); - return ""+message+": "+local+"
"; - } - - public void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - ServletOutputStream out = response.getOutputStream(); - String log = ""; - - response.setHeader("Cache-Control", "no-cache"); - response.setHeader("Pragma", "no-cache"); - response.setHeader("Expires", "0"); - System.out.println("UWOBO "+request.getPathInfo()); - - try { - final String cmd = request.getPathInfo(); - if (cmd == null) { - sendError(response, out, "unknown command", help); return; - } - if (cmd.equals("/add")) { - final String[] xslkey = request.getParameterValues("bind"); - if (xslkey == null) { - sendError(response, out, "bad parameters", usage[1]); return; - } - html_open(response, out); - for (int i = 0; i < xslkey.length; i++) { - final String data[] = split2(xslkey[i], ","); - out.println(msg_out("adding stylesheet "+data[0]+" ("+data[1]+")")); - try { - log = server.add(data[1], data[0]); - if(!log.equals("")) - out.println(msg_out(log)); - } catch (TransformerConfigurationException tce) { - out.println(exc_out("Stylesheet Error", tce)); - } catch (Exception e) { - out.println(exc_out(null, e)); - } - } - html_close(out); return; - } - if (cmd.equals("/apply")) { - final String infile = request.getParameter("xmluri"); - final String keys = request.getParameter("keys"); - - if (infile == null || keys == null) { - sendError(response, out, "bad parameters", usage[6]); return; - } - - final String[] keyName = split(keys, ","); - final Key[] keySeq = new Key[keyName.length]; - for (int i = 0; i < keySeq.length; i++) { - keySeq[i] = new Key(); - keySeq[i].name = keyName[i]; - keySeq[i].params = new HashMap(); - } - - final Properties props = new Properties(); - final Enumeration e = request.getParameterNames(); - while (e.hasMoreElements()) { - String param = (String) e.nextElement(); - if (param.startsWith("param.")) { - final String name = param.substring(6); - final String value = request.getParameter(param); - final String[] keyParam = split(name, "."); - if (keyParam.length == 1) { - // this is a global parameter - Server.log("global parameter: " + keyParam[0] + " = " + value); - for (int i = 0; i < keySeq.length; i++) - // we add the global parameter only if there is no - // local parameter with the same name - if (!keySeq[i].params.containsKey(keyParam[0])) - keySeq[i].params.put(keyParam[0], value); - } else - if (keyParam.length == 2) { - // this is a local parameter - Server.log("local parameter: " + keyParam[0] + "." + keyParam[1] + " = " + value); - for (int i = 0; i < keySeq.length; i++) { - if (keySeq[i].name.equals(keyParam[0])) - keySeq[i].params.put(keyParam[1], value); - } - } else { - sendError(response, out, "bad parameters", usage[6]); return; - } - } else - if (param.startsWith("prop.")) { - final String name = param.substring(5); - final String value = request.getParameter(param); - Server.log("property: " + name + " = " + value); - props.setProperty(name, value); - } - } - - String contentType = props.getProperty(OutputKeys.MEDIA_TYPE); - if (contentType == null && keySeq.length > 0) - contentType = server.getContentType(keySeq[keySeq.length - 1].name); - else if (contentType == null) - contentType = "text/xml"; - response.setContentType(contentType); - Server.log("content type: " + contentType); - - try { - out = response.getOutputStream(); - server.apply(infile, out, keySeq, props); - out.close(); - } catch (TransformerConfigurationException tce) { - sendError(response, out, exc_out("stylesheet error", tce), ""); - } catch (Exception ee) { - sendError(response, out, exc_out(null, ee), ""); - } - return; - } - if (cmd.equals("/remove")) { - final String key = request.getParameter("keys"); - final String [] data = split(key, ","); - html_open(response, out); - for (int i = 0; i < data.length; i++) { - if (data[i] == null) { - out.println(msg_out("removing all keys")); - ArrayList res; - res = server.removeAll(); - Iterator j = res.iterator(); - while (j.hasNext()) - out.println(msg_out((String)j.next())); - } else { - out.println(msg_out("removing key "+data[i])); - out.println(msg_out(server.remove(data[i]))); - } - } - html_close(out); return; - } - if (cmd.equals("/list")) { - html_open(response, out); - out.println("

stylesheet list:

    "); - - Iterator i = server.list().iterator(); - while (i.hasNext()) - out.println("
  • "+i.next()+"
  • "); - out.println("
"); html_close(out); return; - } - if (cmd.equals("/reload")) { - final String key = request.getParameter("keys"); - final String [] data = split(key, ","); - html_open(response, out); - for (int i = 0; i < data.length; i++) { - try { - if (data[i] == null) { - out.println(msg_out("reloading all keys")); - ArrayList res; - res = server.reloadAll(); - Iterator j = res.iterator(); - while(j.hasNext()) - out.println(msg_out((String)j.next())); - } else { - out.println(msg_out("reloading key "+data[i])); - out.println(msg_out(server.reload(data[i]))); - } - } catch (TransformerConfigurationException tce) { - out.println(exc_out("Stylesheet Error", tce)); - } catch (Exception e) { - out.println(exc_out(null, e)); - } - } - html_close(out); return; - } - if (cmd.equals("/help")) { - html_open(response, out); - out.println("

Version "+server.VERSION+"

"); - out.println("compiled "+server.DATE+" at "+server.TIME.substring(0,2)+":"+server.TIME.substring(2)+""); - if(Server.SERIALIZATION_DIR.equals("")) { - out.println("

Stylesheet serialization is off."); - out.println("(To turn it on, choose a non-empty value for the " + - "SERIALIZATION_DIR property.)

"); - } else - out.println("

Serialized stylesheed are stored in "" + - Server.SERIALIZATION_DIR + "".

"); - out.println("

usage:

"+help+""); - html_close(out); return; - } - sendError(response, out, "unknown command", help); return; - } catch (Exception e) { - sendError(response, out, exc_out(null, e),""); - return; - } - } - - private void sendError(HttpServletResponse resp, ServletOutputStream out, - String msg, String usage) - throws IOException - { - html_open(resp, out); - out.println("

"+msg+"

usage: "+usage); - html_close(out); - } - - public String getServletInfo() - { - return "The UWOBO servlet"; - } -} diff --git a/helm/uwobo/src/it/unibo/cs/helm/uwobo/properties.txt b/helm/uwobo/src/it/unibo/cs/helm/uwobo/properties.txt deleted file mode 100644 index debd51773..000000000 --- a/helm/uwobo/src/it/unibo/cs/helm/uwobo/properties.txt +++ /dev/null @@ -1,5 +0,0 @@ -PACKAGE=@PACKAGE@ -VERSION=@VERSION@ -DATE=@DATE@ -TIME=@TIME@ -SERIALIZATION_DIR=@SERIALIZATION_DIR@ diff --git a/helm/uwobo/web.xml b/helm/uwobo/web.xml deleted file mode 100644 index badb809d2..000000000 --- a/helm/uwobo/web.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Uwobo Application - - This is an xslt web application - - - - uwobo - it.unibo.cs.helm.uwobo.Servlet - - - - uwobo - /helm/* - - -