Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r4331 - in branches/WebAdmin/perfSONARWebAdmin: admin/service/soapclient admin/stitching auxiliary/sql auxiliary/sqlma auxiliary/stitching auxiliary/wizard auxiliary/xmlDB test

Subject: perfsonar development work

List archive

perfsonar: r4331 - in branches/WebAdmin/perfSONARWebAdmin: admin/service/soapclient admin/stitching auxiliary/sql auxiliary/sqlma auxiliary/stitching auxiliary/wizard auxiliary/xmlDB test


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r4331 - in branches/WebAdmin/perfSONARWebAdmin: admin/service/soapclient admin/stitching auxiliary/sql auxiliary/sqlma auxiliary/stitching auxiliary/wizard auxiliary/xmlDB test
  • Date: Tue, 5 Aug 2008 06:58:59 -0400

Author: michalis
Date: 2008-08-05 06:58:59 -0400 (Tue, 05 Aug 2008)
New Revision: 4331

Modified:

branches/WebAdmin/perfSONARWebAdmin/admin/service/soapclient/SoapClient.java
branches/WebAdmin/perfSONARWebAdmin/admin/stitching/StitchingServlet.java
branches/WebAdmin/perfSONARWebAdmin/auxiliary/sql/SQLDBManager.java
branches/WebAdmin/perfSONARWebAdmin/auxiliary/sqlma/HTMLOutput.java
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/ElementParser.java
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/HTMLOutput.java

branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/MetadataManager.java

branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/MetadataManagerImpl.java
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/test.java
branches/WebAdmin/perfSONARWebAdmin/auxiliary/wizard/HTMLOutput.java
branches/WebAdmin/perfSONARWebAdmin/auxiliary/wizard/WizardProperty.java

branches/WebAdmin/perfSONARWebAdmin/auxiliary/xmlDB/existAuthenticatorImpl.java
branches/WebAdmin/perfSONARWebAdmin/test/Tester.java
Log:


Modified:
branches/WebAdmin/perfSONARWebAdmin/admin/service/soapclient/SoapClient.java
===================================================================
---
branches/WebAdmin/perfSONARWebAdmin/admin/service/soapclient/SoapClient.java
2008-08-04 10:35:12 UTC (rev 4330)
+++
branches/WebAdmin/perfSONARWebAdmin/admin/service/soapclient/SoapClient.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -3,11 +3,10 @@
import java.io.File;
import java.io.FileInputStream;

-import java.io.ByteArrayInputStream;
+import java.io.ByteArrayInputStream;
import java.io.FileWriter;
import java.io.BufferedWriter;

-
import java.util.List;
import java.util.Vector;
import java.util.Iterator;
@@ -16,10 +15,8 @@
import org.jdom.output.XMLOutputter;
import org.jdom.Attribute;

-
import org.w3c.dom.Document;

-
import java.net.URL;

import javax.xml.namespace.QName;
@@ -31,390 +28,564 @@
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPBodyElement;

-
import org.apache.log4j.Logger;
import org.apache.log4j.FileAppender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.SimpleLayout;

-
public class SoapClient {

- public enum Level {
- DEBUG,INFO,WARN,ERROR,FATAL;
- public org.apache.log4j.Level translate(){
- switch(this){
- case DEBUG: return org.apache.log4j.Level.DEBUG;
- case INFO : return org.apache.log4j.Level.INFO;
- case WARN : return org.apache.log4j.Level.WARN;
- case ERROR: return org.apache.log4j.Level.ERROR;
- case FATAL: return org.apache.log4j.Level.FATAL;
- default: return null;
- }
- }
-};
+ public enum Level {
+ DEBUG, INFO, WARN, ERROR, FATAL;
+ public org.apache.log4j.Level translate() {
+ switch (this) {
+ case DEBUG:
+ return org.apache.log4j.Level.DEBUG;
+ case INFO:
+ return org.apache.log4j.Level.INFO;
+ case WARN:
+ return org.apache.log4j.Level.WARN;
+ case ERROR:
+ return org.apache.log4j.Level.ERROR;
+ case FATAL:
+ return org.apache.log4j.Level.FATAL;
+ default:
+ return null;
+ }
+ }
+ };

+ // public String testStep_xml;

-// public String testStep_xml;
+ private String request_xml = null;

- private String request_xml=null;
+ private String endpoint = null;

- private String endpoint=null;
+ private Document document = null;

- private Document document=null;
+ @SuppressWarnings("unused")
+ private Logger log;

- private Logger log;
+ @SuppressWarnings("unused")
+ private String fileName = null;

- private String fileName = null;
+ /**
+ * @param s
+ * @param i
+ * @param j
+ * @return
+ */
+ private static String substring(String s, int i, int j) {
+ char[] x = s.toCharArray();
+ char[] y = new char[j];
+ for (int k = 0; j > 0; j--, i++, k++)
+ y[k] = x[i];
+ return new String(y);
+ }

- private static String substring( String s , int i , int j ){
- char[] x = s.toCharArray();
- char[] y = new char[j];
- for( int k = 0 ; j > 0 ; j--,i++,k++) y[k] = x[i];
- return new String(y);
- }
+ /**
+ * @param s
+ * @param delim
+ * @return
+ */
+ @SuppressWarnings("unused")
+ private static String[] split(String s, String delim) {
+ int i = s.indexOf(delim);
+ if (i == -1)
+ return null;
+ String sub1 = "", sub2 = "";
+ if (i > 0)
+ sub1 = substring(s, 0, i);
+ int j = i + delim.length();
+ if (j < s.length())
+ sub2 = substring(s, j, s.length() - j);
+ return new String[] { sub1, delim, sub2 };
+ }

- private static String[] split( String s , String delim ){
- int i = s.indexOf(delim);
- if( i == -1 ) return null;
- String sub1 = "" ,sub2="";
- if( i > 0 ) sub1 = substring(s,0,i);
- int j = i + delim.length();
- if( j < s.length() ) sub2 = substring(s,j,s.length()-j);
- return new String[] { sub1,delim, sub2 };
- }
-
-public void sendRequest() throws Exception {
- try {
- try {
- document= ((SOAPBodyElement)((Vector)newCall().
- invoke(new Object[] {new SOAPBodyElement(new
ByteArrayInputStream(request_xml.getBytes()))})).
- get(0)).getAsDocument();
+ /**
+ * @throws Exception
+ */
+ public void sendRequest() throws Exception {
+ try {
+ try {
+ document = ((SOAPBodyElement) ((Vector)
newCall()
+ .invoke(
+ new Object[]
{ new SOAPBodyElement(
+
new ByteArrayInputStream(request_xml
+
.getBytes())) })).get(0))
+ .getAsDocument();

- } catch (ClassCastException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- } catch(Exception e) {
- e.printStackTrace();
- }
-}
+ } catch (ClassCastException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }

+ /**
+ * @return
+ */
+ public String getRequest() {
+ return request_xml;
+ }

-public String getRequest(){ return request_xml; }
+ /**
+ * @return
+ */
+ public org.w3c.dom.Element getRequest_w3c() {
+ if (request_xml == null)
+ return null;
+ return newDoc(request_xml).getDocumentElement();
+ }

-public org.w3c.dom.Element getRequest_w3c() {
- if( request_xml == null ) return null;
- return newDoc(request_xml).getDocumentElement();
-}
+ /**
+ * @param elt
+ * @return
+ * @throws Exception
+ */
+ public static org.jdom.Element w3c2j(org.w3c.dom.Element elt)
+ throws Exception {
+ try {
+ DOMBuilder jbuilder = null;
+ try {
+ jbuilder = new DOMBuilder();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return jbuilder.build(elt);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }

-public static org.jdom.Element w3c2j(org.w3c.dom.Element elt ) throws
Exception {
- try{
- DOMBuilder jbuilder = null;
- try {
- jbuilder = new DOMBuilder();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return jbuilder.build(elt);
- }
- catch(Exception e ){
- e.printStackTrace();
- return null;
- }
-}
+ /**
+ * @param elt
+ * @return
+ * @throws Exception
+ */
+ public static org.jdom.Document w3c2j(org.w3c.dom.Document elt)
+ throws Exception {
+ try {
+ DOMBuilder jbuilder = null;
+ try {
+ jbuilder = new DOMBuilder();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return jbuilder.build(elt);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }

-public static org.jdom.Document w3c2j(org.w3c.dom.Document elt ) throws
Exception {
- try{
- DOMBuilder jbuilder = null;
- try {
- jbuilder = new DOMBuilder();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return jbuilder.build(elt);
- }
- catch(Exception e ){
- e.printStackTrace();
- return null;
- }
-}
+ /**
+ * @return
+ */
+ public org.jdom.Element getRequest_j() {
+ try {
+ return w3c2j(document).getRootElement();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }

+ /**
+ * @param s
+ */
+ public void setRequest(String s) {
+ request_xml = s;
+ }

+ /**
+ * @return
+ */
+ public org.w3c.dom.Element getResponse_w3c() {
+ if (document == null)
+ return null;
+ return document.getDocumentElement();
+ }

-public org.jdom.Element getRequest_j(){
- try{
- return w3c2j(document).getRootElement();
- }
- catch(Exception e ){
- e.printStackTrace();
- return null;
- }
-}
-public void setRequest( String s ) {
- request_xml = s;
-}
+ /**
+ * @return
+ */
+ public org.jdom.Element getResponse_j() {
+ if (document == null)
+ return null;
+ /* Read Message */
+ DOMBuilder jbuilder = null;
+ try {
+ jbuilder = new DOMBuilder();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return jbuilder.build(document).getRootElement();
+ }

-public org.w3c.dom.Element getResponse_w3c(){
- if( document == null ) return null;
- return document.getDocumentElement();
-}
-
-public org.jdom.Element getResponse_j(){
- if( document == null ) return null;
- /* Read Message*/
- DOMBuilder jbuilder = null;
- try {
- jbuilder = new DOMBuilder();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return jbuilder.build(document).getRootElement();
-}
-
-public String getResponse(){
+ /**
+ * @return
+ */
+ public String getResponse() {
XMLOutputter outputter = new XMLOutputter();
- java.io.StringWriter sos = new java.io.StringWriter();
- try{
- DOMBuilder jbuilder = null;
- try {
- jbuilder = new DOMBuilder();
- } catch (Exception e) {
- e.printStackTrace();
- }
- outputter.output(jbuilder.build(document),sos);
- return sos + "";
- }
- catch(Exception e ){
- e.printStackTrace();
- return null;
- }
-}
+ java.io.StringWriter sos = new java.io.StringWriter();
+ try {
+ DOMBuilder jbuilder = null;
+ try {
+ jbuilder = new DOMBuilder();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ outputter.output(jbuilder.build(document), sos);
+ return sos + "";
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }

-public void setEndpoint( String endp ){
- this.endpoint = endp;
-}
+ /**
+ * @param endp
+ */
+ public void setEndpoint(String endp) {
+ this.endpoint = endp;
+ }

-/* Connectivity*/
- private Call newCall(){
- try{
- Call call = (Call)(new Service()).createCall();
- call.setTargetEndpointAddress(new URL(endpoint));
- call.setOperationName(new
QName("http://soapinterop.org/","submit";));
- return call;
- }
- catch( Exception e ){
- e.printStackTrace();
- return null;
- }
- }
+ /* Connectivity */
+ /**
+ * @return
+ */
+ private Call newCall() {
+ try {
+ Call call = (Call) (new Service()).createCall();
+ call.setTargetEndpointAddress(new URL(endpoint));
+ call
+ .setOperationName(new
QName("http://soapinterop.org/";,
+ "submit"));
+ return call;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }

+ /**
+ * @param xml
+ * @return
+ */
+ private Document newDoc(String xml) {
+ try {
+ // org.jdom.Document q = DBClient.parse(xml);

- private Document newDoc(String xml ) {
- try{
-// org.jdom.Document q = DBClient.parse(xml);
+ Document request = null;
+ DocumentBuilderFactory factory =
DocumentBuilderFactory
+ .newInstance();
+ // factory.setNamespaceAware(true);
+ request = factory.newDocumentBuilder().parse(
+ new ByteArrayInputStream(
+ ("<?xml
version=\"1.0\" ?>\n" + xml).getBytes()));
+ return request;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }

- Document request = null;
- DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- //factory.setNamespaceAware(true);
- request = factory.newDocumentBuilder().parse(new
ByteArrayInputStream( ("<?xml version=\"1.0\" ?>\n"+xml).getBytes()));
- return request;
- }
- catch(Exception e ){
- e.printStackTrace();
- return null;
- }
- }
+ /**
+ * @param log
+ */
+ public SoapClient(Logger log) {
+ this.log = log;
+ }

- public SoapClient( Logger log ){
- this.log = log;
- }
- /**
-
**************************************************************************
- HELPER METHODS
- */
- static private Logger globalLogger = null;
+ /**
+ *
*************************************************************************
+ * HELPER METHODS
+ */
+ static private Logger globalLogger = null;

- private static synchronized void setGlobalLogger( Logger logger ){
- if( globalLogger == null ) globalLogger = logger;
- }
+ /**
+ * @param logger
+ */
+ private static synchronized void setGlobalLogger(Logger logger) {
+ if (globalLogger == null)
+ globalLogger = logger;
+ }

- public static String printAtt( Attribute at1 ){
- return at1.getName() + " = \"" + at1.getValue().trim() +"\"";
- }
+ /**
+ * @param at1
+ * @return
+ */
+ public static String printAtt(Attribute at1) {
+ return at1.getName() + " = \"" + at1.getValue().trim() + "\"";
+ }

- public static String xmlString_j( org.jdom.Element elt ){
- XMLOutputter outputter = new XMLOutputter();
- java.io.StringWriter sos = new java.io.StringWriter();
- try{
- DOMBuilder jbuilder = null;
- try {
- jbuilder = new DOMBuilder();
- } catch (Exception e) {
- e.printStackTrace();
- }
- outputter.output(elt.getDocument(),sos);
- return sos + "";
- }
- catch(Exception e ){
- e.printStackTrace();
- return null;
- }
- }
+ /**
+ * @param elt
+ * @return
+ */
+ public static String xmlString_j(org.jdom.Element elt) {
+ XMLOutputter outputter = new XMLOutputter();
+ java.io.StringWriter sos = new java.io.StringWriter();
+ try {
+ @SuppressWarnings("unused")
+ DOMBuilder jbuilder = null;
+ try {
+ jbuilder = new DOMBuilder();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ outputter.output(elt.getDocument(), sos);
+ return sos + "";
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }

+ /**
+ * @param at1
+ * @param at2
+ * @return
+ */
+ public static boolean equal(Attribute at1, Attribute at2) {
+ boolean ret =
at1.getValue().trim().equals(at2.getValue().trim())
+ && at1.getName().equals(at2.getName());
+ // if(!ret) print("Attribute ! at1 : " + at1 + "\nat2 : " +
at2 );
+ return ret;
+ }

- public static boolean equal( Attribute at1 , Attribute at2 ){
- boolean ret = at1.getValue().trim().equals(at2.getValue().trim()) &&
at1.getName().equals(at2.getName());
- // if(!ret) print("Attribute ! at1 : " + at1 + "\nat2 : " + at2 );
- return ret;
- }
+ /**
+ * @param s
+ */
+ public static void print(String s) {
+ System.out.println(s);
+ // globalLogger.error(s);
+ }

- public static void print( String s ){
- System.out.println(s);
- // globalLogger.error(s);
- }
+ /**
+ * @param elt1
+ * @param elt2
+ * @return
+ */
+ public static boolean equal(org.jdom.Element elt1, org.jdom.Element
elt2) {
+ if (elt1.getName().equals(elt2.getName()) == false) {
+ print("BadName:\n elt1 :\n" + elt1.getName() + "\n
elt2 :\n"
+ + elt2.getName() + "\n---END bad
name\n");
+ return false;
+ }
+ if (elt1.getText().trim().equals(elt2.getText().trim()) ==
false) {
+ print("Bad Text !\n elt1:\n" + elt1.getText() +
"\nelt2:\n"
+ + elt2.getText() + "\n---END bad
text\n");
+ return false;
+ }

- public static boolean equal( org.jdom.Element elt1 , org.jdom.Element elt2
) {
- if( elt1.getName().equals(elt2.getName()) == false ){
- print("BadName:\n elt1 :\n" + elt1.getName() + "\n elt2 :\n" +
elt2.getName() + "\n---END bad name\n" );
- return false;
- }
- if( elt1.getText().trim().equals(elt2.getText().trim()) == false ){
- print("Bad Text !\n elt1:\n" + elt1.getText() + "\nelt2:\n"+
elt2.getText() + "\n---END bad text\n");
- return false;
- }
+ List l1 = elt1.getAttributes(), l2 = elt2.getAttributes();
+ if (l1.size() != l2.size()) {
+ print("Node 1: " + elt1.getName() + " has " +
l1.size()
+ + " attributes whereas node 2: " +
elt2.getName() + " has "
+ + l2.size() + " attributes");
+ print("Node1==>Element1:\n " + xmlString_j(elt1)
+ + "\n\n whereas Node2==>Element2:\n"
+ xmlString_j(elt2));
+ return false;
+ }
+ Iterator it1 = l1.iterator(), it2 = l2.iterator();

- List l1 = elt1.getAttributes(), l2 = elt2.getAttributes();
- if( l1.size() != l2.size() ){
- print("Node 1: " + elt1.getName() + " has " + l1.size() + " attributes
whereas node 2: " + elt2.getName() + " has " + l2.size() + " attributes");
- print( "Node1==>Element1:\n " + xmlString_j(elt1) + "\n\n whereas
Node2==>Element2:\n" +xmlString_j(elt2));
- return false;
- }
- Iterator it1 = l1.iterator(), it2 = l2.iterator();
+ Attribute att1, att2;
+ if (elt1.getName().equals("metadata") == false
+ && elt1.getName().equals("data") == false)
+ while (it1.hasNext())
+ if (equal((att1 = (Attribute) it1.next()),
+ (att2 = (Attribute)
it2.next())) == false) {
+ print("Attribute mismatch: Found
Node1 " + elt1.getName()
+ + " attribute :\n" +
printAtt(att1)
+ + "Found Node2 " +
elt2.getName()
+ + " attribute :\n" +
printAtt(att2));
+ return false;
+ }
+ /* Compare children */
+ l1 = elt1.getChildren();
+ l2 = elt2.getChildren();

- Attribute att1, att2;
- if( elt1.getName().equals("metadata") == false &&
elt1.getName().equals("data") == false )
- while( it1.hasNext() )
- if( equal( (att1=(Attribute) it1.next()) , (att2=(Attribute) it2.next())
) == false ){
- print("Attribute mismatch: Found Node1 " + elt1.getName() + "
attribute :\n" + printAtt(att1) +
- "Found Node2 " + elt2.getName() + " attribute :\n" +
printAtt(att2 ) );
- return false;
- }
- /* Compare children */
- l1 = elt1.getChildren(); l2 = elt2.getChildren();
+ if (l1.size() != l2.size()) {
+ print("Node 1: " + elt1.getName() + "has " + l1.size()
+ + " elements whereas node 2: " +
elt2.getName() + " has "
+ + l2.size() + " elements");
+ return false;
+ }
+ it1 = l1.iterator();
+ it2 = l2.iterator();
+ while (it1.hasNext())
+ if (equal((org.jdom.Element) it1.next(),
(org.jdom.Element) it2
+ .next()) == false)
+ return false;
+ return true;
+ }

- if( l1.size() != l2.size() ){
- print("Node 1: " + elt1.getName() + "has " + l1.size() + " elements
whereas node 2: " + elt2.getName() + " has " + l2.size() + " elements");
- return false;
- }
- it1 = l1.iterator() ; it2 = l2.iterator();
- while( it1.hasNext() )
- if( equal( (org.jdom.Element) it1.next() , (org.jdom.Element) it2.next()
) == false ) return false;
- return true;
-}
-public static org.jdom.Element newJElement( String s , boolean
namespaceAware ) throws Exception {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = null;
- DOMBuilder jbuilder = null;
- factory.setNamespaceAware(namespaceAware);
- try {
- builder = factory.newDocumentBuilder();
- jbuilder = new DOMBuilder();
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- }
- return jbuilder.build(builder.parse( new
java.io.StringBufferInputStream(s))).getRootElement();
- }
+ /**
+ * @param s
+ * @param namespaceAware
+ * @return
+ * @throws Exception
+ */
+ @SuppressWarnings("deprecation")
+ public static org.jdom.Element newJElement(String s, boolean
namespaceAware)
+ throws Exception {
+ DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = null;
+ DOMBuilder jbuilder = null;
+ factory.setNamespaceAware(namespaceAware);
+ try {
+ builder = factory.newDocumentBuilder();
+ jbuilder = new DOMBuilder();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+ return jbuilder.build(
+ builder.parse(new
java.io.StringBufferInputStream(s)))
+ .getRootElement();
+ }

- public static boolean testDeployment(String endpoint , SoapClient.Level
level,String logFile,String requestFile , String responseFile ) {
- Logger logger = Logger.getLogger(SoapClient.class);
- try {
- if( logFile == null ){
- logger.addAppender(new ConsoleAppender(new SimpleLayout())); //Say how
to log. this goes to console in simple layout.
- }
- else{
- logger.addAppender(new FileAppender(new
SimpleLayout(),logFile,false));//Say how to log. this goes to console in
simple layout.
- }
- logger.setLevel(level.translate()); //Setting level of logging, there
are 6 logging levels in total.
- setGlobalLogger(logger);
- } catch( Exception e ){
- e.printStackTrace();
- return false;
- }
- SoapClient sc = new SoapClient(logger);
+ /**
+ * @param endpoint
+ * @param level
+ * @param logFile
+ * @param requestFile
+ * @param responseFile
+ * @return
+ */
+ @SuppressWarnings("static-access")
+ public static boolean testDeployment(String endpoint,
+ SoapClient.Level level, String logFile, String
requestFile,
+ String responseFile) {
+ Logger logger = Logger.getLogger(SoapClient.class);
+ try {
+ if (logFile == null) {
+ logger.addAppender(new ConsoleAppender(new
SimpleLayout())); // Say
+

// how
+

// to
+

// log.
+

// this
+

// goes
+

// to
+

// console
+

// in
+

// simple
+

// layout.
+ } else {
+ logger.addAppender(new FileAppender(new
SimpleLayout(),
+ logFile, false));// Say how
to log. this goes to
+
// console in simple layout.
+ }
+ logger.setLevel(level.translate()); // Setting level
of logging,
+
// there are 6 logging levels in
+
// total.
+ setGlobalLogger(logger);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ SoapClient sc = new SoapClient(logger);

- try{
- String in = sc.readFile(requestFile), out = sc.readFile(responseFile);
-// System.out.println("Read : \n" + out );
- org.jdom.Element outelt = newJElement(out,true),inelt;
- sc.setEndpoint(endpoint);
- sc.setRequest(in);
- sc.sendRequest();
- inelt = sc.getResponse_j();
- writeFile("/home/perfsonar/response.xml",xmlString_j(inelt));
- return equal(inelt,outelt);
- }
- catch( Exception e ){
- e.printStackTrace();
- return false;
- }
- }
+ try {
+ String in = sc.readFile(requestFile), out = sc
+ .readFile(responseFile);
+ // System.out.println("Read : \n" + out );
+ org.jdom.Element outelt = newJElement(out, true),
inelt;
+ sc.setEndpoint(endpoint);
+ sc.setRequest(in);
+ sc.sendRequest();
+ inelt = sc.getResponse_j();
+ writeFile("/home/perfsonar/response.xml",
xmlString_j(inelt));
+ return equal(inelt, outelt);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }

-public static String readFile(String fl) throws Exception {
- File file = new File(fl);
- FileInputStream fis = new FileInputStream(file);
- long len = file.length();
- if( (int) len != len ) throw new Exception("Internal error: File size
too large");/* more than 4GB ...*/
-// System.out.println("Read " + len + " bytes");
- byte[] content = new byte[(int)len];
- fis.read(content);
- fis.close();
- return new String(content);
- }
+ /**
+ * @param fl
+ * @return
+ * @throws Exception
+ */
+ public static String readFile(String fl) throws Exception {
+ File file = new File(fl);
+ FileInputStream fis = new FileInputStream(file);
+ long len = file.length();
+ if ((int) len != len)
+ throw new Exception("Internal error: File size too
large");/*
+
* more
+
* than
+
* 4GB
+
* ...
+
*/
+ // System.out.println("Read " + len + " bytes");
+ byte[] content = new byte[(int) len];
+ fis.read(content);
+ fis.close();
+ return new String(content);
+ }

+ /**
+ * @param fname
+ * @param data
+ */
+ public static void writeFile(String fname, String data) {
+ try {
+ // Create file
+ FileWriter fstream = new FileWriter(fname);
+ BufferedWriter out = new BufferedWriter(fstream);
+ out.write(data);
+ // Close the output stream
+ out.close();
+ } catch (Exception e) {// Catch exception if any
+ System.err.println("Error: " + e.getMessage());
+ }
+ }

- public static void writeFile(String fname , String data )
- {
- try{
- // Create file
- FileWriter fstream = new FileWriter(fname);
- BufferedWriter out = new BufferedWriter(fstream);
- out.write(data);
- //Close the output stream
- out.close();
- }catch (Exception e){//Catch exception if any
- System.err.println("Error: " + e.getMessage());
- }
- }
+ /**
+ * @param relativeWebServiceRootPath
+ * @return
+ */
+ public static String guessWebServiceUrl(String
relativeWebServiceRootPath) {
+ try {
+ String baseDir = (new File((new
File(relativeWebServiceRootPath))
+ .getCanonicalPath())).getName();
+ org.jdom.Element elt = newJElement(
+ readFile(relativeWebServiceRootPath
+ +
"/wsdd/service-deploy.wsdd"), false);
+ // System.out.println("Elt name : " + elt.getName() );
+ String serviceName = elt.getChild("service",
elt.getNamespace())
+ .getAttribute("name").getValue();
+ return baseDir + "/services/" + serviceName;
+ } catch (Exception e) {
+ // e.printStackTrace();
+ return "";
+ }
+ }

- public static String guessWebServiceUrl(String relativeWebServiceRootPath
){
- try{
- String baseDir = (new File((new
File(relativeWebServiceRootPath)).getCanonicalPath())).getName();
- org.jdom.Element elt =
newJElement(readFile(relativeWebServiceRootPath
+"/wsdd/service-deploy.wsdd"),false);
- //System.out.println("Elt name : " + elt.getName() );
- String serviceName =
elt.getChild("service",elt.getNamespace()).getAttribute("name").getValue();
- return baseDir + "/services/" + serviceName;
- }
- catch(Exception e ){
- // e.printStackTrace();
- return "";
- }
- }
+ /**
+ * @return
+ */
+ public static String workingDirectory() {
+ return System.getProperty("user.dir");
+ }

- public static String workingDirectory() {
- return System.getProperty("user.dir");
- }
+ public static void main(String[] args) throws Exception {
+ if (args.length < 2) {
+ System.out.println("Insufficient arguments");
+ System.out.println((new
java.io.File(".")).getCanonicalPath());
+ return;
+ }
+ //
testDeployment("http://127.0.0.1:8080/xml-ls/services/LookupService",Level.DEBUG,null,args[0],
+ // args[1]);
+ System.out.println("Working directory : " +
workingDirectory());
+ System.out.println("Guess ws url : " +
guessWebServiceUrl(".."));

- public static void main( String[] args ) throws Exception {
- if (args.length < 2 ) {
- System.out.println("Insufficient arguments");
- System.out.println((new java.io.File(".")).getCanonicalPath()) ;
- return;
- }
-//
testDeployment("http://127.0.0.1:8080/xml-ls/services/LookupService",Level.DEBUG,null,args[0],
args[1]);
- System.out.println("Working directory : " + workingDirectory() );
- System.out.println("Guess ws url : " + guessWebServiceUrl("..") );
-
- }
+ }
}

Modified:
branches/WebAdmin/perfSONARWebAdmin/admin/stitching/StitchingServlet.java
===================================================================
--- branches/WebAdmin/perfSONARWebAdmin/admin/stitching/StitchingServlet.java
2008-08-04 10:35:12 UTC (rev 4330)
+++ branches/WebAdmin/perfSONARWebAdmin/admin/stitching/StitchingServlet.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -50,6 +50,13 @@
import perfSONARWebAdmin.auxiliary.stitching.MetadataManager;
import perfSONARWebAdmin.auxiliary.stitching.MetadataManagerImpl;

+/**
+ * @author Michalis Michael, A servlet that is able to display iformmation
about
+ * the metadata configuration file used in RRD MA. It also provides
the
+ * user the ability to easily upload a new configuration into the
eXist
+ * database
+ *
+ */
public class StitchingServlet extends HttpServlet {

//
-----------------------------------------------------------------------
@@ -70,22 +77,35 @@
// Path to service installation directory
private static String servicePath = null;

+ // URI of the eXist database
private String URI;

+ // Password for the eXist user
private String dbpass;

+ // User name for the eXist database
private String username;

+ // The configuration file used in RRD MA
private String confFile;

+ // The class that handles the UI output(HTML Output)
private HTMLOutput output = new HTMLOutput();;

+ // A helper class that makes tha manipulation of the metadata config
file in
+ // eXist easy
private MetadataManager manager;

+ // Class that parses the a string representation of a data or metadata
+ // element and utputs a string array with usefull information
private ElementParser parser = new ElementParser();

+ // A map to map matric event types to metric names
private HashMap<String, String> metrics;

+ //
-----------------------------------------------------------------------
+ // public methods
+
public void doGet(HttpServletRequest request, HttpServletResponse
response)
throws IOException {

@@ -108,6 +128,12 @@
"discards");
}

+ /*
+ * (non-Javadoc)
+ *
+ * @see
javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest,
+ * javax.servlet.http.HttpServletResponse)
+ */
public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws IOException {

@@ -123,6 +149,7 @@
Authenticator authenticator = new
AuthenticatorImpl(servletProperties);
ServiceProperties properties = new
ServicePropertiesImpl(servicePath
+ serviceProperties);
+ // Accessing the needed info from service properties file
URI = properties.getProperty("component.ma.xmldb.db_uri");
dbpass =
properties.getProperty("component.ma.xmldb.db_password");
username =
properties.getProperty("component.ma.xmldb.db_username");
@@ -135,12 +162,13 @@
throw new IOException(e.getMessage());
}

+ // Checking if authentication has happened and if it was
successful
if (session.getAttribute("authenticated") != null) {
if (((Boolean) session.getAttribute("authenticated"))
.booleanValue()) {

try {
- //System.out.println("Getting to
action");
+
servletActions(request, response);
} catch (Exception e) {
throw new IOException(getFault(e));
@@ -152,7 +180,7 @@
session.invalidate();
}
} else {
- // If the "authentcated" parameter has not been set
then we ask for
+ // If the "authenticated" parameter has not been set
then we ask for
// a username and password
String authorization =
request.getHeader("Authorization");
// if there is non in the headers we ask for it
@@ -178,7 +206,7 @@
session.setAttribute("authenticated",
true);

try {
- //System.out.println("Getting
to action");
+ // If all checks out OK the
we are in bussiness
servletActions(request,
response);
} catch (Exception e) {
throw new
IOException(getFault(e));
@@ -192,16 +220,23 @@
}
}

+ //
-----------------------------------------------------------------------
+ // private methods
+
/**
+ *
* @param request
* @throws Exception
*/
private void servletActions(HttpServletRequest request,
HttpServletResponse response) throws Exception {

+ // If the request has a multipart content then the user is
probably
+ // trying to upload a new configuration into eXist
if (ServletFileUpload.isMultipartContent(request)) {
response.setContentType("text/html");
ServletOutputStream out = response.getOutputStream();
+ // Setting the ServletOutputStream to be used in
HTMLOutput class
output.setOuputStream(out);

ServletFileUpload servletFileUpload = new
ServletFileUpload(
@@ -209,6 +244,7 @@
List fileItemsList =
servletFileUpload.parseRequest(request);
Iterator it = fileItemsList.iterator();

+ // Getting the file
while (it.hasNext()) {
FileItem item = (FileItem) it.next();
if (!item.isFormField()) {
@@ -218,69 +254,105 @@
+
"/WEB-INF/classes/perfsonar/conf/"
+
item.getName().trim()));
if (confFile != null) {
- String newFileName=
servicePath
- +
"/WEB-INF/classes/perfsonar/conf/"
- +
item.getName().trim();
+ String newFileName =
servicePath
+ +
"/WEB-INF/classes/perfsonar/conf/"
+ +
item.getName().trim();
File file = new
File(confFile);
+ // If all is OK with
the new file then it is
+ // validated against
the schema.rng file
if (file.exists() &&
file.isFile()) {
- try
- {
- StreamSource
ss = new StreamSource(new FileInputStream(newFileName));
-
System.out.println("Doc parsed");
-
System.setProperty("javax.xml.validation.SchemaFactory:" +
XMLConstants.RELAXNG_NS_URI,
"org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl");
- SchemaFactory
schefactory = SchemaFactory.newInstance(XMLConstants.RELAXNG_NS_URI);
- Schema schema =
schefactory.newSchema(new File(servicePath
-
+ "/WEB-INF/classes/perfsonar/conf/schema.rng"));
- Validator
validator = schema.newValidator();
- validator.validate((Source)
ss);
-
manager.removeConfigFile(file.getName().trim());
-
- File newFile
= new File(newFileName);
-
PerfsonarProperties properties = new PerfsonarPropertiesImpl();
-
properties.loadProperties(new FileInputStream(new File(
-
servicePath + serviceProperties)));
-
PerfsonarProperty pr = properties
-
.getProperty("service.ma.conf_file");
-
pr.setValue(servicePath
-
+ "/WEB-INF/classes/perfsonar/conf/"
-
+ newFile.getName().trim());
-
properties.setProperty("service.ma.conf_file", pr);
-
properties.storeProperties(new FileOutputStream(
-
servicePath + serviceProperties));
-
manager.addConfigFile(newFile);
-
-
}catch(Exception e){
+ try {
+
+ //
Validating the uploaded file
+
StreamSource ss = new StreamSource(
+
new FileInputStream(newFileName));
+ System
+
.setProperty(
+
"javax.xml.validation.SchemaFactory:"
+
+ XMLConstants.RELAXNG_NS_URI,
+

"org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl");
+
SchemaFactory schefactory = SchemaFactory
+
.newInstance(XMLConstants.RELAXNG_NS_URI);
+
Schema schema = schefactory
+
.newSchema(new File(
+
servicePath
+
+
"/WEB-INF/classes/perfsonar/conf/schema.rng"));
+
Validator validator = schema.newValidator();
+ // If
no problemnd then we continue, if
+ //
there is a problem the validator will
+ //
through an exception explaining why
+
validator.validate((Source) ss);
+ //
Removing old configuration file
+
manager.removeConfigFile(file.getName()
+
.trim());
+
File
newFile = new File(newFileName);
+ //
changing the appropriate property in the
+ //
service.properties file
+
PerfsonarProperties properties = new PerfsonarPropertiesImpl();
+
properties
+
.loadProperties(new FileInputStream(
+
new File(servicePath
+
+ serviceProperties)));
+
PerfsonarProperty pr = properties
+
.getProperty("service.ma.conf_file");
+ pr
+
.setValue(servicePath
+
+ "/WEB-INF/classes/perfsonar/conf/"
+
+ newFile.getName().trim());
+
properties.setProperty(
+
"service.ma.conf_file", pr);
+
properties
+
.storeProperties(new FileOutputStream(
+
servicePath
+
+ serviceProperties));
+ //
Adding file to database
+
manager.addConfigFile(newFile);
+
+ } catch
(Exception e) {
+ // If
an exception happens the process is
+ //
abondoned and the cause is displayed to
+ //
the user
+ File
newFile = new File(newFileName);

newFile.delete();
-
setDefault(null,"Loading file failed!!!Cause: "+e.getLocalizedMessage());
+
setDefault(null,
+
"Loading file failed!!!Cause: "
+
+ e.getLocalizedMessage());
}
}

}
-

}

}
}
- setDefault(null,"");
+ setDefault(null, "");
+ // Else if this is not a multipart request, the its a
request from
+ // the user asking for an action
} else if (request.getParameterNames().hasMoreElements()) {

+ // The user has requested to view info about the
interfaces of a
+ // specific host
if (request.getParameter("ifaces") != null) {
-
+
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
+ @SuppressWarnings("unused")
List hosts = manager.getHostnames();
String host = request.getParameter("Host");
if (host != null) {
- setDefault(host,"");
+ setDefault(host, "");
} else
- setDefault(null,"");
+ setDefault(null, "");

- } else if (request.getParameter("fileAction") !=
null) {
+ }
+ // The user wants to do something with the metadata
config file
+ else if (request.getParameter("fileAction") != null) {
String action =
request.getParameter("fileAction").trim();
-
+
+ // In this case it wants to back it up
if (action.equals("Backup")) {

PerfsonarProperties properties = new
PerfsonarPropertiesImpl();
@@ -290,12 +362,17 @@

.getProperty("service.ma.conf_file");
String filename = pr.getValue();
File file = new File(filename);
- File backfile=new File(filename +
".bak");
- if(backfile.exists()){
+ // Deleting any old back up files
+ File backfile = new File(filename +
".bak");
+ if (backfile.exists()) {
backfile.delete();
}
+ // Renaming the current config file
in the /conf directory
+ // to file.bak
if (file.renameTo(new File(filename +
".bak"))) {

+ // Storing the new file as it
is extracted from the
+ // eXist db
file = new File(filename);
FileWriter fw = new
FileWriter(file);
BufferedWriter bw = new
BufferedWriter(fw);
@@ -304,10 +381,14 @@
fw.close();
file = new File(filename);
int length = 0;
+ // Allowing the user to store
the file in his local
+ // machine

response.setContentType("application/x-download");

response.setContentLength((int) file.length());

response.setHeader("Content-Disposition",
- "attachment;
filename=" + filename.substring(filename.lastIndexOf("/")+1));
+ "attachment;
filename="
+
+ filename.substring(filename
+
.lastIndexOf("/") + 1));
ServletOutputStream out =
response.getOutputStream();
byte[] bbuf = new byte[1000];
DataInputStream in = new
DataInputStream(
@@ -318,20 +399,21 @@
in.close();
out.flush();
out.close();
- throw new Exception("Done ");

- }else{
- throw new Exception("Problem
backing up file, file cannot be saved as");
+ } else {
+ throw new Exception(
+ "Problem
backing up file, file cannot be saved as");
}

- }else{
- throw new Exception("Not back up
"+action+" ");
}

}

+ // Legacy options
+
+ // It allowd the user to view the intefaces per host
name.Not used
else if (request.getParameter("sort") != null) {
-
+
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
@@ -346,13 +428,20 @@
ifaces =
manager.getIfacesbyMetric(metric);
setInfo(ifaces, host, metric);
} else
- setDefault(null,"");
- } else if (request.getParameter("Add") != null) {
+ setDefault(null, "");
+
+ }
+
+ // Allows the user to add anothen interface to the
file.Cuurrently
+ // not used
+ else if (request.getParameter("Add") != null) {
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
output.interface_page(null, null);
- } else if (request.getParameter("Edit") != null) {
+ }
+ // Alows the user to edit an inteface. Currently not
used
+ else if (request.getParameter("Edit") != null) {
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
@@ -365,12 +454,15 @@

parser.parseData((String) manager.getData(

id).get(1)));
} else
- setDefault(null,"");
+ setDefault(null, "");
} else
- setDefault(null,"");
+ setDefault(null, "");
} else
- setDefault(null,"");
- } else if (request.getParameter("Remove") != null) {
+ setDefault(null, "");
+ }
+ // Allows the user to remove an inteface(needs a
confirmaion first
+ // though;)). Not used
+ else if (request.getParameter("Remove") != null) {
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
@@ -378,16 +470,20 @@
if (id != null) {
output.remove_page(id);
} else
- setDefault(null,"");
- } else if (request.getParameter("Create") != null) {
+ setDefault(null, "");
+ }
+ // The user has finished his editing/creating and all
the data are
+ // posted back to the servlet
+ else if (request.getParameter("Create") != null) {

response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
-
+
String action =
request.getParameter("Create");
if (action.equals("Edit") ||
action.equals("Add")) {

+ // Getting all the info sent by the
user
String[] metadata = new String[9];
String[] data = new String[9];
Enumeration en =
request.getParameterNames();
@@ -431,21 +527,25 @@
}
metadata[8] = data[3];

+ // Doing all the apropriate actions
afterwards
if (action.equals("Add")) {
manager.addIface(metadata,
data, metadata[7],
(String)
metrics.get(data[3]));
- setDefault(null,"");
+ setDefault(null, "");
} else {
manager.updateIface(metadata,
data, metadata[7],
(String)
metrics.get(data[3]));
- setDefault(null,"");
+ setDefault(null, "");
}

} else
- setDefault(null,"");
+ setDefault(null, "");

- } else if (request.getParameter("Delete") != null) {
-
+ }
+ // We have confirnation on deletion and we then
continue the rest of
+ // the actions.Not used
+ else if (request.getParameter("Delete") != null) {
+
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
@@ -454,21 +554,25 @@
String id =
request.getParameter("id");
if (id != null) {
manager.removeIfacebyId(id);
- setDefault(null,"");
+ setDefault(null, "");
} else
- setDefault(null,"");
+ setDefault(null, "");
} else
- setDefault(null,"");
- } else if (request.getParameter("Manage") != null) {
+ setDefault(null, "");
+ }
+ // Allows the user to manage the config file. Not used
+ else if (request.getParameter("Manage") != null) {
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
output.manage_config_file_page();
- } else if (request.getParameter("CreateFile") !=
null) {
+ }
+ // Allows the user to create a new config file. Not
used
+ else if (request.getParameter("CreateFile") != null) {
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
-
+
String fileName =
request.getParameter("fileName");
if (fileName != null) {
File newFile = new File(servicePath
@@ -509,7 +613,7 @@

.storeProperties(new FileOutputStream(

servicePath + serviceProperties));

manager.addConfigFile(newFile);
-
setDefault(null,"");
+
setDefault(null, "");

} else
throw new
Exception("Cannot write to new file");
@@ -525,7 +629,7 @@
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
- setDefault(null,"");
+ setDefault(null, "");
}

} else {
@@ -535,7 +639,7 @@
response.setContentType("text/html");
ServletOutputStream out =
response.getOutputStream();
output.setOuputStream(out);
- setDefault(null,"");
+ setDefault(null, "");
}

}
@@ -543,7 +647,14 @@
}

/**
+ * Method used for processing the info fro every found inteface and
returns
+ * a list of String arrays that conntain all the useful info that
will be
+ * displayed by the HTMLOputput class
+ *
* @param ifaces
+ * The list of metadata elements in text representation
+ * @return A list of String arrays that contain all the useful info
about an
+ * interface
* @throws Exception
*/
@SuppressWarnings("unchecked")
@@ -553,81 +664,85 @@
Iterator it = ifaces.iterator();
while (it.hasNext()) {
String iface = (String) it.next();
+ // Parse the metadata string
String[] meta_info = parser.parseMetaData(iface);
- List dataList= manager.getData(meta_info[7]);
- String[] data_info= new String[9];
- if(!dataList.isEmpty()){
- data_info=parser.parseData((String)
dataList.get(0));
+ // Get the stitched datas
+ List dataList = manager.getData(meta_info[7]);
+ String[] data_info = new String[9];
+ if (!dataList.isEmpty()) {
+ // Parse the data string
+ data_info = parser.parseData((String)
dataList.get(0));
}
+ // The interfaces are put in a map with there IP
addresses as keys
+ // If an interface already exists
if (interfaces.containsKey(meta_info[2])) {

String[] info = (String[])
interfaces.get(meta_info[2]);

-
if (meta_info[8]

.equals("http://ggf.org/ns/nmwg/characteristic/utilization/2.0";)) {
-
+
if
(meta_info[4].equalsIgnoreCase("in")) {
info[4] = "true";
- info[5]=data_info[0];
+ info[5] = data_info[0];
} else if
(meta_info[4].equalsIgnoreCase("out")) {
info[6] = "true";
- info[7]=data_info[0];
+ info[7] = data_info[0];
}
-
+
info[8] = "true";
-
+
} else if (meta_info[8]

.equals("http://ggf.org/ns/nmwg/characteristic/errors/2.0";)) {
if
(meta_info[4].equalsIgnoreCase("in")) {
info[9] = "true";
- info[10]=data_info[0];
+ info[10] = data_info[0];
}
} else if (meta_info[8]

.equals("http://ggf.org/ns/nmwg/characteristic/discards/2.0";)) {
-
+
if
(meta_info[4].equalsIgnoreCase("out")) {
info[11] = "true";
- info[12]=data_info[0];
+ info[12] = data_info[0];
}
}
interfaces.put(info[0], info);

} else {
String[] info = new String[13];
- for(int i=0;i<info.length;i++){
- info[i]="";
+ for (int i = 0; i < info.length; i++) {
+ info[i] = "";
}
info[0] = meta_info[2];
info[1] = meta_info[1];
info[2] = meta_info[5];
info[3] = meta_info[3];
-
+
if (meta_info[8]

.equals("http://ggf.org/ns/nmwg/characteristic/utilization/2.0";)) {
if
(meta_info[4].equalsIgnoreCase("in")) {
info[4] = "true";
- info[5]=data_info[0];
+ info[5] = data_info[0];
} else if
(meta_info[4].equalsIgnoreCase("out")) {
info[5] = "true";
- info[7]=data_info[0];
+ info[7] = data_info[0];
}
-
+
info[8] = "true";
} else if (meta_info[8]

.equals("http://ggf.org/ns/nmwg/characteristic/errors/2.0";)) {
-
+
if
(meta_info[4].equalsIgnoreCase("in")) {
info[9] = "true";
- info[10]=data_info[0];
+ info[10] = data_info[0];
}
-
+
} else if (meta_info[8]

.equals("http://ggf.org/ns/nmwg/characteristic/discards/2.0";)) {
-
+
if
(meta_info[4].equalsIgnoreCase("out")) {
info[11] = "true";
- info[12]=data_info[0];
+ info[12] = data_info[0];
}
}
interfaces.put(info[0], info);
@@ -637,6 +752,13 @@

}

+ // Not used
+ /**
+ * Returns the string representation of the root element of a
metadata confi
+ * file
+ *
+ * @return
+ */
private String getNewStoreFile() {

return " <nmwg:store
xmlns:nmwgt=\"http://ggf.org/ns/nmwg/topology/2.0/\"; "
@@ -649,7 +771,11 @@
+
"xmlns=\"http://ggf.org/ns/nmwg/base/2.0/\";> </nmwg:store>";
}

+ // Not used
/**
+ * Displays info about the interfaces of a particular host and metric
+ *
+ *
* @param ifaces
* @param metric
* @param host
@@ -670,25 +796,36 @@
}

/**
+ *
+ * Gathers and prepares all the necessary info that willl be displayed
+ *
* @param device
- * @param string
+ * The device which particular info and interfaces will be
+ * displayed
+ * @param string
+ * A message that probably informs the user about an error
* @throws Exception
*/
private void setDefault(String device, String message) throws
Exception {
// List ifaces = manager.getIfacesbyMetric("netutil");
// setInfo(ifaces, "netutil", null);
+
+ // Get the hos list
List hosts = manager.getHostnames();
PerfsonarProperties properties = new
PerfsonarPropertiesImpl();
- properties.loadProperties(new FileInputStream(new File(
- servicePath + serviceProperties)));
- PerfsonarProperty pr = properties
- .getProperty("service.ma.conf_file");
+ properties.loadProperties(new FileInputStream(new
File(servicePath
+ + serviceProperties)));
+ PerfsonarProperty pr =
properties.getProperty("service.ma.conf_file");
String filename = pr.getValue();

if (hosts != null && !hosts.isEmpty()) {

+ // get the selected host, if none is selected get the
first on the
+ // list
String host = (device != null) ? device : (String)
hosts.get(0);
+ // Get the ifaces of the selected host
List ifaces = manager.getIfacesbyHostname(host);
+ // Gather all the hosts info
String[] hostsInfo = new String[5];
hostsInfo[2] = null;
hostsInfo[3] = null;
@@ -735,10 +872,12 @@
}
hostsInfo[0] = String.valueOf(numIfaces);
hostsInfo[1] = String.valueOf(numDataPoints);
-
output.main_page(filename.substring(filename.lastIndexOf("/")+1),processIfaces(ifaces),
hosts, hostsInfo, host,
- hostInfo,message );
+
output.main_page(filename.substring(filename.lastIndexOf("/") + 1),
+ processIfaces(ifaces), hosts,
hostsInfo, host, hostInfo,
+ message);
} else
-
output.main_page(filename.substring(filename.lastIndexOf("/")+1),null, null,
null, null, null,message);
+
output.main_page(filename.substring(filename.lastIndexOf("/") + 1),
+ null, null, null, null, null,
message);
}

/**

Modified: branches/WebAdmin/perfSONARWebAdmin/auxiliary/sql/SQLDBManager.java
===================================================================
--- branches/WebAdmin/perfSONARWebAdmin/auxiliary/sql/SQLDBManager.java
2008-08-04 10:35:12 UTC (rev 4330)
+++ branches/WebAdmin/perfSONARWebAdmin/auxiliary/sql/SQLDBManager.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -642,6 +642,7 @@
+ DBName + "'@'%'\" and
table_schema='" + DBName + "' ;";
PreparedStatement ps =
connnection.prepareStatement(statement);
ResultSet rs = ps.executeQuery();
+ @SuppressWarnings("unused")
LinkedList priv = new LinkedList();
if (rs.next()) {
result = true;

Modified: branches/WebAdmin/perfSONARWebAdmin/auxiliary/sqlma/HTMLOutput.java
===================================================================
--- branches/WebAdmin/perfSONARWebAdmin/auxiliary/sqlma/HTMLOutput.java
2008-08-04 10:35:12 UTC (rev 4330)
+++ branches/WebAdmin/perfSONARWebAdmin/auxiliary/sqlma/HTMLOutput.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -5,7 +5,7 @@
import javax.servlet.ServletOutputStream;

/**
- * Class used as front end for creation the html output for the SQL admin
+ * Class used as front end for the creation the html output for the SQL admin
* servlet
*
* @author Michalis Michael, CyNet

Modified:
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/ElementParser.java
===================================================================
---
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/ElementParser.java
2008-08-04 10:35:12 UTC (rev 4330)
+++
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/ElementParser.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -11,34 +11,50 @@
import org.jdom.Namespace;

/**
+ * Class used to parse the string representation of data and metadata
elements
* @author Michalis Michael,CyNet
*
*/
public class ElementParser {
-
+
+ //
-----------------------------------------------------------------------
+ // class fileds
+
+ //Namepsaces used in parsing
private Namespace nmwg = Namespace
.getNamespace("http://ggf.org/ns/nmwg/base/2.0/";);

+ @SuppressWarnings("unused")
private Namespace nmtm = Namespace
.getNamespace("http://ggf.org/ns/nmwg/time/2.0/";);

private Namespace nmwgt = Namespace
.getNamespace("http://ggf.org/ns/nmwg/topology/2.0/";);

+ @SuppressWarnings("unused")
private Namespace netutil = Namespace.getNamespace("netutil",

"http://ggf.org/ns/nmwg/characteristic/utilization/2.0/";);

+ @SuppressWarnings("unused")
private Namespace errors = Namespace.getNamespace("errors",
"http://ggf.org/ns/nmwg/characteristic/errors/2.0/";);

+ @SuppressWarnings("unused")
private Namespace discards = Namespace.getNamespace("discards",

"http://ggf.org/ns/nmwg/characteristic/discards/2.0/";);

+ //
-----------------------------------------------------------------------
+ // constructors
+
public ElementParser() {

}

+
//-----------------------------------------------------------------------
+ // public methods
+
/**
+ * Method that parses the metadata element string representation
* @param metadata
* @return
* @throws Exception
@@ -117,6 +133,7 @@
}

/**
+ * Method that parses the data element string representation
* @param data
* @return
* @throws Exception
@@ -183,6 +200,10 @@

}

+ /**
+ * Just for testing
+ * @param argv
+ */
public static void main(String[] argv) {
ElementParser parser = new ElementParser();


Modified:
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/HTMLOutput.java
===================================================================
--- branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/HTMLOutput.java
2008-08-04 10:35:12 UTC (rev 4330)
+++ branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/HTMLOutput.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -8,6 +8,9 @@
import javax.servlet.ServletOutputStream;

/**
+ * Class used as front end, for the creation the html output for the
stitching
+ * servlet
+ *
* @author Michalis Michael,CyNet
*
*/
@@ -22,6 +25,7 @@
// The servlet output stream that will be used to output the html code
private static ServletOutputStream out = null;

+ // A map for mapping the metric names to metric urns
private HashMap<String, String> metrics;

//
-----------------------------------------------------------------------
@@ -57,11 +61,24 @@
out = stream;
}

- /**
+
/***************************************************************************
+ * The only method used to display info and options to the user
+ *
+ * @param file
+ * The file that is currently the metadata config file of
the RRD
+ * MA
* @param ifaces
+ * List of string arfrays containing info about the
inyerfaces
* @param hosts
+ * The list of hosts
+ * @param hostsInfo
+ * A string array conntaing info about the hosts
* @param host
- * @param metric
+ * The selected host
+ * @param hostInfo
+ * A string arrays containing info about the host
+ * @param message
+ * A possible arror message
* @throws IOException
*/
@SuppressWarnings("unchecked")
@@ -79,7 +96,8 @@
out.println("<div id=\"iface_panel_body\" >");

out.println("<table>");
- out.println("<tr><td colspan=\"2\" style=\"color:red;\"
>"+message+"</td></tr>");
+ out.println("<tr><td colspan=\"2\" style=\"color:red;\" >" +
message
+ + "</td></tr>");
out.println("<tr>");
out.println("<td colspan=\"2\">");
out.println("<div id=\"file_management\">");
@@ -89,7 +107,8 @@
out.println("Current file " + file + "</td></tr>");
out
.println("<tr><td ><form
action=\"MetadataAdmin\" method=\"POST\" ENCTYPE=\"multipart/form-data\"
><input class=\"execute_button_stitching\" name=\"fileAction\"
type=\"submit\" value=\"Upload New\"></input><input type=\"file\" size=0
name=\"file\" value=\"\"></input></form></td>");
- out.println("<td><form action=\"MetadataAdmin\"
method=\"POST\" ><input class=\"execute_button_stitching\" type=\"submit\"
name=\"fileAction\" value=\"Backup\"></input></form></td>");
+ out
+ .println("<td><form action=\"MetadataAdmin\"
method=\"POST\" ><input class=\"execute_button_stitching\" type=\"submit\"
name=\"fileAction\" value=\"Backup\"></input></form></td>");
out.println("</tr>");
out.println("</table>");
out.println("</div>");
@@ -189,15 +208,27 @@
change = true;
}

- String utilIn=ifaceInfo[4].equals("true")?"<td
style=\"text-align:center;\" onmouseover=\"setTip(null,'" + ifaceInfo[5]+
"','#D5E9D4')\"><img src=\"tick.gif\" align=\"middle\"
alt=\"tick\"></img></td>":"<td></td>";
- String utilOut=ifaceInfo[6].equals("true")?"<td
style=\"text-align:center;\" onmouseover=\"setTip(null,'" + ifaceInfo[7]+
"','#D5E9D4')\"><img src=\"tick.gif\" align=\"middle\"
alt=\"tick\"></img></td>":"<td></td>";
- String errors=ifaceInfo[9].equals("true")?"<td
style=\"text-align:center;\" onmouseover=\"setTip(null,'" + ifaceInfo[10]+
"','#D5E9D4')\"><img src=\"tick.gif\" align=\"middle\"
alt=\"tick\"></img></td>":"<td></td>";
- String discards=ifaceInfo[11].equals("true")?"<td
style=\"text-align:center;\" onmouseover=\"setTip(null,'" + ifaceInfo[12]+
"','#D5E9D4')\"><img src=\"tick.gif\" align=\"middle\"
alt=\"tick\"></img></td>":"<td></td>";
+ String utilIn = ifaceInfo[4].equals("true") ? "<td
style=\"text-align:center;\" onmouseover=\"setTip(null,'"
+ + ifaceInfo[5]
+ + "','#D5E9D4')\"><img
src=\"tick.gif\" align=\"middle\" alt=\"tick\"></img></td>"
+ : "<td></td>";
+ String utilOut = ifaceInfo[6].equals("true") ? "<td
style=\"text-align:center;\" onmouseover=\"setTip(null,'"
+ + ifaceInfo[7]
+ + "','#D5E9D4')\"><img
src=\"tick.gif\" align=\"middle\" alt=\"tick\"></img></td>"
+ : "<td></td>";
+ String errors = ifaceInfo[9].equals("true") ? "<td
style=\"text-align:center;\" onmouseover=\"setTip(null,'"
+ + ifaceInfo[10]
+ + "','#D5E9D4')\"><img
src=\"tick.gif\" align=\"middle\" alt=\"tick\"></img></td>"
+ : "<td></td>";
+ String discards = ifaceInfo[11].equals("true") ? "<td
style=\"text-align:center;\" onmouseover=\"setTip(null,'"
+ + ifaceInfo[12]
+ + "','#D5E9D4')\"><img
src=\"tick.gif\" align=\"middle\" alt=\"tick\"></img></td>"
+ : "<td></td>";
out.println("<tr class=\"" + cssclass + "\" >");
out.println("<td onmouseover=\"setTip(null,'" +
ifaceInfo[3]
+ "','#D5E9D4')\">" + ifaceInfo[0] +
" </td><td>"
- + ifaceInfo[1] + "</td><td>" +
ifaceInfo[2]
- +
"</td>"+utilIn+utilOut+errors+discards);
+ + ifaceInfo[1] + "</td><td>" +
ifaceInfo[2] + "</td>"
+ + utilIn + utilOut + errors +
discards);
out.println("</tr>");
}

@@ -210,6 +241,8 @@
out.println("</div>");

/*
+ * Cuurrently not needed, could have use in the future
+ *
* out.println("<table >"); out.println("<tr
class=\"headerlavender\" >");
* out .println("<td>Inteface Management</td><td><a
* href=\"?Add=true\">Add Interface</a>&nbsp;&nbsp;&nbsp; <a
@@ -247,8 +280,7 @@
* out.println("<td>" + getMetric(iface[8]) + "</td>");
* out.println("<td>" + iface[4] + "</td>");
out.println("<td><a
* href=\"?Remove=true&id=" + iface[7] + "\" > Remove </a>
</td>");
- * out.println("</tr>");
- * }
+ * out.println("</tr>"); }
*
* out.println("</div>");
*/
@@ -258,6 +290,9 @@
}

/**
+ * Provides the user the possibility ot create or edit an interface.
Not
+ * used
+ *
* @param metadata
* @param data
* @throws IOException
@@ -469,6 +504,8 @@
}

/**
+ * Asks the user to confirm if he wants to remove an interface.Not
used
+ *
* @param id
* @throws IOException
*/
@@ -492,6 +529,37 @@
out.close();
}

+ /**
+ * Displays the metadata config file management page. It allows the
user to
+ * create or upload a config file.Not used
+ *
+ * @throws IOException
+ */
+ public void manage_config_file_page() throws IOException {
+ preempt();
+ out.println("<div id=\"configManagement\">");
+ out.println("<table>");
+ out.println("<form action=\"MetadataAdmin\">");
+ out.println("<tr>");
+ out
+ .println("<td>Would you like to create a new
metadata configuration file?<input type=\"text\" name=\"fileName\" size=20
/>.xml</td><td><input type=\"submit\" name=\"CreateFile\"
value=\"Create\"/></td>");
+ out.println("</tr>");
+ out.println("</form>");
+ out
+ .println("<form action=\"MetadataAdmin\"
method=\"POST\" ENCTYPE=\"multipart/form-data\" > ");
+ out.println("<tr>");
+ out
+ .println("<td>Would you like to upload a new
metadata configuration file?<input type=\"file\" size=0 name=\"file\"
value=\"\"/><td><input type=\"submit\" size name=\"Upload\"
value=\"Upload\"/></td>");
+ out.println("</tr>");
+ out.println("</form>");
+ out.println("</table>");
+ out.println("</div>");
+ out.println("</body>");
+ out.println("</html>");
+ out.close();
+
+ }
+
//
-----------------------------------------------------------------------
// private methods

@@ -524,29 +592,4 @@

}

- public void manage_config_file_page() throws IOException {
- preempt();
- out.println("<div id=\"configManagement\">");
- out.println("<table>");
- out.println("<form action=\"MetadataAdmin\">");
- out.println("<tr>");
- out
- .println("<td>Would you like to create a new
metadata configuration file?<input type=\"text\" name=\"fileName\" size=20
/>.xml</td><td><input type=\"submit\" name=\"CreateFile\"
value=\"Create\"/></td>");
- out.println("</tr>");
- out.println("</form>");
- out
- .println("<form action=\"MetadataAdmin\"
method=\"POST\" ENCTYPE=\"multipart/form-data\" > ");
- out.println("<tr>");
- out
- .println("<td>Would you like to upload a new
metadata configuration file?<input type=\"file\" size=0 name=\"file\"
value=\"\"/><td><input type=\"submit\" size name=\"Upload\"
value=\"Upload\"/></td>");
- out.println("</tr>");
- out.println("</form>");
- out.println("</table>");
- out.println("</div>");
- out.println("</body>");
- out.println("</html>");
- out.close();
-
- }
-
}

Modified:
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/MetadataManager.java
===================================================================
---
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/MetadataManager.java
2008-08-04 10:35:12 UTC (rev 4330)
+++
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/MetadataManager.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -4,34 +4,44 @@
import java.util.List;

/**
+ * Interface for managing the metadata configuration file of RRD MA stored in
+ * eXist fi
+ *
* @author Michalis Michael,CyNet
*
*/
public interface MetadataManager {

/**
- * @return
+ * Method that returnes all haostnames in the file
+ *
+ * @return List of host names
* @throws Exception
*/
public List getHostnames() throws Exception;
-
-
+
/**
- * @return
+ * Method that returns all of the metadata elements
+ *
+ * @return List of metadata elements
* @throws Exception
*/
- public List getIfaces()throws Exception;
+ public List getIfaces() throws Exception;

/**
+ * Method that returns all interfaces that belong to a given host
+ *
* @param hostname
- * @return
+ * @return List of metadata
* @throws Exception
*/
public List getIfacesbyHostname(String hostname) throws Exception;

/**
+ * Method that returns interfaces that are mapped to a certian metric
+ *
* @param metric
- * @return
+ * @return A List of metadata elements
* @throws Exception
*/
public List getIfacesbyMetric(String metric) throws Exception;
@@ -42,29 +52,38 @@
* @return
* @throws Exception
*/
-
+
/**
+ * Mathod that returns the number of interfaces that belong to a
given host
+ *
* @param host
* @return
* @throws Exception
*/
public String getNumberOfIfacesByHost(String host) throws Exception;
-
+
/**
+ * Method that returns the number of data points that belong to a
given host
+ *
* @param host
* @return
* @throws Exception
*/
public String getNumberOfDataByHost(String host) throws Exception;
-
+
/**
+ * Method tha returns the list of metrics configured for a given host
+ *
* @param host
* @return
* @throws Exception
*/
public List getAvailableMetricsByHost(String host) throws Exception;
-
+
/**
+ * Method that returns all the interfaces that belong to a given host
and
+ * are configured fot a given metric
+ *
* @param hostname
* @param metric
* @return
@@ -74,25 +93,33 @@
throws Exception;

/**
+ * Method tha removes all interfaces belonging to a given host
+ *
* @param hostname
* @throws Exception
*/
public void removeIfacesbyHostname(String hostname) throws Exception;

/**
+ * Method that removes all interfaces that are configured to a given
metric
+ *
* @param metric
* @throws Exception
*/
public void removeIfacesbyMetric(String metric) throws Exception;
-
-
+
/**
+ * Method that removes an interfaces given its id attribute
+ *
* @param id
* @throws exception
*/
public void removeIfacebyId(String id) throws Exception;

/**
+ * Method tha removes all interfaces that belong to a given host and
are
+ * configured to a given metric
+ *
* @param hostname
* @param metric
* @throws Exception
@@ -101,6 +128,8 @@
throws Exception;

/**
+ * Method that adds an interface to the config file
+ *
* @param metadata
* @param data
* @throws Exception
@@ -109,6 +138,8 @@
String metric) throws Exception;

/**
+ * Method that updates the information about an interface
+ *
* @param metadata
* @param data
* @throws Exception
@@ -117,6 +148,8 @@
String metric) throws Exception;

/**
+ * Method that returns the data given the id of the metat=data
+ *
* @param id
* @return
* @throws Exception
@@ -124,6 +157,8 @@
public List getData(String id) throws Exception;

/**
+ * Method that returns the metadata that have the given id
+ *
* @param id
* @return
* @throws Exception
@@ -131,6 +166,8 @@
public String getIfacebyId(String id) throws Exception;

/**
+ * Method that returns all metadata with the same IPAdress
+ *
* @param address
* @return
* @throws Exception
@@ -138,42 +175,53 @@
public List getIfacebyAddres(String address) throws Exception;

/**
+ * Method that returns all metadata with the same given interface Name
+ *
* @param name
* @return
* @throws Exception
*/
public List getIfaceByName(String name) throws Exception;
-
-
+
/**
+ * Returns the metadata with the given IP Address and metric
+ *
* @param address
* @return
* @throws Exception
*/
- public String[] getIfacebyAddresMetric(String address,String metric)
throws Exception;
+ public String[] getIfacebyAddresMetric(String address, String metric)
+ throws Exception;

/**
+ * Returns the metadata with the given interface name and the given
metric
+ *
* @param name
* @return
* @throws Exception
*/
- public String[] getIfaceByNameMetric(String name,String metric)
throws Exception;
-
-
+ public String[] getIfaceByNameMetric(String name, String metric)
+ throws Exception;
+
/**
+ * Removes the config file from the eXist databaes
+ *
* @param file
* @throws Exception
*/
public void removeConfigFile(String file) throws Exception;
-
-
+
/**
+ * Adds the config file to the eXist database
+ *
* @param file
* @throws Exception
*/
- public void addConfigFile(File file) throws Exception;
-
+ public void addConfigFile(File file) throws Exception;
+
/**
+ * Returns the config file from the eXist database as a string
+ *
* @return
* @throws Exception
*/

Modified:
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/MetadataManagerImpl.java
===================================================================
---
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/MetadataManagerImpl.java
2008-08-04 10:35:12 UTC (rev 4330)
+++
branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/MetadataManagerImpl.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -2,7 +2,6 @@

import java.io.File;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -19,19 +18,28 @@
import org.xmldb.api.modules.XQueryService;

/**
+ * Class implementing the MetadataManager interface
* @author Michalis Michael,Cynet
*
*/
public class MetadataManagerImpl implements MetadataManager {

+ //
-----------------------------------------------------------------------
+ // class fields
+
+ //The eXist uri
private static String URI;

+ //The exist user name
private static String user;

+ //The password for exist user
private static String pass;

+ //The config file name
private static String Document;

+ //eXist driver
private static String driver = "org.exist.xmldb.DatabaseImpl";

private Collection collection;
@@ -40,6 +48,9 @@

private HashMap<String, String> metrics;

+ //
-----------------------------------------------------------------------
+ // constructors
+
/**
* @param URI
* @param username
@@ -94,6 +105,10 @@
"Error!!! Not able to connect to
eXist database. ");
}

+ //
-----------------------------------------------------------------------
+ // public methods
+
+
/*
* (non-Javadoc)
*
@@ -344,6 +359,7 @@
*
* @see
perfSONARWebAdmin.auxiliary.stitching.MetadataManager#getData(java.lang.String)
*/
+ @SuppressWarnings("unchecked")
public List getData(String id) throws XMLDBException {
LinkedList data = new LinkedList();
CompiledExpression expr = service.compile("for $data in
doc(\""
@@ -519,7 +535,7 @@

ResourceSet set = service.execute(expr);
ResourceIterator it = set.getIterator();
- LinkedList list = new LinkedList();
+ LinkedList<String> list = new LinkedList<String>();
while (it.hasMoreResources()) {
String metric = (String)
it.nextResource().getContent();
if(!list.contains(metric.trim())){
@@ -586,6 +602,10 @@
}


+ //
-----------------------------------------------------------------------
+ // private methods
+
+
/**
* @param data
* @param id

Modified: branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/test.java
===================================================================
--- branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/test.java
2008-08-04 10:35:12 UTC (rev 4330)
+++ branches/WebAdmin/perfSONARWebAdmin/auxiliary/stitching/test.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -2,12 +2,12 @@

import java.io.File;
import java.io.FileInputStream;
-import java.io.IOException;

+
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
+
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
@@ -16,21 +16,11 @@

import org.jdom.input.DOMBuilder;
import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
+
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-import org.xmldb.api.DatabaseManager;
-import org.xmldb.api.base.Collection;
-import org.xmldb.api.base.CompiledExpression;
-import org.xmldb.api.base.Database;
-import org.xmldb.api.base.ResourceIterator;
-import org.xmldb.api.base.ResourceSet;
import org.xmldb.api.base.XMLDBException;
-import org.xmldb.api.modules.XQueryService;

-import com.thaiopensource.util.PropertyMapBuilder;
-import com.thaiopensource.validate.ValidateProperty;
-import com.thaiopensource.validate.ValidationDriver;

public class test implements ErrorHandler {

@@ -42,12 +32,15 @@
* @throws XMLDBException
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException, XMLDBException {
+ @SuppressWarnings("unused")
String driver = "org.exist.xmldb.DatabaseImpl";


DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
+ @SuppressWarnings("unused")
DocumentBuilder builder = null;
+ @SuppressWarnings("unused")
DOMBuilder jbuilder = null;
try {
builder = factory.newDocumentBuilder();

Modified: branches/WebAdmin/perfSONARWebAdmin/auxiliary/wizard/HTMLOutput.java
===================================================================
--- branches/WebAdmin/perfSONARWebAdmin/auxiliary/wizard/HTMLOutput.java
2008-08-04 10:35:12 UTC (rev 4330)
+++ branches/WebAdmin/perfSONARWebAdmin/auxiliary/wizard/HTMLOutput.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -23,7 +23,7 @@
//
-----------------------------------------------------------------------
// class fields

- // The doctypr of the html document. Currently Html 4.01 transitional
+ // The doctype of the html document. Currently Html 4.01 transitional
private static final String doctype = "<!DOCTYPE HTML PUBLIC
\"-//W3C//DTD HTML 4.01 Transitional//EN\"
\"http://www.w3.org/TR/html4/loose.dtd\";>";

// The servlet output stream that will be used to output the html code

Modified:
branches/WebAdmin/perfSONARWebAdmin/auxiliary/wizard/WizardProperty.java
===================================================================
--- branches/WebAdmin/perfSONARWebAdmin/auxiliary/wizard/WizardProperty.java
2008-08-04 10:35:12 UTC (rev 4330)
+++ branches/WebAdmin/perfSONARWebAdmin/auxiliary/wizard/WizardProperty.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -29,7 +29,7 @@
// The accepted values of the property
private String[] AcceptedValues;

- // The group of that the propertu belongs to
+ // The group of that the property belongs to
private String Group;

// The order of the property inside the group

Modified:
branches/WebAdmin/perfSONARWebAdmin/auxiliary/xmlDB/existAuthenticatorImpl.java
===================================================================
---
branches/WebAdmin/perfSONARWebAdmin/auxiliary/xmlDB/existAuthenticatorImpl.java
2008-08-04 10:35:12 UTC (rev 4330)
+++
branches/WebAdmin/perfSONARWebAdmin/auxiliary/xmlDB/existAuthenticatorImpl.java
2008-08-05 10:58:59 UTC (rev 4331)
@@ -34,6 +34,7 @@

private Database database;

+ @SuppressWarnings("unused")
private UserManagementService adminService;

private XQueryService service;

Modified: branches/WebAdmin/perfSONARWebAdmin/test/Tester.java
===================================================================
--- branches/WebAdmin/perfSONARWebAdmin/test/Tester.java 2008-08-04
10:35:12 UTC (rev 4330)
+++ branches/WebAdmin/perfSONARWebAdmin/test/Tester.java 2008-08-05
10:58:59 UTC (rev 4331)
@@ -1,11 +1,8 @@
package perfSONARWebAdmin.test;

import java.io.IOException;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.Socket;
+
import java.net.UnknownHostException;
-import java.util.Enumeration;

public class Tester {




  • perfsonar: r4331 - in branches/WebAdmin/perfSONARWebAdmin: admin/service/soapclient admin/stitching auxiliary/sql auxiliary/sqlma auxiliary/stitching auxiliary/wizard auxiliary/xmlDB test, svnlog, 08/05/2008

Archive powered by MHonArc 2.6.16.

Top of Page