djatoka is open source Java software that builds upon a rich set of APIs and libraries to provide a service framework for the dynamic dissemination of JPEG 2000 image files.
Be the first to post a text review of djatoka. Rate and review a project by clicking thumbs up or thumbs down in the right column.
* New Features - Added Scaling Support + New OpenURL Service Format Parameter: "svc.scale" - Added JPX compositing layer extraction support (i.e. access to JPX frames) + New OpenURL Service Format Parameter: "svc.clayer" + Perform all djatoka functions on individual compositing layers + JPX compositing layer compression is not currently supported. - Added JP2 XML Box Support + New OpenURL Service: info:lanl-repo/svc/getJP2XML + Wraps JPEG 2000 XML Box records in a XML Schema defined wrapper schema - Dynamic Database IReferentResolver Implementation using JBDC/DBCP; DatabaseResolver - Remote Referent (e.g., http & ftp) Access Controls * Enhancements - Solaris-x86 Kakadu Binaries - Enhanced Windows Batch Files - Extended TIFF Input Support (e.g., CCITT/LZW/PB) - New info:lanl-repo/svc/ping Service to see if resource is available and ready - Multi-file Input Compression Support - Improved Logging Support - Improved InputStream Support - Improved Tile Caching Logic - Now accepts a wider range of possible JPEG 2000 file extensions - DjatokaImageMigrator now checks to see if bitstream is JP2 compatible if an file extension is not found. - Improved KduExtractExe & KduCompressExe handling of InputStreams - Improved Region Out of bounds handling
-------- Details -------- --- src/gov/lanl/adore/djatoka/kdu/KduExtractExe.java(revision 4) +++ src/gov/lanl/adore/djatoka/kdu/KduExtractExe.java(working copy) @@ -168,7 +168,6 @@ return bi; } } catch (Exception e) { -e.printStackTrace(); throw new DjatokaException(e); } } @@ -266,7 +265,6 @@ in = new BufferedInputStream(new FileInputStream(new File(input))); in.read(buf, 0, 12); } catch (IOException e) { - e.printStackTrace(); return false; } StringBuffer sb = new StringBuffer(buf.length * 2); @@ -297,13 +295,21 @@ // top if ((token = st.nextToken()).contains(".")) dims.add(Double.parseDouble(token)); -else +else { +int t = Integer.parseInt(token); +if (d[1] < t) +throw new DjatokaException("Region inset out of bounds: " + t + ">" + d[1]); dims.add(Double.parseDouble(token) / d[1]); +} // left if ((token = st.nextToken()).contains(".")) { dims.add(Double.parseDouble(token)); -} else +} else { +int t = Integer.parseInt(token); +if (d[0] < t) +throw new DjatokaException("Region inset out of bounds: " + t + ">" + d[0]); dims.add(Double.parseDouble(token) / d[0]); +} // height if ((token = st.nextToken()).contains(".")) { dims.add(Double.parseDouble(token)); Index: src/gov/lanl/adore/djatoka/openurl/DjatokaImageMigrator.java =================================================================== --- src/gov/lanl/adore/djatoka/openurl/DjatokaImageMigrator.java(revision 4) +++ src/gov/lanl/adore/djatoka/openurl/DjatokaImageMigrator.java(working copy) @@ -78,9 +78,9 @@ File urlLocal; // Obtain Resource InputStream src = IOUtils.getInputStream(uri.toURL()); -if (uri.toURL().toString().endsWith("tif") || uri.toURL().toString().endsWith("tiff")) { +if (uri.toURL().toString().toLowerCase().endsWith("tif") || uri.toURL().toString().toLowerCase().endsWith("tiff")) { urlLocal = File.createTempFile("convert" + uri.hashCode(), ".tif"); -} else if (uri.toURL().toString().endsWith("jp2")) { +} else if (uri.toURL().toString().toLowerCase().endsWith("jp2")) { urlLocal = File.createTempFile("cache" + uri.hashCode(), ".jp2"); } else { urlLocal = File.createTempFile("convert" + uri.hashCode(), ".img"); @@ -116,7 +116,7 @@ */ public File processImage(File img, URI uri) throws DjatokaException { String imgPath = img.getAbsolutePath(); -String fmt = formatMap.get(imgPath.substring(imgPath.lastIndexOf('.') + 1)); +String fmt = formatMap.get(imgPath.substring(imgPath.lastIndexOf('.') + 1).toLowerCase()); try { if (fmt == null || !fmt.equals(FORMAT_MIMEYPE_JP2)) { ICompress jp2 = new KduCompressExe(); Index: src/gov/lanl/adore/djatoka/openurl/SimpleListResolver.java =================================================================== --- src/gov/lanl/adore/djatoka/openurl/SimpleListResolver.java(revision 4) +++ src/gov/lanl/adore/djatoka/openurl/SimpleListResolver.java(working copy) @@ -93,6 +93,11 @@ } catch (Exception e) { throw new ResolverException(e); } + +} else if ((rftId.startsWith("http") || rftId.startsWith("file")) && !new File(ir.getImageFile()).exists()) { +// Handle ImageRecord in cache, but file does not exist on the file system +imgs.remove(rftId); +return getImageRecord(rftId); } return ir; } Index: src/gov/lanl/adore/djatoka/openurl/OpenURLJP2KService.java =================================================================== --- src/gov/lanl/adore/djatoka/openurl/OpenURLJP2KService.java(revision 4) +++ src/gov/lanl/adore/djatoka/openurl/OpenURLJP2KService.java(working copy) @@ -24,6 +24,7 @@ package gov.lanl.adore.djatoka.openurl; import gov.lanl.adore.djatoka.DjatokaDecodeParam; +import gov.lanl.adore.djatoka.DjatokaException; import gov.lanl.adore.djatoka.DjatokaExtractProcessor; import gov.lanl.adore.djatoka.io.FormatConstants; import gov.lanl.adore.djatoka.kdu.KduExtractExe; @@ -222,16 +223,23 @@ bytes = IOUtils.getBytesFromFile(new File(file)); } } +} catch (DjatokaException e) { + bytes = e.getMessage().getBytes(); +responseFormat = "text/plain"; +status = HttpServletResponse.SC_NOT_FOUND; } catch (Exception e) { -try { -bytes = e.getMessage().getBytes("UTF-8"); -} catch (UnsupportedEncodingException e1) { -e1.printStackTrace(); -} +bytes = e.getMessage().getBytes(); responseFormat = "text/plain"; status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } } + +if (bytes == null || bytes.length == 0) { + bytes = "".getBytes(); +responseFormat = "text/plain"; +status = HttpServletResponse.SC_NOT_FOUND; +} + HashMap<String, String> header_map = new HashMap<String, String>(); header_map.put("Content-Length", bytes.length + ""); header_map.put("Date", HttpDate.getHttpDate()); Index: src/gov/lanl/adore/djatoka/io/reader/PNMReader.java =================================================================== --- src/gov/lanl/adore/djatoka/io/reader/PNMReader.java(revision 4) +++ src/gov/lanl/adore/djatoka/io/reader/PNMReader.java(working copy) @@ -56,7 +56,7 @@ ImageDecoder enc = ImageCodec.createImageDecoder("PNM", new File(input), null); aid = new RenderedImageAdapter(enc.decodeAsRenderedImage()); } catch (IOException e) { -e.printStackTrace(); +return null; } return aid.getAsBufferedImage(); } @@ -73,7 +73,7 @@ ImageDecoder enc = ImageCodec.createImageDecoder("PNM", input, null); aid = new RenderedImageAdapter(enc.decodeAsRenderedImage()); } catch (IOException e) { -e.printStackTrace(); +return null; } return aid.getAsBufferedImage(); } Index: src/gov/lanl/adore/djatoka/util/IOUtils.java =================================================================== --- src/gov/lanl/adore/djatoka/util/IOUtils.java(revision 4) +++ src/gov/lanl/adore/djatoka/util/IOUtils.java(working copy) @@ -90,21 +90,28 @@ } public static InputStream getInputStream(URL location) throws Exception { - InputStream in; - try { - HttpURLConnection huc = (HttpURLConnection) (location.openConnection()); - int code = huc.getResponseCode(); - if (code == 200) { - in = huc.getInputStream(); - } else - throw new Exception("Cannot get " + location.toString()); - } catch (MalformedURLException e) { - throw new Exception("A MalformedURLException occurred for " + location.toString()); - } catch (IOException e) { - throw new Exception("An IOException occurred attempting to connect to " + location.toString()); - } - return in; - } +InputStream in; +if (location.getProtocol().equals("file")) { +in = new BufferedInputStream(new FileInputStream(location.getFile())); +} else { +try { +HttpURLConnection huc = (HttpURLConnection) (location.openConnection()); +int code = huc.getResponseCode(); +if (code == 200) { +in = huc.getInputStream(); +} else +throw new Exception("Cannot get " + location.toString()); +} catch (MalformedURLException e) { +throw new Exception("A MalformedURLException occurred for " ++ location.toString()); +} catch (IOException e) { +throw new Exception( +"An IOException occurred attempting to connect to " ++ location.toString()); +} +} +return in; +} public static OutputStream getOutputStream(URL location) throws Exception { return getOutputStream(getInputStream(location));
Sorry for the delay, but there is now a djatoka Windows x86-32 build available for download. The functionality is identical to the previous release, just with Windows support. The Windows binaries are included in the updated adore-djatoka-1.0.tar.gz release file. Release Notes: * Updated gov.lanl.adore.djatoka.kdu.KduExtractExe and gov.lanl.adore.djatoka.kdu.KduCompressExe * Added compress.bat, extract.bat, and tomcat.bat to match functionality in shell scripts * Updated INSTALL.txt to reflect slight differences in Windows set-up
Be the first person to add a text review.
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use
Thanks for your rating!
Would you also like to write a review?
Thanks for your review!
Get credit for your review by logging in via OpenID. Click your account provider: