com.esri.arcgis.geodatabase
Class JSONConverterGdb

java.lang.Object
  extended by com.esri.arcgis.geodatabase.JSONConverterGdb
All Implemented Interfaces:
IExternalDeserializerGdb, IExternalSerializerGdb, IJSONConverterGdb, com.esri.arcgis.interop.RemoteObjRef, IExternalDeserializer, IExternalSerializer, IJSONDeserializer, IJSONSerializer, ISupportErrorInfo, Serializable

public class JSONConverterGdb
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IJSONSerializer, IJSONDeserializer, IExternalSerializerGdb, IExternalDeserializerGdb, IJSONConverterGdb, ISupportErrorInfo

All-in-one JSON conversion for the GeoDatabase library. Supports all previous JSON interfaces in the GeoDatabase, namely IJSONSerializer, IJSONDeserializer, IExternalSerializerGdb, IExternalDeserializerGdb

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

See Also:
Serialized Form

Constructor Summary
JSONConverterGdb()
          Constructs a JSONConverterGdb using ArcGIS Engine.
JSONConverterGdb(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
JSONConverterGdb theJSONConverterGdb = (JSONConverterGdb) obj;
 
Method Summary
 boolean equals(Object o)
          Compare this object with another
static String getClsid()
          getClsid.
 byte[] getErrorObject(String propname, int code, String message, IStringArray details)
          Convenience method.
 IJSONReader getReader()
          Obtains JSON Reader.
 IJSONWriter getWriter()
          Obtains JSON Writer.
 int hashCode()
          the hashcode for this object
 void initDeserializer(IJSONReader pReader, IPropertySet pProps)
          Write deserialization options.
 void initSerializer(IJSONWriter pWriter, IPropertySet pProps)
          Writes serialization options.
 void interfaceSupportsErrorInfo(GUID riid)
          interfaceSupportsErrorInfo
 void queryJSONDomain(IDomain pDomain, IJSONObject pDomainJO)
          Query domain info from IDomain and populate IJSONObject.
 IGeometry readGeometry(int geomType)
          Reads geometry object.
 Object readObject(GUID riid, IPropertySet pProps)
          Deserialize an object.
 void readRecordSet(IJSONReader pReader, IFields pDefaultSchema, IPropertySet pConversionProps, IRecordSet[] ppRecordset, IPropertySet[] ppOriginalToNewFieldMap)
          Reads RecordSet object from IJSONReader.
 ISpatialReference readSpatialReference()
          Reads spatial reference object.
 void toRecordSet(IJSONObject pObj, IFields pDefaultSchema, IPropertySet pConversionProps, IRecordSet[] ppRecordset, IPropertySet[] ppOriginalToNewFieldMap)
          Reads RecordSet object from IJSONObject.
 void writeErrorObject(String propname, int code, String message, IStringArray details)
          Writes error object.
 void writeGeometry(String propname, IGeometry pGeom)
          Writes geometry object.
 void writeObject(Object pUnk, IPropertySet pProps)
          Serializes an object.
 void writeRecordSet(IJSONWriter pWriter, IJSONConverterGeometry pGeomConv, IPropertySet pProps, String propname, IRecordSet pRecordset, IGeometryResultOptions pGeomOpt, boolean bWriteEndOfObj)
          Writes RecordSet to IJSONWriter.
 void writeRecordSet(String propname, IRecordSet pRecordset, IGeometryResultOptions pGeomOpt)
          Writes feature recordset.
 void writeRow(String propname, IRow pRow, IFields pFields, int[] rowFieldIndexes, IGeometryResultOptions pGeomOpt)
          Writes feature row object
 void writeSpatialReference(String propname, ISpatialReference pSR)
          Writes spatial reference object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

JSONConverterGdb

public JSONConverterGdb()
                 throws IOException,
                        UnknownHostException
Constructs a JSONConverterGdb using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

JSONConverterGdb

public JSONConverterGdb(Object obj)
                 throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
JSONConverterGdb theJSONConverterGdb = (JSONConverterGdb) obj;

Construct a JSONConverterGdb using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to JSONConverterGdb.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

getWriter

public IJSONWriter getWriter()
                      throws IOException,
                             AutomationException
Obtains JSON Writer.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getWriter in interface IJSONSerializer
Returns:
A reference to a com.esri.arcgis.system.IJSONWriter
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

initSerializer

public void initSerializer(IJSONWriter pWriter,
                           IPropertySet pProps)
                    throws IOException,
                           AutomationException
Writes serialization options.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
initSerializer in interface IJSONSerializer
Parameters:
pWriter - A reference to a com.esri.arcgis.system.IJSONWriter (in)
pProps - A reference to a com.esri.arcgis.system.IPropertySet (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeObject

public void writeObject(Object pUnk,
                        IPropertySet pProps)
                 throws IOException,
                        AutomationException
Serializes an object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
writeObject in interface IExternalSerializer
Parameters:
pUnk - A reference to another Object (IUnknown) (in)
pProps - A reference to a com.esri.arcgis.system.IPropertySet (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getReader

public IJSONReader getReader()
                      throws IOException,
                             AutomationException
Obtains JSON Reader.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getReader in interface IJSONDeserializer
Returns:
A reference to a com.esri.arcgis.system.IJSONReader
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

initDeserializer

public void initDeserializer(IJSONReader pReader,
                             IPropertySet pProps)
                      throws IOException,
                             AutomationException
Write deserialization options.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
initDeserializer in interface IJSONDeserializer
Parameters:
pReader - A reference to a com.esri.arcgis.system.IJSONReader (in)
pProps - A reference to a com.esri.arcgis.system.IPropertySet (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readObject

public Object readObject(GUID riid,
                         IPropertySet pProps)
                  throws IOException,
                         AutomationException
Deserialize an object. riid references an interface to use. If interface is not supported, E_NOTIMPL is returned.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readObject in interface IExternalDeserializer
Parameters:
riid - A Structure: com.esri.arcgis.support.ms.stdole.GUID (in)
pProps - A reference to a com.esri.arcgis.system.IPropertySet (in)
Returns:
A reference to another Object (IUnknown)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeSpatialReference

public void writeSpatialReference(String propname,
                                  ISpatialReference pSR)
                           throws IOException,
                                  AutomationException
Writes spatial reference object. Pass NULL as propname to write standalone JSON object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
writeSpatialReference in interface IExternalSerializerGdb
Parameters:
propname - The propname (in)
pSR - A reference to a com.esri.arcgis.geometry.ISpatialReference (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeGeometry

public void writeGeometry(String propname,
                          IGeometry pGeom)
                   throws IOException,
                          AutomationException
Writes geometry object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
writeGeometry in interface IExternalSerializerGdb
Parameters:
propname - The propname (in)
pGeom - A reference to a com.esri.arcgis.geometry.IGeometry (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeRow

public void writeRow(String propname,
                     IRow pRow,
                     IFields pFields,
                     int[] rowFieldIndexes,
                     IGeometryResultOptions pGeomOpt)
              throws IOException,
                     AutomationException
Writes feature row object

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
writeRow in interface IExternalSerializerGdb
Parameters:
propname - The propname (in)
pRow - A reference to a com.esri.arcgis.geodatabase.IRow (in)
pFields - A reference to a com.esri.arcgis.geodatabase.IFields (in)
rowFieldIndexes - The rowFieldIndexes (in)
pGeomOpt - A reference to a com.esri.arcgis.geodatabase.IGeometryResultOptions (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeRecordSet

public void writeRecordSet(String propname,
                           IRecordSet pRecordset,
                           IGeometryResultOptions pGeomOpt)
                    throws IOException,
                           AutomationException
Writes feature recordset.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
writeRecordSet in interface IExternalSerializerGdb
Parameters:
propname - The propname (in)
pRecordset - A reference to a com.esri.arcgis.geodatabase.IRecordSet (in)
pGeomOpt - A reference to a com.esri.arcgis.geodatabase.IGeometryResultOptions (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeErrorObject

public void writeErrorObject(String propname,
                             int code,
                             String message,
                             IStringArray details)
                      throws IOException,
                             AutomationException
Writes error object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
writeErrorObject in interface IExternalSerializerGdb
Parameters:
propname - The propname (in)
code - The code (in)
message - The message (in)
details - A reference to a com.esri.arcgis.system.IStringArray (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getErrorObject

public byte[] getErrorObject(String propname,
                             int code,
                             String message,
                             IStringArray details)
                      throws IOException,
                             AutomationException
Convenience method. Creates and returns error object as byte SAFEARRAY.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getErrorObject in interface IExternalSerializerGdb
Parameters:
propname - The propname (in)
code - The code (in)
message - The message (in)
details - A reference to a com.esri.arcgis.system.IStringArray (in)
Returns:
An unsigned byte
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readSpatialReference

public ISpatialReference readSpatialReference()
                                       throws IOException,
                                              AutomationException
Reads spatial reference object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readSpatialReference in interface IExternalDeserializerGdb
Returns:
A reference to a com.esri.arcgis.geometry.ISpatialReference
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readGeometry

public IGeometry readGeometry(int geomType)
                       throws IOException,
                              AutomationException
Reads geometry object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readGeometry in interface IExternalDeserializerGdb
Parameters:
geomType - A com.esri.arcgis.geometry.esriGeometryType constant (in)
Returns:
A reference to a com.esri.arcgis.geometry.IGeometry
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readRecordSet

public void readRecordSet(IJSONReader pReader,
                          IFields pDefaultSchema,
                          IPropertySet pConversionProps,
                          IRecordSet[] ppRecordset,
                          IPropertySet[] ppOriginalToNewFieldMap)
                   throws IOException,
                          AutomationException
Reads RecordSet object from IJSONReader.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readRecordSet in interface IJSONConverterGdb
Parameters:
pReader - A reference to a com.esri.arcgis.system.IJSONReader (in)
pDefaultSchema - A reference to a com.esri.arcgis.geodatabase.IFields (in)
pConversionProps - A reference to a com.esri.arcgis.system.IPropertySet (in)
ppRecordset - A reference to a com.esri.arcgis.geodatabase.IRecordSet (out: use single element array)
ppOriginalToNewFieldMap - A reference to a com.esri.arcgis.system.IPropertySet (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

toRecordSet

public void toRecordSet(IJSONObject pObj,
                        IFields pDefaultSchema,
                        IPropertySet pConversionProps,
                        IRecordSet[] ppRecordset,
                        IPropertySet[] ppOriginalToNewFieldMap)
                 throws IOException,
                        AutomationException
Reads RecordSet object from IJSONObject. pDefaultSchema is used only when input JSON has no 'fields' attribute. Pass NULL if not needed. Also, sometimes field names are corrected by the GeoDatabase, use ppOriginalToNewFieldMap to find new field names.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
toRecordSet in interface IJSONConverterGdb
Parameters:
pObj - A reference to a com.esri.arcgis.system.IJSONObject (in)
pDefaultSchema - A reference to a com.esri.arcgis.geodatabase.IFields (in)
pConversionProps - A reference to a com.esri.arcgis.system.IPropertySet (in)
ppRecordset - A reference to a com.esri.arcgis.geodatabase.IRecordSet (out: use single element array)
ppOriginalToNewFieldMap - A reference to a com.esri.arcgis.system.IPropertySet (out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

writeRecordSet

public void writeRecordSet(IJSONWriter pWriter,
                           IJSONConverterGeometry pGeomConv,
                           IPropertySet pProps,
                           String propname,
                           IRecordSet pRecordset,
                           IGeometryResultOptions pGeomOpt,
                           boolean bWriteEndOfObj)
                    throws IOException,
                           AutomationException
Writes RecordSet to IJSONWriter. Writes closing bracked if bWriteEndOfObj is VARIANT_TRUE. Set bWriteEndOfObj to VARIANT_FALSE if you want to append additional JSON before closing object.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
writeRecordSet in interface IJSONConverterGdb
Parameters:
pWriter - A reference to a com.esri.arcgis.system.IJSONWriter (in)
pGeomConv - A reference to a com.esri.arcgis.geometry.IJSONConverterGeometry (in)
pProps - A reference to a com.esri.arcgis.system.IPropertySet (in)
propname - The propname (in)
pRecordset - A reference to a com.esri.arcgis.geodatabase.IRecordSet (in)
pGeomOpt - A reference to a com.esri.arcgis.geodatabase.IGeometryResultOptions (in)
bWriteEndOfObj - The bWriteEndOfObj (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

queryJSONDomain

public void queryJSONDomain(IDomain pDomain,
                            IJSONObject pDomainJO)
                     throws IOException,
                            AutomationException
Query domain info from IDomain and populate IJSONObject.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
queryJSONDomain in interface IJSONConverterGdb
Parameters:
pDomain - A reference to a com.esri.arcgis.geodatabase.IDomain (in)
pDomainJO - A reference to a com.esri.arcgis.system.IJSONObject (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

interfaceSupportsErrorInfo

public void interfaceSupportsErrorInfo(GUID riid)
                                throws IOException,
                                       AutomationException
interfaceSupportsErrorInfo

Description

Indicates whether the interface supports IErrorInfo.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
interfaceSupportsErrorInfo in interface ISupportErrorInfo
Parameters:
riid - A Structure: com.esri.arcgis.support.ms.stdole.GUID (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.