svn - r33510 - in branches/2.5.x/modules/unsupported/jp2kakadu/src: main/java/org/geotools/coverageio/jp2kak test/java/org/geotools/coverageio/jp2kak

1 message Options
Embed this post
Permalink
svn_geotools

svn - r33510 - in branches/2.5.x/modules/unsupported/jp2kakadu/src: main/java/org/geotools/coverageio/jp2kak test/java/org/geotools/coverageio/jp2kak

Reply Threaded More More options
Print post
Permalink
Author: danieleromagnoli
Date: 2009-07-07 11:14:19 -0400 (Tue, 07 Jul 2009)
New Revision: 33510

Modified:
   branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/JP2KReader.java
   branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/RasterLayerResponse.java
   branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/Utils.java
   branches/2.5.x/modules/unsupported/jp2kakadu/src/test/java/org/geotools/coverageio/jp2kak/ServiceTest.java
Log:
Improved UNC management; fixed service test leveraging on JUNIT 4

Modified: branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/JP2KReader.java
===================================================================
--- branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/JP2KReader.java 2009-07-07 14:08:15 UTC (rev 33509)
+++ branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/JP2KReader.java 2009-07-07 15:14:19 UTC (rev 33510)
@@ -93,8 +93,6 @@
  /** Logger. */
  private final static Logger LOGGER = org.geotools.util.logging.Logging.getLogger(JP2KReader.class);
 
- final static ExecutorService multiThreadedLoader= new ThreadPoolExecutor(4,8,30,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>());
-
  /** The system-dependent default name-separator character. */
     private final static char SEPARATOR = File.separatorChar;
 
@@ -102,25 +100,6 @@
             0xbd, 0x08, 0x3d, 0x4b, 0x43, 0xa5, 0xae, 0x8c, 0xd7, 0xd5, 0xa6,
             0xce, 0x03 };
 
-    static{
- try{
- //check if our jp2k plugin is in the path
- final String kakaduJp2Name=it.geosolutions.imageio.plugins.jp2k.JP2KKakaduImageReaderSpi.class.getName();
- Class.forName(kakaduJp2Name);
-
- // imageio jp2k reader
- final String standardJp2Name=com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderSpi.class.getName();
-
- final boolean succeeded=ImageIOUtilities.replaceProvider(ImageReaderSpi.class, kakaduJp2Name, standardJp2Name, "JPEG2000");
-         if(!succeeded)
-         LOGGER.warning("Unable to set ordering between JP2K readers spi");
-        
- } catch (ClassNotFoundException e) {
- LOGGER.log(Level.SEVERE,"Unable to load specific JP2K reader spi",e);
- }
-        
- }
-    
     /**
      * Creates a new instance of a {@link JP2KReader}. I assume nothing about
      * file extension.

Modified: branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/RasterLayerResponse.java
===================================================================
--- branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/RasterLayerResponse.java 2009-07-07 14:08:15 UTC (rev 33509)
+++ branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/RasterLayerResponse.java 2009-07-07 15:14:19 UTC (rev 33510)
@@ -16,8 +16,6 @@
  */
 package org.geotools.coverageio.jp2kak;
 
-import it.geosolutions.imageio.imageioimpl.imagereadmt.CloneableImageReadParam;
-
 import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Rectangle;
@@ -28,9 +26,11 @@
 import java.awt.image.SampleModel;
 import java.io.File;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Constructor;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
@@ -371,20 +371,23 @@
  final RasterManager rasterManager) {
  this.request = request;
  inputURL = rasterManager.getInputURL();
- File tempFile;
+ File tempFile = null;
  try {
- tempFile = new File(this.inputURL.toURI());
- } catch (URISyntaxException e) {
+ if (inputURL.getProtocol().equalsIgnoreCase("file"))
+                    tempFile = new File(URLDecoder.decode(inputURL.getFile(),
+                            "UTF-8"));
+ else
+ throw new IllegalArgumentException("unsupported input:" + inputURL.toString());
+ }
+ catch (UnsupportedEncodingException e) {
  throw new IllegalArgumentException(e);
- }// TODO improve me
+ }
+
  location = tempFile.getAbsolutePath();
  coverageEnvelope = rasterManager.getCoverageEnvelope();
  this.coverageFactory = rasterManager.getCoverageFactory();
  this.rasterManager = rasterManager;
  transparentColor=request.getInputTransparentColor();
-// finalTransparentColor=request.getOutputTransparentColor();
- // are we doing multithreading?
-// multithreadingAllowed= request.isMultithreadingAllowed();
  useMultithreading = request.isUseMultithreading();
 
  }

Modified: branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/Utils.java
===================================================================
--- branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/Utils.java 2009-07-07 14:08:15 UTC (rev 33509)
+++ branches/2.5.x/modules/unsupported/jp2kakadu/src/main/java/org/geotools/coverageio/jp2kak/Utils.java 2009-07-07 15:14:19 UTC (rev 33510)
@@ -6,6 +6,7 @@
 import it.geosolutions.imageio.imageioimpl.imagereadmt.CloneableImageReadParam;
 import it.geosolutions.imageio.imageioimpl.imagereadmt.DefaultCloneableImageReadParam;
 import it.geosolutions.imageio.stream.input.FileImageInputStreamExt;
+import it.geosolutions.imageio.utilities.ImageIOUtilities;
 
 import java.awt.Color;
 import java.awt.Rectangle;
@@ -24,6 +25,7 @@
 import javax.imageio.ImageIO;
 import javax.imageio.ImageReadParam;
 import javax.imageio.ImageReader;
+import javax.imageio.spi.ImageReaderSpi;
 import javax.imageio.stream.ImageInputStream;
 
 import org.apache.commons.io.FilenameUtils;
@@ -42,14 +44,39 @@
 import org.opengis.referencing.datum.PixelInCell;
 
 /**
- * Sparse utilities for the various mosaic classes. I use them to extract
+ * Sparse utilities for the various classes. I use them to extract
  * complex code from other places.
  *
  * @author Simone Giannecchini, GeoSolutions S.A.S.
  *
  */
 class Utils {
+
  /**
+ * Logger.
+ */
+ final static Logger LOGGER = org.geotools.util.logging.Logging
+ .getLogger(Utils.class.toString());
+
+ static{
+ try{
+ //check if our jp2k plugin is in the path
+ final String kakaduJp2Name=it.geosolutions.imageio.plugins.jp2k.JP2KKakaduImageReaderSpi.class.getName();
+ Class.forName(kakaduJp2Name);
+
+ // imageio jp2k reader
+ final String standardJp2Name=com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReaderSpi.class.getName();
+
+ final boolean succeeded=ImageIOUtilities.replaceProvider(ImageReaderSpi.class, kakaduJp2Name, standardJp2Name, "JPEG2000");
+         if(!succeeded)
+         LOGGER.warning("Unable to set ordering between JP2K readers spi");
+        
+ } catch (ClassNotFoundException e) {
+ LOGGER.log(Level.SEVERE,"Unable to load specific JP2K reader spi",e);
+ }
+ }
+
+ /**
  * {@link AffineTransform} that can be used to go from an image datum placed
  * at the center of pixels to one that is placed at ULC.
  */
@@ -69,11 +96,6 @@
  .getPixelTranslation(PixelInCell.CELL_CORNER));
 
  /**
- * Logger.
- */
- final static Logger LOGGER = org.geotools.util.logging.Logging
- .getLogger(Utils.class.toString());
- /**
  * Defaut wildcard for creating mosaics.
  */
  static final String DEFAULT_WILCARD = "*.*";

Modified: branches/2.5.x/modules/unsupported/jp2kakadu/src/test/java/org/geotools/coverageio/jp2kak/ServiceTest.java
===================================================================
--- branches/2.5.x/modules/unsupported/jp2kakadu/src/test/java/org/geotools/coverageio/jp2kak/ServiceTest.java 2009-07-07 14:08:15 UTC (rev 33509)
+++ branches/2.5.x/modules/unsupported/jp2kakadu/src/test/java/org/geotools/coverageio/jp2kak/ServiceTest.java 2009-07-07 15:14:19 UTC (rev 33510)
@@ -22,6 +22,7 @@
 import org.geotools.coverage.grid.io.GridFormatFactorySpi;
 import org.geotools.coverage.grid.io.GridFormatFinder;
 import org.junit.Assert;
+import org.junit.Test;
 import org.opengis.referencing.FactoryException;
 import org.opengis.referencing.NoSuchAuthorityCodeException;
 
@@ -37,7 +38,7 @@
     public ServiceTest() {
     }
 
-
+    @Test
     public void testIsAvailable() throws NoSuchAuthorityCodeException, FactoryException {
         if (!JP2KTest.testingEnabled()) {
             return;


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
GeoTools-commits mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-commits