本文整理汇总了Java中org.hsqldb.persist.HsqlProperties类的典型用法代码示例。如果您正苦于以下问题:Java HsqlProperties类的具体用法?Java HsqlProperties怎么用?Java HsqlProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HsqlProperties类属于org.hsqldb.persist包,在下文中一共展示了HsqlProperties类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: putPropertiesFromString
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Puts properties from the supplied string argument. The relevant
* key value pairs are the same as those for the (web)server.properties
* file format, except that the 'server.' prefix should not be specified.
*
* @param s semicolon-delimited key=value pair string,
* e.g. silent=false;port=8080;...
* @throws HsqlException if this server is running
*
* @jmx.managed-operation
* impact="ACTION"
* description="'server.' key prefix automatically supplied"
*
* @jmx.managed-operation-parameter
* name="s"
* type="java.lang.String"
* position="0"
* description="semicolon-delimited key=value pairs"
*/
public void putPropertiesFromString(String s) {
if (getState() != ServerConstants.SERVER_STATE_SHUTDOWN) {
throw Error.error(ErrorCode.GENERAL_ERROR);
}
if (StringUtil.isEmpty(s)) {
return;
}
printWithThread("putPropertiesFromString(): [" + s + "]");
HsqlProperties p = HsqlProperties.delimitedArgPairsToProps(s, "=",
";", ServerProperties.sc_key_prefix);
try {
setProperties(p);
} catch (Exception e) {
throw Error.error(e, ErrorCode.GENERAL_ERROR,
ErrorCode.M_Message_Pair,
new String[]{ "Failed to set properties" });
}
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:43,代码来源:Server.java
示例2: Database
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Constructs a new Database object.
*
* @param type is the type of the database: "mem:", "file:", "res:"
* @param path is the given path to the database files
* @param canonicalPath is the canonical path
* @param props property overrides placed on the connect URL
* @exception HsqlException if the specified name and path
* combination is illegal or unavailable, or the database files the
* name and path resolves to are in use by another process
*/
Database(DatabaseType type, String path, String canonicalPath,
HsqlProperties props) {
setState(Database.DATABASE_SHUTDOWN);
this.databaseType = type;
this.path = path;
this.canonicalPath = canonicalPath;
this.urlProperties = props;
if (databaseType == DatabaseType.DB_RES) {
filesInJar = true;
filesReadOnly = true;
}
logger = new Logger(this);
shutdownOnNoConnection =
urlProperties.isPropertyTrue(HsqlDatabaseProperties.url_shutdown);
recoveryMode = urlProperties.getIntegerProperty(
HsqlDatabaseProperties.url_recover, 0);
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:33,代码来源:Database.java
示例3: loadHsqldb
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Load up an HSQLDB in-memory instance.
*
* @return A newly initialized in-memory HSQLDB instance accessible
* through the returned instance of HSQLInterface
*/
public static HSQLInterface loadHsqldb() {
Session sessionProxy = null;
String name = "hsqldbinstance-" + String.valueOf(instanceId) + "-" + String.valueOf(System.currentTimeMillis());
instanceId++;
HsqlProperties props = new HsqlProperties();
try {
sessionProxy = DatabaseManager.newSession(DatabaseURL.S_MEM, name, "SA", "", props, 0);
} catch (HsqlException e) {
e.printStackTrace();
}
// make HSQL case insensitive
sessionProxy.executeDirectStatement("SET IGNORECASE TRUE;");
return new HSQLInterface(sessionProxy);
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:HSQLInterface.java
示例4: putPropertiesFromFile
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Attempts to put properties from the file
* with the specified path. The file
* extension '.properties' is implicit and should not
* be included in the path specification.
*
* @param path the path of the desired properties file, without the
* '.properties' file extension
* @throws RuntimeException if this server is running
* @return true if the indicated file was read sucessfully, else false
*
* @jmx.managed-operation
* impact="ACTION"
* description="Reads in properties"
*
* @jmx.managed-operation-parameter
* name="path"
* type="java.lang.String"
* position="0"
* description="(optional) returns false if path is empty"
*/
public boolean putPropertiesFromFile(String path) {
if (getState() != ServerConstants.SERVER_STATE_SHUTDOWN) {
throw new RuntimeException();
}
path = FileUtil.getDefaultInstance().canonicalOrAbsolutePath(path);
HsqlProperties p = ServerConfiguration.getPropertiesFromFile(path);
if (p == null || p.isEmpty()) {
return false;
}
printWithThread("putPropertiesFromFile(): [" + path + ".properties]");
try {
setProperties(p);
} catch (Exception e) {
throw new RuntimeException("Failed to set properties: " + e);
}
return true;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:46,代码来源:Server.java
示例5: getConnection
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
public static Connection getConnection(String url,
Properties info)
throws SQLException {
HsqlProperties props = DatabaseURL.parseURL(url, true);
if (props == null) {
// supposed to be an HSQLDB driver url but has errors
throw new SQLException(
Trace.getMessage(Trace.INVALID_JDBC_ARGUMENT));
} else if (props.isEmpty()) {
// is not an HSQLDB driver url
return null;
}
props.addProperties(info);
return new jdbcConnection(props);
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:jdbcDriver.java
示例6: jdbcResultSet
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Constructs a new <code>jdbcResultSet</code> object using the specified
* <code>org.hsqldb.Result</code>. <p>
*
* @param s the statement
* @param r the internal result form that the new
* <code>jdbcResultSet</code> represents
* @param props the connection properties
* @exception SQLException when the supplied Result is of type
* org.hsqldb.Result.ERROR
*/
jdbcResultSet(jdbcStatement s, Result r, HsqlProperties props,
boolean isNetConnection) throws SQLException {
sqlStatement = s;
connProperties = props;
this.isNetConn = isNetConnection;
if (r.mode == ResultConstants.UPDATECOUNT) {
iUpdateCount = r.getUpdateCount();
} else if (r.isError()) {
Util.throwError(r);
} else {
if (s != null) {
this.rsType = s.rsType;
}
iUpdateCount = -1;
rResult = r;
iColumnCount = r.getColumnCount();
}
bWasNull = false;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:jdbcResultSet.java
示例7: putPropertiesFromString
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Puts properties from the supplied string argument. The relevant
* key value pairs are the same as those for the (web)server.properties
* file format, except that the 'server.' prefix should not be specified.
*
* @param s semicolon-delimited key=value pair string,
* e.g. k1=v1;k2=v2;k3=v3...
* @throws RuntimeException if this server is running
*
* @jmx.managed-operation
* impact="ACTION"
* description="'server.' key prefix automatically supplied"
*
* @jmx.managed-operation-parameter
* name="s"
* type="java.lang.String"
* position="0"
* description="semicolon-delimited key=value pairs"
*/
public void putPropertiesFromString(String s) {
if (getState() != ServerConstants.SERVER_STATE_SHUTDOWN) {
throw new RuntimeException();
}
if (StringUtil.isEmpty(s)) {
return;
}
printWithThread("putPropertiesFromString(): [" + s + "]");
HsqlProperties p = HsqlProperties.delimitedArgPairsToProps(s, "=",
";", ServerConstants.SC_KEY_PREFIX);
try {
setProperties(p);
} catch (Exception e) {
throw new RuntimeException("Failed to set properties: " + e);
}
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:41,代码来源:Server.java
示例8: setProperties
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Sets server properties using the specified properties object
*
* @param p The object containing properties to set
*/
public void setProperties(HsqlProperties p) {
checkRunning(false);
if (p != null) {
serverProperties.addProperties(p);
ServerConfiguration.translateAddressProperty(serverProperties);
}
maxConnections = serverProperties.getIntegerProperty(
ServerConstants.SC_KEY_MAX_CONNECTIONS, 16);
JavaSystem.setLogToSystem(isTrace());
isSilent =
serverProperties.isPropertyTrue(ServerConstants.SC_KEY_SILENT);
isRemoteOpen = serverProperties.isPropertyTrue(
ServerConstants.SC_KEY_REMOTE_OPEN_DB);
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:Server.java
示例9: newDefaultProperties
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Retrieves a new default properties object for a server of the
* specified protocol
*
* @return a new default properties object
*/
public static HsqlProperties newDefaultProperties(int protocol) {
HsqlProperties p = new HsqlProperties();
p.setProperty(SC_KEY_AUTORESTART_SERVER,
SC_DEFAULT_SERVER_AUTORESTART);
p.setProperty(SC_KEY_ADDRESS, SC_DEFAULT_ADDRESS);
p.setProperty(SC_KEY_NO_SYSTEM_EXIT, SC_DEFAULT_NO_SYSTEM_EXIT);
boolean isTls = SC_DEFAULT_TLS;
try {
isTls = System.getProperty("javax.net.ssl.keyStore") != null;
} catch (Exception e) {}
p.setProperty(SC_KEY_PORT, getDefaultPort(protocol, isTls));
p.setProperty(SC_KEY_SILENT, SC_DEFAULT_SILENT);
p.setProperty(SC_KEY_TLS, isTls);
p.setProperty(SC_KEY_TRACE, SC_DEFAULT_TRACE);
p.setProperty(SC_KEY_WEB_DEFAULT_PAGE, SC_DEFAULT_WEB_PAGE);
p.setProperty(SC_KEY_WEB_ROOT, SC_DEFAULT_WEB_ROOT);
return p;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:ServerConfiguration.java
示例10: 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
示例11: newSession
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Used by in-process connections and by Servlet
*/
public static Session newSession(String type, String path, String user,
String password, HsqlProperties props,
String zoneString, int timeZoneSeconds) {
Database db = getDatabase(type, path, props);
return db.connect(user, password, zoneString, timeZoneSeconds);
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:12,代码来源:DatabaseManager.java
示例12: createHsqlServer
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
public static HsqlSocketRequestHandler createHsqlServer(String dbFilePath,
boolean debugMessages, boolean silentMode) throws SQLException {
HsqlProperties props = new HsqlProperties();
props.setProperty("server.database.0", dbFilePath);
props.setProperty("server.trace", debugMessages);
props.setProperty("server.silent", silentMode);
Server server = new Server();
try {
server.setProperties(props);
} catch (Exception e) {
throw new SQLException("Failed to set server properties: " + e);
}
if (server.openDatabases() == false) {
Throwable t = server.getServerError();
if (t instanceof HsqlException) {
throw Util.sqlException((HsqlException) t);
} else {
throw new SQLException(Trace.getMessage(Trace.GENERAL_ERROR));
}
}
server.setState(ServerConstants.SERVER_STATE_ONLINE);
// Server now implements HsqlSocketRequestHandler,
// so there's really no need for HsqlSocketRequestHandlerImpl
return (HsqlSocketRequestHandler) server;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:HsqlServerFactory.java
示例13: 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
示例14: 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:tiweGH,项目名称:OpenDiabetes,代码行数:20,代码来源:ServerConfiguration.java
示例15: 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
示例16: translateDefaultNoSystemExitProperty
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Translates unspecified no_system_exit property to false, the default
* typically required when a Server is started from the command line.
*
* @param p The properties object upon which to perform the translation
*/
public static void translateDefaultNoSystemExitProperty(HsqlProperties p) {
if (p == null) {
return;
}
p.setPropertyIfNotExists(ServerProperties.sc_key_no_system_exit,
"false");
}
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:16,代码来源:ServerConfiguration.java
示例17: 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
示例18: newSession
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Used by in-process connections and by Servlet
*/
public static Session newSession(String type, String path, String user,
String password, HsqlProperties props,
int timeZoneSeconds) {
Database db = getDatabase(type, path, props);
if (db == null) {
return null;
}
return db.connect(user, password, timeZoneSeconds);
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:16,代码来源:DatabaseManager.java
示例19: getDatabaseObject
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
private static synchronized Database getDatabaseObject(String type,
String path, HsqlProperties props) {
Database db;
String key = path;
HashMap databaseMap;
if (type == DatabaseURL.S_FILE) {
databaseMap = fileDatabaseMap;
key = filePathToKey(path);
} else if (type == DatabaseURL.S_RES) {
databaseMap = resDatabaseMap;
} else if (type == DatabaseURL.S_MEM) {
databaseMap = memDatabaseMap;
} else {
throw Error.runtimeError(ErrorCode.U_S0500,
"DatabaseManager.getDatabaseObject");
}
db = (Database) databaseMap.get(key);
if (db == null) {
db = new Database(type, path, type + key, props);
db.databaseID = dbIDCounter;
databaseIDMap.put(dbIDCounter, db);
dbIDCounter++;
databaseMap.put(key, db);
}
return db;
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:35,代码来源:DatabaseManager.java
示例20: init
import org.hsqldb.persist.HsqlProperties; //导入依赖的package包/类
/**
* Initializes this JDBCResultSetMetaData object from the specified
* Result and HsqlProperties objects.
*
* @param meta the ResultMetaData object from which to initialize this
* JDBCResultSetMetaData object
* @param props the HsqlProperties object from which to initialize this
* JDBCResultSetMetaData object
* @throws SQLException if a database access error occurs
*/
void init(ResultMetaData meta, HsqlProperties props) throws SQLException {
resultMetaData = meta;
columnCount = resultMetaData.getColumnCount();
// fredt - props is null for internal connections, so always use the
// default behaviour in this case
// JDBCDriver.getPropertyInfo says
// default is true
useColumnName = (props == null) ? true
: props.isPropertyTrue(
"get_column_name", true);
}
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:JDBCResultSetMetaData.java
注:本文中的org.hsqldb.persist.HsqlProperties类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论