Package eu.planets_project.tb.api.data.util

Examples of eu.planets_project.tb.api.data.util.DataHandler


        //3. fill the file benchmark goals - used for evaluation of every input file
        boolean bError2 = false;
        Map<String,BenchmarkBean> mBMBs = expBean.getFileBenchmarkBeans();
        Map<URI,List<BenchmarkGoal>> mFileBMGs = new HashMap<URI,List<BenchmarkGoal>>();
        Iterator<String> itLocalInputFileRefs = expBean.getExperimentInputData().values().iterator();
        DataHandler dh = new DataHandlerImpl();
    
        //iterate over every input file and add update their evaluation
        BenchmarkGoal bmg =null;
        try {
          while(itLocalInputFileRefs.hasNext()){
          String localInputFileRef = itLocalInputFileRefs.next();
          URI inputURI = dh.get(localInputFileRef).getDownloadUri();
          List<BenchmarkGoal> lbmgs = new ArrayList<BenchmarkGoal>();
         
          for(BenchmarkBean b : mBMBs.values()){
            bmg = exp.getExperimentEvaluation().getEvaluatedFileBenchmarkGoal(inputURI, b.getID());
            //BenchmarkBean bmb = mBMBs.get(inputURI+b.getID());
View Full Code Here


                            time_s = ( run.getEndDate().getTimeInMillis() - run.getStartDate().getTimeInMillis() ) / 1000.0;
                        }
                        // Look for digital object:
                        long size = -1;
                        try {
                            DataHandler dh = DataHandlerImpl.findDataHandler();
                            DigitalObjectRefBean digitalObjectRefBean = dh.get( run.getDigitalObjectReferenceCopy() );
                            size = digitalObjectRefBean.getSize();
                        } catch ( Exception e) {
                            log.error("Failed to look up object "+run.getDigitalObjectReferenceCopy()+" "+e);
                        }
                        // Look for matching records:
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

  /* (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

         */
        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.api.data.util.DataHandler

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.