You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2001/05/31 11:29:31 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/transformation SQLTransformer.java

cziegeler    01/05/31 02:29:30

  Modified:    src/org/apache/cocoon/transformation SQLTransformer.java
  Log:
  Update to the SQLTransformer. It now resets (recycles) all instance variables
  
  Revision  Changes    Path
  1.4       +35 -21    xml-cocoon2/src/org/apache/cocoon/transformation/SQLTransformer.java
  
  Index: SQLTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/SQLTransformer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SQLTransformer.java	2001/05/23 12:32:18	1.3
  +++ SQLTransformer.java	2001/05/31 09:29:26	1.4
  @@ -18,6 +18,8 @@
   import java.util.Map;
   import java.util.Properties;
   import java.util.Vector;
  +import org.apache.avalon.excalibur.datasource.DataSourceComponent;
  +import org.apache.avalon.excalibur.pool.Recyclable;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
  @@ -31,8 +33,6 @@
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.xml.XMLConsumer;
   import org.apache.cocoon.xml.XMLProducer;
  -import org.apache.avalon.excalibur.datasource.DataSourceComponent;
  -import org.apache.avalon.excalibur.pool.Poolable;
   import org.apache.log.Logger;
   import org.xml.sax.Attributes;
   import org.xml.sax.ContentHandler;
  @@ -46,10 +46,11 @@
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
    * @author <a href="mailto:giacomo.pati@pwr.ch">Giacomo Pati</a>
    *         (PWR Organisation & Entwicklung)
  - * @version CVS $Revision: 1.3 $ $Date: 2001/05/23 12:32:18 $ $Author: giacomo $
  + * @version CVS $Revision: 1.4 $ $Date: 2001/05/31 09:29:26 $ $Author: cziegeler $
    */
   
  -public class SQLTransformer extends AbstractTransformer implements Composable, Poolable, Disposable {
  +public class SQLTransformer extends AbstractTransformer
  +implements Composable, Recyclable, Disposable {
   
       /** The SQL namespace **/
       public static final String my_uri = "http://apache.org/cocoon/SQL/2.0";
  @@ -78,26 +79,22 @@
       public static final int STATE_INSIDE_ANCESTOR_VALUE_ELEMENT = 4;
   
       /** Default parameters that might apply to all queries **/
  -    protected Properties default_properties = new Properties();
  +    protected Properties default_properties;
   
       /** The list of queries that we're currently working on **/
  -    protected Vector queries = new Vector();
  +    protected Vector queries;
   
       /** The offset of the current query in the queries list **/
  -    protected int current_query_index = -1;
  +    protected int current_query_index;
   
       /** The name of the value element we're currently receiving **/
       protected String current_name;
   
       /** The current state of the event receiving FSM **/
  -    protected int current_state = SQLTransformer.STATE_OUTSIDE;
  +    protected int current_state;
   
       /** The value of the value element we're currently receiving **/
  -    protected StringBuffer current_value = new StringBuffer();
  -
  -    /** SAX producing state information **/
  -    protected XMLConsumer xml_consumer;
  -    protected LexicalHandler lexical_handler;
  +    protected StringBuffer current_value;
   
       protected ComponentSelector dbSelector = null;
       protected ComponentManager manager;
  @@ -111,12 +108,29 @@
           }
       }
   
  +    /**
  +     * Recycle this component
  +     */
  +    public void recylce() {
  +        super.recycle();
  +        this.queries = null;
  +        this.current_value = null;
  +        this.current_name = null;
  +        this.default_properties = null;
  +    }
  +
       /** BEGIN SitemapComponent methods **/
   
       public void setup(SourceResolver resolver, Map objectModel,
                         String source, Parameters parameters)
       throws ProcessingException, SAXException, IOException {
  -        current_state = SQLTransformer.STATE_OUTSIDE;
  +        // setup instance variables
  +        this.queries = new Vector();
  +        this.current_value = new StringBuffer();
  +        this.current_name = null;
  +        this.current_query_index = -1;
  +        this.default_properties = new Properties();
  +        this.current_state = SQLTransformer.STATE_OUTSIDE;
   
           // Check for connection
           String parameter = parameters.getParameter(SQLTransformer.MAGIC_CONNECTION, null);
  @@ -151,6 +165,13 @@
   
       }
   
  +    /**
  +     * dispose
  +     */
  +    public void dispose() {
  +        if(this.dbSelector != null) this.manager.release((Component) this.dbSelector);
  +    }
  +
       /** END SitemapComponent methods **/
   
       /** BEGIN my very own methods **/
  @@ -635,11 +656,4 @@
   
       }
   
  -
  -    /**
  -     * dispose
  -     */
  -    public void dispose() {
  -        if(this.dbSelector != null) this.manager.release((Component) this.dbSelector);
  -    }
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org