avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/services SQLParser.java
Date Fri, 30 Nov 2001 20:43:15 GMT
hammant     01/11/30 12:43:15

  Modified:    apps/db/src/conf db-assembly.xml db-config.xml
               apps/db/src/java/org/apache/avalon/db/basic/parser
                        BasicDualParser.java
               apps/db/src/java/org/apache/avalon/db/server/lxsql
                        AbstractLXSQLParser.java
               apps/db/src/java/org/apache/avalon/db/services
                        SQLParser.java
  Log:
  Dual mode parser works pending completion of BasicSQLParser
  
  Revision  Changes    Path
  1.11      +9 -4      jakarta-avalon-cornerstone/apps/db/src/conf/db-assembly.xml
  
  Index: db-assembly.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/conf/db-assembly.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- db-assembly.xml	2001/11/30 11:10:09	1.10
  +++ db-assembly.xml	2001/11/30 20:43:14	1.11
  @@ -43,21 +43,26 @@
         <block class="org.apache.avalon.cornerstone.blocks.dom.DOMBuilderFactory" name="dom-builder-factory"
/>
         
         
  -      <!-- SQL Parsing -->
  +      <!-- SQL Parsing on its own -->
         <!--
         <block class="org.apache.avalon.db.basic.parser.BasicSQLParser" name="sql-parser">
             <provide name="db-persistor" role="org.apache.avalon.db.services.DatabasePersistor"
/>          
         </block>
         -->
    
  -      <!-- LXSQL Parsing -->
  -
  +      <!-- LXSQL Parsing on its own -->
  +      <!--
         <block class="org.apache.avalon.db.basic.parser.BasicLXSQLParser" name="sql-parser">
              <provide name="dom-builder-factory" role="org.apache.avalon.cornerstone.services.dom.DocumentBuilderFactory"
/>
              <provide name="db-persistor" role="org.apache.avalon.db.services.DatabasePersistor"
/>          
         </block>
  -
  +      -->
    
  +      <!-- LXSQL & SQL Parsing -->
  +      <block class="org.apache.avalon.db.basic.parser.BasicDualParser" name="sql-parser">
  +            <provide name="dom-builder-factory" role="org.apache.avalon.cornerstone.services.dom.DocumentBuilderFactory"
/>
  +            <provide name="db-persistor" role="org.apache.avalon.db.services.DatabasePersistor"
/>          
  +      </block>
    
         <!-- SQL Optimizer -->
         <block class="org.apache.avalon.db.optimizer.DefaultSQLOptimizer" name="sql-optimizer"
/>
  
  
  
  1.7       +1 -0      jakarta-avalon-cornerstone/apps/db/src/conf/db-config.xml
  
  Index: db-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/conf/db-config.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- db-config.xml	2001/11/12 21:46:24	1.6
  +++ db-config.xml	2001/11/30 20:43:14	1.7
  @@ -78,6 +78,7 @@
       </avalondb-server>
   
       <sql-parser>TODO</sql-parser>
  +    
       <sql-optimizer>TODO</sql-optimizer>
       
       <!-- This one for "No" Persistence -->
  
  
  
  1.2       +42 -20    jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/parser/BasicDualParser.java
  
  Index: BasicDualParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/parser/BasicDualParser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicDualParser.java	2001/11/30 12:09:09	1.1
  +++ BasicDualParser.java	2001/11/30 20:43:14	1.2
  @@ -7,33 +7,44 @@
    */
   package org.apache.avalon.db.basic.parser;
   
  -import org.apache.avalon.db.server.AbstractParser;
  -import org.apache.avalon.db.server.AbstractRequestHandler;
  -import org.apache.avalon.db.actions.Action;
  -import org.apache.avalon.db.actions.ActionException;
  -import org.apache.avalon.db.transport.Reply;
  -import org.apache.avalon.db.transport.Request;
  -import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.avalon.framework.component.ComponentException;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.Logger;
  +import org.apache.avalon.framework.context.Contextualizable;
  +import org.apache.avalon.framework.context.Context;
  +import org.apache.avalon.framework.context.ContextException;
  +import org.apache.avalon.framework.component.Composable;
  +import org.apache.avalon.framework.component.ComponentException;
  +import org.apache.avalon.framework.component.ComponentManager;
  +import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  +import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.phoenix.Block;
  +import org.apache.avalon.db.services.SQLParser;
  +import org.apache.avalon.db.transport.Request;
  +import org.apache.avalon.db.transport.Reply;
  +import org.apache.avalon.db.actions.Action;
  +import org.apache.avalon.db.actions.ActionException;
  +import org.apache.avalon.db.server.AbstractRequestHandler;
   
   import java.io.InputStream;
   
  +
   /**
    * Class BasicDualParser
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    */
  -public class BasicDualParser extends AbstractParser {
  +public class BasicDualParser extends AbstractLogEnabled
  +        implements Block, SQLParser, Contextualizable, Composable, Configurable, Initializable
 {
   
       private BasicLXSQLParser mBasicLXSQLParser;
       private BasicSQLParser mBasicSQLParser;
   
       public BasicDualParser() {
           mBasicLXSQLParser = new BasicLXSQLParser();
  -        mBasicSQLParser = new BasicSQLParser((InputStream) null);
  +        // TODO - here Gerhard
  +        //mBasicSQLParser = new BasicSQLParser((InputStream) null);
       }
   
       /**
  @@ -46,9 +57,8 @@
        *
        */
       public void compose(ComponentManager componentManager) throws ComponentException {
  -        super.compose(componentManager);
           mBasicLXSQLParser.compose(componentManager);
  -        mBasicSQLParser.compose(componentManager);
  +        if (mBasicSQLParser != null) mBasicSQLParser.compose(componentManager);
       }
   
       /**
  @@ -59,7 +69,7 @@
       public void enableLogging(Logger logger) {
           super.enableLogging(logger);
           mBasicLXSQLParser.enableLogging(logger);
  -        mBasicSQLParser.enableLogging(logger);
  +        if (mBasicSQLParser != null) mBasicSQLParser.enableLogging(logger);
       }
   
       /**
  @@ -72,12 +82,25 @@
        *
        */
       public void configure(Configuration configuration) throws ConfigurationException {
  -        super.configure(configuration);
           mBasicLXSQLParser.configure(configuration);
  -        mBasicSQLParser.configure(configuration);
  +        if (mBasicSQLParser != null) mBasicSQLParser.configure(configuration);
       }
   
       /**
  +     * Pass the Context to the component.
  +     * This method is called after the Loggable.setLogger() (if present)
  +     * method and before any other method.
  +     *
  +     * @param context the context
  +     * @exception ContextException if context is invalid
  +     */
  +    public void contextualize(Context context)
  +            throws ContextException {
  +        mBasicLXSQLParser.contextualize(context);
  +        if (mBasicSQLParser != null) mBasicSQLParser.contextualize(context);
  +    }
  +
  +    /**
        * Initialialize the component. Initialization includes
        * allocating any resources required throughout the
        * components lifecycle.
  @@ -86,16 +109,18 @@
        */
       public void initialize()
               throws Exception {
  -        super.initialize();
           mBasicLXSQLParser.initialize();
  -        mBasicSQLParser.initialize();
  +        if (mBasicSQLParser != null) mBasicSQLParser.initialize();
       }
   
       // overrides parent.
       public Reply processRequest(Request request) {
  +
           if (request.getSQLSyntax() == Request.SYNTAX_LXSQL) {
  +            System.out.println("LXSQL");
               return mBasicLXSQLParser.processRequest(request);
           } else {
  +            System.out.println("SQL");
               return mBasicSQLParser.processRequest(request);
           }
       }
  @@ -104,7 +129,4 @@
           // not needed.
       }
   
  -    protected void getCustomRequestHandlers(AbstractRequestHandler[] handlers) {
  -        // not needed.
  -    }
   }
  
  
  
  1.3       +4 -0      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/lxsql/AbstractLXSQLParser.java
  
  Index: AbstractLXSQLParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/server/lxsql/AbstractLXSQLParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractLXSQLParser.java	2001/11/29 13:04:29	1.2
  +++ AbstractLXSQLParser.java	2001/11/30 20:43:15	1.3
  @@ -14,6 +14,7 @@
   import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.db.actions.ActionException;
  +import org.apache.avalon.db.actions.Action;
   import org.w3c.dom.Document;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
  @@ -75,4 +76,7 @@
               throw new ActionException(ioe.getMessage());
           }
       }
  +
  +    public abstract void initializeAction(Action action) throws ActionException;
  +
   }
  
  
  
  1.9       +1 -3      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/services/SQLParser.java
  
  Index: SQLParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/services/SQLParser.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SQLParser.java	2001/11/30 12:09:09	1.8
  +++ SQLParser.java	2001/11/30 20:43:15	1.9
  @@ -32,11 +32,9 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version * $Revision: 1.8 $
  + * @version * $Revision: 1.9 $
    */
   public interface SQLParser {
  -
  -    // AbstractRequestHandler[] getRequestHandlers();
   
       void initializeAction(Action action) throws ActionException ;
   
  
  
  

--
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