1 16 package scriptella.configuration; 17 18 import java.util.Map ; 19 20 26 public class ConnectionEl extends XmlConfigurableBase { 27 private String id; 28 private String url; 29 private String driver; 30 private String user; 31 private String password; 32 private String catalog; 33 private String schema; 34 private String classpath; 35 private PropertiesEl properties; 36 private boolean lazyInit; 37 38 public ConnectionEl() { 39 } 40 41 public String getId() { 42 return id; 43 } 44 45 public void setId(final String id) { 46 this.id = id; 47 } 48 49 public String getUrl() { 50 return url; 51 } 52 53 public void setUrl(final String url) { 54 this.url = url; 55 } 56 57 public String getDriver() { 58 return driver; 59 } 60 61 public void setDriver(final String driver) { 62 this.driver = driver; 63 } 64 65 public String getUser() { 66 return user; 67 } 68 69 public void setUser(final String user) { 70 this.user = user; 71 } 72 73 public String getPassword() { 74 return password; 75 } 76 77 public void setPassword(final String password) { 78 this.password = password; 79 } 80 81 public String getCatalog() { 82 return catalog; 83 } 84 85 public void setCatalog(final String catalog) { 86 this.catalog = catalog; 87 } 88 89 public String getSchema() { 90 return schema; 91 } 92 93 public void setSchema(final String schema) { 94 this.schema = schema; 95 } 96 97 public String getClasspath() { 98 return classpath; 99 } 100 101 public void setClasspath(String classpath) { 102 this.classpath = classpath; 103 } 104 105 public boolean isLazyInit() { 106 return lazyInit; 107 } 108 109 public void setLazyInit(boolean lazyInit) { 110 this.lazyInit = lazyInit; 111 } 112 113 116 public Map <String , ?> getProperties() { 117 return properties.getMap(); 118 } 119 120 121 public void configure(final XmlElement element) { 122 setProperty(element, "id"); 123 setProperty(element, "url"); 124 setRequiredProperty(element, "driver"); 125 setProperty(element, "user"); 126 setProperty(element, "password"); 127 setProperty(element, "catalog"); 128 setProperty(element, "schema"); 129 setProperty(element, "classpath"); 130 lazyInit = element.getBooleanAttribute("lazy-init", false); 131 setProperty(element, "classpath"); 132 properties = new PropertiesEl(element); 133 } 134 135 public String toString() { 136 StringBuilder res = new StringBuilder ("Connection{driver='").append(driver).append('\''); 137 138 res.append("properties=").append(properties); 139 if (classpath != null) { 140 res.append(", classpath='").append(classpath).append('\''); 141 } 142 if (schema != null) { 143 res.append(", schema='").append(schema).append('\''); 144 } 145 if (catalog != null) { 146 res.append(", catalog='").append(catalog).append('\''); 147 } 148 if (password != null) { 149 res.append(", password='").append(password).append('\''); 150 } 151 if (user != null) { 152 res.append(", user='").append(user).append('\''); 153 } 154 if (url != null) { 155 res.append(", url='").append(url).append('\''); 156 } 157 if (id != null) { 158 res.append(", id='").append(id).append('\'' + '}'); 159 } 160 161 return res.toString(); 162 } 163 } 164 | Popular Tags |