1 |
79a8b5c2
|
Andreas Müller
|
/**
|
2 |
|
|
* Copyright (C) 2007 EDIT
|
3 |
|
|
* European Distributed Institute of Taxonomy
|
4 |
|
|
* http://www.e-taxonomy.eu
|
5 |
|
|
*
|
6 |
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7 |
|
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
package eu.etaxonomy.cdm.database;
|
11 |
|
|
|
12 |
|
|
import org.apache.log4j.Logger;
|
13 |
|
|
|
14 |
|
|
/**
|
15 |
|
|
* @author AM
|
16 |
|
|
* @created 09.06.2008
|
17 |
|
|
* @version 1.0
|
18 |
|
|
*/
|
19 |
|
|
public enum H2Mode {
|
20 |
|
|
EMBEDDED,
|
21 |
|
|
IN_MEMORY,
|
22 |
|
|
TCP;
|
23 |
|
|
private static final Logger logger = Logger.getLogger(H2Mode.class);
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
private static final String embedded = "embedded";
|
27 |
|
|
private static final String inMemory = "inMemory";
|
28 |
|
|
private static final String tcp = "tcp";
|
29 |
|
|
|
30 |
|
|
public String toString(){
|
31 |
|
|
if (this.equals(H2Mode.EMBEDDED)){
|
32 |
|
|
return embedded;
|
33 |
|
|
}else if (this.equals(H2Mode.IN_MEMORY)){
|
34 |
|
|
return inMemory;
|
35 |
|
|
}else if (this.equals(H2Mode.TCP)){
|
36 |
|
|
return tcp;
|
37 |
|
|
}else{
|
38 |
|
|
logger.warn("toString for mode not yet implemented");
|
39 |
|
|
return "";
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
public static H2Mode fromString(String modeString){
|
45 |
|
|
if (modeString == null){
|
46 |
|
|
return null;
|
47 |
|
|
}else if (modeString.equals(H2Mode.EMBEDDED.toString())){
|
48 |
|
|
return H2Mode.EMBEDDED;
|
49 |
|
|
}else if (modeString.equals(H2Mode.IN_MEMORY.toString())){
|
50 |
|
|
return H2Mode.IN_MEMORY;
|
51 |
|
|
}else if (modeString.equals(H2Mode.IN_MEMORY.toString())){
|
52 |
|
|
return H2Mode.TCP;
|
53 |
|
|
}else{
|
54 |
|
|
logger.warn("Unknown modeString");
|
55 |
|
|
return null;
|
56 |
|
|
}
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
}
|