perfsonar-dev - perfsonar: r5391 - in branches/new-structure-with-base2/ps-mdm-web-admin: ant src/main/java/org/perfsonar/webadmin/base2/config src/main/java/org/perfsonar/webadmin/base2/servlet src/main/java/org/perfsonar/webadmin/base2/servlet/util
Subject: perfsonar development work
List archive
perfsonar: r5391 - in branches/new-structure-with-base2/ps-mdm-web-admin: ant src/main/java/org/perfsonar/webadmin/base2/config src/main/java/org/perfsonar/webadmin/base2/servlet src/main/java/org/perfsonar/webadmin/base2/servlet/util
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5391 - in branches/new-structure-with-base2/ps-mdm-web-admin: ant src/main/java/org/perfsonar/webadmin/base2/config src/main/java/org/perfsonar/webadmin/base2/servlet src/main/java/org/perfsonar/webadmin/base2/servlet/util
- Date: Wed, 9 Dec 2009 06:54:57 -0500
Author: trzaszcz
Date: 2009-12-09 06:54:57 -0500 (Wed, 09 Dec 2009)
New Revision: 5391
Added:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/BasicConfigurationServlet.java
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/util/Base64.java
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/util/ConfigurationServletHelper.java
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/ant/build.xml
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
Log:
missing class added
Modified: branches/new-structure-with-base2/ps-mdm-web-admin/ant/build.xml
===================================================================
--- branches/new-structure-with-base2/ps-mdm-web-admin/ant/build.xml
2009-12-09 10:38:46 UTC (rev 5390)
+++ branches/new-structure-with-base2/ps-mdm-web-admin/ant/build.xml
2009-12-09 11:54:57 UTC (rev 5391)
@@ -240,7 +240,7 @@
</target>
<target name="war-deploy" depends="war">
- <delete dir="${tomcat.dir}/webapps/${warfilename}"
includes="**/*.*" includeemptydirs="true"/>
+ <delete dir="${tomcat.dir}/webapps/${warfilename}"
includes="**/**/*" includeemptydirs="true"/>
<delete file="${tomcat.dir}/webapps/${warfilename}.war"/>
<copy todir="${tomcat.dir}/webapps/"
file="build/${warfilename}.war"/>
</target>
Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
2009-12-09 10:38:46 UTC (rev 5390)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
2009-12-09 11:54:57 UTC (rev 5391)
@@ -5,6 +5,7 @@
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
@@ -20,7 +21,18 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+/**
+ *
+ * wrapper for Hashtable
+ *
+ * @author czacha
+ *
+ */
+@SuppressWarnings("serial")
public class ObjectMap extends Hashtable<Integer, Object> {
+
+ private Logger logger=Logger.getAnonymousLogger();
+
Tuple<WebAdminInterface, JAXBContext> waconfig;
String waconfigfile = "";
Hashtable<String, Document> file2doc = new Hashtable<String,
Document>();
@@ -125,29 +137,24 @@
return ret;
}
- public synchronized void updateObjects(Map pmap) throws Exception {
- Set entrySet = pmap.entrySet();
+ public synchronized void updateObjects(Map<String,String[]> pmap){
Object myobj = null;
- Entry e;
- for (Object o : entrySet) {
- e = (Entry) o;
+ for (Entry<String,String[]> entry : pmap.entrySet()) {
try {
- myobj = get(Integer.parseInt((String)
e.getKey()));
+ Integer
inputName=Integer.parseInt(entry.getKey());
+ myobj = get(inputName);
if (myobj == null) {
- String err = "Could not find object
for key: \""
- + (String) e.getKey()
+ "\"";
- System.out.println("WA --- " + err);
- throw new Exception(err);
+ logger.warning("element
"+entry.getKey()+" not found !");
}
if (myobj instanceof BaseType)
- updateBase((BaseType) myobj,
(String[]) e.getValue());
+ updateBase((BaseType) myobj,
entry.getValue());
else if (myobj instanceof NodeList)
- updateNodeList((NodeList) myobj,
(String[]) e.getValue());
- else
- throw new Exception("Unknown type");
- } catch (Exception ee) {
- System.out.println("WA --- Key \"" + (String)
e.getKey()
- + "\" will not be updated.");
+ updateNodeList((NodeList)
myobj,entry.getValue());
+ else{
+ logger.warning(" Cannot match object
type :"+myobj.getClass());
+ }
+ } catch (NumberFormatException ex) {
+ logger.info("Key - "+entry.getKey()+" is not
a number - ignore it");
}
}
sync = true;
@@ -157,35 +164,37 @@
return sync;
}
- private void updateBase(BaseType o, String[] v) {
+ private void updateBase(BaseType o, String[] valueArray) {
System.out.println("WA --- Should update base type");
- if (v.length < 1) {
- System.out.println("WA --- Empty value list ---
Internal error");
+ if (valueArray.length == 0) {
+ logger.warning("value is empty");
return;
}
- String s = v[0];
- for (int i = 1; i < v.length; i++)
- s += "," + v[i];
+
+ String s = valueArray[0];
+ for (int i = 1; i < valueArray.length; i++)
+ s += "," + valueArray[i];
// NOTE:Assuming that this is a text element (not xpath)
o.setText(s);
- System.out.println("WA --- Updated base type");
+ logger.info("base type updated");
}
- private void updateNodeList(NodeList t, String[] v) {
- if (t.getLength() < 1) {
- System.out.println("WA --- EMPTY NODE LIST ---"
- + " This possibly indicates a bad
xpath "
- + "element in WA configuration
file.");
+
+ private void updateNodeList(NodeList t, String[] valueArray) {
+ if (t.getLength() == 0 ) {
+ logger.warning("empty node list");
return;
- } else if (v.length < 1) {
- System.out.println("WA --- Empty value list ---
Internal error");
+ } else if (valueArray.length == 0) {
+ logger.warning("value is empty !");
return;
}
Node n = t.item(0);
- String s = v[0];
- for (int i = 1; i < v.length; i++)
- s += "," + v[i];
+ String s = valueArray[0];
+ for (int i = 1; i < valueArray.length; i++){
+ s += "," + valueArray[i];
+ }
n.setNodeValue(s);
- System.out.println("WA --- Updated node list");
+ logger.info("list node updated");
}
+
};
Added:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/BasicConfigurationServlet.java
Added:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/util/Base64.java
Added:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/servlet/util/ConfigurationServletHelper.java
- perfsonar: r5391 - in branches/new-structure-with-base2/ps-mdm-web-admin: ant src/main/java/org/perfsonar/webadmin/base2/config src/main/java/org/perfsonar/webadmin/base2/servlet src/main/java/org/perfsonar/webadmin/base2/servlet/util, svnlog, 12/09/2009
Archive powered by MHonArc 2.6.16.