KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > controller > core > ControllerConstants


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2005 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Mathieu Peltier.
22  * Contributor(s): Nicolas Modrzyk, Emmanuel Cecchet.
23  */

24
25 package org.objectweb.cjdbc.controller.core;
26
27 import java.io.File JavaDoc;
28 import java.net.URL JavaDoc;
29
30 /**
31  * Constants relative to C-JDBC controller.
32  *
33  * @author <a HREF="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier </a>
34  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
35  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
36  * @author <a HREF="mailto:duncan@mightybot.com">Duncan Smith </a>
37  * @version 1.0
38  */

39 public class ControllerConstants
40 {
41   /** Default controller port number value. */
42   public static final int DEFAULT_PORT = 25322;
43
44   /**
45    * Default IP address to bind controller to. InetAddress.anyLocalAddress()
46    * would be more IPv12 compliant
47    */

48   public static final String JavaDoc DEFAULT_IP = "0.0.0.0";
49
50   /** Default backlog size for driver connections. */
51   public static final int DEFAULT_BACKLOG_SIZE = 10;
52
53   /** This allow to send a command from the ControllerShutdown class */
54   public static final String JavaDoc SHUTDOWN = "CJDBC_SHUTDOWN";
55
56   /** Backup directory */
57   public static final String JavaDoc DEFAULT_BACKUP_DIR = ".."
58                                                                               + File.separator
59                                                                               + "backup";
60
61   /** C-JDBC-Controller DTD file name (must be found in classpath). */
62   public static final String JavaDoc C_JDBC_CONTROLLER_DTD_FILE = "c-jdbc-controller.dtd";
63
64   /**
65    * Default sleep time in ms for a controller worker thread. If no job is ready
66    * after this time, the thread dies.
67    */

68   public static final int DEFAULT_CONTROLLER_WORKER_THREAD_SLEEP_TIME = 15000;
69
70   /** JMX Enable by default */
71   public static final boolean JMX_ENABLE = false;
72
73   /** Add Driver enable by default */
74   public static final boolean ADD_DRIVER_ENABLE = false;
75
76   /** Checkpoint to take by default */
77   public static final String JavaDoc DATABASE_DEFAULT_CHECKPOINT = "last";
78
79   /** Default configuration file */
80   public static final String JavaDoc DEFAULT_CONFIG_FILE = "controller.xml";
81
82   /** Log4j property file resource (must be found in classpath). */
83   public static final String JavaDoc LOG4J_RESOURCE = "/log4j.properties";
84
85   /** Default log directory name (will be stored into CJDBC_HOME directory). */
86   public static final String JavaDoc DEFAULT_LOG_DIR_NAME = "log";
87
88   /** Default report location */
89   public static final String JavaDoc REPORT_LOCATION = ".."
90                                                                               + File.separator
91                                                                               + DEFAULT_LOG_DIR_NAME;
92
93   /** Report file */
94   public static final String JavaDoc REPORT_FILE = "cjdbc.report";
95
96   /**
97    * Name of the C-JDBC JAR file (must be found in classpath). This information
98    * is used to find the drivers directory.
99    */

100   public static final String JavaDoc C_JDBC_DRIVER_JAR_FILE = "/c-jdbc-driver.jar";
101
102   /**
103    * Return default path and name for saving of configuration file
104    *
105    * @param resource name of the resource to get save file for
106    * @return path
107    */

108   public static final String JavaDoc getSaveFile(String JavaDoc resource)
109   {
110     URL JavaDoc url = ControllerConstants.class.getResource("/" + DEFAULT_CONFIG_FILE);
111     File JavaDoc dir = (new File JavaDoc(url.getFile())).getParentFile();
112     return dir.getPath() + File.separator + resource + "-saved.xml";
113   }
114
115   /** Enable all backend from their last known state at controller start */
116   public static final int AUTO_ENABLE_TRUE = 0;
117   /** Do not enable any backend when starting controller */
118   public static final int AUTO_ENABLE_FALSE = 1;
119   /** Restore the state from an existing recovery log */
120   public static final int AUTO_ENABLE_FORCE = 2;
121
122   /** Auto Enable Backend default */
123   public static final int AUTO_ENABLE_BACKEND = AUTO_ENABLE_FALSE;
124
125 }
Popular Tags