// // This file is an example for SXML, a tool to automate the publication of // XML data through the Siena wide-area event notification system. // // See http://www.cs.colorado.edu/serl/siena/ // // Copyright (C) 2000-2001 University of Colorado // // Author: Antonio Carzaniga // See the file AUTHORS for full details. // // 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, or send email to serl@cs.colorado.edu. // // $Id: XMLPublisher.java,v 1.2 2001/01/23 19:22:57 carzanig Exp $ // import siena.*; import siena.sxml.*; // // a simple publisher of XML data // public class XMLPublisher { public static void main(String args[]) { if (args.length < 2) { System.err.println("Usage: XMLPublisher [event..]"); System.exit(1); } try { Siena siena = new ThinClient(args[0]); EventMap m = new EventMap(); // // reads the set of mapping rules from a file // m.importRules(args[1]); // // configure the SeXML map to attach the XML sources to // the events that it it produces // m.attachXml(); if (args.length == 2) { // // reads the XML source from the standard input // siena.publish(m.makeNotification(System.in)); } else { // // reads the XML sources from file passed through the // command line // for(int i = 2; i < args.length; ++i) siena.publish(m.makeNotification(args[i])); } } catch (Exception ex) { ex.printStackTrace(); System.exit(1); } System.exit(0); } };