Package edu.harvard.hul.ois.fits.exceptions

Examples of edu.harvard.hul.ois.fits.exceptions.FitsToolException


      String md5Hash = MD5.asHex(MD5.getHash(new File(file.getPath())));
      Element signature = new Element("md5checksum",fitsNS);
      signature.setText(md5Hash);
      fileInfo.addContent(signature);
    } catch (IOException e) {
      throw new FitsToolException("Could not calculate the MD5 for "+file.getPath(),e);
    }
    //fslastmodified
    Element fslastmodified = new Element("fslastmodified",fitsNS);
    fslastmodified.setText(String.valueOf(file.lastModified()));
    fileInfo.addContent(fslastmodified);
View Full Code Here


  //Identification data about the image
  private List<ToolIdentity> identity = new ArrayList<ToolIdentity>();
 
  public ToolOutput(Tool tool, Document fitsXml, Document toolOutput) throws FitsToolException {
    if(Fits.validateToolOutput && fitsXml !=null && !validateXmlOutput(fitsXml)) {
      throw new FitsToolException(tool.getToolInfo().getName()+" "+
          tool.getToolInfo().getVersion() + " produced invalid FITS XML output");
    }
   
    this.tool = tool;
    this.toolOutput = toolOutput;
View Full Code Here

      Transformer transformer = templates.newTransformer();
      transformer.transform(docw, out);
      doc = out.getDocument();
    }
    catch(Exception e) {
      throw new FitsToolException(info.getName()+": Error converting output using "+xslt,e);
    }
    return doc;
  }
View Full Code Here

      infoCommand.addAll(unixCommand);
      info.setNote("mediainfo for unix");
    }
   
    else {
      throw new FitsToolException("MediaInfo was not found on this system");
    }
    infoCommand.add("--Version");
    versionOutput = CommandLine.exec(infoCommand,null)
    info.setVersion(versionOutput.trim());
    transformMap = XsltTransformMap.getMap(mediaInfoFitsConfig+"mediainfo_xslt_map.xml");
View Full Code Here

            //ensure the underlying stream is always closed
            scanner.close();
          }
      }
      catch (Exception e)  {
        throw new FitsToolException("Error parsing ADL file", e);
      }
     
      Element identification = new Element("identification",fitsNS);
      Element identity = new Element("identity",fitsNS);
      identity.setAttribute("format","Audio Decision List");
View Full Code Here

          jhoveApp = new App ("Jhove","1.5", new int[] {2009, 12, 23}, "","");
      xh.setApp(jhoveApp);
      xh.setBase(jhove);       
    }
    catch (JhoveException e) {
      throw new FitsToolException("Error initializing Jhove",e);
    }

    //initialize tool info
    info = new ToolInfo(jhoveApp.getName(),jhoveApp.getRelease(),jhove.getDate().toString());   
    transformMap = XsltTransformMap.getMap(jhoveFitsConfig+"jhove_xslt_map.xml");
View Full Code Here

      dom = characterize(file);
      String jhoveModule = XmlUtils.getDomValue(dom,"reportingModule");
      Module mod = jhove.getModule(jhoveModule);
      dom = getFileInfo(file,mod);
    } catch (Exception e) {
      throw new FitsToolException("Jhove error while processing "+file.getName(),e);
    }
    catch (OutOfMemoryError e) {
      throw new FitsToolException("Jhove OutOfMemoryError while processing "+file.getName());
    }
    String format = XmlUtils.getDomValue(dom,"format");
    String xsltTransform = (String)transformMap.get(format.toUpperCase());

    /* debug code
View Full Code Here

      infoCommand.addAll(UNIX_COMMAND);
    }
   
    else {
      //Tool cannot be used on this system
      throw new FitsToolException("File Utility cannot be used on this system");
    }
    infoCommand.add("-v");   
    versionOutput = CommandLine.exec(infoCommand,null);   
    String[] lines = versionOutput.split("\n");
    String firstLine = lines[0];
View Full Code Here

        e.printStackTrace();
      }*/
         
    }
    catch (JDOMException e) {
      throw new FitsToolException("Error parsing NLNZ Metadata Extractor XML output",e);
    }
    catch (Exception e) {
      // harvesting metadata failed
      throw new FitsToolException("NLNZ Metadata Extractor error while harvesting file "+file.getName(),e);   
    }
    finally {
      //done with the adapter output streams so close them
      try {
        adapterOutput.close();
        //tAdapterOutput.close();
      } catch (IOException e) {
        throw new FitsToolException("Error closing NLNZ Metadata Extractor XML output stream",e);
      }
    }

    //FileIdentity identity = null;
    Document fitsXml = null;
View Full Code Here

      infoCommand.addAll(unixCommand);
      info.setNote("exiftool for unix");
    }
   
    else {
      throw new FitsToolException("Exiftool cannot be used on this system");
    }
    infoCommand.add("-ver");
    versionOutput = CommandLine.exec(infoCommand,null)
    info.setVersion(versionOutput.trim());
    transformMap = XsltTransformMap.getMap(exiftoolFitsConfig+"exiftool_xslt_map.xml");
View Full Code Here

TOP

Related Classes of edu.harvard.hul.ois.fits.exceptions.FitsToolException

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.