Package gov.lanl.adore.djatoka

Examples of gov.lanl.adore.djatoka.IExtract


        int status = HttpServletResponse.SC_OK;
        ByteArrayOutputStream baos =  new ByteArrayOutputStream();
        try {
            baos = new ByteArrayOutputStream();
            ImageRecord r = ReferentManager.getImageRecord(contextObject.getReferent());
            IExtract jp2 = extractorFactory.getExtractorInstanceForFile(r.getImageFile());
            r = jp2.getMetadata(r);
            StringBuffer sb = new StringBuffer();
            sb.append("{");
            sb.append("\n\"identifier\": \"" + r.getIdentifier() + "\",");
            sb.append("\n\"imagefile\": \"" + r.getImageFile() + "\",");
            sb.append("\n\"width\": \"" + r.getWidth() + "\",");
View Full Code Here


    String responseFormat = "application/xml";;
    int status = HttpServletResponse.SC_OK;
    ByteArrayOutputStream baos =  new ByteArrayOutputStream();
      try {
      baos = new ByteArrayOutputStream();
      IExtract jp2 = new KduExtractExe();
      ImageRecord r = ReferentManager.getImageRecord(contextObject.getReferent());
      String[] xml = jp2.getXMLBox(r);
      StringBuffer sb = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            sb.append("<jp2:JP2XML xmlns:jp2=\"http://library.lanl.gov/2008-11/aDORe/JP2XML/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"  xsi:schemaLocation=\"http://library.lanl.gov/2008-11/aDORe/JP2XML/ http://purl.lanl.gov/aDORe/schemas/2008-11/JP2XML.xsd\"");           
            sb.append(" boxCount=\"" + ((xml != null) ? xml.length : 0) + "\">");
      if (xml != null) {
        for (String x : xml) {
View Full Code Here

        jp2.compressImage(img.getAbsolutePath(), jp2Local.getAbsolutePath(), new DjatokaEncodeParam());
        img.delete();
        img = jp2Local;
      } else {
        try {
          IExtract ex = new KduExtractExe();
          ex.getMetadata(new ImageRecord(uri.toString(), img.getAbsolutePath()));
        } catch (DjatokaException e) {
          throw new DjatokaException("Unknown JP2/JPX file format");
        }
      }
    } catch (Exception e) {
View Full Code Here

                    LOGGER.warn("File not deleted: {}", img);
                }
                img = jp2Local;
            } else {
                try {
                    final IExtract ex = new KduExtractExe();
                    ex.getMetadata(new ImageRecord(uri.toString(), img.getAbsolutePath()));
                } catch (final DjatokaException e) {
                    throw new DjatokaException("Unknown JP2/JPX file format");
                }
            }
        } catch (final Exception e) {
View Full Code Here

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        try {
            final ObjectMapper mapper = new ObjectMapper();
            final ObjectNode rootNode = mapper.createObjectNode();
            final IExtract jp2 = new KduExtractExe();

            ImageRecord r = ReferentManager.getImageRecord(contextObject.getReferent());
            r = jp2.getMetadata(r);

            rootNode.put("identifier", r.getIdentifier());
            rootNode.put("imagefile", r.getImageFile());
            rootNode.put("width", r.getWidth());
            rootNode.put("height", r.getHeight());
View Full Code Here

        String responseFormat = "application/xml";;
        int status = HttpServletResponse.SC_OK;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            baos = new ByteArrayOutputStream();
            IExtract jp2 = new KduExtractExe();
            ImageRecord r = ReferentManager.getImageRecord(contextObject.getReferent());
            String[] xml = jp2.getXMLBox(r);
            StringBuffer sb = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            sb.append("<jp2:JP2XML ");
            sb.append("xmlns:jp2=\"http://library.lanl.gov/2008-11/aDORe/JP2XML/\" ");
            sb.append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"  ");
            sb.append("xsi:schemaLocation=\"http://library.lanl.gov/2008-11/aDORe/JP2XML/ ");
View Full Code Here

TOP

Related Classes of gov.lanl.adore.djatoka.IExtract

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.