first commit
This commit is contained in:
69
hrmsEjb/org/apache/struts/config/DataSourceConfig.java
Normal file
69
hrmsEjb/org/apache/struts/config/DataSourceConfig.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package org.apache.struts.config;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class DataSourceConfig implements Serializable {
|
||||
protected boolean configured = false;
|
||||
|
||||
protected String key = "org.apache.struts.action.DATA_SOURCE";
|
||||
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
if (this.configured)
|
||||
throw new IllegalStateException("Configuration is frozen");
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
protected HashMap properties = new HashMap();
|
||||
|
||||
public Map getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
protected String type = "org.apache.struts.util.GenericDataSource";
|
||||
|
||||
public String getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
if (this.configured)
|
||||
throw new IllegalStateException("Configuration is frozen");
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void addProperty(String name, String value) {
|
||||
if (this.configured)
|
||||
throw new IllegalStateException("Configuration is frozen");
|
||||
this.properties.put(name, value);
|
||||
}
|
||||
|
||||
public void freeze() {
|
||||
this.configured = true;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer("DataSourceConfig[");
|
||||
sb.append("key=");
|
||||
sb.append(this.key);
|
||||
sb.append(",type=");
|
||||
sb.append(this.type);
|
||||
Iterator names = this.properties.keySet().iterator();
|
||||
while (names.hasNext()) {
|
||||
String name = names.next();
|
||||
String value = (String)this.properties.get(name);
|
||||
sb.append(',');
|
||||
sb.append(name);
|
||||
sb.append('=');
|
||||
sb.append(value);
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user