1 24 25 package org.objectweb.cjdbc.common.shared; 26 27 import java.io.Serializable ; 28 29 import javax.management.NotCompliantMBeanException ; 30 31 import org.objectweb.cjdbc.controller.backend.DatabaseBackend; 32 33 43 public class BackendInfo implements Serializable 44 { 45 private static final long serialVersionUID = 235252034979233679L; 46 47 private String name; 48 private String url; 49 private String driverPath; 50 private String driverClassName; 51 private String virtualDatabaseName; 52 private String connectionTestStatement; 53 private int dynamicPrecision; 54 private boolean gatherSystemTables = false; 55 private String schemaName; 56 private String xml; 57 58 64 public BackendInfo(DatabaseBackend backend) 65 { 66 this.url = backend.getURL(); 67 this.name = backend.getName(); 68 this.driverPath = backend.getDriverPath(); 69 this.driverClassName = backend.getDriverClassName(); 70 this.virtualDatabaseName = backend.getVirtualDatabaseName(); 71 this.connectionTestStatement = backend.getConnectionTestStatement(); 72 this.dynamicPrecision = backend.getDynamicPrecision(); 73 this.gatherSystemTables = backend.isGatherSystemTables(); 74 this.schemaName = backend.getSchemaName(); 75 this.xml = backend.getXml(); 76 } 77 78 84 public DatabaseBackend getDatabaseBackend() 85 { 86 try 87 { 88 return new DatabaseBackend(name, driverPath, driverClassName, url, 89 virtualDatabaseName, true, connectionTestStatement); 90 } 91 catch (NotCompliantMBeanException e) 92 { 93 throw new RuntimeException ( 94 "Unable to recreate backend from BackendInfo object", e); 95 } 96 } 97 98 103 public String getXml() 104 { 105 return xml; 106 } 107 108 113 public String getConnectionTestStatement() 114 { 115 return connectionTestStatement; 116 } 117 118 123 public String getDriverClassName() 124 { 125 return driverClassName; 126 } 127 128 133 public String getDriverPath() 134 { 135 return driverPath; 136 } 137 138 143 public int getDynamicPrecision() 144 { 145 return dynamicPrecision; 146 } 147 148 153 public String getName() 154 { 155 return name; 156 } 157 158 163 public String getSchemaName() 164 { 165 return schemaName; 166 } 167 168 173 public String getUrl() 174 { 175 return url; 176 } 177 178 183 public String getVirtualDatabaseName() 184 { 185 return virtualDatabaseName; 186 } 187 188 193 public boolean isGatherSystemTables() 194 { 195 return gatherSystemTables; 196 } 197 198 203 public void setXml(String xml) 204 { 205 this.xml = null; 206 } 207 208 } | Popular Tags |