Hi Mark;

Can you open up a Jira issue and attach your patch to that? We find it
a bit easier to keep track of changes.

Jody

On Wed, May 20, 2009 at 6:14 PM, Mark Leslie <[email protected]> wrote:
> Greetings,
> I've been working with the ArcSDE plugin over the last few weeks and I found
> the large character objects weren't being supported properly. Since the
> ArcSDE api doesn't return them on SeRow.getObject() calls (it returns null
> for all large objects) they were being reported as strings but never output.
>  I've added read support for CLOBs and NCLOBs, and have that working nicely
> here.  I haven't yet added write support.
>
> I've also been working against ArcSDE 9.3, so I've updated the pom to suck
> in the icu4j jar in when 9.3 is stated.  I followed the directions at
> http://docs.codehaus.org/display/GEOTOOLS/ArcSDE+Plugin, and they were
> almost dead on.  In the "So what do I have to type again?" section the
> -DhaveSDEJars=true parameter is neglected.  I also installed the icu4j jar
> provided with the ArcSDE API instead of using the one published to the repo.
>
> I am hoping Gabriel can look this over an let me know if I'm on the right
> track.  I'm plan to get write support added, but it's not needed for my
> project at the moment so it will be harder to scratch the time together.
>
> --
> Mark Leslie
> Geospatial Software Architect
> LISAsoft
>
> -------------------------------------------------------------
> Ph: +61 2 8570 5000 Fax: +61 2 8570 5099 Mob: +61
> Suite 112, Jones Bay Wharf 19-21 Pirrama Rd Pyrmont NSW 2009
> -------------------------------------------------------------
>
> LISAsoft is part of the A2end Group of Companies
> http://www.ardec.com.au
> http://www.lisasoft.com
> http://www.terrapages.com
>
> Index: sde-dummy/src/main/java/com/esri/sde/sdk/client/SeRow.java
> ===================================================================
> --- sde-dummy/src/main/java/com/esri/sde/sdk/client/SeRow.java  (revision
> 32008)
> +++ sde-dummy/src/main/java/com/esri/sde/sdk/client/SeRow.java  (working
> copy)
> @@ -1,7 +1,7 @@
>  package com.esri.sde.sdk.client;
>
> +import java.io.ByteArrayInputStream;
>  import java.util.Calendar;
> -import java.util.logging.Level;
>
>  public class SeRow {
>
> @@ -29,5 +29,7 @@
>     public void setLong(int index, Long value) {}
>     public SeShape getShape(int i) {return null;}
>     public void setNString(int index, String convertedValue) {}
> +    public ByteArrayInputStream getClob(int i) {return null;}
> +    public ByteArrayInputStream getNClob(int i) {return null;}
>
>  }
> Index: datastore/src/test/java/org/geotools/arcsde/data/TestData.java
> ===================================================================
> --- datastore/src/test/java/org/geotools/arcsde/data/TestData.java
>  (revision 32008)
> +++ datastore/src/test/java/org/geotools/arcsde/data/TestData.java
>  (working copy)
> @@ -425,7 +425,7 @@
>             public SeColumnDefinition[] execute(ISession session,
> SeConnection connection)
>                     throws SeException, IOException {
>
> -                SeColumnDefinition[] colDefs = new SeColumnDefinition[8];
> +                SeColumnDefinition[] colDefs = new SeColumnDefinition[9];
>
>                 /*
>                  * Define the columns and their attributes for the table to
> be
> @@ -453,6 +453,9 @@
>                 // this is a blob one and should be ignored to all effects
>                 colDefs[7] = new SeColumnDefinition("SE_ANNO_CAD_DATA",
>                         SeColumnDefinition.TYPE_BLOB, 1000, 0, isNullable);
> +                // This should not be ignored, but pulled into a String
> +                colDefs[8] = new SeColumnDefinition("CLOB_COL",
> +                               SeColumnDefinition.TYPE_CLOB, 1000, 0,
> isNullable);
>
>                 try {
>                     table.delete();
> Index:
> datastore/src/test/java/org/geotools/arcsde/data/ArcSDEFeatureStoreTest.java
> ===================================================================
> ---
> datastore/src/test/java/org/geotools/arcsde/data/ArcSDEFeatureStoreTest.java
>        (revision 32008)
> +++
> datastore/src/test/java/org/geotools/arcsde/data/ArcSDEFeatureStoreTest.java
>        (working copy)
> @@ -16,7 +16,13 @@
>  */
>  package org.geotools.arcsde.data;
>
> -import static org.junit.Assert.*;
> +import static org.junit.Assert.assertEquals;
> +import static org.junit.Assert.assertFalse;
> +import static org.junit.Assert.assertNotNull;
> +import static org.junit.Assert.assertNull;
> +import static org.junit.Assert.assertSame;
> +import static org.junit.Assert.assertTrue;
> +import static org.junit.Assert.fail;
>
>  import java.io.IOException;
>  import java.util.Calendar;
> Index: datastore/src/main/java/org/geotools/arcsde/data/SdeRow.java
> ===================================================================
> --- datastore/src/main/java/org/geotools/arcsde/data/SdeRow.java
>  (revision 32008)
> +++ datastore/src/main/java/org/geotools/arcsde/data/SdeRow.java
>  (working copy)
> @@ -17,11 +17,14 @@
>  */
>  package org.geotools.arcsde.data;
>
> +import java.io.BufferedReader;
>  import java.io.IOException;
> +import java.io.InputStreamReader;
>
>  import org.geotools.arcsde.ArcSdeException;
>  import org.geotools.data.DataSourceException;
>
> +import com.esri.sde.sdk.client.SeColumnDefinition;
>  import com.esri.sde.sdk.client.SeException;
>  import com.esri.sde.sdk.client.SeRow;
>  import com.esri.sde.sdk.client.SeShape;
> @@ -63,6 +66,36 @@
>                         || statusIndicator == SeRow.SE_IS_NULL_VALUE) {
>                 } else {
>                     values[i] = row.getObject(i);
> +                    /*
> +                     * I'm adding checks here for the [n]clob object that
> are returned as null
> +                     * by getObject, but are reported as Strings.  We can
> suck those out of
> +                     * ByteArrayStreams
> +                     */
> +                    if(values[i] == null) {
> +                       int type = row.getColumnDef(i).getType();
> +                       BufferedReader reader = null;
> +                       if(type == SeColumnDefinition.TYPE_NCLOB) {
> +                               reader = new BufferedReader(new
> InputStreamReader(row.getNClob(i), "UTF-16"));
> +                       }
> +                       else if(type == SeColumnDefinition.TYPE_CLOB) {
> +                               reader = new BufferedReader(new
> InputStreamReader(row.getClob(i), "UTF-16"));
> +                       }
> +                       if(reader != null) {
> +                               try {
> +                                       StringBuffer buf = new
> StringBuffer();
> +                                       String snip = reader.readLine();
> +                                       while(snip != null) {
> +                                               buf.append(snip);
> +                                               buf.append('\n');
> +                                               snip = reader.readLine();
> +                                       }
> +                                       if(buf.length() > 0)
> +                                               values[i] = buf.toString();
> +                               } finally {
> +                                       reader.close();
> +                               }
> +                       }
> +                    }
>                 }
>             }
>         } catch (SeException e) {
> Index: datastore/pom.xml
> ===================================================================
> --- datastore/pom.xml   (revision 32008)
> +++ datastore/pom.xml   (working copy)
> @@ -198,7 +198,7 @@
>         </dependency>
>         <dependency>
>           <groupId>com.esri</groupId>
> -          <artifactId>jsde_jpe_sdk</artifactId>
> +          <artifactId>jpe_sdk</artifactId>
>           <version>${sde.version}</version>
>         </dependency>
>       </dependencies>
> @@ -235,6 +235,21 @@
>         </plugins>
>       </build>
>     </profile>
> +       <profile>
> +               <activation>
> +                       <property>
> +                               <name>sde.version</name>
> +                               <value>9.3</value>
> +                       </property>
> +               </activation>
> +               <dependencies>
> +                       <dependency>
> +                               <groupId>com.ibm.icu</groupId>
> +                               <artifactId>icu4j</artifactId>
> +                               <version>3.2</version>
> +                       </dependency>
> +               </dependencies>
> +       </profile>
>     <profile>
>       <!-- this profile auto-drags in the ArcSDE 9.2 dependecy
>            on the icu4j libraries -->
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables
> unlimited royalty-free distribution of the report engine
> for externally facing server and web deployment.
> http://p.sf.net/sfu/businessobjects
> _______________________________________________
> Geotools-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to