⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 opp.java

📁 用Java写的面相对象的数据库管理系统
💻 JAVA
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-2000 by SMB GmbH. All rights reserved.//// $Id: OPP.java,v 1.9 2000/10/28 16:55:20 daniela Exp $package org.ozoneDB.tools.OPP;import java.io.*;import org.ozoneDB.DxLib.*;import org.ozoneDB.core.ObjectContainer;/** * Command line driver of the OPP tool. *  *  * @author <a href="http://www.softwarebuero.de/">SMB</a> * @version $Revision: 1.9 $Date: 2000/10/28 16:55:20 $ */public class OPP {        public final static String SIGNATURE_DELIMITER = "|";    public final static String UPDATE_SIGN = "/[*]+ *update *[*]/|// *update";    public final static String METHOD_PATTERN = "([_a-zA-Z][_0-9a-zA-Z]*)[ \\t]*\\([^)]*\\)";        static boolean odmg = false;    static boolean quiet = false;    static boolean cache = true;    static boolean keepSource = false;    static boolean compileSource = true;    static boolean printStackTrace = false;    static boolean searchInterfaceSource = true;    static String methodPattern = ".*_update";    static String outputDirName = "." + File.separator;            public static void main( String[] args ) {                DxHashSet classes = new DxHashSet();                if (args.length == 0) {            printUsage();            System.exit( 0 );        }                 for (int argCount = 0; argCount < args.length; argCount++) {            if (args[argCount].equals( "-q" )) {                quiet = true;            } else if (args[argCount].equals( "-ks" )) {                keepSource = true;            } else if (args[argCount].equals( "-KS" )) {                keepSource = true;                compileSource = false;            } else if (args[argCount].equals( "-odmg" )) {                odmg = true;            } else if (args[argCount].equals( "-nc" )) {                cache = false;            } else if (args[argCount].equals( "-st" )) {                printStackTrace = true;            } else if (args[argCount].equals( "-ni" )) {                searchInterfaceSource = false;            } else if (args[argCount].startsWith( "-p" )) {                methodPattern = args[argCount].substring( 2 );            } else if (args[argCount].equals( "-version" )) {                System.out.println( "$Id: OPP.java,v 1.9 2000/10/28 16:55:20 daniela Exp $" );                System.exit( 0 );            } else if (args[argCount].equals( "-h" )) {                printUsage();                System.exit( 0 );            } else if (args[argCount].startsWith( "-o" )) {                outputDirName = args[argCount].substring( 2 ) + File.separator;            } else {                if (args[argCount].startsWith( "-" )) {                    System.out.println( "Unknown option '" + args[argCount] + "'!\n" );                    printUsage();                    System.exit( 0 );                } else {                    classes.add( args[argCount] );                }             }         }                 try {            if (odmg) {                makeODMGProxies( classes );            } else {                makeProxies( classes );            }         } catch (Exception e) {            e.printStackTrace( System.out );            System.exit( 1 );        }     }             protected static void makeODMGProxies( DxHashSet classes ) throws Exception {                DxIterator it = classes.iterator();        while (it.next() != null) {            String name = (String)it.object();                        OPPHelper.progressMsg( name + ":", quiet );                        // create the *_Impl class of the original class            Class cl = Class.forName( name );            String newClassName = cl.getName() + ObjectContainer.IMPLNAME_POSTFIX;                        ImplManipulator manipulator = new ImplManipulator( cl, outputDirName, quiet );            manipulator.changeClassFile( classes, outputDirName + OPPHelper.rawClassName( cl ) + ".class",                    newClassName );                        // generate source and class file of the *_Proxy proxy class            makeProxy( name );                        // create the *_Impl class of the original class            cl = Class.forName( name + ObjectContainer.PROXYNAME_POSTFIX );            newClassName = name;            manipulator.changeClassFile( null, outputDirName + OPPHelper.rawClassName( cl ) + ".class", newClassName );        }     }             protected static void makeProxies( DxHashSet classes ) throws Exception {        DxIterator it = classes.iterator();        while (it.next() != null) {            String name = (String)it.object();                        OPPHelper.progressMsg( name + ":", quiet );                        makeProxy( name );        }     }             protected static void makeODMGProxy( String arg ) throws Exception {                // create the *_Impl class of the original class        Class cl = Class.forName( arg );        ImplManipulator manipulator = new ImplManipulator( cl, outputDirName, quiet );        String newClassName = cl.getName() + ObjectContainer.IMPLNAME_POSTFIX;        manipulator.changeClassFile( null, outputDirName + OPPHelper.rawClassName( cl ) + ".class", newClassName );                // generate source and class file of the *_Proxy proxy class        makeProxy( arg );                // create the *_Impl class of the original class        cl = Class.forName( arg + ObjectContainer.PROXYNAME_POSTFIX );        manipulator = new ImplManipulator( cl, outputDirName, quiet );        newClassName = arg;        manipulator.changeClassFile( null, outputDirName + OPPHelper.rawClassName( cl ) + ".class", newClassName );    }             protected static void makeProxy( String arg ) throws Exception {        Class cl = Class.forName( arg );                ProxyGenerator generator = new ProxyGenerator( cl, methodPattern, outputDirName, quiet, cache );        generator.searchUpdateMethods( searchInterfaceSource );        generator.generateSource();                if (compileSource) {            generator.compileSource();        }                 if (!keepSource) {            generator.deleteSource();        }     }             public static void printUsage() {        System.out.println( "Ozone Post Processor" );        System.out.println(                "usage: opp [-ks] [-st] [-p<pattern>] [-ni] [-nc] [-q] [-h] [-o<directory>] [-odmg] class [class]*" );        System.out.println( "   -ks       save the generated source files" );        System.out.println( "   -KS       save the generated source files; do not invoke compiler" );        System.out.println( "   -st       print stack trace" );        System.out.println( "   -p        regular expression to specify update methods" );        System.out.println( "   -ni       do not search interface code for update methods" );        System.out.println( "   -q        supress output of any messages" );        System.out.println( "   -o        out/input directory for class files and sources" );        System.out.println( "   -odmg     create proxies for the ozone ODMG interface" );        System.out.println( "   -nc       do not create code needed for direct invokes and ClientCacheDatabase" );        System.out.println( "   -version  shows version information" );        System.out.println( "   -h        shows this help" );    }     }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -