Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
/*---------------------------------------------------------------*/
/*          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() ;     }
   
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i < resultList.size(); i++) {

 public Data getResponse(List resultList) throws Exception {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Datum datum&nbsp;Data data = new DatumData();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for Map(int resultMapi = (Map) 0; i < resultList.getsize(); i++); {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Collection<String>Datum kCollectiondatum = ((Map)resultList.get(i)).keySet new Datum();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; forMap (StringresultMap column= : kCollection) {

&nbsp;&nbsp;&nbsp;&nbsp;(Map) resultList.get(i);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObjectCollection<String> valuekCollection = resultMap((Map)resultList.get(i)).keySet(column);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String className = value.getClass().getName(); for (String column : kCollection) {

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StringObject strValuevalue = null;
resultMap.get(column);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ifString (className = value.equalsgetClass("java.lang.Float"))).getName();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String strValue = Float.toString((Float) value);null;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (className.equals("java.lang.DoubleFloat"))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; strValue = DoubleFloat.toString((DoubleFloat) value);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (className.equals("java.lang.IntegerDouble"))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; strValue = IntegerDouble.toString((IntegerDouble) value);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (className.equals("java.lang.LongInteger"))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; strValue = LongInteger.toString((LongInteger) value);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (className.equals("java.lang.DateLong"))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; strValue = Long.toString((DateLong) value).toString();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (className.equals("java.lang.StringDate"))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strValue = (String) value;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (strValue \!= null((Date) {

value).toString();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; else if (columnclassName.equals("resultsjava.lang.String")) datum.setDatum(strValue);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strValue = (String) value;

&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
; if (strValue \!= null)
{                  if (column.equals("results")) datum.setDatum(strValue);                                   }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data.addChild(datum);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return data;

&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp; public static void main (String \[\] arg )
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
&nbsp;&nbsp;&nbsp;
{              }
&nbsp; &nbsp;
}