Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r5435 - 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/util tomcat/classes/perfsonar/conf

Subject: perfsonar development work

List archive

perfsonar: r5435 - 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/util tomcat/classes/perfsonar/conf


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r5435 - 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/util tomcat/classes/perfsonar/conf
  • Date: Tue, 29 Dec 2009 09:18:34 -0500

Author: trzaszcz
Date: 2009-12-29 09:18:33 -0500 (Tue, 29 Dec 2009)
New Revision: 5435

Removed:
branches/new-structure-with-base2/ps-mdm-web-admin/ant/build_orig.xml
Modified:

branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/HTMLGenerator.java

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/util/XMLUtil.java

branches/new-structure-with-base2/ps-mdm-web-admin/tomcat/classes/perfsonar/conf/wa.xml
Log:


Deleted: branches/new-structure-with-base2/ps-mdm-web-admin/ant/build_orig.xml

Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/HTMLGenerator.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/HTMLGenerator.java
2009-12-29 13:08:56 UTC (rev 5434)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/HTMLGenerator.java
2009-12-29 14:18:33 UTC (rev 5435)
@@ -350,40 +350,5 @@
} catch (Exception e) {
e.printStackTrace();
}
- // for( String s : values.second() )
- // System.out.println("\ngroup radio value : " + s);
- // System.out.println("group radio inner code:\n" +
innerHTML);
- // System.out.println("end radio group");
}
-
- // ///////////////////////////////////
- public static void main(String args[]) throws Exception {
- // Tuple<WebAdminInterface,JAXBContext>
- // wai = WAXMLReader.parseFile(args[0]);
- // HTMLGenerator gen = new HTMLGenerator(System.out,args[0]);
- // gen.translate(wai);
- // gen.registerObject(wai);
- }
- // // REMOVE THIS
- // //public HTMLGenerator( PrintStream out, String configFile )
- // throws Exception
- // { this.out = out; omap = new ObjectMap(configFile); }
-
- // public HTMLGenerator(String basePath,
- // String confPath,
- // String configFile )
- // throws Exception
- // { omap = new ObjectMap(basePath,confPath,configFile); }
-
- /*
- * public synchronized void setOutput( PrintStream out0, ObjectMap o
) { if(
- * out != null ) { try { do{ wait(); } while( out != null ); }
- * catch(InterruptedException e) {
- * System.out.println("InterruptedException caught"); } } out = out0;
omap =
- * o; html = new HTMLUtil(out); }
- *
- * public synchronized void done() { omap = null; html = null; out =
null;
- * notifyAll(); }
- */
-
};

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-29 13:08:56 UTC (rev 5434)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/config/ObjectMap.java
2009-12-29 14:18:33 UTC (rev 5435)
@@ -12,7 +12,6 @@
import org.perfsonar.webadmin.base2.util.NSContext;
import org.perfsonar.webadmin.base2.util.Tuple;
import org.perfsonar.webadmin.base2.util.WAXMLReader;
-import org.perfsonar.webadmin.base2.util.WAXMLWriter;
import org.perfsonar.webadmin.base2.util.XMLUtil;
import org.perfsonar.webadmin.base2.waschema.v20090201.BaseType;
import org.perfsonar.webadmin.base2.waschema.v20090201.NsMap;
@@ -25,18 +24,17 @@
*
* wrapper for Hashtable
*
- *
+ *
*/
@SuppressWarnings("serial")
public class ObjectMap extends Hashtable<Integer, Object> {
-
- private Logger logger=Logger.getAnonymousLogger();
-
+
+ private Logger logger = Logger.getAnonymousLogger();
+
Tuple<WebAdminInterface, JAXBContext> waconfig;
String waconfigfile = "";
Hashtable<String, Document> file2doc = new Hashtable<String,
Document>();
String basePath = "";
- String confPath = ""; // TODO: unused field
NSContext namespaces;
boolean sync = false;

@@ -46,7 +44,6 @@
waconfigfile = basePath + "/" + confPath + "/" + file;
waconfig = WAXMLReader.parseFile(waconfigfile);
this.basePath = basePath;
- this.confPath = confPath;
makeMap();
}

@@ -76,43 +73,26 @@

}

- private boolean saveWA() {
- try {
- WAXMLWriter.writeToFile(waconfig.second(),
waconfig.first(),
- waconfigfile);
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- return true;
- }
-
private boolean saveExternal() {
-
- try {
- Set<Entry<String, Document>> entrySet =
file2doc.entrySet();
- for (Entry<String, Document> o : entrySet) {
- try {
- XMLUtil.writeXml(o.getValue(),
- new
java.io.FileOutputStream(basePath + "/"
- +
o.getKey()));
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
+ Set<Entry<String, Document>> entrySet = file2doc.entrySet();
+ for (Entry<String, Document> o : entrySet) {
+ try {
+ XMLUtil.writeXml(o.getValue(), new
java.io.FileOutputStream(
+ basePath + "/" + o.getKey()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
}
- } catch (Exception e) {
- e.printStackTrace();
- return false;
}
return true;
}

public synchronized boolean save() {
- boolean b = saveExternal() && saveWA();
- if (b)
+ boolean saved = saveExternal();
+ if (saved) {
sync = false;
- return b;
+ }
+ return saved;
}

public synchronized int registerObject(BaseType ui) {
@@ -120,8 +100,6 @@
}

public synchronized int registerObject(NodeList n) {
- // Document doc = t.first().getOwnerDocument();
- // Document old = file2doc.get(t.second())) == doc
return _registerObject(n);
}

@@ -136,24 +114,28 @@
return ret;
}

- public synchronized void updateObjects(Map<String,String[]> pmap){
+ public synchronized void updateObjects(Map<String, String[]> pmap) {
Object myobj = null;
- for (Entry<String,String[]> entry : pmap.entrySet()) {
+ for (Entry<String, String[]> entry : pmap.entrySet()) {
try {
- Integer
inputName=Integer.parseInt(entry.getKey());
+ Integer inputName =
Integer.parseInt(entry.getKey());
myobj = get(inputName);
if (myobj == null) {
- logger.warning("element
"+entry.getKey()+" not found !");
+ logger
+ .warning("element " +
entry.getKey()
+ + "
not found !");
}
if (myobj instanceof BaseType)
updateBase((BaseType) myobj,
entry.getValue());
else if (myobj instanceof NodeList)
- updateNodeList((NodeList)
myobj,entry.getValue());
- else{
- logger.warning(" Cannot match object
type :"+myobj.getClass());
+ 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");
+ logger.info("Key - " + entry.getKey()
+ + " is not a number - ignore
it");
}
}
sync = true;
@@ -169,7 +151,7 @@
logger.warning("value is empty");
return;
}
-
+
String s = valueArray[0];
for (int i = 1; i < valueArray.length; i++)
s += "," + valueArray[i];
@@ -178,9 +160,8 @@
logger.info("base type updated");
}

-
private void updateNodeList(NodeList t, String[] valueArray) {
- if (t.getLength() == 0 ) {
+ if (t.getLength() == 0) {
logger.warning("empty node list");
return;
} else if (valueArray.length == 0) {
@@ -189,18 +170,18 @@
}
Node n = t.item(0);
String s = valueArray[0];
- for (int i = 1; i < valueArray.length; i++){
+ for (int i = 1; i < valueArray.length; i++) {
s += "," + valueArray[i];
}
- if(n.getNodeValue()!=null){
- //if value comes from tag attribute
+ if (n.getNodeValue() != null) {
+ // if value comes from tag attribute
n.setNodeValue(s);
- }else{
- //if value comes from tag value
+ } else {
+ // if value comes from tag value
n.setTextContent(s);
}
-
+
logger.info("list node updated");
}
-
+
};

Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/XMLUtil.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/XMLUtil.java
2009-12-29 13:08:56 UTC (rev 5434)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/src/main/java/org/perfsonar/webadmin/base2/util/XMLUtil.java
2009-12-29 14:18:33 UTC (rev 5435)
@@ -29,6 +29,7 @@
import org.xml.sax.SAXException;

public class XMLUtil {
+
public static String readFile(String fname) throws Exception {
java.io.File file = new File(fname);
String ret = "";

Modified:
branches/new-structure-with-base2/ps-mdm-web-admin/tomcat/classes/perfsonar/conf/wa.xml
===================================================================
---
branches/new-structure-with-base2/ps-mdm-web-admin/tomcat/classes/perfsonar/conf/wa.xml
2009-12-29 13:08:56 UTC (rev 5434)
+++
branches/new-structure-with-base2/ps-mdm-web-admin/tomcat/classes/perfsonar/conf/wa.xml
2009-12-29 14:18:33 UTC (rev 5435)
@@ -4,6 +4,7 @@
<wa:interface
xmlns:wa="http://webadmin.perfsonar.org/base2/waschema/v20090201";>

+ <!-- credential for WA -->
<wa:credential>
<wa:username>aaaa</wa:username>
<wa:password>aaaa</wa:password>



  • perfsonar: r5435 - 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/util tomcat/classes/perfsonar/conf, svnlog, 12/29/2009

Archive powered by MHonArc 2.6.16.

Top of Page