Package eu.admire.seismo.metadata

Examples of eu.admire.seismo.metadata.Dataset


try
{   
     
  
   Dataset ds = new JSONDeserializer<Dataset>().deserialize(URLDecoder.decode((String) iterationData[0],"UTF-8"));
  
    
  
    
    String traceExpression="INSERT INTO trace (Station,Network,Channel,StartTime,EndTime,Samples,Frequency,DatasetID) VALUES";
    traceExpression=traceExpression+getInsertTraceExpression(ds, 0);
for (int j=1; j<ds.getTraceList().size();j++)
  
   traceExpression=","+traceExpression+getInsertTraceExpression(ds, j);
   
  
}
traceExpression=traceExpression+";";
    
         mOutputBlockWriterSQLExpression = getOutput(OUTPUT_XPRESSION_SQL);
   
         if(mOutputBlockWriterSQLExpression!=null)
           mOutputBlockWriterSQLExpression.write(traceExpression);
        
         mOutputBlockWriterMetadataString = getOutput(OUTPUT_METADATA_STRING);
        
         if(mOutputBlockWriterMetadataString!=null)
         {  JSONSerializer serializer = new JSONSerializer();
            mOutputBlockWriterMetadataString.write(serializer.include("traceList").serialize(ds));
         }
        
        

         mOutputBlockWriterDatasetId = getOutput(OUTPUT_ID);
        
         if(mOutputBlockWriterDatasetId!=null)
             mOutputBlockWriterDatasetId.write(ds.getDatasetId());
      
}
catch (PipeClosedException e)
View Full Code Here


try
{   
     
    validateInput(INPUT_METADATA_STRING);
   // validateInput(INPUT_STEPBACK);
  Dataset dsx = new JSONDeserializer<Dataset>().deserialize(URLDecoder.decode((String) iterationData[0],"UTF-8"));
  Dataset ds1 = new JSONDeserializer<Dataset>().deserialize(URLDecoder.decode((String) iterationData[3],"UTF-8"));
  Dataset ds2 = new JSONDeserializer<Dataset>().deserialize(URLDecoder.decode((String) iterationData[4],"UTF-8"));
 
  System.out.println("CREATING METADATA PREPRO "+dsx.getInstanceId());
  dsx.setStepbackId((String)iterationData[2]);
  dsx.setDatasetId(dsx.getDatasetId()+UUID.randomUUID());
   
    try{
      dsx.setUri((String) iterationData[1]);
   
    }catch (Exception e)
     {
       }
   
   
    String expression=getInsertXCDatasetExpression(dsx,ds1,ds2);
    this.executeInsert(expression);
   
  
    

         mOutputBlockWriterDatasetId = getOutput(OUTPUT_ID);
         if(mOutputBlockWriterDatasetId!=null){
           System.out.println("Producing Id "+dsx.getDatasetId()+" for "+dsx.getInstanceId());
        
             mOutputBlockWriterDatasetId.write(dsx.getDatasetId());
         }
        
         mOutputBlockWriterDatasetMetadata = getOutput(OUTPUT_METADATA);
         if(mOutputBlockWriterDatasetMetadata!=null)
         {
           XCDataset xcorr = new XCDataset();
           xcorr.setXcorrelationId(dsx.getDatasetId());
           xcorr.setCreationDate(dsx.getCreationDate());
           xcorr.setInputTrace1(ds1.getTraceList().get(0));
           xcorr.setInputTrace2(ds2.getTraceList().get(0));
           xcorr.setInstanceId(dsx.getInstanceId());
           xcorr.setParameters(dsx.getParameters());
           xcorr.setRequestId(dsx.getRequestId());
           xcorr.setUri(dsx.getUri());
          
View Full Code Here

           
          }
      //  System.out.println("station: "+station);
        if(station!=null&&!"".equals(station)){
       
        Dataset currentDs = new JSONDeserializer<Dataset>().deserialize(URLDecoder.decode(metadata,"UTF-8"));
      //  System.out.println("selected data size: "+selectedData.size());
       
       
         Iterator<Dataset> keys=selectedData.keySet().iterator();
         Dataset ds;
        
        if((ds=containsDataset(keys, currentDs))!=null){
          if(substitute(currentDs, ds)){
          System.out.println("substitute STA:"+currentDs.getTraceList().get(0).getStation()+" CH: "+currentDs.getTraceList().get(0).getChannel());
          selectedData.remove(ds);
            selectedData.put(currentDs, station);
          }else{
            System.out.println("skip STA:"+currentDs.getTraceList().get(0).getStation()+" CH: "+currentDs.getTraceList().get(0).getChannel());
            continue;
          }
        }   
        else if(containsDataset(keys, currentDs)==null){
          System.out.println("insert STA:"+currentDs.getTraceList().get(0).getStation()+" CH: "+currentDs.getTraceList().get(0).getChannel());
         
          selectedData.put(currentDs, station);
       
         
       
 
        } }
        //write output
      
        Iterator it=selectedData.keySet().iterator();
        JSONSerializer serializer = new JSONSerializer();
        while(it.hasNext()){
           mOutput.write(ControlBlock.LIST_BEGIN);
           Dataset key=(Dataset)it.next();
             mOutput.write(serializer.include("traceList").serialize(key));
             mOutput.write(selectedData.get(key));
             mOutput.write(ControlBlock.LIST_END);
           }
       
View Full Code Here

       
     
    }
       
    private Dataset containsDataset(Iterator<Dataset> datasets,Dataset currentDs){
      Dataset d=null;
      
       while(datasets!=null&&datasets.hasNext()){ 
         Dataset ds=datasets.next();
        // System.out.println("containsDataset current sta: "+currentDs.getTraceList().get(0).getStation()+" ch:"+currentDs.getTraceList().get(0).getChannel());
         //System.out.println("containsDataset ds sta: "+ds.getTraceList().get(0).getStation()+" ch:"+ds.getTraceList().get(0).getChannel());
         
         if(currentDs.getTraceList().get(0).getStation().equals(ds.getTraceList().get(0).getStation())
             &&currentDs.getTraceList().get(0).getChannel().equals(ds.getTraceList().get(0).getChannel())){
            d=ds;
            break;
         }    
       }
     
View Full Code Here

try
{   
     
    validateInput(INPUT_METADATA_STRING);
   // validateInput(INPUT_STEPBACK);
  Dataset ds = new JSONDeserializer<Dataset>().deserialize(URLDecoder.decode((String) iterationData[0],"UTF-8"));
  LOG.debug("CREATING METADATA PREPRO "+ds.getInstanceId());
    ds.setStepbackId((String)iterationData[2]);
    ds.setDatasetId(ds.getDatasetId()+UUID.randomUUID());
   
    try{
      ds.setUri((String) iterationData[1]);
   
    }catch (Exception e)
     {
       }
   
   
    String expression=getInsertDatasetExpression(ds);
    this.executeInsert(expression);
   

    if(ds.getTraceList()!=null && ds.getTraceList().size()>0)
    {
     
   
   
    String traceExpression="INSERT INTO trace (Station,Network,Channel,StartTime,EndTime,Samples,Frequency,DatasetID,TraceID) VALUES";
    traceExpression=traceExpression+getInsertTraceExpression(ds, 0);
    for (int j=1; j<ds.getTraceList().size();j++)
    { 
  
      traceExpression=","+traceExpression+getInsertTraceExpression(ds, j);
   
  
    }
    traceExpression=traceExpression+";";
    this.executeInsert(traceExpression);
   
    }
  
    

         mOutputBlockWriterDatasetId = getOutput(OUTPUT_ID);
         if(mOutputBlockWriterDatasetId!=null){
           LOG.debug("Producing Id "+ds.getDatasetId()+" for "+ds.getInstanceId());
             mOutputBlockWriterDatasetId.write(ds.getDatasetId());
         }
        
         mOutputBlockWriterDatasetMetadata = getOutput(OUTPUT_METADATA);
         if(mOutputBlockWriterDatasetMetadata!=null)
         {
           JSONSerializer serializer = new JSONSerializer();
             mOutputBlockWriterDatasetMetadata.write(URLEncoder.encode(serializer.include("traceList").serialize(ds),"UTF-8"));
         }
     
     
         LOG.debug("CREATED METADATA PREPRO "+ds.getInstanceId())
  
}
catch (SQLException e)
{
View Full Code Here

try
{   
     
  
  Dataset ds = new JSONDeserializer<Dataset>().deserialize(URLDecoder.decode((String) iterationData[0],"UTF-8"));
  ds.setDatasetId(ds.getDatasetId()+UUID.randomUUID());
  ds.setStepbackId((String)iterationData[2]);
    ds.setUri((String)iterationData[1]);
  
    String datasetExpression=getInsertDatasetExpression(ds);
   
   
    
         mOutputBlockWriterSQLDatasetExpression = getOutput(OUTPUT_XPRESSION_SQL);
   
         if(mOutputBlockWriterSQLDatasetExpression!=null)
           mOutputBlockWriterSQLDatasetExpression.write(datasetExpression);
      
         mOutputBlockWriterDatasetId = getOutput(OUTPUT_ID);
        
         if(mOutputBlockWriterDatasetId!=null)
             mOutputBlockWriterDatasetId.write(ds.getDatasetId());
        
      
         mOutputBlockWriterMetadataString = getOutput(OUTPUT_METADATA_STRING);
    
         if(mOutputBlockWriterMetadataString!=null)
View Full Code Here

TOP

Related Classes of eu.admire.seismo.metadata.Dataset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.