ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/util/uk/org/iscream/cms/util/XMLPacketMaker.java
(Generate patch)

Comparing projects/cms/source/util/uk/org/iscream/cms/util/XMLPacketMaker.java (file contents):
Revision 1.3 by tdb, Wed Nov 29 19:11:53 2000 UTC vs.
Revision 1.8 by tdb, Thu Jan 18 01:55:57 2001 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.ac.ukc.iscream.xml;
2 > package uk.ac.ukc.iscream.util;
3  
4   //---IMPORTS---
5   import java.io.*;
# Line 10 | Line 10 | import javax.xml.parsers.SAXParserFactory;
10   import javax.xml.parsers.ParserConfigurationException;
11   import javax.xml.parsers.SAXParser;
12  
13 import uk.ac.ukc.iscream.core.*;
14
13   /**
14   * XMLPacketMaker - Creates an XMLPacket object.
15   *
# Line 32 | Line 30 | public class XMLPacketMaker extends HandlerBase {
30   //---CONSTRUCTORS---
31  
32      // Constructor for accepting XML input.
33 <    public XMLPacketMaker (String xml, Logger logger) {
34 <        this.xml = xml;
37 <        this.logger = logger;
33 >    public XMLPacketMaker (String xml) {
34 >        _xml = xml;
35      }
36  
37   //---PUBLIC METHODS---
# Line 49 | Line 46 | public class XMLPacketMaker extends HandlerBase {
46          try {
47  
48              // Parse the input
49 <            InputSource inputSource = new InputSource(new StringReader(xml));
49 >            InputSource inputSource = new InputSource(new StringReader(_xml));
50              SAXParser saxParser = factory.newSAXParser();
51              saxParser.parse(inputSource, new XMLStringParser(packet));
52  
53          }
54          catch (Exception e) {
58            logger.write(this.toString(), Logger.WARNING, "An invalid XML UDP packet has been detected: "+packet.printAll());
59            //t.printStackTrace();
55              return null;
56          }
57          
# Line 67 | Line 62 | public class XMLPacketMaker extends HandlerBase {
62       * Overrides the {@link java.lang.Object#toString() Object.toString()}
63       * method to provide clean logging (every class should have this).
64       *
65 +     * This uses the uk.ac.ukc.iscream.util.NameFormat class
66 +     * to format the toString()
67 +     *
68       * @return the name of this class and its CVS revision
69       */
70      public String toString() {
71 <        return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
71 >        return FormatName.getName(
72 >            _name,
73 >            getClass().getName(),
74 >            REVISION);
75      }
76  
77   //---PRIVATE METHODS---
# Line 79 | Line 80 | public class XMLPacketMaker extends HandlerBase {
80  
81   //---ATTRIBUTES---
82  
83 <    String xml;
84 <    Logger logger;
83 >    /**
84 >     * Holds the xml
85 >     */
86 >    String _xml;
87 >    
88 >    /**
89 >     * This is the friendly identifier of the
90 >     * component this class is running in.
91 >     * eg, a Filter may be called "filter1",
92 >     * If this class does not have an owning
93 >     * component,  a name from the configuration
94 >     * can be placed here.  This name could also
95 >     * be changed to null for utility classes.
96 >     */
97 >    private String _name = null;
98  
99   //---STATIC ATTRIBUTES---
100  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines