/*---------------------------------------------------------------*/
/* STANFORD UNIVERSITY NOTICES FOR SLAC SOFTWARE \*/
/* ON WHICH COPYRIGHT IS DISCLAIMED \*/
/* \*/
/\* AUTHORSHIP \*/
/\* This software was created by Yee-Ting Li, Stanford Linear \*/
/\* Accelerator Center, Stanford University. \*/
/* \*/
/\* ACKNOWLEDGEMENT OF SPONSORSHIP \*/
/\* This software was produced by the Stanford Linear Accelerator \*/
/\* Center, Stanford University, under Contract DE-AC03-76SFO0515 \*/
/\* with the Department of Energy. \*/
/* \*/
/\* GOVERNMENT DISCLAIMER OF LIABILITY \*/
/\* Neither the United States nor the United States Department of \*/
/\* Energy, nor any of their employees, makes any warranty, \*/
/\* express or implied, or assumes any legal liability or \*/
/\* responsibility for the accuracy, completeness, or usefulness \*/
/\* of any data, apparatus, product, or process disclosed, or \*/
/\* represents that its use would not infringe privately owned \*/
/\* rights. \*/
/* \*/
/\* STANFORD DISCLAIMER OF LIABILITY \*/
/\* Stanford University makes no representations or warranties, \*/
/\* express or implied, nor assumes any liability for the use of \*/
/\* this software. \*/
/* \*/
/\* STANFORD DISCLAIMER OF COPYRIGHT \*/
/\* Stanford University, owner of the copyright, hereby disclaims \*/
/\* its copyright and all other rights in this software. Hence, \*/
/\* anyone may freely use it for any purpose without restriction. \*/
/* \*/
/* \*/
/\* MAINTENANCE OF NOTICES \*/
/\* In the interest of clarity regarding the origin and status of \*/
/\* this SLAC software, this and all the preceding Stanford \*/
/\* University notices are to remain affixed to any copy or \*/
/\* derivative of this software made or distributed by the \*/
/\* recipient and are to be affixed to any copy of software made \*/
/\* or distributed by the recipient that contains a copy or \*/
/\* derivative of this software. \*/
/* \*/
/\* SLAC Software Notices, Set 4 (OTT.002a, 2004 FEB 03) \*/
/*---------------------------------------------------------------*/
/\* TracerouteResponseGenerator.java
\*
\* Created on January 2, 2007, 1:49 PM
\*
\* To change this template, choose Tools \| Template Manager
\* and open the template in the editor.
*/
package org.perfsonar.service.measurementArchive.sqlType.fetch;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Date;
import org.ggf.ns.nmwg.base.v2_0.Data;
import org.ggf.ns.nmwg.tools.traceroute.v2_0.Datum;
import org.perfsonar.commons.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.commons.auxiliary.ComponentNames;
import org.perfsonar.commons.auxiliary.components.logger.LoggerComponent;
import org.perfsonar.service.commons.exceptions.SystemException;
/*\*
\*
\* @author Mohammad Asif
\* Created on January 2, 2007, 1:49 PM
*/
public class TracerouteResponseGenerator extends ResponseGenerator {
/*\* Creates a new instance of TracerouteResponseGenerator \*/
public TracerouteResponseGenerator() throws SystemException{
super() ;
}
public Data getResponse(List resultList) throws Exception {
package org.perfsonar.service.measurementArchive.sqlType.fetch;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Date;
import org.ggf.ns.nmwg.base.v2_0.Data;
import org.ggf.ns.nmwg.tools.traceroute.v2_0.Datum;
import org.perfsonar.commons.auxiliary.AuxiliaryComponentManager;
import org.perfsonar.commons.auxiliary.ComponentNames;
import org.perfsonar.commons.auxiliary.components.logger.LoggerComponent;
import org.perfsonar.service.commons.exceptions.SystemException;
/*\*
\*
\* @author Mohammad Asif
\* Created on January 2, 2007, 1:49 PM
*/
public class TracerouteResponseGenerator extends ResponseGenerator {
Data data = new Data();
/*\* Creates a new instance of TracerouteResponseGenerator \*/
public TracerouteResponseGenerator() throws SystemException
{ super() ; }
for (int i = 0; i < resultList.size(); i++) {
public Data getResponse(List resultList) throws Exception {
Datum datum Data data = new DatumData();
for Map(int resultMapi = (Map) 0; i < resultList.getsize(); i++); {
Collection<String>Datum kCollectiondatum = ((Map)resultList.get(i)).keySet new Datum();
forMap (StringresultMap column= : kCollection) {
(Map) resultList.get(i);
ObjectCollection<String> valuekCollection = resultMap((Map)resultList.get(i)).keySet(column);
String className = value.getClass().getName(); for (String column : kCollection) {
StringObject strValuevalue = null;
resultMap.get(column);
ifString (className = value.equalsgetClass("java.lang.Float"))).getName();
String strValue = Float.toString((Float) value);null;
if (className.equals("java.lang.DoubleFloat"))
strValue = DoubleFloat.toString((DoubleFloat) value);
else if (className.equals("java.lang.IntegerDouble"))
strValue = IntegerDouble.toString((IntegerDouble) value);
else if (className.equals("java.lang.LongInteger"))
strValue = LongInteger.toString((LongInteger) value);
else if (className.equals("java.lang.DateLong"))
strValue = Long.toString((DateLong) value).toString();
else if (className.equals("java.lang.StringDate"))
strValue = (String) value;
if (strValue \!= null((Date) {
value).toString();
else if (columnclassName.equals("resultsjava.lang.String")) datum.setDatum(strValue);
strValue = (String) value;
}
; if (strValue \!= null)
{ if (column.equals("results")) datum.setDatum(strValue); }
}
data.addChild(datum);
}
return data;
}
public static void main (String \[\] arg )
{
{ }
} |