xlawrence 2005/05/17 16:29:10 CEST
Added files:
calClient/src/java/org/jahia/suite/calendar/calServer
HSQLDB.java
Log:
Servlet for starting HSQL database instances
Revision Changes Path
1.1 +101 -0
uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/HSQLDB.java
(new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/calClient/src/java/org/jahia/suite/calendar/calServer/HSQLDB.java?rev=1.1&content-type=text/plain
Index: HSQLDB.java
====================================================================
/*
* ____.
* __/\ ______| |__/\. _______
* __ .____| | \ | +----+ \
* _______| /--| | | - \ _ | : - \_________
* \\______: :---| : : | : | \________>
* |__\---\_____________:______: :____|____:_____\
* /_____|
*
* . . . i n j a h i a w e t r u s t . . .
*
*
*
* ----- BEGIN LICENSE BLOCK -----
* Version: JCSL 1.0
*
* The contents of this file are subject to the Jahia Community Source License
* 1.0 or later (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.jahia.org/license
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the rights, obligations and limitations governing use of the contents
* of the file. The Original and Upgraded Code is the Jahia CMS and Portal
* Server. The developer of the Original and Upgraded Code is JAHIA Ltd. JAHIA
* Ltd. owns the copyrights in the portions it created. All Rights Reserved.
*
* The Shared Modifications are Jahia View Helper.
*
* The Developer of the Shared Modifications is Jahia Solution S�rl.
* Portions created by the Initial Developer are Copyright (C) 2002 by the
* Initial Developer. All Rights Reserved.
*
* ----- END LICENSE BLOCK -----
*/
package org.jahia.suite.calendar.calServer;
import javax.servlet.http.HttpServlet;
import javax.servlet.ServletException;
import org.hsqldb.Server;
import org.apache.log4j.Logger;
/**
*
* @author Xavier Lawrence
*/
public class HSQLDB extends HttpServlet implements Runnable {
// log4j logger
static Logger log = Logger.getLogger(HSQLDB.class);
public String[] argsUW;
public String[] argsSM;
private boolean started = false;
public void init() throws ServletException {
log.info("Starting Required DataBases...");
String[] tmp1 = {"-database",
super.getServletContext().getRealPath("/WEB-INF/db/UwCal"),
"-port", "8887"};
String[] tmp2 = {"-database",
super.getServletContext().getRealPath("/WEB-INF/db/SyncManager"),
"-port", "8889"};
argsUW = tmp1;
argsSM = tmp2;
start();
}
public void start() {
Thread t = new Thread(this);
t.setDaemon(true);
t.start();
Thread t2 = new Thread(this);
t2.setDaemon(true);
t2.start();
try {
// Let the databases start...
Thread.currentThread().sleep(5000);
} catch (InterruptedException e) {}
}
public void run() {
if (!started) {
started = true;
log.info("UW Calendar DataBase Server starting...");
Server.main(argsUW);
} else {
log.info("UW Calendar SyncManager Database starting...");
Server.main(argsSM);
}
}
}