avalon-dev 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/bcelparser BCELSQLParser.java BCELSQLParser.xinfo BaseBCELParser.java GeneratedObjectClassLoader.java
Date Thu, 01 Nov 2001 09:22:15 GMT
hammant     01/11/01 01:22:15

  Modified:    apps/db/src/java/org/apache/avalon/db/bcel/parser
                        BCELSQLParser.java
  Removed:     apps/db/src/java/org/apache/avalon/db/bcelactions
                        AbstractBCELAction.java BCELCreateTable.java
                        BCELInsertSingleValue.java
               apps/db/src/java/org/apache/avalon/db/bcelparser
                        BCELSQLParser.java BCELSQLParser.xinfo
                        BaseBCELParser.java GeneratedObjectClassLoader.java
  Log:
  Split of BCEL parser into parent class and SQL impl
  
  Revision  Changes    Path
  1.3       +2 -194    jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/bcel/parser/BCELSQLParser.java
  
  Index: BCELSQLParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/bcel/parser/BCELSQLParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BCELSQLParser.java	2001/10/31 14:42:14	1.2
  +++ BCELSQLParser.java	2001/11/01 09:22:15	1.3
  @@ -58,17 +58,10 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  -public class BCELSQLParser extends AbstractLoggable
  -        implements Block, SQLParser, Contextualizable, Composable, Configurable, Initializable
{
  +public class BCELSQLParser extends BaseBCELParser {
   
  -    private DatabasePersistor mDatabasePersistor;
  -    private GeneratedObjectClassLoader mGenClassLoader = new GeneratedObjectClassLoader();
  -    private static int mGenObjSeq;
  -    private HashMap mGeneratedObjTranslation = new HashMap();
  -
  -
       /**
        * Method createAction
        *
  @@ -82,52 +75,8 @@
           return null;
       }
   
  -    /**
  -     * Method contextualize
  -     *
  -     *
  -     * @param context
  -     *
  -     * @throws ContextException
  -     *
  -     */
  -    public void contextualize(Context context) throws ContextException {}
  -
  -    /**
  -     * Method compose
  -     *
  -     *
  -     * @param componentManager
  -     *
  -     * @throws ComponentException
  -     *
  -     */
  -    public void compose(ComponentManager componentManager) throws ComponentException {
  -        mDatabasePersistor =
  -            (DatabasePersistor) componentManager.lookup(DatabasePersistor.class.getName());
  -    }
  -
  -    /**
  -     * Method configure
  -     *
  -     *
  -     * @param configuration
  -     *
  -     * @throws ConfigurationException
  -     *
  -     */
  -    public void configure(Configuration configuration) throws ConfigurationException {}
   
       /**
  -     * Method initialize
  -     *
  -     *
  -     * @throws Exception
  -     *
  -     */
  -    public void initialize() throws Exception {}
  -
  -    /**
        * Method createSelectAction
        *
        *
  @@ -140,68 +89,6 @@
           return null;
       }
   
  -    private String getWordOne(String str) {
  -
  -        int ix0 = str.indexOf(' ');
  -
  -        if (ix0 == -1) {
  -            ix0 = str.length();
  -        }
  -
  -        return str.substring(0, ix0);
  -    }
  -
  -    private String getWordTwo(String str) {
  -
  -        int ix0 = str.indexOf(' ');
  -        int ix1 = str.indexOf(' ', ix0 + 1);
  -
  -        if (ix1 == -1) {
  -            ix1 = str.length();
  -        }
  -
  -        return str.substring(ix0 + 1, ix1);
  -    }
  -
  -    private String getWordThree(String str) {
  -
  -        int ix0 = str.indexOf(' ');
  -        int ix1 = str.indexOf(' ', ix0 + 1);
  -        int ix2 = str.indexOf(' ', ix1 + 1);
  -
  -        if (ix2 == -1) {
  -            ix2 = str.length();
  -        }
  -
  -        return str.substring(ix1 + 1, ix2);
  -    }
  -
  -    private String getWordFour(String str) {
  -
  -        int ix0 = str.indexOf(' ');
  -        int ix1 = str.indexOf(' ', ix0 + 1);
  -        int ix2 = str.indexOf(' ', ix1 + 1);
  -        int ix3 = str.indexOf(' ', ix2 + 1);
  -
  -        if (ix3 == -1) {
  -            ix3 = str.length();
  -        }
  -
  -        return str.substring(ix2 + 1, ix3);
  -    }
  -
  -    private String getBracketedExpr(String str) {
  -
  -        int ix0 = str.indexOf('(');
  -        int ix1 = str.lastIndexOf(')');
  -
  -        System.out.println("str=" + str);
  -        System.out.println("ix0=" + ix0);
  -        System.out.println("ix1=" + ix1);
  -
  -        return str.substring(ix0 + 1, ix1);
  -    }
  -
       /**
        * Method createCreateTableAction
        *
  @@ -252,45 +139,7 @@
           return action;
       }
   
  -    private Type getType(String type) {
  -
  -        System.out.println("Type=(" + type + ")");
  -
  -        if (type.equals("varchar")) {
  -            return Type.STRING;
  -        } else if (type.equals("char")) {
  -            return Type.STRING;
  -        }
  -
  -        return Type.VOID;
  -    }
  -
  -    private void createField(ConstantPoolGen cp, ClassGen cg, Type fieldType, String name)
{
  -
  -        System.out.println("fn=" + name);
  -        System.out.println("Type2=" + fieldType);
  -
  -        FieldGen fg = new FieldGen(Constants.ACC_PUBLIC, fieldType, name, cp);
  -
  -        cg.addField(fg.getField());
  -    }
   
  -    private void createSetter(ConstantPoolGen cp, ClassGen cg, Type fieldType, String name,
  -                              String table) {
  -
  -        InstructionList il = new InstructionList();
  -        MethodGen mg = new MethodGen(Constants.ACC_PUBLIC,    // access flags
  -                                     Type.VOID,               // return type
  -                                     new Type[]{ fieldType }, new String[]{ "value" },
   // arg names
  -                                     "set" + name, table,     // method, class
  -                                     il, cp);
  -
  -        mg.stripAttributes(true);
  -        mg.setMaxStack();
  -        mg.setMaxLocals();
  -        cg.addMethod(mg.getMethod());
  -    }
  -
       /**
        * Method createInsertAction
        *
  @@ -317,47 +166,6 @@
           }
   
           return null;
  -    }
  -
  -    //private Insert createNamedColumnsInsert(Table table, String sql ) {
  -    //}
  -    private Insert createAllValuesInsert(Table table, String sql) {
  -
  -        String values = getBracketedExpr(sql);
  -        StringTokenizer st = new StringTokenizer(values, ",");
  -        Vector valuesVec = new Vector();
  -
  -        while (st.hasMoreTokens()) {
  -            valuesVec.add(st.nextToken().trim());
  -        }
  -
  -        //TODO get columns from table.
  -        return new BCELInsertSingleValue(table, null, valuesVec);
  -    }
  -
  -    //private Insert createSelectInsert(Table table, String sql) {
  -    //}
  -
  -    public void addGeneratedClass(String name, byte[] bytes) {
  -        mGenClassLoader.addGeneratedClass(name, bytes);
  -    }
  -
  -    public Object getGeneratedInstance(String name) {
  -        return mGenClassLoader.getGeneratedInstance(name);
  -    }
  -
  -    public Class getGeneratedClass(String name) {
  -        return mGenClassLoader.findClass(name);
  -    }
  -
  -    public String createUniqueClassName(String sqlObjectName){
  -        String className = "gen.A" + mGenObjSeq++;
  -        mGeneratedObjTranslation.put(sqlObjectName, className);
  -        return className;
  -    }
  -
  -    public String getGeneratedClassName(String sqlObjectName){
  -        return (String) mGeneratedObjTranslation.get(sqlObjectName);
       }
   
   
  
  
  

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


Mime
View raw message