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

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


                        }
                        // 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:
                        boolean matches = false;
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();
                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 (FileNotFoundException e) {
                    log.error("Failed to generate download URL. " + e);
                    return "";
                }
            }
View Full Code Here

            Collections.sort(runs, new RunComparator() );
            for( ExecutionRecordImpl exr : runs ) {
                //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();
                            
                    ResultsForDigitalObjectBean res = new ResultsForDigitalObjectBean(exr.getDigitalObjectReferenceCopy());
                    Double time = null;
                    boolean success = false;
                    // First, attempt to pull from stage records:
View Full Code Here

    /* (non-Javadoc)
     * @see eu.planets_project.tb.api.data.util.DataHandler#get(java.lang.String)
     */
    public DigitalObjectRefBean get(String id) {
        DigitalObjectRefBean dobr = null;
        // Lookup in Data Registry:
        try {
            dobr = this.findDOinDataRegistry(id);
        } catch (FileNotFoundException e1) {
            log.debug("File "+id+" not found in Data Registry. "+e1);
View Full Code Here

       
        // Check in the known locations for the files - look in each directory.
        if( file.exists() ) {
            this.log.debug("Found file: " +file.getAbsolutePath());
            // URGENT The file must be lodged somewhere!
            return new DigitalObjectRefBean(name, id, file);
        }
    throw new FileNotFoundException("Could not find file " + id);
       
    }
View Full Code Here

                if( leafname.contains("/") )
                {
                    // Strip any directory path information.
                    leafname = leafname.substring(leafname.lastIndexOf("/") + 1);
                }
                return new DigitalObjectRefBean(leafname, domUri.toString(), domUri, digitalObject);
            } catch (DigitalObjectNotFoundException e) {
                throw new FileNotFoundException("Could not find file " + id);
            }
        }
    throw new FileNotFoundException("Could not find file " + id);
View Full Code Here

      if(id==null) throw new DigitalObjectNotFoundException("id is null");

      // Fix up any encoding issues:
      id = PDURI.encodePlanetsUriStringAsUri(id).toASCIIString();
     
      DigitalObjectRefBean digoRef = dh.get(id);
      if(digoRef==null) throw new DigitalObjectNotFoundException("digital object "+id+" not found");
     
      // set the metadata if it's contained within the digital object
      DigitalObject object = digoRef.getDigitalObject();
      for(Metadata md : object.getMetadata()) {
        if(md.getName().equals(MIME_TYPE_METADATA_NAME))
          response.setContentType(md.getContent());
      }
     
      is = digoRef.getContentAsStream();
     
      // read from input stream and write to client
      int bytesRead = 0;
      byte[] buffer = new byte[BUFFER_SIZE];
      while((bytesRead=is.read(buffer))!=-1){
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.