日期:2014-05-16 浏览次数:20505 次
public static void main(String[] paramArrayOfString)
{
//获取并读取 server.properties 文件,若没有取默认
String str = FileUtil.getDefaultInstance().canonicalOrAbsolutePath("server");
HsqlProperties localHsqlProperties1 = ServerConfiguration.getPropertiesFromFile(str);
HsqlProperties localHsqlProperties2 = (localHsqlProperties1 == null) ? new HsqlProperties() : localHsqlProperties1;
HsqlProperties localHsqlProperties3 = null;
//获取main参数数组,加入 server.properties.保存到HsqlProperties对象.
try
{
localHsqlProperties3 = HsqlProperties.argArrayToProps(paramArrayOfString, "server");
}
catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
{
printHelp("server.help");
return;
}
if (localHsqlProperties3 != null)
{
if (localHsqlProperties3.getErrorKeys().length != 0)
{
printHelp("server.help");
return;
}
localHsqlProperties2.addProperties(localHsqlProperties3);
}
//可略过
ServerConfiguration.translateDefaultDatabaseProperty(localHsqlProperties2);
ServerConfiguration.translateDefaultNoSystemExitProperty(localHsqlProperties2);
//创建Server,并设置属性文件.主要分配serverid.取默认协议.
Server localServer = new Server();
try
{
localServer.setProperties(localHsqlProperties2);
}
catch (Exception localException)
{
localServer.printError("Failed to set properties");
localServer.printStackTrace(localException);
return;
}
//输出初始化信息
localServer.print("Startup sequence initiated from main() method");
if (localHsqlProperties1 != null)
{
localServer.print("Loaded properties from [" + str + ".properties]");
}
else
{
localServer.print("Could not load properties from file");
localServer.print("Using cli/default properties only");
}
//启动Server.
localServer.start();
}
//启动服务器线程 this.serverThread = new ServerThread(this, "HSQLDB Server "); this.serverThread.start();