当前位置: 首页>>代码示例>>Java>>正文


Java HsqlProperties.getProperty方法代码示例

本文整理汇总了Java中org.hsqldb.persist.HsqlProperties.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java HsqlProperties.getProperty方法的具体用法?Java HsqlProperties.getProperty怎么用?Java HsqlProperties.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hsqldb.persist.HsqlProperties的用法示例。


在下文中一共展示了HsqlProperties.getProperty方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: translateDefaultDatabaseProperty

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
/**
 * Translates the legacy default database form: database=...
 * to the 1.7.2 form: database.0=...
 *
 * @param p The properties object upon which to perform the translation
 */
public static void translateDefaultDatabaseProperty(HsqlProperties p) {

    if (p == null) {
        return;
    }

    if (!p.isPropertyTrue(SC_KEY_REMOTE_OPEN_DB)) {
        if (p.getProperty(SC_KEY_DATABASE + "." + 0) == null) {
            String defaultdb = p.getProperty(SC_KEY_DATABASE);

            if (defaultdb == null) {
                defaultdb = SC_DEFAULT_DATABASE;
            }

            p.setProperty(SC_KEY_DATABASE + ".0", defaultdb);
            p.setProperty(SC_KEY_DBNAME + ".0", "");
        }

        if (p.getProperty(SC_KEY_DBNAME + "." + 0) == null) {
            p.setProperty(SC_KEY_DBNAME + ".0", "");
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:ServerConfiguration.java

示例2: translateAddressProperty

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
/**
 * Translates null or zero length value for address key to the
 * special value ServerConstants.SC_DEFAULT_ADDRESS which causes
 * ServerSockets to be constructed without specifying an InetAddress.
 *
 * @param p The properties object upon which to perform the translation
 */
public static void translateAddressProperty(HsqlProperties p) {

    if (p == null) {
        return;
    }

    String address = p.getProperty(SC_KEY_ADDRESS);

    if (StringUtil.isEmpty(address)) {
        p.setProperty(SC_KEY_ADDRESS, SC_DEFAULT_ADDRESS);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:ServerConfiguration.java

示例3: translateDefaultDatabaseProperty

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
/**
 * Translates the legacy default database form: database=...
 * to the 1.7.2 form: database.0=...
 *
 * @param p The properties object upon which to perform the translation
 */
public static void translateDefaultDatabaseProperty(HsqlProperties p) {

    if (p == null) {
        return;
    }

    if (!p.isPropertyTrue(ServerProperties.sc_key_remote_open_db)) {
        if (p.getProperty(ServerProperties.sc_key_database + "." + 0)
                == null) {
            String defaultdb =
                p.getProperty(ServerProperties.sc_key_database);

            if (defaultdb == null) {
                defaultdb = SC_DEFAULT_DATABASE;
            } else {
                p.removeProperty(ServerProperties.sc_key_database);
            }

            p.setProperty(ServerProperties.sc_key_database + ".0",
                          defaultdb);
            p.setProperty(ServerProperties.sc_key_dbname + ".0", "");
        }

        if (p.getProperty(ServerProperties.sc_key_dbname + "." + 0)
                == null) {
            p.setProperty(ServerProperties.sc_key_dbname + ".0", "");
        }
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:36,代码来源:ServerConfiguration.java

示例4: main

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
public static void main(String[] argv) {

        TestCacheSize  test  = new TestCacheSize();
        HsqlProperties props = HsqlProperties.argArrayToProps(argv, "test");

        test.bigops   = props.getIntegerProperty("test.bigops", test.bigops);
        test.bigrows  = test.bigops;
        test.smallops = test.bigops / 8;
        test.cacheScale = props.getIntegerProperty("test.scale",
                test.cacheScale);
        test.tableType = props.getProperty("test.tabletype", test.tableType);
        test.nioMode   = props.isPropertyTrue("test.nio", test.nioMode);

        if (props.getProperty("test.dbtype", "").equals("mem")) {
            test.filepath = "mem:test";
            test.filedb   = false;
            test.shutdown = false;
        }

        test.setUp();

        StopWatch sw = new StopWatch();

        test.testFillUp();
        test.checkResults();

        long time = sw.elapsedTime();

        test.storeResult("total test time", 0, (int) time, 0);
        System.out.println("total test time -- " + sw.elapsedTime() + " ms");
        test.tearDown();
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:33,代码来源:TestCacheSize.java

示例5: setDBInfoArrays

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
/**
 * Initialises the database attributes lists from the server properties object.
 */
private void setDBInfoArrays() {

    dbAlias = getDBNameArray();
    dbPath  = new String[dbAlias.length];
    dbType  = new String[dbAlias.length];
    dbID    = new int[dbAlias.length];
    dbProps = new HsqlProperties[dbAlias.length];

    for (int i = 0; i < dbAlias.length; i++) {
        if (dbAlias[i] == null) {
            continue;
        }

        String path = getDatabasePath(i, true);

        if (path == null) {
            dbAlias[i] = null;

            continue;
        }

        HsqlProperties dbURL = DatabaseURL.parseURL(path, false);

        if (dbURL == null) {
            dbAlias[i] = null;

            continue;
        }

        dbPath[i]  = dbURL.getProperty("database");
        dbType[i]  = dbURL.getProperty("connection_type");
        dbProps[i] = dbURL;
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:Server.java

示例6: main

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
public static void main(String[] argv) {

        TestCacheSize  test  = new TestCacheSize();
        HsqlProperties props = HsqlProperties.argArrayToProps(argv, "test");

        test.bigops   = props.getIntegerProperty("test.bigops", test.bigops);
        test.bigrows  = test.bigops;
        test.smallops = test.bigops / 8;
        test.cacheScale = props.getIntegerProperty("test.scale",
                test.cacheScale);
        test.logType   = props.getProperty("test.logtype", test.logType);
        test.tableType = props.getProperty("test.tabletype", test.tableType);
        test.nioMode   = props.isPropertyTrue("test.nio", test.nioMode);

        if (props.getProperty("test.dbtype", "").equals("mem")) {
            test.filepath = "mem:test";
            test.filedb   = false;
            test.shutdown = false;
        }

        test.setUp();

        StopWatch sw = new StopWatch();

        test.testFillUp();
        test.checkResults();

        long time = sw.elapsedTime();

        test.storeResult("total test time", 0, (int) time, 0);
        System.out.println("total test time -- " + sw.elapsedTime() + " ms");
        test.tearDown();
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:TestCacheSize.java

示例7: translateAddressProperty

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
/**
 * Translates null or zero length value for address key to the
 * special value ServerConstants.SC_DEFAULT_ADDRESS which causes
 * ServerSockets to be constructed without specifying an InetAddress.
 *
 * @param p The properties object upon which to perform the translation
 */
public static void translateAddressProperty(HsqlProperties p) {

    if (p == null) {
        return;
    }

    String address = p.getProperty(ServerProperties.sc_key_address);

    if (StringUtil.isEmpty(address)) {
        p.setProperty(ServerProperties.sc_key_address, SC_DEFAULT_ADDRESS);
    }
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:20,代码来源:ServerConfiguration.java

示例8: setDBInfoArrays

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
/**
 * Initialises the database attributes lists from the server properties object.
 */
private void setDBInfoArrays() {

    IntKeyHashMap dbNumberMap  = getDBNameArray();
    int           maxDatabases = dbNumberMap.size();

    if (serverProperties.isPropertyTrue(
            ServerProperties.sc_key_remote_open_db)) {
        int max = serverProperties.getIntegerProperty(
            ServerProperties.sc_key_max_databases,
            ServerConstants.SC_DEFAULT_MAX_DATABASES);

        if (maxDatabases < max) {
            maxDatabases = max;
        }
    }

    dbAlias          = new String[maxDatabases];
    dbPath           = new String[dbAlias.length];
    dbType           = new String[dbAlias.length];
    dbID             = new int[dbAlias.length];
    dbActionSequence = new long[dbAlias.length];
    dbProps          = new HsqlProperties[dbAlias.length];

    Iterator it = dbNumberMap.keySet().iterator();

    for (int i = 0; it.hasNext(); ) {
        int    dbNumber = it.nextInt();
        String path     = getDatabasePath(dbNumber, true);

        if (path == null) {
            printWithThread("missing database path: "
                            + dbNumberMap.get(dbNumber));

            continue;
        }

        HsqlProperties dbURL = DatabaseURL.parseURL(path, false, false);

        if (dbURL == null) {
            printWithThread("malformed database path: " + path);

            continue;
        }

        dbAlias[i] = (String) dbNumberMap.get(dbNumber);
        dbPath[i]  = dbURL.getProperty("database");
        dbType[i]  = dbURL.getProperty("connection_type");
        dbProps[i] = dbURL;

        i++;
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:56,代码来源:Server.java

示例9: main

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
/**
 * Creates and starts a new Server.  <p>
 *
 * Allows starting a Server via the command line interface. <p>
 *
 * @param args the command line arguments for the Server instance
 */
public static void main(String[] args) {

    HsqlProperties argProps = null;

    argProps = HsqlProperties.argArrayToProps(args,
            ServerProperties.sc_key_prefix);

    String[] errors = argProps.getErrorKeys();

    if (errors.length != 0) {
        System.out.println("no value for argument:" + errors[0]);
        printHelp("server.help");

        return;
    }

    String propsPath = argProps.getProperty(ServerProperties.sc_key_props);
    String propsExtension = "";

    if (propsPath == null) {
        propsPath      = "server";
        propsExtension = ".properties";
    } else {
        argProps.removeProperty(ServerProperties.sc_key_props);
    }

    propsPath = FileUtil.getFileUtil().canonicalOrAbsolutePath(propsPath);

    ServerProperties fileProps = ServerConfiguration.getPropertiesFromFile(
        ServerConstants.SC_PROTOCOL_HSQL, propsPath, propsExtension);
    ServerProperties props =
        fileProps == null
        ? new ServerProperties(ServerConstants.SC_PROTOCOL_HSQL)
        : fileProps;

    props.addProperties(argProps);
    ServerConfiguration.translateDefaultDatabaseProperty(props);

    // Standard behaviour when started from the command line
    // is to halt the VM when the server shuts down.  This may, of
    // course, be overridden by whatever, if any, security policy
    // is in place.
    ServerConfiguration.translateDefaultNoSystemExitProperty(props);
    ServerConfiguration.translateAddressProperty(props);

    // finished setting up properties;
    Server server = new Server();

    try {
        server.setProperties(props);
    } catch (Exception e) {
        server.printError("Failed to set properties");
        server.printStackTrace(e);

        return;
    }

    // now messages go to the channel specified in properties
    server.print("Startup sequence initiated from main() method");

    if (fileProps != null) {
        server.print("Loaded properties from [" + propsPath
                     + propsExtension + "]");
    } else {
        server.print("Could not load properties from file");
        server.print("Using cli/default properties only");
    }

    server.start();
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:78,代码来源:Server.java

示例10: JDBCConnection

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
/**
 * Constructs a new external <code>Connection</code> to an HSQLDB
 * <code>Database</code>. <p>
 *
 * This constructor is called on behalf of the
 * <code>java.sql.DriverManager</code> when getting a
 * <code>Connection</code> for use in normal (external)
 * client code. <p>
 *
 * Internal client code, that being code located in HSQLDB SQL
 * functions and stored procedures, receives an INTERNAL
 * connection constructed by the {@link
 * #JDBCConnection(org.hsqldb.SessionInterface)
 * JDBCConnection(SessionInterface)} constructor. <p>
 *
 * @param props A <code>Properties</code> object containing the connection
 *      properties
 * @exception SQLException when the user/password combination is
 *     invalid, the connection url is invalid, or the
 *     <code>Database</code> is unavailable. <p>
 *
 *     The <code>Database</code> may be unavailable for a number
 *     of reasons, including network problems or the fact that it
 *     may already be in use by another process.
 */
public JDBCConnection(HsqlProperties props) throws SQLException {

    String user     = props.getProperty("user");
    String password = props.getProperty("password");
    String connType = props.getProperty("connection_type");
    String host     = props.getProperty("host");
    int    port     = props.getIntegerProperty("port", 0);
    String path     = props.getProperty("path");
    String database = props.getProperty("database");
    boolean isTLS = (connType == DatabaseURL.S_HSQLS
                     || connType == DatabaseURL.S_HTTPS);

    if (user == null) {
        user = "SA";
    }

    if (password == null) {
        password = "";
    }

    Calendar cal         = Calendar.getInstance();
    int      zoneSeconds = HsqlDateTime.getZoneSeconds(cal);

    try {
        if (DatabaseURL.isInProcessDatabaseType(connType)) {

            /**
             * @todo fredt - this should be the only static reference to a core class in
             *   the jdbc package - we may make it dynamic
             */
            sessionProxy = DatabaseManager.newSession(connType, database,
                    user, password, props, zoneSeconds);
        } else {    // alias: type not yet implemented
            throw Util.invalidArgument(connType);
        }
        connProperties = props;
    } catch (HsqlException e) {
        throw Util.sqlException(e);
    }
}
 
开发者ID:s-store,项目名称:s-store,代码行数:66,代码来源:JDBCConnection.java

示例11: jdbcConnection

import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
/**
     * Constructs a new external <code>Connection</code> to an HSQLDB
     * <code>Database</code>. <p>
     *
     * This constructor is called on behalf of the
     * <code>java.sql.DriverManager</code> when getting a
     * <code>Connection</code> for use in normal (external)
     * client code. <p>
     *
     * Internal client code, that being code located in HSQLDB SQL
     * functions and stored procedures, receives an INTERNAL
     * connection constructed by the {@link #jdbcConnection(Session)
     * jdbcConnection(Session)} constructor. <p>
     *
     * @param props A <code>Properties</code> object containing the connection
     *      properties
     * @exception SQLException when the user/password combination is
     *     invalid, the connection url is invalid, or the
     *     <code>Database</code> is unavailable. <p>
     *
     *     The <code>Database</code> may be unavailable for a number
     *     of reasons, including network problems or the fact that it
     *     may already be in use by another process.
     */
    public jdbcConnection(HsqlProperties props) throws SQLException {

        String user     = props.getProperty("user");
        String password = props.getProperty("password");
        String connType = props.getProperty("connection_type");
        String host     = props.getProperty("host");
        int    port     = props.getIntegerProperty("port", 0);
        String path     = props.getProperty("path");
        String database = props.getProperty("database");
        boolean isTLS = (connType == DatabaseURL.S_HSQLS
                         || connType == DatabaseURL.S_HTTPS);

        if (user == null) {
            user = "SA";
        }

        if (password == null) {
            password = "";
        }

        user     = user.toUpperCase(Locale.ENGLISH);
        password = password.toUpperCase(Locale.ENGLISH);

        try {
            if (DatabaseURL.isInProcessDatabaseType(connType)) {

/** @todo fredt - this should be the only static reference to a core class in
                     *  the jdbc package - we may make it dynamic */
                sessionProxy = DatabaseManager.newSession(connType, database,
                        user, password, props);
            } else if (connType == DatabaseURL.S_HSQL
                       || connType == DatabaseURL.S_HSQLS) {
                sessionProxy = new HSQLClientConnection(host, port, path,
                        database, isTLS, user, password);
                isNetConn = true;
            } else if (connType == DatabaseURL.S_HTTP
                       || connType == DatabaseURL.S_HTTPS) {
                sessionProxy = new HTTPClientConnection(host, port, path,
                        database, isTLS, user, password);
                isNetConn = true;
            } else {    // alias: type not yet implemented
                throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT);
            }

            connProperties = props;
        } catch (HsqlException e) {
            throw Util.sqlException(e);
        }
    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:74,代码来源:jdbcConnection.java


注:本文中的org.hsqldb.persist.HsqlProperties.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。