Merge branch 'release/5.45.0'
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / database / H2Mode.java
1 /**
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 package eu.etaxonomy.cdm.database;
10
11 import org.apache.logging.log4j.LogManager;
12 import org.apache.logging.log4j.Logger;
13
14 /**
15 * @author AM
16 * @since 09.06.2008
17 */
18 public enum H2Mode {
19 EMBEDDED,
20 IN_MEMORY,
21 TCP;
22
23 private static final Logger logger = LogManager.getLogger();
24
25 private static final String embedded = "embedded";
26 private static final String inMemory = "inMemory";
27 private static final String tcp = "tcp";
28
29 @Override
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 }