ConfigUpdateImplpublic class ConfigUpdateImpl extends ConfigChangeImpl implements Serializable, com.sun.enterprise.config.ConfigUpdateA configuration change for an element. Holds xpath, list of changed
attributes, their old and new values. |
Fields Summary |
---|
private HashMap | oldValues | private HashMap | newValues |
Constructors Summary |
---|
public ConfigUpdateImpl(String xpath, String attrName, String oldValue, String newValue)
this.xpath = xpath;
addChangedAttribute(attrName, oldValue, newValue);
|
Methods Summary |
---|
public void | addChangedAttribute(java.lang.String attrName, java.lang.String oldValue, java.lang.String newValue)add attr changes to the hashmap
//FIXME: This solution will not work for cases involving setAttribute(A, NULL)
// null has to be handled gracefully in future releases.
if(oldValues.get(attrName) == null) {
// if(!oldValue.equals(newValue)) {
oldValues.put(attrName, oldValue);
newValues.put(attrName, newValue);
// } else {
// return;
// }
} else if(oldValues.get(attrName).equals(newValue)) {
oldValues.remove(attrName);
newValues.remove(attrName);
} else {
newValues.put(attrName, newValue);
}
| public java.util.Set | getAttributeSet()
return oldValues.keySet();
| public java.lang.String | getConfigChangeType()
return TYPE_UPDATE;
| public java.lang.String | getName()
return null; //FIXME TBD
| public java.lang.String | getNewValue(java.lang.String attrName)
return (String)newValues.get(attrName);
| public java.lang.String | getOldValue(java.lang.String attrName)
return (String)oldValues.get(attrName);
| public void | removeAttribute(java.lang.String attrName)
if (attrName == null) {
throw new IllegalArgumentException("Attribute name is null");
}
if (oldValues.containsKey(attrName) && newValues.containsKey(attrName)) {
oldValues.remove(attrName);
newValues.remove(attrName);
}
| public java.lang.String | toString()
String ret = "update xpath=" +xpath +"\n";
Set s = newValues.keySet();
for(Iterator iter = s.iterator(); iter.hasNext();) {
String next = (String) iter.next();
ret+= "\t" + "attr=" + next + " " + oldValues.get(next) + "-->" + newValues.get(next) + "\n";
}
return ret;
|
|