avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xmlizer/impl HTMLXMLizer.java TextXMLizer.java XMLizerImpl.java
Date Wed, 10 Jul 2002 08:53:18 GMT
donaldp     2002/07/10 01:53:18

  Modified:    xmlutil/src/java/org/apache/avalon/excalibur/xml
                        ContentHandlerWrapper.java JaxpParser.java
                        XercesParser.java
               xmlutil/src/java/org/apache/avalon/excalibur/xml/xpath
                        EmptyNodeList.java JaxenProcessorImpl.java
                        SimpleNodeList.java XPathProcessorImpl.java
               xmlutil/src/java/org/apache/avalon/excalibur/xml/xslt
                        TraxErrorHandler.java XSLTProcessorImpl.java
               xmlutil/src/java/org/apache/excalibur/xmlizer/impl
                        HTMLXMLizer.java TextXMLizer.java XMLizerImpl.java
  Log:
  Made all the variables as private and as final as possible to make it easier to evolve in
the future.
  
  Revision  Changes    Path
  1.3       +44 -45    jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/ContentHandlerWrapper.java
  
  Index: ContentHandlerWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/ContentHandlerWrapper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContentHandlerWrapper.java	7 Jul 2002 07:19:49 -0000	1.2
  +++ ContentHandlerWrapper.java	10 Jul 2002 08:53:17 -0000	1.3
  @@ -24,15 +24,15 @@
    *         (Apache Software Foundation, Computer Associates)
    * @version CVS $Revision$ $Date$
    */
  -public class ContentHandlerWrapper
  +public final class ContentHandlerWrapper
       extends AbstractXMLConsumer
       implements Recyclable
   {
  -    /** The current <code>ContentHandler</code>. */
  -    protected ContentHandler contentHandler;
  +    /** The current {@link ContentHandler}. */
  +    private ContentHandler m_contentHandler;
   
  -    /** The optional <code>LexicalHandler</code> */
  -    protected LexicalHandler lexicalHandler;
  +    /** The optional {@link LexicalHandler} */
  +    private LexicalHandler m_lexicalHandler;
   
       /**
        * Create a new <code>ContentHandlerWrapper</code> instance.
  @@ -60,41 +60,41 @@
       }
   
       /**
  -     * Set the <code>ContentHandler</code> that will receive XML data.
  +     * Set the {@link ContentHandler} that will receive XML data.
        *
  -     * @exception IllegalStateException If the <code>ContentHandler</code>
  +     * @exception IllegalStateException If the {@link ContentHandler}
        *                                  was already set.
        */
       public void setContentHandler( final ContentHandler contentHandler )
           throws IllegalStateException
       {
  -        if( null != this.contentHandler )
  +        if( null != m_contentHandler )
           {
               throw new IllegalStateException();
           }
  -        this.contentHandler = contentHandler;
  +        m_contentHandler = contentHandler;
       }
   
       /**
  -     * Set the <code>LexicalHandler</code> that will receive XML data.
  +     * Set the {@link LexicalHandler} that will receive XML data.
        *
  -     * @exception IllegalStateException If the <code>LexicalHandler</code>
  +     * @exception IllegalStateException If the {@link LexicalHandler}
        *                                  was already set.
        */
       public void setLexicalHandler( final LexicalHandler lexicalHandler )
           throws IllegalStateException
       {
  -        if( null != this.lexicalHandler )
  +        if( null != m_lexicalHandler )
           {
               throw new IllegalStateException();
           }
  -        this.lexicalHandler = lexicalHandler;
  +        m_lexicalHandler = lexicalHandler;
       }
   
       public void recycle()
       {
  -        contentHandler = null;
  -        lexicalHandler = null;
  +        m_contentHandler = null;
  +        m_lexicalHandler = null;
       }
   
       /**
  @@ -102,13 +102,13 @@
        */
       public void setDocumentLocator( final Locator locator )
       {
  -        if( null == contentHandler )
  +        if( null == m_contentHandler )
           {
               return;
           }
           else
           {
  -            contentHandler.setDocumentLocator( locator );
  +            m_contentHandler.setDocumentLocator( locator );
           }
       }
   
  @@ -118,12 +118,12 @@
       public void startDocument()
           throws SAXException
       {
  -        if( null == contentHandler )
  +        if( null == m_contentHandler )
           {
               final String message = "ContentHandler not set";
               throw new SAXException( message );
           }
  -        contentHandler.startDocument();
  +        m_contentHandler.startDocument();
       }
   
       /**
  @@ -132,7 +132,7 @@
       public void endDocument()
           throws SAXException
       {
  -        contentHandler.endDocument();
  +        m_contentHandler.endDocument();
       }
   
       /**
  @@ -142,12 +142,12 @@
                                       final String uri )
           throws SAXException
       {
  -        if( null == contentHandler )
  +        if( null == m_contentHandler )
           {
               final String message = "ContentHandler not set";
               throw new SAXException( message );
           }
  -        contentHandler.startPrefixMapping( prefix, uri );
  +        m_contentHandler.startPrefixMapping( prefix, uri );
       }
   
       /**
  @@ -156,7 +156,7 @@
       public void endPrefixMapping( final String prefix )
           throws SAXException
       {
  -        contentHandler.endPrefixMapping( prefix );
  +        m_contentHandler.endPrefixMapping( prefix );
       }
   
       /**
  @@ -168,7 +168,7 @@
                                 final Attributes a )
           throws SAXException
       {
  -        contentHandler.startElement( uri, loc, raw, a );
  +        m_contentHandler.startElement( uri, loc, raw, a );
       }
   
       /**
  @@ -179,7 +179,7 @@
                               final String raw )
           throws SAXException
       {
  -        contentHandler.endElement( uri, loc, raw );
  +        m_contentHandler.endElement( uri, loc, raw );
       }
   
       /**
  @@ -190,7 +190,7 @@
                               final int len )
           throws SAXException
       {
  -        contentHandler.characters( ch, start, len );
  +        m_contentHandler.characters( ch, start, len );
       }
   
       /**
  @@ -201,7 +201,7 @@
                                        final int len )
           throws SAXException
       {
  -        contentHandler.ignorableWhitespace( ch, start, len );
  +        m_contentHandler.ignorableWhitespace( ch, start, len );
       }
   
       /**
  @@ -211,7 +211,7 @@
                                          final String data )
           throws SAXException
       {
  -        contentHandler.processingInstruction( target, data );
  +        m_contentHandler.processingInstruction( target, data );
       }
   
       /**
  @@ -223,7 +223,7 @@
       public void skippedEntity( final String name )
           throws SAXException
       {
  -        contentHandler.skippedEntity( name );
  +        m_contentHandler.skippedEntity( name );
       }
   
       /**
  @@ -240,9 +240,9 @@
                             final String systemId )
           throws SAXException
       {
  -        if( null != lexicalHandler )
  +        if( null != m_lexicalHandler )
           {
  -            lexicalHandler.startDTD( name, publicId, systemId );
  +            m_lexicalHandler.startDTD( name, publicId, systemId );
           }
       }
   
  @@ -252,9 +252,9 @@
       public void endDTD()
           throws SAXException
       {
  -        if( null != lexicalHandler )
  +        if( null != m_lexicalHandler )
           {
  -            lexicalHandler.endDTD();
  +            m_lexicalHandler.endDTD();
           }
       }
   
  @@ -267,9 +267,9 @@
       public void startEntity( final String name )
           throws SAXException
       {
  -        if( null != lexicalHandler )
  +        if( null != m_lexicalHandler )
           {
  -            lexicalHandler.startEntity( name );
  +            m_lexicalHandler.startEntity( name );
           }
       }
   
  @@ -281,9 +281,9 @@
       public void endEntity( final String name )
           throws SAXException
       {
  -        if( null != lexicalHandler )
  +        if( null != m_lexicalHandler )
           {
  -            lexicalHandler.endEntity( name );
  +            m_lexicalHandler.endEntity( name );
           }
       }
   
  @@ -293,9 +293,9 @@
       public void startCDATA()
           throws SAXException
       {
  -        if( null != lexicalHandler )
  +        if( null != m_lexicalHandler )
           {
  -            lexicalHandler.startCDATA();
  +            m_lexicalHandler.startCDATA();
           }
       }
   
  @@ -305,9 +305,9 @@
       public void endCDATA()
           throws SAXException
       {
  -        if( null != lexicalHandler )
  +        if( null != m_lexicalHandler )
           {
  -            lexicalHandler.endCDATA();
  +            m_lexicalHandler.endCDATA();
           }
       }
   
  @@ -323,10 +323,9 @@
                            final int len )
           throws SAXException
       {
  -        if( null != lexicalHandler )
  +        if( null != m_lexicalHandler )
           {
  -            lexicalHandler.comment( ch, start, len );
  +            m_lexicalHandler.comment( ch, start, len );
           }
       }
  -
   }
  
  
  
  1.3       +70 -72    jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/JaxpParser.java
  
  Index: JaxpParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/JaxpParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JaxpParser.java	7 Jul 2002 07:20:33 -0000	1.2
  +++ JaxpParser.java	10 Jul 2002 08:53:17 -0000	1.3
  @@ -71,55 +71,51 @@
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
    * @version CVS $Revision$ $Date$
    */
  -public class JaxpParser
  +public final class JaxpParser
       extends AbstractLogEnabled
       implements Parser, ErrorHandler, Composable, Parameterizable, Poolable
   {
       /** the SAX Parser factory */
  -    protected SAXParserFactory factory;
  +    private SAXParserFactory m_factory;
   
       /** the Document Builder factory */
  -    protected DocumentBuilderFactory docFactory;
  +    private DocumentBuilderFactory m_docFactory;
   
       /** The SAX reader. It is created lazily by {@link #setupXMLReader()}
        and cleared if a parsing error occurs. */
  -    protected XMLReader reader;
  +    private XMLReader m_reader;
   
       /** The DOM builder. It is created lazily by {@link #setupDocumentBuilder()}
        and cleared if a parsing error occurs. */
  -    protected DocumentBuilder docBuilder;
  -
  -    /** the component manager */
  -    protected ComponentManager manager;
  +    private DocumentBuilder m_docBuilder;
   
       /** the Entity Resolver */
  -    protected EntityResolver resolver;
  +    private EntityResolver m_resolver;
   
       /** do we want namespaces also as attributes ? */
  -    protected boolean nsPrefixes;
  +    private boolean m_nsPrefixes;
   
       /** do we want to reuse parsers ? */
  -    protected boolean reuseParsers;
  +    private boolean m_reuseParsers;
   
       /** do we stop on warnings ? */
  -    protected boolean stopOnWarning;
  +    private boolean m_stopOnWarning;
   
       /** do we stop on recoverable errors ? */
  -    protected boolean stopOnRecoverableError;
  +    private boolean m_stopOnRecoverableError;
   
       /**
        * Get the Entity Resolver from the component manager
        */
  -    public void compose( ComponentManager manager )
  +    public void compose( final ComponentManager manager )
           throws ComponentException
       {
  -        this.manager = manager;
           if( manager.hasComponent( EntityResolver.ROLE ) )
           {
  -            resolver = (EntityResolver)manager.lookup( EntityResolver.ROLE );
  +            m_resolver = (EntityResolver)manager.lookup( EntityResolver.ROLE );
               if( getLogger().isDebugEnabled() )
               {
  -                getLogger().debug( "JaxpParser: Using EntityResolver: " + resolver );
  +                getLogger().debug( "JaxpParser: Using EntityResolver: " + m_resolver );
               }
           }
       }
  @@ -129,62 +125,62 @@
       {
           // Validation and namespace prefixes parameters
           boolean validate = params.getParameterAsBoolean( "validate", false );
  -        this.nsPrefixes = params.getParameterAsBoolean( "namespace-prefixes", false );
  -        this.reuseParsers = params.getParameterAsBoolean( "reuse-parsers", true );
  -        this.stopOnWarning = params.getParameterAsBoolean( "stop-on-warning", true );
  -        this.stopOnRecoverableError = params.getParameterAsBoolean( "stop-on-recoverable-error",
true );
  +        m_nsPrefixes = params.getParameterAsBoolean( "namespace-prefixes", false );
  +        m_reuseParsers = params.getParameterAsBoolean( "reuse-parsers", true );
  +        m_stopOnWarning = params.getParameterAsBoolean( "stop-on-warning", true );
  +        m_stopOnRecoverableError = params.getParameterAsBoolean( "stop-on-recoverable-error",
true );
   
           // Get the SAXFactory
           final String saxParserFactoryName = params.getParameter( "sax-parser-factory",
                                                                    "javax.xml.parsers.SAXParserFactory"
);
           if( "javax.xml.parsers.SAXParserFactory".equals( saxParserFactoryName ) )
           {
  -            this.factory = SAXParserFactory.newInstance();
  +            m_factory = SAXParserFactory.newInstance();
           }
           else
           {
               try
               {
  -                final Class factoryClass = this.loadClass( saxParserFactoryName );
  -                this.factory = (SAXParserFactory)factoryClass.newInstance();
  +                final Class factoryClass = loadClass( saxParserFactoryName );
  +                m_factory = (SAXParserFactory)factoryClass.newInstance();
               }
               catch( Exception e )
               {
                   throw new ParameterException( "Cannot load SAXParserFactory class " + saxParserFactoryName,
e );
               }
           }
  -        this.factory.setNamespaceAware( true );
  -        this.factory.setValidating( validate );
  +        m_factory.setNamespaceAware( true );
  +        m_factory.setValidating( validate );
   
           // Get the DocumentFactory
           final String documentBuilderFactoryName = params.getParameter( "document-builder-factory",
                                                                          "javax.xml.parsers.DocumentBuilderFactory"
);
           if( "javax.xml.parsers.DocumentBuilderFactory".equals( documentBuilderFactoryName
) )
           {
  -            this.docFactory = DocumentBuilderFactory.newInstance();
  +            m_docFactory = DocumentBuilderFactory.newInstance();
           }
           else
           {
               try
               {
  -                final Class factoryClass = this.loadClass( documentBuilderFactoryName );
  -                this.docFactory = (DocumentBuilderFactory)factoryClass.newInstance();
  +                final Class factoryClass = loadClass( documentBuilderFactoryName );
  +                m_docFactory = (DocumentBuilderFactory)factoryClass.newInstance();
               }
               catch( Exception e )
               {
                   throw new ParameterException( "Cannot load DocumentBuilderFactory class
" + documentBuilderFactoryName, e );
               }
           }
  -        this.docFactory.setNamespaceAware( true );
  -        this.docFactory.setValidating( validate );
  +        m_docFactory.setNamespaceAware( true );
  +        m_docFactory.setValidating( validate );
   
  -        if( this.getLogger().isDebugEnabled() )
  +        if( getLogger().isDebugEnabled() )
           {
  -            this.getLogger().debug( "JaxpParser: validating: " + validate +
  -                                    ", namespace-prefixes: " + this.nsPrefixes +
  -                                    ", reuse parser: " + this.reuseParsers +
  -                                    ", stop on warning: " + this.stopOnWarning +
  -                                    ", stop on recoverable-error: " + this.stopOnRecoverableError
+
  +            getLogger().debug( "JaxpParser: validating: " + validate +
  +                                    ", namespace-prefixes: " + m_nsPrefixes +
  +                                    ", reuse parser: " + m_reuseParsers +
  +                                    ", stop on warning: " + m_stopOnWarning +
  +                                    ", stop on recoverable-error: " + m_stopOnRecoverableError
+
                                       ", saxParserFactory: " + saxParserFactoryName +
                                       ", documentBuilderFactory: " + documentBuilderFactoryName
);
           }
  @@ -193,21 +189,21 @@
       /**
        * Load a class
        */
  -    protected Class loadClass( String name ) throws Exception
  +    private Class loadClass( String name ) throws Exception
       {
           ClassLoader loader = Thread.currentThread().getContextClassLoader();
           if( loader == null )
           {
  -            loader = this.getClass().getClassLoader();
  +            loader = getClass().getClassLoader();
           }
           return loader.loadClass( name );
       }
   
       /**
  -     * Parse the <code>InputSource</code> and send
  +     * Parse the {@link InputSource} and send
        * SAX events to the consumer.
        * Attention: the consumer can either be an XMLConsumer
  -     * or implement the <code>LexicalHandler</code> as well.
  +     * or implement the {@link LexicalHandler} as well.
        * The parse should take care of this.
        */
       public void parse( final InputSource in,
  @@ -239,8 +235,8 @@
           setupXMLReader();
   
           // Ensure we will use a fresh new parser at next parse in case of failure
  -        XMLReader tmpReader = this.reader;
  -        this.reader = null;
  +        XMLReader tmpReader = m_reader;
  +        m_reader = null;
   
           try
           {
  @@ -260,16 +256,18 @@
   
           tmpReader.setErrorHandler( this );
           tmpReader.setContentHandler( contentHandler );
  -        if( null != resolver )
  +        if( null != m_resolver )
           {
  -            tmpReader.setEntityResolver( resolver );
  +            tmpReader.setEntityResolver( m_resolver );
           }
   
           tmpReader.parse( in );
   
  -        // Here, parsing was successful : restore this.reader
  -        if( this.reuseParsers )
  -            this.reader = tmpReader;
  +        // Here, parsing was successful : restore reader
  +        if( m_reuseParsers )
  +        {
  +            m_reader = tmpReader;
  +        }
       }
   
       /**
  @@ -281,72 +279,72 @@
           setupDocumentBuilder();
   
           // Ensure we will use a fresh new parser at next parse in case of failure
  -        DocumentBuilder tmpBuilder = this.docBuilder;
  -        this.docBuilder = null;
  +        DocumentBuilder tmpBuilder = m_docBuilder;
  +        m_docBuilder = null;
   
  -        if( null != resolver )
  +        if( null != m_resolver )
           {
  -            tmpBuilder.setEntityResolver( resolver );
  +            tmpBuilder.setEntityResolver( m_resolver );
           }
   
           Document result = tmpBuilder.parse( input );
   
  -        // Here, parsing was successful : restore this.builder
  -        if( reuseParsers )
  +        // Here, parsing was successful : restore builder
  +        if( m_reuseParsers )
           {
  -            this.docBuilder = tmpBuilder;
  +            m_docBuilder = tmpBuilder;
           }
   
           return result;
       }
   
       /**
  -     * Creates a new <code>XMLReader</code> if needed.
  +     * Creates a new {@link XMLReader} if needed.
        */
  -    protected void setupXMLReader()
  +    private void setupXMLReader()
           throws SAXException
       {
  -        if( null == reader )
  +        if( null == m_reader )
           {
               // Create the XMLReader
               try
               {
  -                reader = factory.newSAXParser().getXMLReader();
  +                m_reader = m_factory.newSAXParser().getXMLReader();
               }
               catch( final ParserConfigurationException pce )
               {
                   final String message = "Cannot produce a valid parser";
                   throw new SAXException( message, pce );
               }
  -            if( nsPrefixes )
  +            if( m_nsPrefixes )
               {
                   try
                   {
  -                    reader.setFeature( "http://xml.org/sax/features/namespace-prefixes",
  -                                       nsPrefixes );
  +                    m_reader.setFeature( "http://xml.org/sax/features/namespace-prefixes",
  +                                       m_nsPrefixes );
                   }
                   catch( final SAXException se )
                   {
                       final String message =
                           "SAX2 XMLReader does not support setting feature: " +
                           "'http://xml.org/sax/features/namespace-prefixes'";
  -                    this.getLogger().warn( message );
  +                    getLogger().warn( message );
                   }
               }
           }
       }
   
       /**
  -     * Creates a new <code>DocumentBuilder</code> if needed.
  +     * Creates a new {@link DocumentBuilder} if needed.
        */
  -    protected void setupDocumentBuilder()
  +    private void setupDocumentBuilder()
           throws SAXException
       {
  -        if( null == docBuilder )
  +        if( null == m_docBuilder )
           {
               try
               {
  -                docBuilder = docFactory.newDocumentBuilder();
  +                m_docBuilder = m_docFactory.newDocumentBuilder();
               }
               catch( final ParserConfigurationException pce )
               {
  @@ -357,13 +355,13 @@
       }
   
       /**
  -     * Return a new <code>Document</code>.
  +     * Return a new {@link Document}.
        */
       public Document createDocument()
           throws SAXException
       {
           setupDocumentBuilder();
  -        return docBuilder.newDocument();
  +        return m_docBuilder.newDocument();
       }
   
       /**
  @@ -376,7 +374,7 @@
               "Error parsing " + spe.getSystemId() + " (line " +
               spe.getLineNumber() + " col. " + spe.getColumnNumber() +
               "): " + spe.getMessage();
  -        if( stopOnRecoverableError )
  +        if( m_stopOnRecoverableError )
           {
               throw new SAXException( message, spe );
           }
  @@ -407,7 +405,7 @@
               spe.getLineNumber() + " col. " + spe.getColumnNumber() +
               "): " + spe.getMessage();
   
  -        if( stopOnWarning )
  +        if( m_stopOnWarning )
           {
               throw new SAXException( message, spe );
           }
  
  
  
  1.6       +2 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/XercesParser.java
  
  Index: XercesParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/XercesParser.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XercesParser.java	10 Jul 2002 08:38:48 -0000	1.5
  +++ XercesParser.java	10 Jul 2002 08:53:17 -0000	1.6
  @@ -27,7 +27,7 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @version CVS $Revision$ $Date$
    */
  -public class XercesParser
  +public final class XercesParser
       extends AbstractLogEnabled
       implements Parser, ErrorHandler, ThreadSafe, Initializable
   {
  
  
  
  1.2       +2 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xpath/EmptyNodeList.java
  
  Index: EmptyNodeList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xpath/EmptyNodeList.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EmptyNodeList.java	7 Jul 2002 06:24:16 -0000	1.1
  +++ EmptyNodeList.java	10 Jul 2002 08:53:17 -0000	1.2
  @@ -16,7 +16,7 @@
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @version CVS $Revision$ $Date$ $Author$
    */
  -class EmptyNodeList
  +final class EmptyNodeList
       implements NodeList
   {
       public Node item( int index )
  
  
  
  1.4       +2 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xpath/JaxenProcessorImpl.java
  
  Index: JaxenProcessorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xpath/JaxenProcessorImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JaxenProcessorImpl.java	7 Jul 2002 06:24:16 -0000	1.3
  +++ JaxenProcessorImpl.java	10 Jul 2002 08:53:17 -0000	1.4
  @@ -29,7 +29,7 @@
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @version CVS $Revision$ $Date$ $Author$
    */
  -public class JaxenProcessorImpl
  +public final class JaxenProcessorImpl
       extends AbstractLoggable
       implements XPathProcessor, ThreadSafe
   {
  
  
  
  1.2       +2 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xpath/SimpleNodeList.java
  
  Index: SimpleNodeList.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xpath/SimpleNodeList.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleNodeList.java	7 Jul 2002 06:24:16 -0000	1.1
  +++ SimpleNodeList.java	10 Jul 2002 08:53:17 -0000	1.2
  @@ -17,7 +17,7 @@
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @version CVS $Revision$ $Date$ $Author$
    */
  -class SimpleNodeList
  +final class SimpleNodeList
       implements NodeList
   {
       private final List m_list;
  
  
  
  1.3       +2 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xpath/XPathProcessorImpl.java
  
  Index: XPathProcessorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xpath/XPathProcessorImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XPathProcessorImpl.java	7 Jul 2002 06:24:16 -0000	1.2
  +++ XPathProcessorImpl.java	10 Jul 2002 08:53:17 -0000	1.3
  @@ -29,7 +29,7 @@
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @version CVS $Revision$ $Date$ $Author$
    */
  -public class XPathProcessorImpl
  +public final class XPathProcessorImpl
       extends AbstractLoggable
       implements XPathProcessor, ThreadSafe
   {
  
  
  
  1.4       +7 -3      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xslt/TraxErrorHandler.java
  
  Index: TraxErrorHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xslt/TraxErrorHandler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TraxErrorHandler.java	7 Jul 2002 07:15:01 -0000	1.3
  +++ TraxErrorHandler.java	10 Jul 2002 08:53:17 -0000	1.4
  @@ -20,13 +20,17 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @version CVS $Id$
    */
  -public class TraxErrorHandler
  +class TraxErrorHandler
       implements ErrorListener
   {
       private Logger m_logger;
   
  -    public TraxErrorHandler( final Logger logger )
  +    TraxErrorHandler( final Logger logger )
       {
  +        if( null == logger )
  +        {
  +            throw new NullPointerException( "logger" );
  +        }
           m_logger = logger;
       }
   
  
  
  
  1.10      +64 -68    jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xslt/XSLTProcessorImpl.java
  
  Index: XSLTProcessorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/avalon/excalibur/xml/xslt/XSLTProcessorImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XSLTProcessorImpl.java	7 Jul 2002 07:15:01 -0000	1.9
  +++ XSLTProcessorImpl.java	10 Jul 2002 08:53:17 -0000	1.10
  @@ -66,7 +66,7 @@
    * @version 1.0
    * @since   July 11, 2001
    */
  -public class XSLTProcessorImpl
  +public final class XSLTProcessorImpl
       extends AbstractLogEnabled
       implements XSLTProcessor,
       Composable,
  @@ -74,32 +74,28 @@
       Parameterizable,
       URIResolver
   {
  -
  -    protected ComponentManager manager;
  +    private ComponentManager m_manager;
   
       /** The store service instance */
  -    protected Store store;
  -
  -    /** The trax TransformerFactory lookup table*/
  -    protected HashMap factories;
  +    private Store m_store;
   
       /** The trax TransformerFactory this component uses */
  -    protected SAXTransformerFactory factory;
  +    private SAXTransformerFactory m_factory;
   
       /** Is the store turned on? (default is off) */
  -    protected boolean useStore = false;
  +    private boolean m_useStore;
   
       /** Is incremental processing turned on? (default for Xalan: no) */
  -    protected boolean incrementalProcessing;
  +    private boolean m_incrementalProcessing;
   
       /** Resolver used to resolve XSLT document() calls, imports and includes */
  -    protected SourceResolver resolver;
  +    private SourceResolver m_resolver;
   
       /** The error handler for the transformer */
  -    protected TraxErrorHandler errorHandler;
  +    private TraxErrorHandler m_errorHandler;
   
       /** Map of pairs of System ID's / validities of the included stylesheets */
  -    protected Map includesMap = new HashMap();
  +    private Map m_includesMap = new HashMap();
   
       /**
        * Compose. Try to get the store
  @@ -107,9 +103,9 @@
       public void compose( final ComponentManager manager )
           throws ComponentException
       {
  -        this.manager = manager;
  -        errorHandler = new TraxErrorHandler( getLogger() );
  -        resolver = (SourceResolver)manager.lookup( SourceResolver.ROLE );
  +        m_manager = manager;
  +        m_errorHandler = new TraxErrorHandler( getLogger() );
  +        m_resolver = (SourceResolver)manager.lookup( SourceResolver.ROLE );
       }
   
       /**
  @@ -117,15 +113,15 @@
        */
       public void dispose()
       {
  -        if( null != manager )
  +        if( null != m_manager )
           {
  -            manager.release( store );
  -            store = null;
  -            manager.release( resolver );
  -            resolver = null;
  +            m_manager.release( m_store );
  +            m_store = null;
  +            m_manager.release( m_resolver );
  +            m_resolver = null;
           }
  -        errorHandler = null;
  -        manager = null;
  +        m_errorHandler = null;
  +        m_manager = null;
       }
   
       /**
  @@ -134,14 +130,14 @@
       public void parameterize( final Parameters params )
           throws ParameterException
       {
  -        useStore = params.getParameterAsBoolean( "use-store", this.useStore );
  -        incrementalProcessing = params.getParameterAsBoolean( "incremental-processing",
this.incrementalProcessing );
  -        factory = getTransformerFactory( params.getParameter( "transformer-factory", null
) );
  -        if( useStore )
  +        m_useStore = params.getParameterAsBoolean( "use-store", this.m_useStore );
  +        m_incrementalProcessing = params.getParameterAsBoolean( "incremental-processing",
this.m_incrementalProcessing );
  +        m_factory = getTransformerFactory( params.getParameter( "transformer-factory",
null ) );
  +        if( m_useStore )
           {
               try
               {
  -                store = (Store)manager.lookup( Store.TRANSIENT_STORE );
  +                m_store = (Store)m_manager.lookup( Store.TRANSIENT_STORE );
               }
               catch( final ComponentException ce )
               {
  @@ -158,7 +154,7 @@
        */
       public void setTransformerFactory( final String classname )
       {
  -        factory = getTransformerFactory( classname );
  +        m_factory = getTransformerFactory( classname );
       }
   
       public TransformerHandler getTransformerHandler( final Source stylesheet )
  @@ -197,7 +193,7 @@
   
                   // Create a Templates ContentHandler to handle parsing of the
                   // stylesheet.
  -                TemplatesHandler templatesHandler = this.factory.newTemplatesHandler();
  +                TemplatesHandler templatesHandler = m_factory.newTemplatesHandler();
   
                   // Set the system ID for the template handler since some
                   // TrAX implementations (XSLTC) rely on this in order to obtain
  @@ -218,7 +214,7 @@
                   final SourceValidity validity = stylesheet.getValidity();
                   if( validity != null )
                   {
  -                    includesMap.put( id, new ArrayList() );
  +                    m_includesMap.put( id, new ArrayList() );
                   }
   
                   try
  @@ -233,14 +229,14 @@
                       putTemplates( template, stylesheet, id );
   
                       // Create transformer handler
  -                    final TransformerHandler handler = this.factory.newTransformerHandler(
template );
  -                    handler.getTransformer().setErrorListener( this.errorHandler );
  +                    final TransformerHandler handler = m_factory.newTransformerHandler(
template );
  +                    handler.getTransformer().setErrorListener( m_errorHandler );
   
                       // Create aggregated validity
                       AggregatedValidity aggregated = null;
                       if( validity != null )
                       {
  -                        List includes = (List)includesMap.get( id );
  +                        List includes = (List)m_includesMap.get( id );
                           if( includes != null )
                           {
                               aggregated = new AggregatedValidity();
  @@ -257,7 +253,7 @@
                   }
                   finally
                   {
  -                    includesMap.remove( id );
  +                    m_includesMap.remove( id );
                   }
               }
               else
  @@ -297,7 +293,7 @@
           }
           else
           {
  -            final XMLizer xmlizer = (XMLizer)manager.lookup( XMLizer.ROLE );
  +            final XMLizer xmlizer = (XMLizer)m_manager.lookup( XMLizer.ROLE );
               try
               {
                   final InputStream inputStream = source.getInputStream();
  @@ -307,7 +303,7 @@
               }
               finally
               {
  -                manager.release( xmlizer );
  +                m_manager.release( xmlizer );
               }
           }
       }
  @@ -387,7 +383,7 @@
                   ClassLoader loader = Thread.currentThread().getContextClassLoader();
                   if( loader == null )
                   {
  -                    loader = this.getClass().getClassLoader();
  +                    loader = getClass().getClassLoader();
                   }
                   _factory = (SAXTransformerFactory)loader.loadClass( factoryName ).newInstance();
               }
  @@ -395,29 +391,29 @@
               {
                   getLogger().error( "Cannot find the requested TrAX factory '" + factoryName
                                      + "'. Using default TrAX Transformer Factory instead."
);
  -                if( this.factory != null )
  -                    return this.factory;
  +                if( m_factory != null )
  +                    return m_factory;
                   _factory = (SAXTransformerFactory)TransformerFactory.newInstance();
               }
               catch( ClassCastException cce )
               {
                   getLogger().error( "The indicated class '" + factoryName
                                      + "' is not a TrAX Transformer Factory. Using default
TrAX Transformer Factory instead." );
  -                if( this.factory != null )
  -                    return this.factory;
  +                if( m_factory != null )
  +                    return m_factory;
                   _factory = (SAXTransformerFactory)TransformerFactory.newInstance();
               }
               catch( Exception e )
               {
                   getLogger().error( "Error found loading the requested TrAX Transformer
Factory '"
                                      + factoryName + "'. Using default TrAX Transformer Factory
instead." );
  -                if( this.factory != null )
  -                    return this.factory;
  +                if( m_factory != null )
  +                    return m_factory;
                   _factory = (SAXTransformerFactory)TransformerFactory.newInstance();
               }
           }
   
  -        _factory.setErrorListener( this.errorHandler );
  +        _factory.setErrorListener( m_errorHandler );
           _factory.setURIResolver( this );
   
           // FIXME (SM): implementation-specific parameter passing should be
  @@ -425,7 +421,7 @@
           if( _factory.getClass().getName().equals( "org.apache.xalan.processor.TransformerFactoryImpl"
) )
           {
               _factory.setAttribute( "http://xml.apache.org/xalan/features/incremental",
  -                                   new Boolean( incrementalProcessing ) );
  +                                   new Boolean( m_incrementalProcessing ) );
           }
   
           return _factory;
  @@ -434,7 +430,7 @@
       private TransformerHandlerAndValidity getTemplates( Source stylesheet, String id )
           throws IOException, SourceException, TransformerException
       {
  -        if( !useStore )
  +        if( !m_useStore )
           {
               return null;
           }
  @@ -442,7 +438,7 @@
           // we must augment the template ID with the factory classname since one
           // transformer implementation cannot handle the instances of a
           // template created by another one.
  -        String key = id + this.factory.getClass().getName();
  +        String key = id + m_factory.getClass().getName();
   
           if( getLogger().isDebugEnabled() )
           {
  @@ -455,12 +451,12 @@
           if( newValidity == null )
           {
               // Remove an old template
  -            store.remove( key );
  +            m_store.remove( key );
               return null;
           }
   
           // Stored is an array of the templates and the caching time and list of includes
  -        Object[] templateAndValidityAndIncludes = (Object[])store.get( key );
  +        Object[] templateAndValidityAndIncludes = (Object[])m_store.get( key );
           if( templateAndValidityAndIncludes == null )
           {
               // Templates not found in cache
  @@ -481,7 +477,7 @@
           }
           if( !isValid )
           {
  -            store.remove( key );
  +            m_store.remove( key );
               return null;
           }
   
  @@ -504,7 +500,7 @@
                   isValid = false;
                   if( valid == 0 )
                   {
  -                    SourceValidity included = resolver.resolveURI( (String)pair[ 0 ] ).getValidity();
  +                    SourceValidity included = m_resolver.resolveURI( (String)pair[ 0 ]
).getValidity();
                       if( included != null )
                       {
                           isValid = storedValidity.isValid( included );
  @@ -516,28 +512,28 @@
                   }
                   if( !isValid )
                   {
  -                    store.remove( key );
  +                    m_store.remove( key );
                       return null;
                   }
               }
           }
   
  -        TransformerHandler handler = factory.newTransformerHandler(
  +        TransformerHandler handler = m_factory.newTransformerHandler(
               (Templates)templateAndValidityAndIncludes[ 0 ] );
  -        handler.getTransformer().setErrorListener( this.errorHandler );
  +        handler.getTransformer().setErrorListener( m_errorHandler );
           return new TransformerHandlerAndValidity( handler, aggregated );
       }
   
       private void putTemplates( Templates templates, Source stylesheet, String id )
           throws IOException
       {
  -        if( !useStore )
  +        if( !m_useStore )
               return;
   
           // we must augment the template ID with the factory classname since one
           // transformer implementation cannot handle the instances of a
           // template created by another one.
  -        String key = id + factory.getClass().getName();
  +        String key = id + m_factory.getClass().getName();
   
           // only stylesheets with a last modification date are stored
           SourceValidity validity = stylesheet.getValidity();
  @@ -547,8 +543,8 @@
               Object[] templateAndValidityAndIncludes = new Object[ 3 ];
               templateAndValidityAndIncludes[ 0 ] = templates;
               templateAndValidityAndIncludes[ 1 ] = validity;
  -            templateAndValidityAndIncludes[ 2 ] = includesMap.get( id );
  -            store.store( key, templateAndValidityAndIncludes );
  +            templateAndValidityAndIncludes[ 2 ] = m_includesMap.get( id );
  +            m_store.store( key, templateAndValidityAndIncludes );
           }
       }
   
  @@ -572,7 +568,7 @@
           if( getLogger().isDebugEnabled() )
           {
               getLogger().debug( "resolve(href = " + href +
  -                               ", base = " + base + "); resolver = " + this.resolver );
  +                               ", base = " + base + "); resolver = " + m_resolver );
           }
   
           Source xslSource = null;
  @@ -581,12 +577,12 @@
               if( base == null || href.indexOf( ":" ) > 1 )
               {
                   // Null base - href must be an absolute URL
  -                xslSource = this.resolver.resolveURI( href );
  +                xslSource = m_resolver.resolveURI( href );
               }
               else if( href.length() == 0 )
               {
                   // Empty href resolves to base
  -                xslSource = this.resolver.resolveURI( base );
  +                xslSource = m_resolver.resolveURI( base );
               }
               else
               {
  @@ -602,7 +598,7 @@
                       }
                       else
                       {
  -                        xslSource = this.resolver.resolveURI( base.substring( 0, lastPathElementPos
)
  +                        xslSource = m_resolver.resolveURI( base.substring( 0, lastPathElementPos
)
                                                                 + "/" + href );
                       }
                   }
  @@ -610,7 +606,7 @@
                   {
                       File parent = new File( base.substring( 5 ) );
                       File parent2 = new File( parent.getParentFile(), href );
  -                    xslSource = this.resolver.resolveURI( parent2.toURL().toExternalForm()
);
  +                    xslSource = m_resolver.resolveURI( parent2.toURL().toExternalForm()
);
                   }
               }
   
  @@ -622,7 +618,7 @@
               }
   
               // Populate included validities
  -            List includes = (List)includesMap.get( base );
  +            List includes = (List)m_includesMap.get( base );
               if( includes != null )
               {
                   SourceValidity included = xslSource.getValidity();
  @@ -633,7 +629,7 @@
                   else
                   {
                       // One of the included stylesheets is not cacheable
  -                    includesMap.remove( base );
  +                    m_includesMap.remove( base );
                   }
               }
   
  @@ -673,7 +669,7 @@
           }
           finally
           {
  -            this.resolver.release( xslSource );
  +            m_resolver.release( xslSource );
           }
       }
   
  
  
  
  1.7       +2 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xmlizer/impl/HTMLXMLizer.java
  
  Index: HTMLXMLizer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xmlizer/impl/HTMLXMLizer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HTMLXMLizer.java	7 Jul 2002 07:22:30 -0000	1.6
  +++ HTMLXMLizer.java	10 Jul 2002 08:53:17 -0000	1.7
  @@ -37,7 +37,7 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @version CVS $Revision$ $Date$
    */
  -public class HTMLXMLizer
  +public final class HTMLXMLizer
       extends AbstractLogEnabled
       implements XMLizer, ThreadSafe, Composable
   {
  
  
  
  1.3       +2 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xmlizer/impl/TextXMLizer.java
  
  Index: TextXMLizer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xmlizer/impl/TextXMLizer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TextXMLizer.java	7 Jul 2002 07:11:45 -0000	1.2
  +++ TextXMLizer.java	10 Jul 2002 08:53:17 -0000	1.3
  @@ -27,7 +27,7 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @version CVS $Revision$ $Date$
    */
  -public class TextXMLizer
  +public final class TextXMLizer
       extends AbstractLogEnabled
       implements XMLizer, ThreadSafe, Composable
   {
  
  
  
  1.5       +2 -2      jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xmlizer/impl/XMLizerImpl.java
  
  Index: XMLizerImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/xmlutil/src/java/org/apache/excalibur/xmlizer/impl/XMLizerImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLizerImpl.java	7 Jul 2002 06:16:34 -0000	1.4
  +++ XMLizerImpl.java	10 Jul 2002 08:53:17 -0000	1.5
  @@ -26,7 +26,7 @@
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @version CVS $Revision$ $Date$
    */
  -public class XMLizerImpl
  +public final class XMLizerImpl
       extends DefaultComponentSelector
       implements XMLizer, ThreadSafe
   {
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message