本文整理汇总了Java中org.hsqldb.persist.HsqlProperties.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Java HsqlProperties.setProperty方法的具体用法?Java HsqlProperties.setProperty怎么用?Java HsqlProperties.setProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hsqldb.persist.HsqlProperties
的用法示例。
在下文中一共展示了HsqlProperties.setProperty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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", "");
}
}
}
示例3: 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);
}
}
示例4: 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", "");
}
}
}
示例5: 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;
}
示例6: 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);
}
}
示例7: setUp
import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
protected void setUp() {
user = "sa";
password = "";
try {
sStatement = null;
cConnection = null;
TestSelf.deleteDatabase(filepath);
HsqlProperties props = new HsqlProperties(filepath);
boolean fileexists = props.checkFileExists();
if (!network && !fileexists == false) {
jdbcDataSource dataSource = new jdbcDataSource();
dataSource.setDatabase(url + filepath);
cConnection = dataSource.getConnection(user, password);
sStatement = cConnection.createStatement();
sStatement.execute("SET LOGSIZE " + 400);
sStatement.execute("SET WRITE_DELAY " + writeDelay);
sStatement.execute("SHUTDOWN");
cConnection.close();
props.load();
props.setProperty("hsqldb.cache_scale", "" + cacheScale);
props.save();
cConnection = dataSource.getConnection(user, password);
sStatement = cConnection.createStatement();
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("TestSql.setUp() error: " + e.getMessage());
}
}
示例8: setUp
import org.hsqldb.persist.HsqlProperties; //导入方法依赖的package包/类
protected void setUp() {
user = "sa";
password = "";
try {
sStatement = null;
cConnection = null;
HsqlProperties props = new HsqlProperties(filepath);
boolean fileexists = props.checkFileExists();
if (!network && !fileexists == false) {
jdbcDataSource dataSource = new jdbcDataSource();
dataSource.setDatabase(url + filepath);
cConnection = dataSource.getConnection(user, password);
sStatement = cConnection.createStatement();
sStatement.execute("SET SCRIPTFORMAT " + logType);
sStatement.execute("SET LOGSIZE " + 400);
sStatement.execute("SET WRITE_DELAY " + writeDelay);
sStatement.execute("SHUTDOWN");
cConnection.close();
props.load();
props.setProperty("hsqldb.cache_scale", "" + cacheScale);
props.save();
cConnection = dataSource.getConnection(user, password);
sStatement = cConnection.createStatement();
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("TestSql.setUp() error: " + e.getMessage());
}
}