00001 /** 00002 * C-JDBC: Clustered JDBC. 00003 * Copyright (C) 2002-2004 French National Institute For Research In Computer 00004 * Science And Control (INRIA). 00005 * Contact: c-jdbc@objectweb.org 00006 * 00007 * This library is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU Lesser General Public License as published by the 00009 * Free Software Foundation; either version 2.1 of the License, or any later 00010 * version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 00015 * for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this library; if not, write to the Free Software Foundation, 00019 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00020 * 00021 * Initial developer(s): Mathieu Peltier. 00022 * Contributor(s): Nicolas Modrzyk, Emmanuel Cecchet. 00023 */ 00024 00025 package org.objectweb.cjdbc.controller.core; 00026 00027 import java.io.File; 00028 import java.net.URL; 00029 00030 /** 00031 * Constants relative to C-JDBC controller. 00032 * 00033 * @author <a href="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a> 00034 * @author <a href="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a> 00035 * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a> 00036 * @author <a href="mailto:duncan@mightybot.com">Duncan Smith </a> 00037 * @version 1.0 00038 */ 00039 public class ControllerConstants 00040 { 00041 /** Default controller port number value. */ 00042 public static final int DEFAULT_PORT = 25322; 00043 00044 /** Default IP address to bind controller to */ 00045 public static final String DEFAULT_IP = "0.0.0.0"; 00046 00047 /** Default backlog size for driver connections. */ 00048 public static final int DEFAULT_BACKLOG_SIZE = 10; 00049 00050 /** This allow to send a command from the ControllerShutdown class */ 00051 public static final String SHUTDOWN = "CJDBC_SHUTDOWN"; 00052 00053 /** Backup directory */ 00054 public static final String DEFAULT_BACKUP_DIR = ".." 00055 + File.separator 00056 + "backup"; 00057 00058 /** C-JDBC-Controller DTD file name (must be found in classpath). */ 00059 public static final String C_JDBC_CONTROLLER_DTD_FILE = "c-jdbc-controller.dtd"; 00060 00061 /** 00062 * Default sleep time in ms for a controller worker thread. If no job is ready 00063 * after this time, the thread dies. 00064 */ 00065 public static final int DEFAULT_CONTROLLER_WORKER_THREAD_SLEEP_TIME = 15000; 00066 00067 /** JMX Enable by default */ 00068 public static final boolean JMX_ENABLE = false; 00069 00070 /** Add Driver enable by default */ 00071 public static final boolean ADD_DRIVER_ENABLE = false; 00072 00073 /** Checkpoint to take by default */ 00074 public static final String DATABASE_DEFAULT_CHECKPOINT = "last"; 00075 00076 /** Default configuration file */ 00077 public static final String DEFAULT_CONFIG_FILE = "controller.xml"; 00078 00079 /** Log4j property file resource (must be found in classpath). */ 00080 public static final String LOG4J_RESOURCE = "/log4j.properties"; 00081 00082 /** Default log directory name (will be stored into CJDBC_HOME directory). */ 00083 public static final String DEFAULT_LOG_DIR_NAME = "log"; 00084 00085 /** Default report location */ 00086 public static final String REPORT_LOCATION = ".." 00087 + File.separator 00088 + DEFAULT_LOG_DIR_NAME; 00089 00090 /** Report file */ 00091 public static final String REPORT_FILE = "cjdbc.report"; 00092 00093 /** 00094 * Name of the C-JDBC JAR file (must be found in classpath). This information 00095 * is used to find the drivers directory. 00096 */ 00097 public static final String C_JDBC_DRIVER_JAR_FILE = "/c-jdbc-driver.jar"; 00098 00099 /** 00100 * Return default path and name for saving of configuration file 00101 * 00102 * @param resource name of the resource to get save file for 00103 * @return path 00104 */ 00105 public static final String getSaveFile(String resource) 00106 { 00107 URL url = ControllerConstants.class.getResource("/" + DEFAULT_CONFIG_FILE); 00108 File dir = (new File(url.getFile())).getParentFile(); 00109 return dir.getPath() + File.separator + resource + "-saved.xml"; 00110 } 00111 00112 /** Enable all backend from their last known state at controller start */ 00113 public static final int AUTO_ENABLE_TRUE = 0; 00114 /** Do not enable any backend when starting controller */ 00115 public static final int AUTO_ENABLE_FALSE = 1; 00116 /** Restore the state from an existing recovery log */ 00117 public static final int AUTO_ENABLE_FORCE = 2; 00118 00119 /** Auto Enable Backend default */ 00120 public static final int AUTO_ENABLE_BACKEND = AUTO_ENABLE_TRUE; 00121 00122 }