Package eu.planets_project.tb.impl.data.util

Examples of eu.planets_project.tb.impl.data.util.DataHandlerImpl


     if(expBean.getExperiment().getExperimentExecutable().getBatchExecutionRecords().size()!=lTempFileDownloadLinkForWEEWFResults.size()){
       lTempFileDownloadLinkForWEEWFResults = new ArrayList<String>();
       for(BatchExecutionRecordImpl batchRec : expBean.getExperiment().getExperimentExecutable().getBatchExecutionRecords()){
        if((batchRec.getWorkflowExecutionLog()!=null)&&(batchRec.getWorkflowExecutionLog().getSerializedWorkflowResult()!=null)){
          //create a temp file for this.
          DataHandler dh = new DataHandlerImpl();
          try {
            //get a temporary file
            File f = dh.createTempFileInExternallyAccessableDir();
            Writer out = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(f), "UTF-8" ) );
            out.write(batchRec.getWorkflowExecutionLog().getSerializedWorkflowResult());
            out.close();
            lTempFileDownloadLinkForWEEWFResults.add(""+dh.getHttpFileRef(f));
          } catch (Exception e) {
            log.debug("Error getting getTempFileDownloadLinkForWEEWFResults "+e);
            return new ArrayList<String>();
          }
        }
View Full Code Here


            int i = 1;
            for( ExecutionRecordImpl exr : batch.getRuns() ) {
                //log.info("Found Record... "+exr+" stages: "+exr.getStages());
                if( exr != null && exr.getStages() != null ) {
                    // Look up the object, so we can get the name.
                    DigitalObjectRefBean dh = new DataHandlerImpl().get(exr.getDigitalObjectReferenceCopy());
                    String dobName = "Object "+i;
                    if( dh != null ) dobName = dh.getName();

                    for( ExecutionStageRecordImpl exsr : exr.getStages() ) {
                        Double time = exsr.getDoubleMeasurement( TecRegMockup.PROP_SERVICE_TIME );
View Full Code Here

  /* (non-Javadoc)
   * @see eu.planets_project.tb.api.model.ExperimentExecutable#getInputHttpFileRef(java.lang.String)
   */
  public URI getInputHttpFileRef(String localFileRef) {
    DataHandler dh = new DataHandlerImpl();
    if(localFileRef!=null){
      try {
        return dh.get(localFileRef).getDownloadUri();
       
      } catch (FileNotFoundException e) {
        log.debug("Exception while building URI for InputFile");
      }
    }
View Full Code Here

  /* (non-Javadoc)
   * @see eu.planets_project.tb.api.model.ExperimentExecutable#getAllInputHttpDataEntries()
   */
  public Collection<URI> getAllInputHttpDataEntries(){
    List<URI> ret = new Vector<URI>();
    DataHandler dh = new DataHandlerImpl();
    Iterator<String> itInputData =  this.getInputData().iterator();
    while(itInputData.hasNext()){
      try {
        URI uri = dh.get(itInputData.next()).getDownloadUri();
        if(uri!=null){
          ret.add(uri);
        }
      } catch (FileNotFoundException e) {
        log.debug("Exception while building URI for all Input data");
View Full Code Here

  /* (non-Javadoc)
   * @see eu.planets_project.tb.api.model.ExperimentExecutable#getOutputHttpFileRef(java.lang.String)
   */
  public URI getOutputHttpFileRef(String localFileRef) {
    DataHandler dh = new DataHandlerImpl();
    if(localFileRef!=null){
      try {
        return dh.get(localFileRef).getDownloadUri();
       
      } catch (FileNotFoundException e) {
        log.debug("Exception while building URI for OutputFile");
      }
    }
View Full Code Here

  /* (non-Javadoc)
   * @see eu.planets_project.tb.api.model.ExperimentExecutable#getAllMigrationOutputHttpData()
   */
  public Collection<URI> getAllMigrationOutputHttpData(){
    List<URI> ret = new Vector<URI>();
    DataHandler dh = new DataHandlerImpl();
    Iterator<String> itOutputData =  this.getOutputData().iterator();
    while(itOutputData.hasNext()){
      try {
        URI uri = dh.get(itOutputData.next()).getDownloadUri();
        if(uri!=null){
          ret.add(uri);
        }
      } catch (FileNotFoundException e) {
        log.debug("Exception while building URI for all output data");
View Full Code Here

     * and writes it to a temporary file that's accessible via an external url ref.
     * This can be used within the browser to download the currentXMLConfig
     * @return
     */
    public String getTempFileDownloadLinkForCurrentXMLConfig(){
    DataHandler dh = new DataHandlerImpl();
    String currXMLConfig = buildXMLConfigFromCurrentConfiguration();
    if(currXMLConfig==null){
      return null;
    }
    //save it's hashcode - for caching purposes
    if((this.currXMLConfigHashCode!=-1)&&(this.currXMLConfigHashCode!=currXMLConfig.hashCode())){
      this.currXMLConfigHashCode =  currXMLConfig.hashCode();
     
      try {
        //get a temporary file
        File f = dh.createTempFileInExternallyAccessableDir();
        Writer out = new BufferedWriter( new OutputStreamWriter( new FileOutputStream(f), "UTF-8" ) );
        out.write(currXMLConfig);
        out.close();
        currXMLConfigTempFileURI = ""+dh.getHttpFileRef(f);
        return currXMLConfigTempFileURI;
      } catch (Exception e) {
        log.debug("Error getting TempFileDownloadLinkForCurrentXMLConfig "+e);
        return null;
      }
View Full Code Here

         */
        public String getDigitalObjectResult() {
      Object tbDigoURI = props.get(ExecutionRecordImpl.RESULT_PROPERTY_URI);
            String summary = "Run "+batchId+": ";
            if( tbDigoURI != null ) {
                DataHandler dh = new DataHandlerImpl();
                DigitalObjectRefBean dobr;
                try {
                    dobr = dh.get((String)tbDigoURI);
                } catch (FileNotFoundException e) {
                    log.error("Could not find file. "+e);
                    return "";
                }
                summary += dobr.getName();
View Full Code Here

         * e.g. https://localhost:8443/testbed/reader/download.jsp?fid=file%253A%252FD%253A%252FImplementation%252Fifr_server%252Fplanets-ftp%252Fusa_bundesstaaten_png.png
         * @return
         */
        private String getDigitalObjectDownloadURL(Object tbDigoURI) {
            if( tbDigoURI != null ) {
                DataHandler dh = new DataHandlerImpl();
                try {
                    DigitalObjectRefBean dobr = dh.get((String)tbDigoURI);
                    return dobr.getDownloadUri().toString();
                } catch (FileNotFoundException e) {
                    log.error("Failed to generate download URL. " + e);
                    return "";
                }
View Full Code Here

     * @param dob
     * @param exp
     * @return
     */
    public URI setDigitalObjectResult( DigitalObject dob, Experiment exp ) {
        DataHandler dh = new DataHandlerImpl();
        URI storeUri = dh.storeDigitalObject(dob, exp);
        return setDigitalObjectResult(storeUri, exp);
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.tb.impl.data.util.DataHandlerImpl

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.