svn - r34347 - in trunk/modules/unsupported: . idl-process idl-process/src idl-process/src/main idl-process/src/main/java idl-process/src/main/java/org idl-process/src/main/java/org/geotools idl-process/src/main/java/org/geotools/process idl-process/src/main/java/org/geotools/process/idl idl-process/src/main/java/org/geotools/process/idl/impl idl-process/src/main/java/org/geotools/process/impl idl-process/src/main/java/org/geotools/process/impl/util idl-process/src/main/resources idl-process/src/main/resources/META-INF idl-process/src/main/resources/META-INF/services idl-process/src/site idl-process/src/site/apt idl-process/src/test idl-process/src/test/java idl-process/src/test/java/org idl-process/src/test/java/org/geotools idl-process/src/test/java/org/geotools/process idl-process/src/test/java/org/geotools/process/idl idl-process/src/test/java/org/geotools/process/idl/impl idl-process/src/test/resources idl-process/src/test/resources/org idl-process/src/test/reso urces/org/geotools idl-process/src/test/resources/org/geotools/process idl-process/src/test/resources/org/geotools/process/idl idl-process/src/test/resources/org/geotools/process/idl/impl idl-process/src/test/resources/org/geotools/process/idl/impl/test-data

1 message Options
Embed this post
Permalink
svn_geotools

svn - r34347 - in trunk/modules/unsupported: . idl-process idl-process/src idl-process/src/main idl-process/src/main/java idl-process/src/main/java/org idl-process/src/main/java/org/geotools idl-process/src/main/java/org/geotools/process idl-process/src/main/java/org/geotools/process/idl idl-process/src/main/java/org/geotools/process/idl/impl idl-process/src/main/java/org/geotools/process/impl idl-process/src/main/java/org/geotools/process/impl/util idl-process/src/main/resources idl-process/src/main/resources/META-INF idl-process/src/main/resources/META-INF/services idl-process/src/site idl-process/src/site/apt idl-process/src/test idl-process/src/test/java idl-process/src/test/java/org idl-process/src/test/java/org/geotools idl-process/src/test/java/org/geotools/process idl-process/src/test/java/org/geotools/process/idl idl-process/src/test/java/org/geotools/process/idl/impl idl-process/src/test/resources idl-process/src/test/resources/org idl-process/src/test/reso urces/org/geotools idl-process/src/test/resources/org/geotools/process idl-process/src/test/resources/org/geotools/process/idl idl-process/src/test/resources/org/geotools/process/idl/impl idl-process/src/test/resources/org/geotools/process/idl/impl/test-data

Reply Threaded More More options
Print post
Permalink
Author: danieleromagnoli
Date: 2009-11-09 08:56:45 -0500 (Mon, 09 Nov 2009)
New Revision: 34347

Added:
   trunk/modules/unsupported/idl-process/
   trunk/modules/unsupported/idl-process/pom.xml
   trunk/modules/unsupported/idl-process/src/
   trunk/modules/unsupported/idl-process/src/main/
   trunk/modules/unsupported/idl-process/src/main/java/
   trunk/modules/unsupported/idl-process/src/main/java/org/
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLExecutionException.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLObjectWrapper.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLProcess.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLProcessFactory.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLWrapperPoolableFactory.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/PrintingProgressListener.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/BaseIDLObjectWrapper.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDL-process.ucls
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcess.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcessFactory.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionWrapper.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLMainFeatureExtractionProcess.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLMainFeatureExtractionProcessFactory.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GeoserverIngestionProcess.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GeoserverIngestionProcessFactory.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GetCoverageProcess.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GetCoverageProcessFactory.java
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/util/
   trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/util/Utilities.java
   trunk/modules/unsupported/idl-process/src/main/resources/
   trunk/modules/unsupported/idl-process/src/main/resources/META-INF/
   trunk/modules/unsupported/idl-process/src/main/resources/META-INF/services/
   trunk/modules/unsupported/idl-process/src/main/resources/META-INF/services/org.geotools.process.ProcessFactory
   trunk/modules/unsupported/idl-process/src/main/resources/psg_fx__define.pro
   trunk/modules/unsupported/idl-process/src/main/resources/ta__define.pro
   trunk/modules/unsupported/idl-process/src/site/
   trunk/modules/unsupported/idl-process/src/site/apt/
   trunk/modules/unsupported/idl-process/src/site/apt/review.apt
   trunk/modules/unsupported/idl-process/src/test/
   trunk/modules/unsupported/idl-process/src/test/java/
   trunk/modules/unsupported/idl-process/src/test/java/org/
   trunk/modules/unsupported/idl-process/src/test/java/org/geotools/
   trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/
   trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/
   trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/IDLBaseTestCase.java
   trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/
   trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/ArrayTest.java
   trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/IDLProcessTest.java
   trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/IDLWrapperTest.java
   trunk/modules/unsupported/idl-process/src/test/resources/
   trunk/modules/unsupported/idl-process/src/test/resources/org/
   trunk/modules/unsupported/idl-process/src/test/resources/org/geotools/
   trunk/modules/unsupported/idl-process/src/test/resources/org/geotools/process/
   trunk/modules/unsupported/idl-process/src/test/resources/org/geotools/process/idl/
   trunk/modules/unsupported/idl-process/src/test/resources/org/geotools/process/idl/impl/
   trunk/modules/unsupported/idl-process/src/test/resources/org/geotools/process/idl/impl/test-data/
   trunk/modules/unsupported/idl-process/src/test/resources/org/geotools/process/idl/impl/test-data/testin.tif
Log:
adding idl-process module

Added: trunk/modules/unsupported/idl-process/pom.xml
===================================================================
--- trunk/modules/unsupported/idl-process/pom.xml                        (rev 0)
+++ trunk/modules/unsupported/idl-process/pom.xml 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- =======================================================================    
+        Maven Project Configuration File                                        
+                                                                                
+        The Geotools Project                                                    
+            http://www.geotools.org/                                           
+                                                                                
+        Version: $Id: pom.xml 4678 2009-05-19 07:14:20Z daniele $              
+     ======================================================================= -->
+  <project xmlns="http://maven.apache.org/POM/4.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
+                               http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.geotools</groupId>
+    <artifactId>unsupported</artifactId>
+    <version>2.7-SNAPSHOT</version>
+  </parent>
+
+
+  <!-- =========================================================== -->
+  <!--   Properties and Profiles                                   -->
+  <!--       explanation of their effect.                          -->
+  <!--                                                             -->
+  <!--   Available profiles are:                                   -->
+  <!--                                                             -->
+  <!--     nameOfprofile      Explantion of what the profile does  -->
+  <!--                        for the user.                        -->
+  <!--                                                             -->
+  <!--     Example:           mvn -PnameOfprofile install          -->
+  <!--                                                             -->
+  <!--     Note ...                                                -->
+  <!-- =========================================================== -->
+  <!-- Default setting of properties -->
+  
+  <properties>
+    <IDL_HOME>${env.IDL_HOME}</IDL_HOME>
+  </properties>
+  
+  <!-- Profiles set on the command-line to override default properties. -->
+  <!--
+  <profiles>
+    <profile>
+      <id>nameOfprofile</id>
+      <properties>
+        <nameOfproperty>valueOfsetting</nameOfproperty>
+      </properties>
+    </profile>
+  </profiles>
+  -->
+  
+
+  <!-- =========================================================== -->
+  <!--     Module Description                                      -->
+  <!-- =========================================================== -->
+  <groupId>org.geotools</groupId>
+  <artifactId>gt-idl-process</artifactId>
+  <packaging>jar</packaging>
+  <name>IDL Based Process</name>
+  <url>http://maven.geotools.fr/reports/modules/unsupported/process/</url>
+
+  <scm>
+    <connection>
+      scm:svn:http://svn.geotools.org/trunk/modules/unsupported/process/
+    </connection>
+    <url>http://svn.geotools.org/trunk/modules/unsupported/process/</url>
+  </scm>
+
+  <description>
+    This is an API for creating processes/operations.
+  </description>
+  
+  <organization>
+    <name></name>
+    <url></url>
+  </organization>
+  
+  <!-- for your project. -->
+  <inceptionYear></inceptionYear>
+
+  <!-- Pick your license. -->
+  <!--
+  <licenses>
+    <license>
+      <name>Lesser General Public License (LGPL)</name>
+      <url>http://www.gnu.org/copyleft/lesser.txt</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+  -->
+
+
+  <!-- =========================================================== -->
+  <!--     Dependency Mangement                                    -->
+  <!-- =========================================================== -->
+  <dependencies>
+    <dependency>
+      <groupId>org.geotools</groupId>
+      <artifactId>gt-process</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.geotools</groupId>
+      <artifactId>gt-sample-data</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.geotools</groupId>
+      <artifactId>gt-epsg-hsql</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.idl</groupId>
+      <artifactId>javaidlb</artifactId>
+      <version>7</version>
+      <!--scope>system</scope>
+      <systemPath>${IDL_HOME}/resource/bridges/export/java/javaidlb.jar</systemPath>-->
+      
+    </dependency>
+  </dependencies>
+
+
+  <!-- =========================================================== -->
+  <!--     Build Configuration                                     -->
+  <!--         copies all JARs in a single directory.              -->
+  <!-- =========================================================== -->
+  <build>
+
+    <plugins>
+      <!-- ====    Compilation      ============================== -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <!-- ====    Switch commenting to skip tests    = -->
+          <skip>${allow.test.skip}</skip>
+          <!-- skip>true</skip> -->
+          <includes>
+            <include></include>
+          </includes>
+          <excludes>
+            <exclude></exclude>
+          </excludes>
+        </configuration>
+      </plugin>
+
+      <!-- ====    Testing          ============================== -->
+      <!-- ====    Code Formatting  ============================== -->
+      <!--
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>jalopy-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>format</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      -->
+      <!-- ====    Code Coverage    ============================== -->
+      <!--
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clover-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal></goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      -->
+    </plugins>
+
+  </build>
+  <repositories>
+    <repository>
+      <id>geosolutions</id>
+      <name>GeoSolutions libraries repository</name>
+      <url>http://mvn.geo-solutions.it/</url>
+    </repository>
+  </repositories>
+
+</project>

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLExecutionException.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLExecutionException.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLExecutionException.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,57 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl;
+
+public class IDLExecutionException extends Exception{
+    
+    /**
+     *
+     */
+    private static final long serialVersionUID = 7572300203990368917L;
+
+    public IDLExecutionException() {
+        
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message.
+     *
+     * @param message the detail message, saved for later retrieval by the {@link #getMessage} method.
+     */
+    public IDLExecutionException(final String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new exception with the specified cause.
+     *
+     * @param cause the cause, saved for later retrieval by the {@link Throwable#getCause} method.
+     */
+    public IDLExecutionException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message and cause.
+     *
+     * @param message the detail message, saved for later retrieval by the {@link #getMessage} method.
+     * @param cause the cause, saved for later retrieval by the {@link Throwable#getCause} method.
+     */
+    public IDLExecutionException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLObjectWrapper.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLObjectWrapper.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLObjectWrapper.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,48 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.opengis.util.ProgressListener;
+
+import com.idl.javaidl.JIDLObjectI;
+import com.idl.javaidl.JIDLString;
+
+public interface IDLObjectWrapper extends JIDLObjectI{
+    
+    /**
+     * Invokes the underlying IDL function with the proper set of input parameters as specified
+     * by the Map. Note that the Map shall be an instance of {@link LinkedHashMap} in order to
+     * preserve parameters order.
+     *
+     * @param inputParameters an instance of {@link LinkedHashMap} containing input parameters
+     * @return the result of the processing as a {@link JIDLString}.
+     * @throws IDLExecutionException
+     *
+     */
+    public JIDLString execute(final Map<String, Object> inputParameters) throws IDLExecutionException;
+    
+    /**
+     * Set a ProgressListener for this {@link IDLObjectWrapper}
+     *
+     * @param listener
+     */
+    public void setProgressListener(final ProgressListener listener);
+    
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLProcess.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLProcess.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLProcess.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,104 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.geotools.process.ProcessFactory;
+import org.geotools.process.idl.impl.BaseIDLObjectWrapper;
+import org.geotools.process.impl.AbstractProcess;
+import org.geotools.util.logging.Logging;
+import org.opengis.util.ProgressListener;
+
+import com.idl.javaidl.JIDLString;
+
+/**
+ * Main IDL Generic process abstract class.
+ * It exposes the IDL Processing capabilities as a {@link Process}.
+ */
+public abstract class IDLProcess extends AbstractProcess{
+
+ private final static Logger LOGGER = Logging
+ .getLogger("org.geotools.process.idl");
+
+    //TODO: move to upper class.
+    protected ProcessFactory getProcessFactory(){
+        return factory;
+    }
+    
+    protected IDLProcess(final ProcessFactory factory/*, final BaseIDLObjectWrapper wrapper*/) {
+        super(factory);
+    }
+    
+    /**
+     * Default Process execute implementation
+     */
+    public Map<String, Object> execute(final Map<String, Object> input,
+            ProgressListener monitor) {
+        
+        // Get a pooled object from the factory
+        Map<String,Object> result;
+        IDLObjectWrapper wrapper = null;
+        try{
+            wrapper = (IDLObjectWrapper) ((IDLProcessFactory)getProcessFactory()).getWrapper();
+            wrapper.setProgressListener(monitor);
+            final JIDLString idlresult = wrapper.execute(input);
+            result = new HashMap<String, Object>();
+            boolean noRes = false;
+            if (idlresult == null || idlresult.stringValue() == null ||
+             idlresult.stringValue().trim().length() == 0)
+             noRes = true;
+            if (!noRes)
+             result.put("result", new String(idlresult.stringValue()));
+            else{
+             final StringBuilder sb = new StringBuilder("No result have been provided by the IDL processing");
+             final String errorMessage = ((BaseIDLObjectWrapper)wrapper).getLastNotifiedError();
+             if (errorMessage != null && errorMessage.length()>0)
+             sb.append(" due to the error: ").append(errorMessage);
+             if (LOGGER.isLoggable(Level.SEVERE))
+                 LOGGER.severe(sb.toString());
+             return Collections.emptyMap();            
+            }
+
+        } catch (NoSuchElementException e){
+         if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe("No more wrappers available to execute the process");
+         return Collections.emptyMap();
+            
+        } catch(IDLExecutionException e){
+         if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe("IDL Execution exception occured during IDL process execution:" + e.getLocalizedMessage());
+         return Collections.emptyMap();
+            
+        } catch (Exception e) {
+         if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe(e.getLocalizedMessage());
+         return Collections.emptyMap();
+        }
+        finally{
+            //Return the wrapper to the pool
+            if (wrapper != null)
+                ((IDLProcessFactory)getProcessFactory()).returnWrapper(wrapper);
+        }
+        return result;
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLProcessFactory.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLProcessFactory.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLProcessFactory.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,143 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.logging.Logger;
+
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.geotools.factory.OptionalFactory;
+import org.geotools.process.Process;
+import org.geotools.process.impl.SingleProcessFactory;
+
+/**
+ * Factory for IDL Processes.
+ */
+public abstract class IDLProcessFactory extends SingleProcessFactory {
+
+    /** The IDL folder containing IDL *.pro files */
+    protected final static String IDL_LIB_FOLDER;
+    
+    /** The System's File separator char: / or \ depending on the OS */
+    protected final static String FILE_SEPARATOR = System.getProperty("file.separator");
+    
+    protected final static Logger LOGGER = Logger.getLogger("org.geotools.process.idl");
+    
+    private final static DateFormat df = new SimpleDateFormat("yyyyMMddhhmmss");
+
+    /** A Wrapper pool */
+    private GenericObjectPool wrapperPool;
+
+    private static boolean init = false;
+
+    private static boolean isIDLAvailable;
+    
+    public static boolean isIDLAvailable() {
+ return isIDLAvailable;
+ }
+
+ public abstract Process create();  
+
+    static {
+        loadIDL();
+        final String IDL_HOME = System.getenv("IDL_HOME");
+        if (IDL_HOME == null ||IDL_HOME.length()==0){
+            LOGGER.warning("IDL_HOME variable need to be defined");
+            IDL_LIB_FOLDER="";
+        }
+        else{
+            IDL_LIB_FOLDER = new StringBuilder(IDL_HOME).append(FILE_SEPARATOR)
+            .append("lib").toString();
+        }
+    }
+
+    /**
+     * Return true in case this {@link OptionalFactory} is available
+     */
+    public boolean isAvailable() {
+        return isIDLAvailable();
+    }
+
+    /**
+     * Load IDL Lib to check everything needed to support IDL processes, is on its place.
+     */
+    private synchronized static void loadIDL() {
+        if (init == false)
+            init = true;
+        else
+            return;
+        try {
+            // Try loading a required IDL libraries
+            System.loadLibrary("idl_ebutil");
+            isIDLAvailable = true;
+        } catch (UnsatisfiedLinkError e) {
+            LOGGER.warning("Unable to load IDL DLLs");
+            isIDLAvailable = false;
+        }
+    }
+
+    /**
+     * Return the wrapper pool.
+     * @return the wrapper pool.
+     */
+    public GenericObjectPool getWrapperPool() {
+        return wrapperPool;
+    }
+
+    /**
+     * Set the wrapper pool for this factory.
+     * @param wrapperPool the pool to be used for this factory.
+     */
+    protected void setWrapperPool(final GenericObjectPool wrapperPool) {
+        this.wrapperPool = wrapperPool;
+    }
+
+    /**
+     * Produce a timeStamp for the current time.
+     * @return a String timestamp in the form yyyyMMddhhmmss.
+     */
+    public static String getTimeStamp() {
+        return df.format(new Date(System.currentTimeMillis()));
+    }
+
+    /**
+     * Call this method when the process have produced its result and it is no
+     * more needed and then needs to be returned to the pool.
+     *
+     * @param process
+     */
+    void returnWrapper(final IDLObjectWrapper wrapper) {
+        try {
+            wrapperPool.returnObject(wrapper);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Obtain a wrapper from the pool.
+     *
+     * @return
+     * @throws Exception
+     */
+    IDLObjectWrapper getWrapper() throws Exception {
+            return (IDLObjectWrapper)wrapperPool.borrowObject();
+    }
+  
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLWrapperPoolableFactory.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLWrapperPoolableFactory.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/IDLWrapperPoolableFactory.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,103 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.commons.pool.PoolableObjectFactory;
+import org.geotools.process.idl.impl.BaseIDLObjectWrapper;
+
+/**
+ * A PoolableFactory needed to handle {@link IDLObjectWrapper} instances
+ */
+public abstract class IDLWrapperPoolableFactory implements
+        PoolableObjectFactory {
+
+    protected final static Logger LOGGER = Logger.getLogger("org.geotools.process.idl");
+    
+    /** The IDLProcessFactory used by this PoolableFactory to create processes */
+    private IDLProcessFactory factory;
+
+    /** Process name prefix created by this factory */
+    private String processNamePrefix;
+
+    /**
+     * The {@link IDLWrapperPoolableFactory} constructor.
+     * @param factory
+     * the factory used to instance IDL processes.
+     * @param processNamePrefix
+     * the name prefix of any process instanced by this factory.
+     */
+    public IDLWrapperPoolableFactory(final IDLProcessFactory factory,
+            final String processNamePrefix) {
+        this.factory = factory;
+        this.processNamePrefix = processNamePrefix;
+    }
+
+    /**
+     * @see org.apache.commons.pool.PoolableObjectFactory
+     */
+    public abstract void destroyObject(Object wrapper)  throws Exception;
+
+    /**
+     * @see org.apache.commons.pool.PoolableObjectFactory
+     */
+    public abstract Object makeObject() throws Exception;
+    
+    /**
+     * @see org.apache.commons.pool.PoolableObjectFactory
+     */
+    public void activateObject(Object wrapper) throws Exception {
+     final BaseIDLObjectWrapper theWrapper = (BaseIDLObjectWrapper)wrapper;
+         theWrapper.setLastNotifiedError("");
+    }
+
+    /**
+     * @see org.apache.commons.pool.PoolableObjectFactory
+     */
+    public void passivateObject(Object wrapper) throws Exception {
+         final IDLObjectWrapper theWrapper = (IDLObjectWrapper)wrapper;
+         theWrapper.setProgressListener(null);
+    }
+
+    /**
+     * @see org.apache.commons.pool.PoolableObjectFactory
+     */
+    public boolean validateObject(Object wrapper) {
+        IDLObjectWrapper theWrapper = (IDLObjectWrapper)wrapper;
+        if (LOGGER.isLoggable(Level.FINE))
+            LOGGER.log(Level.FINE, theWrapper.toString());
+        return theWrapper.isObjectCreated();
+    }
+
+    /**
+     * Return the process name prefix of this factory.
+     * @return Return the process name prefix.
+     */
+    public String getProcessNamePrefix() {
+        return processNamePrefix;
+    }
+
+    /**
+     * Return the {@link IDLProcessFactory} used by this {@link PoolableObjectFactory}.
+     * @return
+     */
+    public IDLProcessFactory getFactory() {
+        return factory;
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/PrintingProgressListener.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/PrintingProgressListener.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/PrintingProgressListener.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,136 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.geotools.util.logging.Logging;
+import org.opengis.util.InternationalString;
+import org.opengis.util.ProgressListener;
+
+/**
+ * Test Purpose class which handle progress by printing on Logger.
+ */
+public class PrintingProgressListener implements ProgressListener{
+
+ private final static Logger LOGGER = Logging.getLogger("org.geotools.process.idl");
+
+ /** The progress percentage */
+    private float progressPercent;
+    
+    /** The operation description */
+    private String description;
+    
+    /** The task description */
+    private InternationalString task;
+    
+    /**
+     * @see org.opengis.util.ProgressListener
+     */
+    public void complete() {
+     if (LOGGER.isLoggable(Level.INFO))
+     LOGGER.info("Completed");
+    }
+
+    /**
+     * @see org.opengis.util.ProgressListener
+     */
+    public void dispose() {
+        
+    }
+
+    /**
+     * @see org.opengis.util.ProgressListener
+     */
+    public void exceptionOccurred(Throwable arg0) {
+    }
+
+    /** Return the operation description */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Return the current progress as percent completed
+     * @see org.opengis.util.ProgressListener
+     */
+    public float getProgress() {
+        return progressPercent;
+    }
+
+    /**
+     * Return the description of the current task being performed.
+     * @see org.opengis.util.ProgressListener
+     */
+    public InternationalString getTask() {
+        return task;
+    }
+
+    /**
+     * Return {@code true} if this job is canceled.
+     * @see org.opengis.util.ProgressListener
+     */
+    public boolean isCanceled() {
+        return false;
+    }
+
+    /**
+     * Notify the listener of progress.
+     * @see org.opengis.util.ProgressListener
+     */
+    public void progress(final float progress) {
+        progressPercent = progress;
+        if (LOGGER.isLoggable(Level.INFO))
+     LOGGER.info("Progress:" + Float.toString(progress));
+    }
+
+    public void setCanceled(boolean canceled) {
+    }
+
+    /**
+     * Set the description of the operation.
+     * @see org.opengis.util.ProgressListener
+     */
+    public void setDescription(final String description) {
+        this.description = description;
+    }
+
+    /**
+     * Set the description of the current task being performed.
+     * @see org.opengis.util.ProgressListener
+     */
+    public void setTask(final InternationalString task) {
+        this.task = task;
+        if (LOGGER.isLoggable(Level.INFO))
+     LOGGER.info(task.toString());
+    }
+
+    /**
+     * Notifies the listener that the operation begins.
+     * @see org.opengis.util.ProgressListener
+     */
+    public void started() {
+     if (LOGGER.isLoggable(Level.INFO))
+     LOGGER.info("Started");
+    }
+
+    public void warningOccurred(String arg0, String arg1, String arg2) {
+    
+    }
+
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/BaseIDLObjectWrapper.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/BaseIDLObjectWrapper.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/BaseIDLObjectWrapper.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,357 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.geotools.process.Process;
+import org.geotools.process.idl.IDLExecutionException;
+import org.geotools.process.idl.IDLObjectWrapper;
+import org.geotools.text.Text;
+import org.geotools.util.logging.Logging;
+import org.opengis.util.ProgressListener;
+
+import com.idl.javaidl.JIDLArray;
+import com.idl.javaidl.JIDLByte;
+import com.idl.javaidl.JIDLDouble;
+import com.idl.javaidl.JIDLException;
+import com.idl.javaidl.JIDLFloat;
+import com.idl.javaidl.JIDLInteger;
+import com.idl.javaidl.JIDLLong;
+import com.idl.javaidl.JIDLNotifyListener;
+import com.idl.javaidl.JIDLNumber;
+import com.idl.javaidl.JIDLObject;
+import com.idl.javaidl.JIDLObjectI;
+import com.idl.javaidl.JIDLOutputListener;
+import com.idl.javaidl.JIDLShort;
+import com.idl.javaidl.JIDLString;
+
+/**
+ * Base Implementation of {@link IDLObjectWrapper}.
+ * Instances of this class will be used by {@link Process}es
+ * based on IDL capabilities.
+ */
+public abstract class BaseIDLObjectWrapper extends JIDLObject
+    implements IDLObjectWrapper, JIDLNotifyListener, JIDLOutputListener{
+
+ private final static Logger LOGGER = Logging
+ .getLogger("org.geotools.process.idl.impl");
+
+ private static final long serialVersionUID = -3079444720037881431L;
+
+ /** Method prefix to be found in order to use reflection */
+    private final static String EXPOSED_METHOD_PREFIX = "_IDL__";
+    
+    private final static String ERROR_PREFIX = "FX ERROR";
+    
+    private String lastNotifiedError;
+    
+    /**
+     * Return the last notified error.
+     * @return
+     */
+    public String getLastNotifiedError() {
+ return lastNotifiedError;
+ }
+
+    /**
+     * Set the last notified error content.
+     * @param lastNotifiedError
+     */
+ public void setLastNotifiedError(String lastNotifiedError) {
+ this.lastNotifiedError = lastNotifiedError;
+ }
+
+ /**
+ * {@link BaseIDLObjectWrapper} constructor.
+ * @param className
+ * @param processName
+ */
+ protected BaseIDLObjectWrapper(final String className, final String processName){
+        super(className,processName);
+    }
+    
+    /** A listener for this IDL Object Wrapper */
+    private ProgressListener progressListener;
+    
+    
+    /**
+     * Call the wrapper's function with the specified set of input parameters.
+     * Note that the incoming map should become pre-ordered in order to assign the proper
+     * input parameters to the related wrapper's argument.  
+     * @throws IDLExecutionException
+     */
+    public JIDLString execute(final Map<String, Object> inputParameters) throws IDLExecutionException{
+        Map<String, Object>  parameters = null;
+        
+        // Wrap JAVA primitive types to proper IDL Objects to be used by the
+        // incoming IDL's function call
+        if (inputParameters != null && !inputParameters.isEmpty()){
+            parameters = wrap(inputParameters);
+        }
+        
+        final Method[] methods = this.getClass().getMethods();
+        JIDLString result = null;
+        
+        // Variables to check conditions needed to successful method invocation
+        boolean methodInvoked = false;
+        boolean parameterSizeMatch = false;
+        boolean parametersTypeMatch = true;
+
+        //Find the proper method
+        for (Method method: methods){
+            if (method.getName().startsWith(EXPOSED_METHOD_PREFIX)){
+                final Class<?>[] parameterTypes = method.getParameterTypes();
+                final int size = parameterTypes.length;
+                
+                // //
+                //
+                // 1st check: Parameter size match
+                //
+                // //
+                if (parameters.size() == size) {
+                    parameterSizeMatch = true;
+                    final Object[] args = new Object[size];
+                    final Iterator<String> keys = parameters.keySet().iterator();
+
+                    // Set arguments
+                    for (int i = 0; i < size; i++) {
+                        final Object value = ((LinkedHashMap<String, Object>) parameters)
+                                .get(keys.next());
+                        final Class<?> parameterClass = parameterTypes[i];
+                        
+                        // //
+                        //
+                        // 2nd check: Parameter types match
+                        //
+                        // //
+                        if (!(parameterClass.isInstance(value))) {
+                            parametersTypeMatch = false;
+                            break;
+                        }
+                        else
+                            args[i] = value;
+                    }
+                    if (parametersTypeMatch) {
+                        try {
+                            result = (JIDLString) method.invoke(this, args);
+                        } catch (IllegalArgumentException e) {
+                            throw new IDLExecutionException(
+                                    "Invoking IDL method:" + e.getLocalizedMessage(), e);
+                        } catch (IllegalAccessException e) {
+                            throw new IDLExecutionException(
+                                    "Invoking IDL method:" + e.getLocalizedMessage(), e);
+                        } catch (InvocationTargetException e) {
+                            final Throwable e1 = e.getCause();
+                            if (e1 != null && e1 instanceof JIDLException) {
+                                // This step is suggested in the IDL-Bridges
+                                // documentation.
+                                // Needs further investigation
+                                this.executeString("MESSAGE, /RESET");
+                                throw new IDLExecutionException(
+                                        "Invoking IDL method:" + e1.getMessage(), e);
+                            }
+                            throw new IDLExecutionException(
+                                    "Invoking IDL method:" + e.getMessage(), e);
+                        } finally {
+                         if (lastNotifiedError != null && lastNotifiedError.length()>0)
+                         if (LOGGER.isLoggable(Level.WARNING))
+                         LOGGER.warning("IDL Algorithm Error Message:" + lastNotifiedError);
+                        }
+                        methodInvoked = true;
+                        break;
+                    }
+                }
+                else {
+                    parameterSizeMatch = false;
+                }
+            }
+        }
+        // //
+        //
+        // Check method invocation have been done
+        //
+        // //
+        if (!methodInvoked){
+            final StringBuilder sb = new StringBuilder("No valid IDL function have been found ");
+            if (!parameterSizeMatch)
+                sb.append("having the proper number of arguments");
+            else
+                sb.append("having the proper type of arguments");
+            throw new IDLExecutionException(sb.toString());
+        }
+        return result;
+    }
+
+    /**
+     * Catch the IDL Notify and propagate the message to the progress listener.
+     */
+    public void OnIDLNotify(JIDLObjectI idlObject, final String task, final String value) {
+    
+     // Look for an IDL Error
+     if (task != null && task.length()>0 && task.equalsIgnoreCase(ERROR_PREFIX))
+     lastNotifiedError = value;
+    
+     // Notify the progress
+     if (progressListener != null){
+     final StringBuilder taskText = new StringBuilder(task);
+            float progress = Float.NaN;
+            try{
+                progress = Float.parseFloat(value);
+                
+            }catch(NumberFormatException nfe){
+                //TODO: Does nothing. Maybe, no progress percent have been notified.
+                progress = Float.NaN;
+            }
+            if (Float.isNaN(progress)){
+                taskText.append(":").append(value);
+                progressListener.setTask(Text.text(taskText.toString()));
+            }
+            else{
+                progressListener.progress(progress);
+            }
+        }
+        
+    }
+    
+
+    public void IDLoutput(JIDLObjectI object, String val) {
+        //Default implementation actually does nothing
+    }
+
+    /**
+     * Return the progress listener attached to this {@link IDLObjectWrapper}
+     * @return
+     */
+    public ProgressListener getProgressListener() {
+        return progressListener;
+    }
+
+    /**
+     * Set the progress listener for this {@link IDLObjectWrapper}
+     * @return
+     */
+    public void setProgressListener(ProgressListener progressListener) {
+        this.progressListener = progressListener;
+    }
+    
+    /**
+     * Builds a Map containing proper JIDL entities to be used by the {@link IDLObjectWrapper},
+     * by wrapping the Java Object entities contained in the input map.
+     *  
+     * TODO: Handle JIDLObjectI types
+     */
+    private static Map<String,Object> wrap(final Map<String,Object> params){
+        if (params == null || params.size() == 0)
+            throw new IllegalArgumentException("Provided parameters map is not valid");
+        final int size = params.size();
+      
+        //prepare the wrapped parameters Map
+        final Map<String,Object> wrapped = new LinkedHashMap<String, Object>(size);
+        final Iterator<String> paramsIt = params.keySet().iterator();
+        
+        // Loop over the params
+        while (paramsIt.hasNext()){
+            final String key = paramsIt.next();
+            final Object value = params.get(key);
+            if (value instanceof String){
+                wrapped.put(key, new JIDLString((String)value));
+            }
+            else if (value instanceof Number){
+                wrapped.put(key, wrapNumber((Number)value));
+            }
+            else if (value instanceof String[] ||
+                    value instanceof Number[]){
+                wrapped.put(key, wrapArray((Object[])value));
+            }
+            else if (value instanceof byte[] ||
+                value instanceof short[] ||
+                value instanceof int[] ||
+                value instanceof long[] ||
+                value instanceof float[] ||
+                value instanceof double[]){
+                wrapped.put(key, wrapPrimitiveArray(value));
+            }
+            else
+                throw new IllegalArgumentException("Unsupported param type: " + value.getClass());
+        }
+        return wrapped;
+    }
+
+    /**
+     * Wrap a Java Array of primitives to a {@link JIDLArray}
+     */
+    private static JIDLArray wrapPrimitiveArray(Object value) {
+        final JIDLArray array = new JIDLArray(value);
+        return array;
+    }
+
+    /**
+     * Wrap a Java Array of Objects to a {@link JIDLArray}
+     */
+    private static JIDLArray wrapArray(Object[] value) {
+        if (value == null || value.length == 0){
+           throw new IllegalArgumentException("Provided Object array is null or empty");
+        }
+        final JIDLArray array = new JIDLArray(value);
+        return array;
+    }
+
+    /**
+     * Setup a proper {@link JIDLNumber} from a Java {@link Number}
+     *
+     * @param value the Java {@link Number} to be transformed to a {@link JIDLNumber}
+     * @return the wrapping {@link JIDLNumber}
+     */
+    private static JIDLNumber wrapNumber(final Number value) {
+        if (value == null)
+            throw new NullPointerException("Provided Number is null");
+        if (value instanceof Byte)
+            return new JIDLByte(value.byteValue());
+        else if (value instanceof Short)
+            return new JIDLShort(value.shortValue());
+        else if (value instanceof Integer)
+            return new JIDLInteger(value.intValue());
+        else if (value instanceof Long)
+            return new JIDLLong(value.longValue());
+        else if (value instanceof Float)
+            return new JIDLFloat(value.floatValue());
+        else if (value instanceof Double)
+            return new JIDLDouble(value.doubleValue());
+        else
+            throw new IllegalArgumentException("Unsupported Number type");
+    }
+
+    @Override
+    public String toString() {
+        if (isObjectCreated()){
+            final StringBuffer buffer = new StringBuffer();
+            buffer.append("IDL Process Name: ").append(getProcessName()).
+            append("\n IDLObject Class Name: ").append(getIDLObjectClassName()).
+            append("\n IDLObject Variable Name: ").append(getIDLObjectVariableName());
+            return buffer.toString();
+        }
+        else
+            return "No Underlying IDL Object available";
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDL-process.ucls
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDL-process.ucls                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDL-process.ucls 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,221 @@
+<class-diagram version="0.9.86" icons="true" always-add-relationships="false" generalizations="true" realizations="true"
+  associations="true" dependencies="true" nesting-relationships="true">  
+  <class corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.idl.impl.BaseIDLObjectWrapper"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/BaseIDLObjectWrapper.java"
+    binary="false">    
+    <position x="112" y="258" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </class>  
+  <class corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.idl.impl.IDLFeatureExtractionWrapper"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionWrapper.java"
+    binary="false">    
+    <position x="112" y="359" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </class>  
+  <class corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.idl.impl.IDLFeatureExtractionProcessFactory"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcessFactory.java"
+    binary="false">    
+    <position x="412" y="359" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </class>  
+  <class corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.idl.IDLProcess"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcess.java" binary="false">    
+    <position x="603" y="140" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </class>  
+  <interface corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.idl.IDLObjectWrapper"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLObjectWrapper.java" binary="false">    
+    <position x="217" y="181" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </interface>  
+  <class corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.idl.IDLProcessFactory"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcessFactory.java" binary="false">    
+    <position x="333" y="258" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </class>  
+  <class corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.idl.IDLWrapperPoolableFactory"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLWrapperPoolableFactory.java"
+    binary="false">    
+    <position x="142" y="58" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </class>  
+  <class corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.impl.AbstractProcess"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="C:/Users/daniele/.m2/repository/org/geotools/gt-process/2.7-SNAPSHOT/gt-process-2.7-SNAPSHOT.jar"
+    binary="true">    
+    <position x="603" y="63" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </class>  
+  <interface corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.Process"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="C:/Users/daniele/.m2/repository/org/geotools/gt-process/2.7-SNAPSHOT/gt-process-2.7-SNAPSHOT.jar"
+    binary="true">    
+    <position x="461" y="63" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </interface>  
+  <class corner="BOTTOM_RIGHT" language="java" name="org.geotools.process.idl.impl.IDLFeatureExtractionProcess"
+    project="gt-idl-process-2.7-SNAPSHOT"
+    file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcess.java"
+    binary="false">    
+    <position x="603" y="258" width="-1" height="-1"/>    
+    <display autosize="true" package="true" initial-value="false" signature="true" visibility="false">      
+      <attributes public="false" package="false" protected="false" private="false"/>      
+      <operations public="false" package="false" protected="false" private="false"/>    
+    </display>  
+  </class>  
+  <generalization>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLProcess"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcess.java" binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.impl.AbstractProcess"
+      file="C:/Users/daniele/.m2/repository/org/geotools/gt-process/2.7-SNAPSHOT/gt-process-2.7-SNAPSHOT.jar"
+      binary="true"/>  
+  </generalization>  
+  <dependency>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLProcess"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcess.java" binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLProcessFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcessFactory.java" binary="false"/>  
+  </dependency>  
+  <realization>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.impl.BaseIDLObjectWrapper"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/BaseIDLObjectWrapper.java"
+      binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLObjectWrapper"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLObjectWrapper.java" binary="false"/>  
+  </realization>  
+  <association>    
+    <bendpoint x="332" y="126"/>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLWrapperPoolableFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLWrapperPoolableFactory.java"
+      binary="false" navigable="false">      
+      <attribute name="factory"/>      
+      <multiplicity minimum="0" maximum="1"/>    
+    </source>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLProcessFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcessFactory.java" binary="false"
+      navigable="true"/>    
+    <display labels="true" multiplicity="true"/>  
+  </association>  
+  <dependency>    
+    <source project="gt-idl-process-2.7-SNAPSHOT"
+      name="org.geotools.process.idl.impl.IDLFeatureExtractionProcessFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcessFactory.java"
+      binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.impl.IDLFeatureExtractionProcess"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcess.java"
+      binary="false"/>  
+  </dependency>  
+  <generalization>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.impl.IDLFeatureExtractionWrapper"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionWrapper.java"
+      binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.impl.BaseIDLObjectWrapper"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/BaseIDLObjectWrapper.java"
+      binary="false"/>  
+  </generalization>  
+  <dependency>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLProcess"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcess.java" binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLObjectWrapper"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLObjectWrapper.java" binary="false"/>  
+  </dependency>  
+  <generalization>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.impl.IDLFeatureExtractionProcess"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcess.java"
+      binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLProcess"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcess.java" binary="false"/>  
+  </generalization>  
+  <generalization>    
+    <source project="gt-idl-process-2.7-SNAPSHOT"
+      name="org.geotools.process.idl.impl.IDLFeatureExtractionProcessFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcessFactory.java"
+      binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLProcessFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcessFactory.java" binary="false"/>  
+  </generalization>  
+  <dependency>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLWrapperPoolableFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLWrapperPoolableFactory.java"
+      binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLObjectWrapper"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLObjectWrapper.java" binary="false"/>  
+  </dependency>  
+  <dependency>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.impl.IDLFeatureExtractionProcess"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcess.java"
+      binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLProcessFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcessFactory.java" binary="false"/>  
+  </dependency>  
+  <dependency>    
+    <source project="gt-idl-process-2.7-SNAPSHOT"
+      name="org.geotools.process.idl.impl.IDLFeatureExtractionProcessFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcessFactory.java"
+      binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.Process"
+      file="C:/Users/daniele/.m2/repository/org/geotools/gt-process/2.7-SNAPSHOT/gt-process-2.7-SNAPSHOT.jar"
+      binary="true"/>  
+  </dependency>  
+  <realization>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.impl.AbstractProcess"
+      file="C:/Users/daniele/.m2/repository/org/geotools/gt-process/2.7-SNAPSHOT/gt-process-2.7-SNAPSHOT.jar"
+      binary="true"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.Process"
+      file="C:/Users/daniele/.m2/repository/org/geotools/gt-process/2.7-SNAPSHOT/gt-process-2.7-SNAPSHOT.jar"
+      binary="true"/>  
+  </realization>  
+  <dependency>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLProcessFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLProcessFactory.java" binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLObjectWrapper"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLObjectWrapper.java" binary="false"/>  
+  </dependency>  
+  <dependency>    
+    <source project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.IDLWrapperPoolableFactory"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/IDLWrapperPoolableFactory.java"
+      binary="false"/>    
+    <target project="gt-idl-process-2.7-SNAPSHOT" name="org.geotools.process.idl.impl.BaseIDLObjectWrapper"
+      file="/gt-idl-process-2.7-SNAPSHOT/src/main/java/org/geotools/process/idl/impl/BaseIDLObjectWrapper.java"
+      binary="false"/>  
+  </dependency>  
+  <classifier-display autosize="true" package="true" initial-value="false" signature="true" visibility="false">    
+    <attributes public="true" package="false" protected="false" private="false"/>    
+    <operations public="true" package="false" protected="false" private="false"/>  
+  </classifier-display>  
+  <association-display labels="true" multiplicity="true"/>
+</class-diagram>
\ No newline at end of file

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcess.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcess.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcess.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,33 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl.impl;
+
+import org.geotools.process.idl.IDLProcess;
+import org.geotools.process.idl.IDLProcessFactory;
+
+/**
+ * IDL FeatureExtraction process implementation, simply extending the
+ * abstract {@link IDLProcess} process class.
+ */
+public class IDLFeatureExtractionProcess extends IDLProcess {
+
+    public IDLFeatureExtractionProcess(
+            final IDLProcessFactory idlProcessFactory) {
+        super(idlProcessFactory);
+    }
+
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcessFactory.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcessFactory.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionProcessFactory.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,159 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl.impl;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.geotools.data.Parameter;
+import org.geotools.process.Process;
+import org.geotools.process.idl.IDLProcessFactory;
+import org.geotools.process.idl.IDLWrapperPoolableFactory;
+import org.geotools.text.Text;
+import org.opengis.util.InternationalString;
+
+/**
+ * Factory definition of the Feature Extraction processing functionalities.
+ */
+public class IDLFeatureExtractionProcessFactory extends IDLProcessFactory {
+    
+ /** The definition file containing the IDL Feature Extraction algorithm */
+    private final static String DEFINITION_FILE="psg_fx__define.pro";
+    
+    private final static String PROCESS_NAME_PREFIX = "IDL_FEATUREEXTRACT";
+
+    public IDLFeatureExtractionProcessFactory() {
+        final IDLFeatureExtractionWrapperPool pool = new IDLFeatureExtractionWrapperPool(
+                this);
+        pool.setMaxActive(2);
+        pool.setMaxIdle(2);
+        pool.setMaxWait(3000000);
+        pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
+        setWrapperPool(pool);
+    }
+
+    // TODO: input could be a filename, an URI, a getCoverage request String,...
+    private static final Parameter<String> INPUT_DATA = new Parameter<String>(
+            "input_data", String.class, Text.text("Input data"), Text
+                    .text("Input file to be processed"));
+    
+    private static final Parameter<String> RESULT = new Parameter<String>(
+            "result", String.class, Text.text("Output feature"), Text
+                    .text("Result of the operation, as the feature produced by the processing"));
+
+    private static final InternationalString TITLE = Text.text("FeatureExt");
+
+    private static final InternationalString DESCRIPTION = Text.text("Extract Feature from an input file");
+    
+    private static final String NAME = "FeatureExt";
+
+    private static final Map<String, Parameter<?>> parameterInfo = new TreeMap<String, Parameter<?>>();
+
+    private static final Map<String, Parameter<?>> resultInfo = new TreeMap<String, Parameter<?>>();
+    
+    static {
+        parameterInfo.put(INPUT_DATA.key, INPUT_DATA);
+        resultInfo.put(RESULT.key, RESULT);
+    }
+
+    @Override
+    public boolean isAvailable() {
+        boolean isAvailable = super.isAvailable();
+        if (isAvailable) {
+            final File file = new File(new StringBuilder(IDL_LIB_FOLDER).append(FILE_SEPARATOR).append(DEFINITION_FILE).toString());
+            if (file.exists()){
+                isAvailable = true;
+            }
+        }
+        return isAvailable;
+    }
+
+    public InternationalString getDescription() {
+        return DESCRIPTION;
+    }
+
+    public Map<String, Parameter<?>> getParameterInfo() {
+        return Collections.unmodifiableMap(parameterInfo);
+    }
+
+    public Map<String, Parameter<?>> getResultInfo(
+            Map<String, Object> parameters) throws IllegalArgumentException {
+        return Collections.unmodifiableMap(resultInfo);
+    }
+
+    public InternationalString getTitle() {
+        return TITLE;
+    }
+
+    public String getVersion() {
+        return "1.0.0";
+    }
+
+    public boolean supportsProgress() {
+        return true;
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    /**
+     * Pool of FeatureExtraction Wrappers
+     */
+    class IDLFeatureExtractionWrapperPool extends GenericObjectPool {
+        public IDLFeatureExtractionWrapperPool(
+                final IDLFeatureExtractionProcessFactory factory) {
+            super(new IDLFeatureExtractionWrapperPoolableFactory(factory));
+        }
+    }
+
+    /**
+     * Factory to handle pool of FeatureExtraction Wrappers
+     */
+    class IDLFeatureExtractionWrapperPoolableFactory extends
+            IDLWrapperPoolableFactory {
+
+        public IDLFeatureExtractionWrapperPoolableFactory(
+                final IDLFeatureExtractionProcessFactory factory) {
+            super(factory, PROCESS_NAME_PREFIX);
+        }
+
+        @Override
+        public synchronized void destroyObject(Object wrapper) throws Exception {
+            ((BaseIDLObjectWrapper)wrapper).destroyObject();
+        }
+
+        @Override
+        public synchronized Object makeObject() throws Exception {
+            BaseIDLObjectWrapper wrapper = new IDLFeatureExtractionWrapper(getProcessNamePrefix() + getTimeStamp());
+            wrapper.createObject();
+            wrapper.addIDLNotifyListener(wrapper);
+            return wrapper;
+        }
+    }
+
+    /**
+     * Create an {@link IDLFeatureExtractionProcess} process
+     */
+    @Override
+    public Process create() {
+        return new IDLFeatureExtractionProcess(this);
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionWrapper.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionWrapper.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLFeatureExtractionWrapper.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,59 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+
+// This code has been generated by the code Wizard and should not be
+// modified.  The recommended manner of changing the behavior is to
+// implement a class that inherits from this generated class.
+package org.geotools.process.idl.impl;
+
+import com.idl.javaidl.JIDLConst;
+import com.idl.javaidl.JIDLString;
+
+/**
+ * IDL FeatureExtraction operation Wrapper.
+ */
+public class IDLFeatureExtractionWrapper extends BaseIDLObjectWrapper{
+    private static final long serialVersionUID = 6560909290441349623L;
+    // Constants set by Wizard
+    private static String IDL_CLASS = "psg_fx";
+
+    // Constructor
+    public IDLFeatureExtractionWrapper(final String processName) {
+       super(IDL_CLASS,processName);
+    }
+
+    // properties generated by Wizard
+
+    // class methods generated by Wizard
+
+    public JIDLString _IDL__FEATUREEXTRACTION(
+       JIDLString FILENAME){
+       final int ARGC = 1;
+       Object[] argv = new Object[ARGC];
+       int[] argp = new int[ARGC];
+
+       Object result = null;
+       final int FLAGS = 0;
+
+       // Parameter assignments
+       argv[0] = FILENAME;
+       argp[0] = JIDLConst.PARMFLAG_CONST;
+
+       result = super.callFunction("__IDL_EXECUTE", ARGC, argv, argp, FLAGS);
+       return (JIDLString)result;
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLMainFeatureExtractionProcess.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLMainFeatureExtractionProcess.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLMainFeatureExtractionProcess.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,350 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl.impl;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.geotools.process.Process;
+import org.geotools.process.ProcessException;
+import org.geotools.process.idl.IDLProcess;
+import org.geotools.process.idl.IDLProcessFactory;
+import org.geotools.process.impl.util.Utilities;
+import org.geotools.referencing.CRS;
+import org.geotools.util.logging.Logging;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.util.ProgressListener;
+
+/**
+ * Main IDL Feature Extraction Process implementation which, when invoked for the execution,
+ * does the following operations:
+ * 1) a getCoverage request.
+ * 2) a feature extraction on the returned coverage.
+ * 3) a geoserver ingestion of the produced feature.
+ */
+public class IDLMainFeatureExtractionProcess extends IDLProcess {
+
+ private final static Logger LOGGER = Logging
+ .getLogger("org.geotools.process.idl.impl");
+
+ /**
+ * Base {@link IDLMainFeatureExtractionProcess} constructor.
+ */
+    public IDLMainFeatureExtractionProcess(final IDLProcessFactory idlProcessFactory) {
+        super(idlProcessFactory);
+    }
+
+    /**
+     * Execute the whole Feature Extraction process.
+     */
+    public Map<String, Object> execute(final Map<String, Object> input,
+            final ProgressListener monitor) {
+        Map<String, Object> result;
+
+        try {
+         // ////////////////////////////////////////////////////////////////
+         //
+         // 1) Execute a getCoverage request
+         //
+         // ////////////////////////////////////////////////////////////////
+        final String filePath = getCoverage(input, monitor);
+        
+        // Check for the returned coverage
+        if (filePath == null || filePath.trim().length() == 0)
+            return Collections.emptyMap();
+
+        // Retrieving the getCoverage request which is the input_data parameter
+        final URL url = new URL((String)input.get("input_data"));
+        final String coverageRequest = url.toString().toLowerCase();
+        if (LOGGER.isLoggable(Level.INFO))
+         LOGGER.info("GetCoverageRequest="+coverageRequest);
+        
+        // Actually, getCoverage request have parameters in this order:
+        // ...crs=EPSG:XXX&bbox=...
+        // Parsing the boundingBox and the coverage CRS
+        
+        final int bboxIndex = coverageRequest.indexOf("&bbox=");
+        final int crsIndex = coverageRequest.indexOf("&crs=");
+        final String epsgCode = coverageRequest.substring(crsIndex+5,bboxIndex);
+        final CoordinateReferenceSystem crs = CRS.decode(epsgCode,true);
+        final String wkt = crs.toWKT();
+        
+        // Updating the inputMap for the next execution step.
+        // The input of the real IDL featureExtraction operation is a file.
+        Map<String, Object> inputMap = new LinkedHashMap<String, Object>(1);
+        inputMap.put("input_data", filePath);
+
+        // ////////////////////////////////////////////////////////////////
+         //
+         // 2) Execute a featureExtraction on the returned coverage
+         //
+         // ////////////////////////////////////////////////////////////////
+        result = featureExtraction(inputMap, monitor);
+        if (result != null && !result.isEmpty() && result.containsKey("result")){
+        
+         // Get the produced feature from the result map.
+        final String fileToBeIngested = (String) result.get("result");
+        
+        // Preparing for the final step: the feature ingestion in geoserver
+        final Map<String, Object> ingestionInputMap = new LinkedHashMap<String, Object>(4);
+        ingestionInputMap.put("input_data", fileToBeIngested);
+        ingestionInputMap.put(Utilities.GS_URL, input.get(Utilities.GS_URL));
+        ingestionInputMap.put(Utilities.GS_UID, input.get(Utilities.GS_UID));
+        ingestionInputMap.put(Utilities.GS_PWD, input.get(Utilities.GS_PWD));
+        
+        // ////////////////////////////////////////////////////////////////
+         //
+         // 3) Ingest the returned feature in geoserver
+         //
+         // ////////////////////////////////////////////////////////////////
+        result = ingestToGeoserver(ingestionInputMap, monitor, wkt);
+
+        // Delete the feature after it has been ingested (and copied) to geoserver
+        final File fileToBeDeleted = new File(filePath);
+        if (fileToBeDeleted.exists())
+            fileToBeDeleted.delete();
+        }
+        else{
+         if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe("Unable to execute IDL Processing: No results have been produced");
+            return Collections.emptyMap();
+        }
+        }catch(Throwable t){
+         if (LOGGER.isLoggable(Level.SEVERE))
+         LOGGER.severe("Error in processing" + t );
+         return Collections.emptyMap();
+        
+        }
+        return result;
+    }
+
+//    /**
+//     * TEST METHOD
+//     * @return
+//     */
+//    private String createShapeFile() {
+//
+//        final SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyyMMdd'T'HHmmssSSS");
+// final String destinationName= new StringBuilder(dateFormat.format(new Date())).toString();
+//    
+// final String[] exts = new String[]{".shp", ".dbf", ".prj", ".shx"};
+// final String base = "D:/data/shapes/";
+// final String baseInput =  base + "shapes";
+// final String baseOutput = base + destinationName;
+//
+// for (int i=0;i<4;i++){
+// final String ext = exts[i];
+//
+// File inputFile = new File(baseInput+ext);
+//        File outputFile = new File(baseOutput+ext);
+//
+//        FileReader in=null;
+//        FileWriter out=null;
+// try {
+// in = new FileReader(inputFile);
+// out = new FileWriter(outputFile);
+//        int c;
+//
+//        while ((c = in.read()) != -1)
+//          out.write(c);
+//
+//         in.close();
+//         out.close();
+// } catch (FileNotFoundException e) {
+// } catch (IOException e) {
+// }
+// }
+// return baseOutput + ".shp";
+// }
+
+    /**
+     * Execute the real {@code featureExtraction} process.
+     * @param input
+ * The input parameters map.
+ * @param monitor
+ * The {@link ProgressListener} monitor.
+ * @return a map containing the result entry (the output feature).
+     * @throws ProcessException
+     */
+ private Map<String, Object> featureExtraction(Map<String, Object> inputMap,
+            ProgressListener monitor) throws ProcessException {
+        final Process featureExtractionProcess = IDLMainFeatureExtractionProcessFactory.featureExtractionFactory.create();
+        return featureExtractionProcess.execute(inputMap, monitor);
+    }
+
+ /**
+ * Execute the {@code getCoverage} process.
+ *
+ * @param input
+ * The input parameters map also containing the getCoverage request URL.
+ * @param monitor
+ * The {@link ProgressListener} monitor.
+ * @return the path of the file containing the requested coverage.
+ * @throws ProcessException
+ */
+    private String getCoverage(final Map<String, Object> input, final ProgressListener monitor) throws ProcessException {
+        final Process getCoverageProcess = IDLMainFeatureExtractionProcessFactory.getCoverageFactory.create();
+        final Map<String, Object> result = getCoverageProcess.execute(input, monitor);
+        if (!result.isEmpty())
+         return (String) result.get("result");
+        return "";
+    }
+
+    /**
+     * Execute the {@code ingestToGeoserver} process.
+     *
+     * @param input
+     * The input parameters map, also containing the input_data entry representing
+     * the feature file to be ingested.
+     * @param monitor
+     * The {@link ProgressListener} monitor.
+     * @param wkt
+     * The WKT of the feature to be ingested to create a proper PRJ file when missing.
+     * @return a map containing the result entry (the ingested layer).
+     * @throws ProcessException
+     */
+    private Map<String, Object> ingestToGeoserver(
+            final Map<String, Object> input, final ProgressListener monitor, final String wkt) throws ProcessException {
+        final String fileToBeIngested = (String) input.get("input_data");
+        final int extensionIndex = fileToBeIngested.lastIndexOf(".");
+        final String extension = fileToBeIngested.substring(extensionIndex + 1);
+
+        if (extension.equalsIgnoreCase("zip")) {
+         final File file = new File(fileToBeIngested);
+         if (file.exists())
+         input.put("input_data", fileToBeIngested);
+        } else {
+         // No zip file available. Create a proper zip archive containing the shape file
+         // as well as the prj with the CRS when missing.
+            final String base = fileToBeIngested.substring(0, fileToBeIngested.lastIndexOf("."));
+            final String prjPath = new StringBuilder(base).append(".prj").toString();
+            final File prjFile = new File(prjPath);
+            if(!prjFile.exists())
+             buildPrjFile(prjPath, wkt);
+            
+            String zipFile;
+            try {
+                zipFile = zipFiles(base);
+                input.put("input_data", zipFile);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        // Ingest the zip archive (the extracted feature) in Geoserver.
+        final Process geoserverIngestionProcess = IDLMainFeatureExtractionProcessFactory.geoserverIngestionFactory
+                .create();
+        return geoserverIngestionProcess.execute(input, monitor);
+    }
+
+    /**
+     * Create a prj file from a provided WKT.
+     * @param prjPath
+     * the path of the prj file to be written.  
+     * @param wkt
+     * the wkt CRS definition.
+     */
+    private void buildPrjFile(final String prjPath, final String wkt) {
+ BufferedWriter bfw = null;
+ try {
+ bfw = new BufferedWriter(new FileWriter(new File(prjPath)));
+ bfw.write(wkt);
+ } catch (IOException e) {
+ if (LOGGER.isLoggable(Level.FINE))
+ LOGGER.log(Level.FINE, e.getLocalizedMessage());
+ } finally{
+ if (bfw!=null){
+ try{
+ bfw.close();
+ }catch(Throwable t){
+ if (LOGGER.isLoggable(Level.FINE))
+ LOGGER.log(Level.FINE, t.getLocalizedMessage());
+ }
+ }
+ }
+ }
+
+ /**
+     * Zip a set of files starting with a common prefix.
+     */
+    private static String zipFiles(final String baseFile) throws IOException{
+
+        final String prjFile = new StringBuilder(baseFile).append(".prj")
+                .toString();
+        final String shapeFile = new StringBuilder(baseFile).append(".shp")
+                .toString();
+        final String dbfFile = new StringBuilder(baseFile).append(".dbf")
+                .toString();
+        final String shxFile = new StringBuilder(baseFile).append(".shx")
+                .toString();
+        final String zipFile = new StringBuilder(baseFile).append(".zip")
+                .toString();
+
+        final String files[] = new String[] { shapeFile, dbfFile, shxFile,
+                prjFile };
+
+        // TODO: Add optional files management
+
+        // ///////////////////////////////////
+        // Check that the directory is a directory, and get its contents
+        // ///////////////////////////////////
+
+        final byte[] buffer = new byte[4096]; // Create a buffer for copying
+        int bytesRead;
+
+        final ZipOutputStream out = new ZipOutputStream(new FileOutputStream(
+                zipFile));
+        try {
+        for (int i = 0; i < files.length; i++) {
+            final File f = new File(files[i]);
+            if (f.isDirectory())
+                continue; // Ignore directory
+            final FileInputStream in = new FileInputStream(f); // Stream to read file
+            final ZipEntry entry = new ZipEntry(f.getName()); // Make a ZipEntry
+            out.putNextEntry(entry); // Store entry
+            while ((bytesRead = in.read(buffer)) != -1)
+                out.write(buffer, 0, bytesRead);
+            in.close();
+        }
+        } catch (IOException e) {
+ if (LOGGER.isLoggable(Level.FINE))
+ LOGGER.log(Level.FINE, e.getLocalizedMessage());
+ } finally{
+ if (out!=null){
+ try{
+ out.close();
+ }catch(Throwable t){
+ if (LOGGER.isLoggable(Level.FINE))
+ LOGGER.log(Level.FINE, t.getLocalizedMessage());
+ }
+ }
+ }
+        return zipFile;
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLMainFeatureExtractionProcessFactory.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLMainFeatureExtractionProcessFactory.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/idl/impl/IDLMainFeatureExtractionProcessFactory.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,131 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl.impl;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.geotools.data.Parameter;
+import org.geotools.process.Process;
+import org.geotools.process.idl.IDLProcessFactory;
+import org.geotools.process.impl.GeoserverIngestionProcessFactory;
+import org.geotools.process.impl.GetCoverageProcessFactory;
+import org.geotools.process.impl.util.Utilities;
+import org.geotools.text.Text;
+import org.opengis.util.InternationalString;
+
+/**
+ * Factory definition of the Feature Extraction processing functionalities.
+ */
+public class IDLMainFeatureExtractionProcessFactory extends IDLProcessFactory {
+    
+ /** The GeoserverIngestion process factory */
+    final static GeoserverIngestionProcessFactory geoserverIngestionFactory = new GeoserverIngestionProcessFactory();
+    
+    /** The GetCoverage process factory */
+    final static GetCoverageProcessFactory getCoverageFactory = new GetCoverageProcessFactory();
+    
+    /** The FeatureExtraction process factory */
+    final static IDLFeatureExtractionProcessFactory featureExtractionFactory = new IDLFeatureExtractionProcessFactory();
+
+    /** Base constructor */
+    public IDLMainFeatureExtractionProcessFactory() {
+    
+    }
+
+    // TODO: input could be a filename, an URI, a getCoverage request String,...
+    private static final Parameter<String> INPUT_DATA = new Parameter<String>(
+            "input_data", String.class, Text.text("Input data"), Text
+                    .text("URI referring the input data to be processed"));
+    
+    private static final Parameter<String> GEOSERVER_BASE_URL = new Parameter<String>(
+            Utilities.GS_URL, String.class, Text.text("Geoserver url"), Text
+                    .text("Geoserver url"));
+    
+    private static final Parameter<String> GEOSERVER_UID = new Parameter<String>(
+            Utilities.GS_UID, String.class, Text.text("Geoserver uid"), Text
+                    .text("Geoserver User id"));
+    
+    private static final Parameter<String> GEOSERVER_PWD = new Parameter<String>(
+            Utilities.GS_PWD, String.class, Text.text("Geoserver pwd"), Text
+                    .text("Geoserver user password"));
+    
+    private static final Parameter<String> OUTPUT_DIR = new Parameter<String>(
+            Utilities.OUTPUT_DIR, String.class, Text.text("output dir"), Text
+                    .text("The output dir where to save exported geotiff"));
+    
+    private static final Parameter<String> RESULT = new Parameter<String>(
+            "result", String.class, Text.text("Ingested layer"), Text
+                    .text("Result of the operation, as the feature ingested in geoserver"));
+
+    private static final InternationalString TITLE = Text
+            .text("FeatureExtraction");
+
+    private static final InternationalString DESCRIPTION = Text
+            .text("Extract Features and ingest them on geoserver");
+    
+    private static final String NAME = "FeatureExtraction";
+
+    private static final Map<String, Parameter<?>> parameterInfo = new TreeMap<String, Parameter<?>>();
+
+    private static final Map<String, Parameter<?>> resultInfo = new TreeMap<String, Parameter<?>>();
+    
+    static {
+        parameterInfo.put(INPUT_DATA.key, INPUT_DATA);
+        parameterInfo.put(GEOSERVER_BASE_URL.key, GEOSERVER_BASE_URL);
+        parameterInfo.put(GEOSERVER_UID.key, GEOSERVER_UID);
+        parameterInfo.put(GEOSERVER_PWD.key, GEOSERVER_PWD);
+        parameterInfo.put(OUTPUT_DIR.key, OUTPUT_DIR);
+        resultInfo.put(RESULT.key, RESULT);
+    }
+
+    public InternationalString getDescription() {
+        return DESCRIPTION;
+    }
+
+    public Map<String, Parameter<?>> getParameterInfo() {
+        return Collections.unmodifiableMap(parameterInfo);
+    }
+
+    public Map<String, Parameter<?>> getResultInfo(
+            Map<String, Object> parameters) throws IllegalArgumentException {
+        return Collections.unmodifiableMap(resultInfo);
+    }
+
+    public InternationalString getTitle() {
+        return TITLE;
+    }
+
+    public String getVersion() {
+        return "1.0.0";
+    }
+
+    public boolean supportsProgress() {
+        return true;
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    @Override
+    public Process create() {
+        return new IDLMainFeatureExtractionProcess(this);
+    }
+
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GeoserverIngestionProcess.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GeoserverIngestionProcess.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GeoserverIngestionProcess.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,215 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.Authenticator;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.PasswordAuthentication;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.geotools.process.ProcessFactory;
+import org.geotools.process.impl.util.Utilities;
+import org.geotools.util.logging.Logging;
+import org.opengis.util.ProgressListener;
+
+/**
+ * A GeoserverIngestion Process functionality which allow to ingest a dataset
+ * in geoserver using REST.  
+ */
+public class GeoserverIngestionProcess extends AbstractProcess {
+
+ private final static Logger LOGGER = Logging
+ .getLogger("org.geotools.process.impl");
+
+    protected GeoserverIngestionProcess(ProcessFactory factory) {
+        super(factory);
+    }
+
+    /**
+     * Execute the geoserverIngestion process.
+     */
+    public Map<String, Object> execute(Map<String, Object> input,
+            ProgressListener monitor) {
+        final Map<String, Object> result = new HashMap<String, Object>(1);
+
+        final String namespace = "it.geosolutions";
+        final String fileName = (String) input.get("input_data");
+
+        final File file = new File(fileName);
+        String dataName = file.getName();
+        final int idx = dataName.lastIndexOf(".");
+        dataName = (idx > 0 ? dataName.substring(0, idx) : dataName);
+
+        final String geoserverBaseUrl = (String) input.get(Utilities.GS_URL);
+        final String geoserverUid = (String) input.get(Utilities.GS_UID);
+        final String geoserverPwd = (String) input.get(Utilities.GS_PWD);
+
+        URL geoserverREST_URL;
+        try {
+            geoserverREST_URL = new URL(new StringBuilder(geoserverBaseUrl)
+                    .append("/rest/workspaces/").append(namespace).append(
+                            "/datastores/").append(dataName).append("/file.")
+                    .append("shp").append("?").append("style=polygon").toString());
+        } catch (MalformedURLException e) {
+         if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe("No more wrappers available to execute the process");
+         return Collections.emptyMap();
+        }
+        final String response = putBinaryFileTo(geoserverREST_URL, file,
+                geoserverUid, geoserverPwd);
+        if (response!=null && response.trim().length()>0){
+         String layerName = extractLayerNameFromResponse(response);
+         result.put("result", layerName);
+        }
+        else{
+         if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe("The rest POST request has not produced a valid response");
+         return Collections.emptyMap();
+        }
+        
+        
+        return result;
+    }
+
+    /**
+     * Extract the layerName from the response.
+     * @param response A String response returned by a geoserver REST put request.
+     * @return the layer name found in the response.
+     */
+    private String extractLayerNameFromResponse(final String response) {
+     //TODO:
+     //Improve this using better XML objects parsing
+        final String nameTag = "<name>";
+        final String nameEndTag = "</name>";
+        final String nameSpaceTag = "<namespace>";
+        final int firstIndexOfName = response.indexOf(nameTag);
+        final int lastIndexOfName = response.indexOf(nameEndTag,
+                firstIndexOfName);
+        final String name = response.substring(firstIndexOfName
+                + nameTag.length(), lastIndexOfName);
+        int firstIndexOfNameSpace = response.indexOf(nameSpaceTag);
+        firstIndexOfNameSpace = response
+                .indexOf(nameTag, firstIndexOfNameSpace);
+
+        int lastIndexOfNameSpace = response.indexOf(nameEndTag,
+                firstIndexOfNameSpace);
+        final String nameSpace = response.substring(firstIndexOfNameSpace
+                + nameTag.length(), lastIndexOfNameSpace);
+        return new StringBuilder(nameSpace).append(":").append(name).toString();
+    }
+
+    /**
+     *
+     * @param geoserverREST_URL
+     * @param file
+     * @return
+     */
+    public static String putBinaryFileTo(final URL geoserverREST_URL,
+            final File file, final String gsUser, final String gsPassword) {
+        HttpURLConnection con = null;
+        String res = "";
+        try {
+            con = (HttpURLConnection) geoserverREST_URL.openConnection();
+            con.setDoOutput(true);
+            con.setDoInput(true);
+            con.setRequestMethod("PUT");
+            if (file.getPath().endsWith(".zip"))
+                con.setRequestProperty("CONTENT-TYPE", "application/zip");
+        } catch (IOException e) {
+             if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe("HTTP ERROR: " + e.getLocalizedMessage());
+            return res;
+        }
+
+        final String login = gsUser;
+        final String password = gsPassword;
+
+        if ((login != null) && (login.trim().length() > 0)) {
+            Authenticator.setDefault(new Authenticator() {
+                protected PasswordAuthentication getPasswordAuthentication() {
+                    return new PasswordAuthentication(login, password
+                            .toCharArray());
+                }
+            });
+        }
+
+        OutputStream outputStream = null;
+        InputStream inputStream = null;
+        try {
+            outputStream = con.getOutputStream();
+            inputStream = new FileInputStream(file);
+            Utilities.copyStream(inputStream, outputStream, true, true);
+        } catch (IOException e) {
+             if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe("HTTP ERROR: " + e.getLocalizedMessage());
+            return res;
+        } finally {
+            if (outputStream != null)
+                try {
+                    outputStream.close();
+                } catch (Exception e) {
+                }
+
+            if (inputStream != null)
+                try {
+                    inputStream.close();
+                } catch (Exception e) {
+                }
+        }
+
+        try {
+            final int responseCode = con.getResponseCode();
+            if (responseCode == HttpURLConnection.HTTP_OK) {
+                InputStreamReader is = new InputStreamReader(con
+                        .getInputStream());
+                String response = Utilities.readIs(is);
+                is.close();
+                 if (LOGGER.isLoggable(Level.FINE))
+                 LOGGER.fine("HTTP OK: " + response);
+                res = response;
+                return res;
+            } else if (responseCode == HttpURLConnection.HTTP_CREATED) {
+                InputStreamReader is = new InputStreamReader(con
+                        .getInputStream());
+                String response = Utilities.readIs(is);
+                is.close();
+                if (LOGGER.isLoggable(Level.FINE))
+                 LOGGER.log(Level.FINE,"HTTP CREATED: " + response);
+                res = response;
+            } else {
+                 if (LOGGER.isLoggable(Level.INFO))
+                 LOGGER.info("HTTP ERROR: " + con.getResponseMessage());
+            }
+        } catch (IOException e) {
+             if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe("HTTP ERROR: " + e.getLocalizedMessage());
+        }
+        return res;
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GeoserverIngestionProcessFactory.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GeoserverIngestionProcessFactory.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GeoserverIngestionProcessFactory.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,113 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.impl;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.geotools.data.Parameter;
+import org.geotools.process.Process;
+import org.geotools.process.impl.util.Utilities;
+import org.geotools.text.Text;
+import org.opengis.util.InternationalString;
+
+/**
+ * Factory definition of the GeoserverIngestion processing functionalities.
+ */
+public class GeoserverIngestionProcessFactory extends SingleProcessFactory {
+
+    public GeoserverIngestionProcessFactory() {
+      
+    }
+
+    // TODO: input could be a filename, an URI, a getCoverage request String,...
+    // Temp for testings
+    private static final Parameter<String> INPUT_DATA = new Parameter<String>(
+            "input_data", String.class, Text.text("Input data"), Text
+                    .text("File to be ingested"));
+    
+    private static final Parameter<String> GEOSERVER_BASE_URL = new Parameter<String>(
+            Utilities.GS_URL, String.class, Text.text("Geoserver url"), Text
+                    .text("Geoserver url"));
+    
+    private static final Parameter<String> GEOSERVER_UID = new Parameter<String>(
+            Utilities.GS_UID, String.class, Text.text("Geoserver uid"), Text
+                    .text("Geoserver User id"));
+    
+    private static final Parameter<String> GEOSERVER_PWD = new Parameter<String>(
+            Utilities.GS_PWD, String.class, Text.text("Geoserver pwd"), Text
+                    .text("Geoserver user password"));
+    
+    private static final Parameter<String> RESULT = new Parameter<String>(
+            "result", String.class, Text.text("XML"), Text
+                    .text("The XML of the geoserver ingestion response"));
+
+    private static final InternationalString TITLE = Text
+            .text("GeoserverIngestion");
+
+    private static final InternationalString DESCRIPTION = Text
+            .text("Ingest data to geoserver");
+    
+    private static final String NAME = "GeoserverIngestion";
+
+    private static final Map<String, Parameter<?>> parameterInfo = new TreeMap<String, Parameter<?>>();
+
+    private static final Map<String, Parameter<?>> resultInfo = new TreeMap<String, Parameter<?>>();
+    
+    static {
+        parameterInfo.put(INPUT_DATA.key, INPUT_DATA);
+        parameterInfo.put(GEOSERVER_BASE_URL.key, GEOSERVER_BASE_URL);
+        parameterInfo.put(GEOSERVER_UID.key, GEOSERVER_UID);
+        parameterInfo.put(GEOSERVER_PWD.key, GEOSERVER_PWD);
+        resultInfo.put(RESULT.key, RESULT);
+    }
+
+    public InternationalString getDescription() {
+        return DESCRIPTION;
+    }
+
+    public Map<String, Parameter<?>> getParameterInfo() {
+        return Collections.unmodifiableMap(parameterInfo);
+    }
+
+    public Map<String, Parameter<?>> getResultInfo(
+            Map<String, Object> parameters) throws IllegalArgumentException {
+        return Collections.unmodifiableMap(resultInfo);
+    }
+
+    public InternationalString getTitle() {
+        return TITLE;
+    }
+
+    public String getVersion() {
+        return "1.0.0";
+    }
+
+    public boolean supportsProgress() {
+        return true;
+    }
+
+    public String getName() {
+        return NAME;
+    }
+    
+    public Process create() {
+        return new GeoserverIngestionProcess(this);
+    }
+
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GetCoverageProcess.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GetCoverageProcess.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GetCoverageProcess.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,148 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.impl;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.Authenticator;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.PasswordAuthentication;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.geotools.process.ProcessFactory;
+import org.geotools.process.impl.util.Utilities;
+import org.geotools.util.logging.Logging;
+import org.opengis.util.ProgressListener;
+
+/**
+ * A GetCoverage process functionality which allow to execute a getCoverage request
+ * and store the returned coverage on an output file.
+ *
+ */
+public class GetCoverageProcess extends AbstractProcess{
+
+ private final static Logger LOGGER = Logging
+ .getLogger("org.geotools.process.impl");
+
+    protected GetCoverageProcess(ProcessFactory factory) {
+        super(factory);
+    }
+
+    /**
+     * Execute the getCoverage process.
+     */
+    public Map<String, Object> execute(Map<String, Object> input,
+            ProgressListener monitor) {
+        
+        try {
+            final URL url = new URL((String)input.get("input_data"));
+            final String uid = (String)input.get(Utilities.GS_UID);
+            final String pwd = (String)input.get(Utilities.GS_PWD);
+            final String outFolder = (String)input.get(Utilities.OUTPUT_DIR);
+            final String outputFile = getCoverage(url, outFolder, uid, pwd);
+            Map<String, Object> result = new HashMap<String, Object>();
+            result.put("result",outputFile);
+            return result;
+        } catch (MalformedURLException e) {
+            return Collections.emptyMap();
+        }
+    }
+
+    /**
+     * Perform a GeoServer's getCoverage request and return the path of an output file
+     * (usually a GeoTIFF, depending on the coverage request) containing the requested coverage.
+     *
+     * @param geoserverURL
+     * The whole geoserver getCoverage request, as an instance:
+     * {@code http://localhost:8080/geoserver/ows?service=WCS&request=GetCoverage&Format=GeoTIFF&version=1.0.0&" +
+     *       "coverage=it.geosolutions:testlayer&crs=EPSG:32721&bbox=-22856.625,2412871.75,812143.375,3385771.75&width=800&height=523}
+     * @param outFolder
+     * The folder where to store the output file.
+     * @param gsUser
+     * The geoserver user authentication.
+     * @param gsPassword
+     * The geoserver password authentication.
+     * @return the path of the output file containing the requested coverage.
+     */
+    private String getCoverage(final URL geoserverURL, final String outFolder, final String gsUser, final String gsPassword) {
+        
+        HttpURLConnection con=null;
+        String res = "";
+    try {
+        con = (HttpURLConnection) geoserverURL.openConnection();
+        con.setDoOutput(true);
+        con.setDoInput(true);                  
+        con.setRequestMethod("GET");
+
+        //Prepare for authentication
+    final String login = gsUser;
+    final String password = gsPassword;
+
+    if ((login != null) && (login.trim().length() > 0)) {
+        Authenticator.setDefault(new Authenticator() {
+                protected PasswordAuthentication getPasswordAuthentication() {
+                    return new PasswordAuthentication(login, password.toCharArray());
+                }
+            });
+    }
+    
+        final int responseCode = con.getResponseCode();
+        if (responseCode == HttpURLConnection.HTTP_OK) {
+         final String gsUrl = geoserverURL.toString();
+         final int coverageIndex = gsUrl.indexOf("&coverage=");
+         final int endOfCoverageIndex = gsUrl.indexOf("&",coverageIndex+1);
+        
+         //Throw away the namespace
+         String coverageName = gsUrl.substring(coverageIndex+10, endOfCoverageIndex);
+         coverageName = coverageName.substring(coverageName.indexOf(":")+1);
+        
+            final InputStream inputStream = con.getInputStream();
+            
+            //Write the output file
+            final SimpleDateFormat dateFormat = new SimpleDateFormat ("yyyyMMdd'T'HHmmssSSS");
+ final StringBuilder builderDestinationName= new StringBuilder(coverageName);
+ builderDestinationName.append("_").append(dateFormat.format(new Date())).append(".tif");
+            
+            final String fileName = builderDestinationName.toString();
+            final File outFile = new File(new StringBuilder(outFolder).append(Utilities.FILE_SEPARATOR)
+             .append(fileName).toString());
+            final FileOutputStream outputStream = new FileOutputStream(outFile);
+            Utilities.copyStream(inputStream, outputStream, true, true);
+            res =  outFile.getAbsolutePath();
+            
+        } else {
+         if (LOGGER.isLoggable(Level.SEVERE))
+             LOGGER.severe("Unsuccessfull getCoverage request. The server responded with " + responseCode + " code");
+        }
+     } catch (IOException e) {
+//      if (LOGGER.isLoggable(Level.SEVERE))
+//              LOGGER.severe("HTTP ERROR: " + e.getLocalizedMessage());
+    
+        }
+     return res;
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GetCoverageProcessFactory.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GetCoverageProcessFactory.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/GetCoverageProcessFactory.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,118 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.impl;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.geotools.data.Parameter;
+import org.geotools.process.Process;
+import org.geotools.process.impl.util.Utilities;
+import org.geotools.text.Text;
+import org.opengis.util.InternationalString;
+
+/**
+ * Factory definition of the GetCoverage processing functionalities.
+ */
+public class GetCoverageProcessFactory extends SingleProcessFactory {
+
+    public GetCoverageProcessFactory() {
+      
+    }
+
+    // TODO: input could be a filename, an URI, a getCoverage request String,...
+    // Temp for testings
+    private static final Parameter<String> INPUT_URL = new Parameter<String>(
+            "input_uri", String.class, Text.text("GetCoverage request URL"), Text
+                    .text("URL containing the getCoverageRequest"));
+    
+    private static final Parameter<String> GEOSERVER_BASE_URL = new Parameter<String>(
+            Utilities.GS_URL, String.class, Text.text("Geoserver url"), Text
+                    .text("Geoserver url"));
+    
+    private static final Parameter<String> GEOSERVER_UID = new Parameter<String>(
+            Utilities.GS_UID, String.class, Text.text("Geoserver uid"), Text
+                    .text("Geoserver User id"));
+    
+    private static final Parameter<String> GEOSERVER_PWD = new Parameter<String>(
+            Utilities.GS_PWD, String.class, Text.text("Geoserver pwd"), Text
+                    .text("Geoserver user password"));
+    
+    private static final Parameter<String> OUTPUT_DIR = new Parameter<String>(
+     Utilities.OUTPUT_DIR, String.class, Text.text("output dir"), Text
+                    .text("The output dir where to save exported geotiff"));
+    
+    private static final Parameter<String> RESULT = new Parameter<String>(
+            "result", String.class, Text.text("Result location"), Text
+                    .text("The output GeoTiff file resulting from the request"));
+
+    private static final InternationalString TITLE = Text
+            .text("GetCoverage");
+
+    private static final InternationalString DESCRIPTION = Text
+            .text("Compute a GetCoverage request and returns a GeoTIFF");
+    
+    private static final String NAME = "GetCoverage";
+
+    private static final Map<String, Parameter<?>> parameterInfo = new TreeMap<String, Parameter<?>>();
+
+    private static final Map<String, Parameter<?>> resultInfo = new TreeMap<String, Parameter<?>>();
+    
+    static {
+        parameterInfo.put(INPUT_URL.key, INPUT_URL);
+        parameterInfo.put(GEOSERVER_BASE_URL.key, GEOSERVER_BASE_URL);
+        parameterInfo.put(GEOSERVER_UID.key, GEOSERVER_UID);
+        parameterInfo.put(GEOSERVER_PWD.key, GEOSERVER_PWD);
+        parameterInfo.put(OUTPUT_DIR.key, OUTPUT_DIR);
+        resultInfo.put(RESULT.key, RESULT);
+    }
+
+    public InternationalString getDescription() {
+        return DESCRIPTION;
+    }
+
+    public Map<String, Parameter<?>> getParameterInfo() {
+        return Collections.unmodifiableMap(parameterInfo);
+    }
+
+    public Map<String, Parameter<?>> getResultInfo(
+            Map<String, Object> parameters) throws IllegalArgumentException {
+        return Collections.unmodifiableMap(resultInfo);
+    }
+
+    public InternationalString getTitle() {
+        return TITLE;
+    }
+
+    public String getVersion() {
+        return "1.0.0";
+    }
+
+    public boolean supportsProgress() {
+        return true;
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    public Process create() {
+        return new GetCoverageProcess(this);
+    }
+
+}

Added: trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/util/Utilities.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/util/Utilities.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/java/org/geotools/process/impl/util/Utilities.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,130 @@
+package org.geotools.process.impl.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+
+public class Utilities {
+
+    private static int DEFAULT_SIZE = 1024 * 1024;
+
+    public final static String GS_URL = "geoserver_base_url";
+
+    public final static String GS_UID = "geoserver_uid";
+
+    public final static String GS_PWD = "geoserver_pwd";
+    
+    public final static String OUTPUT_DIR = "output_dir";
+    
+    public final static String FILE_SEPARATOR = System.getProperty("file.separator");
+
+    /**
+     * Read input stream reader
+     * @param is
+     * @return
+     */
+    public static String readIs(InputStreamReader is) {
+        char[] inCh = new char[1024];
+        StringBuffer input = new StringBuffer();
+        int r;
+
+        try {
+            while ((r = is.read(inCh)) > 0) {
+                input.append(inCh, 0, r);
+            }
+        } catch (IOException e) {
+            // if(LOGGER.isLoggable(Level.SEVERE))
+            // LOGGER.log(Level.SEVERE,e.getLocalizedMessage(),e);
+        }
+
+        return input.toString();
+    }
+
+    /**
+     * Copy {@link InputStream} to {@link OutputStream}.
+     *
+     * @param sourceStream
+     *                {@link InputStream} to copy from.
+     * @param destinationStream
+     *                {@link OutputStream} to copy to.
+     * @param closeInput
+     *                quietly close {@link InputStream}.
+     * @param closeOutput
+     *                quietly close {@link OutputStream}
+     * @throws IOException
+     *                 in case something bad happens.
+     */
+    public static void copyStream(InputStream sourceStream,
+            OutputStream destinationStream, boolean closeInput,
+            boolean closeOutput) throws IOException {
+        copyStream(sourceStream, destinationStream, DEFAULT_SIZE, closeInput,
+                closeOutput);
+    }
+
+    /**
+     * Copy {@link InputStream} to {@link OutputStream}.
+     *
+     * @param sourceStream
+     *                {@link InputStream} to copy from.
+     * @param destinationStream
+     *                {@link OutputStream} to copy to.
+     * @param size
+     *                size of the buffer to use internally.
+     * @param closeInput
+     *                quietly close {@link InputStream}.
+     * @param closeOutput
+     *                quietly close {@link OutputStream}
+     * @throws IOException
+     *                 in case something bad happens.
+     *
+     */
+    public static void copyStream(InputStream sourceStream,
+            OutputStream destinationStream, int size, boolean closeInput,
+            boolean closeOutput) throws IOException {
+
+        inputNotNull(sourceStream, destinationStream);
+        byte[] buf = new byte[size];
+        int n = -1;
+        try {
+            while (-1 != (n = sourceStream.read(buf))) {
+                destinationStream.write(buf, 0, n);
+                destinationStream.flush();
+            }
+        } finally {
+            // closing streams and connections
+            try {
+                destinationStream.flush();
+            } finally {
+                try {
+                    if (closeOutput)
+                        destinationStream.close();
+                } finally {
+                    try {
+                        if (closeInput)
+                            sourceStream.close();
+                    } finally {
+
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Checks if the input is not null.
+     *
+     * @param oList
+     *                list of elements to check for null.
+     */
+    private static void inputNotNull(Object... oList) {
+        for (Object o : oList)
+            if (o == null)
+                throw new NullPointerException("Input objects cannot be null");
+
+    }
+
+    private Utilities() {
+
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/main/resources/META-INF/services/org.geotools.process.ProcessFactory
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/resources/META-INF/services/org.geotools.process.ProcessFactory                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/resources/META-INF/services/org.geotools.process.ProcessFactory 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1 @@
+org.geotools.process.idl.impl.IDLMainFeatureExtractionProcessFactory

Added: trunk/modules/unsupported/idl-process/src/main/resources/psg_fx__define.pro
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/resources/psg_fx__define.pro                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/resources/psg_fx__define.pro 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,177 @@
+; ---------------------------------------------------------------------
+;  Copyright (c) 2005-2008, ITT Visual Information Solutions. All
+;       rights reserved.
+;
+;  FILE:
+;       _idl_fx_toshape.pro
+;
+;
+;  MODIFICATION HISTORY:
+;       06/2009,   SL - written
+;      
+; -----------------------------------------------------------
+;
+; Tiff/Geotiff Feature Extraction + vector output as shapefile
+;
+; Returns the created Shapefile (string)
+;
+
+; ---------------------------------------------------------------------------
+; Generic reporting routine that selects between bridgenotify and command log
+; ---------------------------------------------------------------------------
+PRO PSG_FX::Report, title, text
+  IF (self.debug) THEN PRINT, title, ': ', text $
+  ELSE self->NotifyBridge, title, text
+END
+
+; --------------------------------------------------------------------------------
+; This routine does the heavy lifting. It is really a wrapper around ENVI_FX_DOIT
+; --------------------------------------------------------------------------------
+FUNCTION PSG_FX::__idl_execute, imageFile, ruleFile, shapeFile, Debug=debug
+
+  COMPILE_OPT IDL2
+
+  debug = KEYWORD_SET(debug) ; controls whether to print or notify bridge
+  
+  ; --- Error Handler ---
+  ; Reports error to bridge and returns null string to indicate failure ---
+  CATCH, Err
+  IF (Err NE 0) THEN BEGIN
+    CATCH, /CANCEL
+    self->Report, 'FX ERROR', !ERROR_STATE.MSG
+    RETURN, ''
+  ENDIF
+  
+  ; --- Check the input file validity ---
+  self->Report, 'FX File Initialisation', 'Opening input files'
+  IF (N_ELEMENTS(imageFile) EQ 0) THEN MESSAGE, 'An input image filename must be supplied'
+  IF ~FILE_TEST(imageFile) THEN MESSAGE, 'Input file not found'
+
+  IF (~QUERY_TIFF(imageFile)) THEN MESSAGE, 'Input file must be TIFF format'
+  
+  ; --- Read the image and metadata ---
+  img = READ_TIFF(imageFile, GEOTIFF=metadata, CHANNELS=0)
+  IF (N_ELEMENTS(metadata) EQ 0) THEN MESSAGE, 'Input image file must have georeferencing information'
+  imSize = SIZE(img)
+  dims = imSize[0] EQ 3 ? imSize[2:3] : imSize[1:2]
+  nb   = imSize[0] EQ 3 ? imSize[1] : 1L
+  
+  ; Extract the image filename without the extension
+  dirname  = FILE_DIRNAME(imageFile)
+  basename = FILE_BASENAME(imageFile)
+  locn = STRPOS(basename,'.',/REVERSE_SEARCH)
+  IF (locn NE -1) THEN basename = STRMID(basename, 0, locn)
+  
+  ; Check the ruleset filename, if none was specified use a default based on the input image location
+  ;IF (N_ELEMENTS(ruleFile) EQ 0) THEN BEGIN ; default rule filename if none is provided
+  ;  ruleFile = FILEPATH('fx_default_rules.xml', ROOT=FILE_DIRNAME(imageFile))
+  ;  self->Report, 'FX WARNING', 'No rule file specified, attempting to use default'
+  ;ENDIF
+  ;IF ~FILE_TEST(ruleFile) THEN MESSAGE, 'Ruleset file not found'
+  
+  ; --- Create the output shape filename ---
+  self->Report, 'FX Execution', 'Performing Feature Extraction'
+  
+  IF N_ELEMENTS(shapeFile) EQ 0 THEN $    
+    shapeFile = FILEPATH(basename+'.shp', ROOT=dirName)
+    
+  ; --- Perform feature extraction using my own half-baked approach ---
+  
+  img = ROTATE(TEMPORARY(img),7)
+  
+  hist = TOTAL(HISTOGRAM(img), /CUMUL)
+  thresh = MIN(WHERE(hist GT (MAX(hist)*0.85)))
+  threshImg = TEMPORARY(img) GT thresh
+  
+  strucElem = REPLICATE(1, 3, 3)
+  threshImg = ERODE(DILATE(TEMPORARY(threshImg), strucElem), strucElem)
+  
+  CONTOUR, threshImg, LEVEL=1, PATH_INFO=pathInfo, PATH_XY=pathXY, /PATH_DATA_COORDS
+  nSegs = N_ELEMENTS(pathInfo)
+  IF (nSegs EQ 0) THEN MESSAGE, 'Segmentation detected no discrete objects'
+  nFound = 0UL
+  
+  ; Go through the segments checking size and adding to output vector layer
+  FOR i = 0, nSegs - 1 DO BEGIN
+  
+    nVerts = pathInfo[i].n
+    line  = [LINDGEN(nVerts), 0]
+    verts = pathXY[*, pathInfo[i].OFFSET + line]
+    oROI  = OBJ_NEW('IDLanROI', verts[0,*], verts[1,*])
+    roiStats = oROI->ComputeGeometry(AREA=area)
+    OBJ_DESTROY, oROI
+    
+    ; If area is greater than 100 pixels, add it to the layer    
+    IF (area LT 500) || (area GT 100000) THEN CONTINUE
+
+    ; Initialize the new shape file (containing polygons)
+    IF (~OBJ_VALID(oShapeFile)) THEN BEGIN    
+      oShapeFile = OBJ_NEW('IDLffShape', shapeFile, /UPDATE, ENTITY_TYPE=5)
+      IF(~OBJ_VALID(oShapeFile)) THEN MESSAGE, 'Failed to create output vector file'
+    ENDIF
+    
+    ; --- Convert the coords to map projection ---
+    verts[0,*] = verts[0,*] * metadata.ModelPixelScaleTag[0] + (metadata.ModelTiePointTag[3])
+    verts[1,*] = verts[1,*] * metadata.ModelPixelScaleTag[1] + (metadata.ModelTiePointTag[4] - (dims[1] * metadata.ModelPixelScaleTag[1]))
+    
+    ;--- Create the SHAPE file entity ---
+    xMin = MIN(verts[0,*], MAX=xMax)
+    yMin = MIN(verts[1,*], MAX=yMax)
+    entNew = {IDL_SHAPE_ENTITY}
+    entNew.SHAPE_TYPE = 5
+    entNew.BOUNDS     = [xMin, yMin, 0.0, 0.0, xMax, yMax, 0.0, 0.0]
+    entNew.N_VERTICES = N_ELEMENTS(verts[0,*])
+    entNew.VERTICES   = PTR_NEW(verts, /NO_COPY)
+    entnew.MEASURE    = PTR_NEW(FLTARR(nVerts), /NO_COPY)
+    
+    ; Add the new entity to new shapefile.
+    oShapeFile->PutEntity, entNew          
+
+    PTR_FREE, entNew.VERTICES
+    PTR_FREE, entNew.MEASURE
+
+    nFound++
+    
+  ENDFOR
+
+  ; Finish defining and close the new SHAPE file
+  oShapeFile->Close
+  OBJ_DESTROY, oShapeFile
+
+  IF (nFound EQ 0) THEN MESSAGE, 'No features found in image'
+  self->Report, 'FX Complete', 'Processing completed successfully'
+  RETURN, shapeFile
+
+END
+
+FUNCTION PSG_FX::INIT, DEBUG=debug
+  self.debug = KEYWORD_SET(debug)
+  RETURN, self->IDLitComponent::INIT()
+END
+
+; ---------------------------------------------------------------------------
+; CLASS DEFINITION
+; ---------------------------------------------------------------------------
+PRO PSG_FX__Define
+  struct = {PSG_FX, debug:0B, INHERITS IDLitComponent}
+END
+
+; ---------------------------------------------------------------------------
+; TEST PROGRAM (to be called from the ENVI command line
+; ---------------------------------------------------------------------------  
+PRO PSG_FX_Test
+
+  ; Figure out the names for the test input data files
+  dir = 'C:\Users\daniele\Downloads\'
+  dir1 = 'D:\work\programs\ITT\IDL71\lib\'
+  imageFile = FILEPATH('7667112720090922T154410801.tiff', Root=dir)
+  ruleFile  = FILEPATH('ruleset_fx_roofs.xml', Root=dir)
+ ; shapefile = FILEPATH('METADATA.shp', Root=dir)
+
+  obj = OBJ_NEW('PSG_FX', /DEBUG)
+  result = obj->__idl_execute(imageFile, ruleFile)  
+  HELP, result
+
+END
+
+
\ No newline at end of file

Added: trunk/modules/unsupported/idl-process/src/main/resources/ta__define.pro
===================================================================
--- trunk/modules/unsupported/idl-process/src/main/resources/ta__define.pro                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/main/resources/ta__define.pro 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,34 @@
+;  FILE:
+;       ta__define.pro
+;
+FUNCTION ta::_idl__testarray, strings, values
+  asize = N_ELEMENTS(strings)
+  vsize = N_ELEMENTS(values)
+  output = 'Result is'
+  value = 0
+  for i=0, asize-1 do begin
+    output = output + strings[i]
+  endfor
+  
+  for j=0, vsize-1 do begin
+    value = value + values[j]
+  endfor
+  output = output + ':' + value
+  RETURN,  output
+END
+
+FUNCTION ta::INIT
+
+   RETURN, 1
+
+END
+
+; -----------------------------------------------------------
+; Object definition.
+PRO ta__define
+  struct = {ta, $
+    inherits IDLitComponent, $
+    strings: ['test'], $
+    values: [1.0] $
+  }
+END
\ No newline at end of file

Added: trunk/modules/unsupported/idl-process/src/site/apt/review.apt
===================================================================
--- trunk/modules/unsupported/idl-process/src/site/apt/review.apt                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/site/apt/review.apt 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,7 @@
+IDL-PROCESS MODULE
+~~~~~~~~~~~~~~~~~~
+
+  Module Maintainer: Daniele Romagnoli
+
+
+

Added: trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/IDLBaseTestCase.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/IDLBaseTestCase.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/IDLBaseTestCase.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,37 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl;
+
+
+/**
+ * Base test class checking whether all the IDL libraries
+ * are on places.
+ *  
+ */
+public class IDLBaseTestCase{
+
+    static boolean isIDLAvailable;
+    
+    static{
+     isIDLAvailable = IDLProcessFactory.isIDLAvailable();
+    }
+    
+    public static boolean isIDLAvailable() {
+        return isIDLAvailable;
+    }
+
+}

Added: trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/ArrayTest.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/ArrayTest.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/ArrayTest.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,94 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl.impl;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.geotools.process.idl.IDLBaseTestCase;
+import org.geotools.process.idl.IDLExecutionException;
+import org.geotools.process.idl.PrintingProgressListener;
+import org.geotools.process.idl.impl.BaseIDLObjectWrapper;
+import org.junit.Assert;
+
+import com.idl.javaidl.JIDLArray;
+import com.idl.javaidl.JIDLConst;
+import com.idl.javaidl.JIDLString;
+
+public class ArrayTest extends IDLBaseTestCase {
+
+    /**
+     * Test array Java-IDL bridging.
+     */
+    @org.junit.Test
+    public void testArray() throws IDLExecutionException {
+        if (!isIDLAvailable())
+            return;
+        final ArrayTestWrapper testArray = new ArrayTestWrapper("process1");
+        testArray.createObject();
+        testArray.addIDLNotifyListener(testArray);
+        testArray.setProgressListener(new PrintingProgressListener());
+
+        final Map<String, Object> params = new LinkedHashMap<String, Object>(2);
+        params.put("strings", new String[] { "one", "two", "three" });
+        params.put("values", new int[] { 4, 5, 6 });
+        final JIDLString result = testArray.execute(params);
+        final String sResult = result.stringValue();
+        final String val[] = sResult.split(":");
+        
+        Assert.assertEquals(val.length, 2);
+        Assert.assertEquals(val[val.length-1].trim(), Integer.toString(15));
+    }
+    
+    class ArrayTestWrapper extends BaseIDLObjectWrapper{
+
+        /**
+         *
+         */
+        private static final long serialVersionUID = 0L;
+        private static final String IDL_CLASS = "ta";
+      
+       // Constructor
+       public ArrayTestWrapper(final String processName) {
+          super(IDL_CLASS, processName);
+       }
+
+       public JIDLString _IDL__TESTARRAY(
+               JIDLArray STRINGS,
+               JIDLArray VALUES
+               )
+            {
+               final int ARGC = 2;
+               Object[] argv = new Object[ARGC];
+               int[] argp = new int[ARGC];
+
+               Object result = null;
+               final int FLAGS = 0;
+
+               // Parameter assignments
+               argv[0] = STRINGS;
+               argp[0] = JIDLConst.PARMFLAG_CONST|JIDLConst.PARMFLAG_CONVMAJORITY;
+               argv[1] = VALUES;
+               argp[1] = JIDLConst.PARMFLAG_CONST|JIDLConst.PARMFLAG_CONVMAJORITY;
+
+               result = super.callFunction("_IDL__TESTARRAY",
+                  ARGC, argv, argp, FLAGS);
+
+               return (JIDLString)result;
+            }
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/IDLProcessTest.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/IDLProcessTest.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/IDLProcessTest.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,99 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.geotools.process.Process;
+import org.geotools.process.ProcessException;
+import org.geotools.process.idl.IDLBaseTestCase;
+import org.geotools.process.idl.PrintingProgressListener;
+import org.geotools.process.idl.impl.IDLFeatureExtractionProcessFactory;
+import org.geotools.test.TestData;
+import org.junit.Assert;
+
+/**
+ * Simple test class leveraging on the Feature Extraction function,
+ * offered by means of the proper IDL wrapper.
+ */
+public class IDLProcessTest extends IDLBaseTestCase {
+
+    /**
+     * Launch 3 processes executing the Feature Extraction process.
+     * Note that the pool is actually with size = 2, therefore
+     * you should notice the third process starting after one
+     * of the previous two have finished.
+     *
+     * @throws InterruptedException
+     */
+    @org.junit.Test
+    public void testProcesses() throws InterruptedException {
+        if (!isIDLAvailable())
+            return;
+        final IDLFeatureExtractionProcessFactory factory = new IDLFeatureExtractionProcessFactory();
+        ProcessThread p1 = new ProcessThread(factory);
+        p1.start();
+        p1.run();
+    }
+    
+    static class ProcessThread extends Thread {
+        IDLFeatureExtractionProcessFactory factory;
+
+        public ProcessThread(IDLFeatureExtractionProcessFactory factory) {
+            this.factory = factory;
+        }
+
+        public void run() {
+            final Process process = factory.create();
+            File testData = null;
+ try {
+ testData = TestData.file(this,"testin.tif");
+ } catch (FileNotFoundException e1) {
+
+ } catch (IOException e1) {
+
+ }
+            final Map<String, Object> values = new LinkedHashMap<String, Object>(2);
+            values.put("input_data",testData.getAbsolutePath());  
+            
+//            values.put("input_data", "http://localhost:8081/geoserver/ows?service=WCS&request=GetCoverage&Format=GeoTIFF&version=1.0.0&" +
+//             "coverage=topp:asar22&crs=EPSG:32721&bbox=-22856.625,2412871.75,812143.375,3385771.75&width=800&height=523"
+//             );
+//            values.put(Utilities.GS_URL, "http://localhost:8081/geoserver");
+//            values.put(Utilities.GS_UID, "admin");
+//            values.put(Utilities.GS_PWD, "geoserver");
+//            values.put(Utilities.OUTPUT_DIR, "D:\\gds\\jboss-4.2.3.GA\\workdir\\features");
+            Map<String, Object> result = null;
+ try {
+ result = process.execute(values,
+        new PrintingProgressListener());
+ } catch (ProcessException e) {
+
+ }
+            if (result != null && !result.isEmpty()) {
+                final Iterator keysIt = result.keySet().iterator();
+                final Object output = result.get(keysIt.next());
+                Assert.assertNotNull(output);
+            }
+        }
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/IDLWrapperTest.java
===================================================================
--- trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/IDLWrapperTest.java                        (rev 0)
+++ trunk/modules/unsupported/idl-process/src/test/java/org/geotools/process/idl/impl/IDLWrapperTest.java 2009-11-09 13:56:45 UTC (rev 34347)
@@ -0,0 +1,50 @@
+/*
+ *    GeoTools - The Open Source Java GIS Toolkit
+ *    http://geotools.org
+ *
+ *    (C) 2007-2009, Open Source Geospatial Foundation (OSGeo)
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License as published by the Free Software Foundation;
+ *    version 2.1 of the License.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ */
+package org.geotools.process.idl.impl;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.geotools.process.idl.IDLBaseTestCase;
+import org.geotools.process.idl.IDLExecutionException;
+import org.geotools.process.idl.impl.BaseIDLObjectWrapper;
+import org.geotools.process.idl.impl.IDLFeatureExtractionWrapper;
+import org.geotools.test.TestData;
+
+import com.idl.javaidl.JIDLString;
+
+public class IDLWrapperTest extends IDLBaseTestCase {
+
+    @org.junit.Test
+    public void testInvocation() throws InterruptedException, FileNotFoundException, IOException, IDLExecutionException {
+        if (!isIDLAvailable())
+            return;
+        final BaseIDLObjectWrapper wrapper = new IDLFeatureExtractionWrapper("test");
+        wrapper.createObject();
+        final Map<String, Object> values = new LinkedHashMap<String, Object>(1);
+        JIDLString result;
+        
+        //Testing wrapper with right parameters
+        final File testData = TestData.file(this, "testin.tif");
+        values.put("IMAGEFILE", testData.getAbsolutePath());
+        result = wrapper.execute(values);
+        wrapper.destroyObject();
+    }
+}

Added: trunk/modules/unsupported/idl-process/src/test/resources/org/geotools/process/idl/impl/test-data/testin.tif
===================================================================
(Binary files differ)


Property changes on: trunk/modules/unsupported/idl-process/src/test/resources/org/geotools/process/idl/impl/test-data/testin.tif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
GeoTools-commits mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-commits