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

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


        }
    }
   
    private String lookupFileName( String dobUri ) {
        DataHandler dh = DataHandlerImpl.findDataHandler();
        DigitalObjectRefBean dorb;
        try {
            dorb = dh.get(dobUri);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return "Missing file!";
        }
        return dorb.getName();
       
    }
View Full Code Here


    private void init( String file ) {
        // Populate using the results:
        DataHandler dh = DataHandlerImpl.findDataHandler();
        // Set up the DO name, etc
        setDigitalObject(file);
        DigitalObjectRefBean bean;
        try {
            bean = dh.get(file);
            setDownloadURL(bean.getDownloadUri().toString());
            setDigitalObjectName(DataHandlerImpl.createShortDOName(bean.getName()));
        } catch (Exception e) {
            setDownloadURL("");
            setDigitalObjectName(DataHandlerImpl.createShortDOName(file));
        }
        log.info("DigitalObjectBean initialised.");
View Full Code Here

        public String getDigitalObjectResult() {
            String summary = "";
            String tbDigoURI = this.getDobResultReference();
            if( tbDigoURI != null ) {
                DataHandler dh = new DataHandlerImpl();
                DigitalObjectRefBean dobr;
                try {
                    dobr = dh.get(tbDigoURI);
                } catch (FileNotFoundException e) {
                    log.error("Could not find file. "+e);
                    return "";
                }
                if( dobr == null ) return "";
                summary += dobr.getName();
                long size = dobr.getSize();
                if( size >= 0 ) {
                    summary += " ("+size+" bytes)";
                }
                return summary;
            }
View Full Code Here

         */
        private String getDigitalObjectDownloadURL(Object tbDigoURI) {
            if( tbDigoURI != null ) {
                DataHandler dh = new DataHandlerImpl();
                try {
                    DigitalObjectRefBean dobr = dh.get((String)tbDigoURI);
                    return dobr.getDownloadUri().toString();
                } catch ( Exception e ) {
                    log.error("Failed to generate download URL. " + e);
                    return "";
                }
            }
View Full Code Here

                  //iterate over all input files
                  for(String localFileRef : this.inputData.values()) {
                      // Clean up the localFileRef, so that the TB can cope with it's data store being moved.
                      //store a set of file BMGoals for every record item
                      DataHandler dh = new DataHandlerImpl();
                      DigitalObjectRefBean dorb = dh.get(localFileRef);
                      if( dorb != null ) {
                          URI inputFileURI = dorb.getDownloadUri();
                          Collection<BenchmarkGoal> colFileBMGoals = exp.getExperimentEvaluation().getEvaluatedFileBenchmarkGoals(inputFileURI);
                          if(colFileBMGoals==null)
                              throw new Exception("Exception while setting file benchmarks for record: "+inputFileURI);

                          for(BenchmarkGoal bmg : colFileBMGoals){
View Full Code Here

              boolean found = false;
            try {
              Map<String,String> map = new HashMap<String,String>();
              //retrieve URI
                String fInput = localFileRefs.get(key);
                DigitalObjectRefBean dobr = dh.get(fInput);
                if( dobr != null ) {
                    URI uri = dobr.getDownloadUri();
                    map.put("uri", uri.toString()) ;
                    map.put("name", this.createShortDoName(dobr) );
                    map.put("inputID", key);
                    ret.add(map);
                    found = true;
                } else {
                    log.error("Digital Object "+key+" could not be found!");
                }
          } catch (FileNotFoundException e) {
            log.error(e.toString());
          }
          // Catch lost items...
          if( !found ) {
                    Map<String,String> map = new HashMap<String,String>();
                    String fInput = localFileRefs.get(key);
                    map.put("uri", fInput);
                    map.put("name", "ERROR: Digital Object Not Found: " + getLeafnameFromPath(fInput));
                    map.put("inputID", key);
                    ret.add(map);
          }
          }
      }
      //when we're calling this in evaluate experiment -> fetch the external eval data refs
      if(expStage.equals("evaluate expeirment") && this.getEvaluationExternalDigoRefs() != null ){
        for(String digoRef : this.getEvaluationExternalDigoRefs()){
          try {
          Map<String,String> map = new HashMap<String,String>();
          DigitalObjectRefBean dobr = dh.get(digoRef);
          if(dobr != null ) {
            URI uri = dobr.getDownloadUri();
            map.put("uri", uri.toString()) ;
            map.put("name", this.createShortDoName(dobr) );
            map.put("inputID", dobr.getDomUri()+"");
            ret.add(map);
                } else {
                  log.error("Digital Object "+digoRef+" could not be found!");
                }
          } catch (FileNotFoundException e) {
View Full Code Here

        //mixing different objects within this map
        HashMap<String,Object> hm = new HashMap<String,Object>();
       //For the Input:
        try{
        //test: convert input to URI
                DigitalObjectRefBean dobr = dh.get(input);
          URI uriInput = dobr.getDownloadUri();
          //add "inputURI" and "inputName" into ret hashmap
          hm.put("input", uriInput.toString());
          hm.put("inputName", dobr.getName());
          hm.put("inputTypeURI", "URI");
         
        }
        catch(Exception e){
          //this input was not a file or fileRef not readable  - display as text
          hm.put("input", input);
          hm.put("inputName", null);
          hm.put("inputTypeURI", null);
        }
       
       //For the Output:
        try{
            //test: convert output to URI
                DigitalObjectRefBean dobr = dh.get(output);
            URI uriOutput = dobr.getDownloadUri();
            //add "outputURI" and "outputName" "outputType" into ret hashmap
          hm.put("output", uriOutput.toString());
          hm.put("outputName", dobr.getName());
          hm.put("outputTypeURI", "URI");
          }
          catch(Exception e){
            //this input was not a file or fileRef not readable  - display as text
            hm.put("output", output);
View Full Code Here

            DataHandler dh = new DataHandlerImpl();
            //file ref
            HtmlOutputText outputText = (HtmlOutputText) facesContext
                    .getApplication().createComponent(
                            HtmlOutputText.COMPONENT_TYPE);
            DigitalObjectRefBean dobr = dh.get(fileRef);
            outputText.setValue(" "+dobr.getName());
            outputText.setId("fileName" + key);
            //file name
            HtmlOutputLink link_src = (HtmlOutputLink) facesContext
                    .getApplication().createComponent(
                            HtmlOutputLink.COMPONENT_TYPE);
            link_src.setId("fileRef" + key);
            URI URIFileRef = dobr.getDownloadUri();
            link_src.setValue(URIFileRef);
            link_src.setTarget("_new");

            //CommandLink+Icon allowing to delete this entry
            HtmlCommandLink link_remove = (HtmlCommandLink) facesContext
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 );
                        // Look for timing:
                        if( time != null ) {
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 );
                        Double size = exsr.getDoubleMeasurement(TecRegMockup.PROP_DO_SIZE);
                        // Look for timing:
View Full Code Here

TOP

Related Classes of eu.planets_project.tb.api.data.util.DigitalObjectRefBean

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.