public class JGeoRaster
extends java.lang.Object
Two constructors are defined in the class to allow users to initiate an instance based on different parameters:
public JGeoRaster(STRUCT georaster) throws ExceptionHere is sample code showing how to use these two constructors:
public JGeoRaster(Connection conn, String rasterDataTable, NUMBER rasterID) throws GeoRasterException
/// reading a GeoRaster object from database based on a query ResultSet rs = statement.executeQuery("SELECT a.georaster FROM georaster_table a where a.georaster.rasterdatatable='RDT' and a.georaster.rasterid=1"); STRUCT geor = (STRUCT) rs.getObject(1); //convert STRUCT into JGeoRaster JGeoRaster j_geor = new JGeoRaster(geor); or /// reading a GeoRaster object from database based on connection,RDT and rid. JGeoRaster j_geor = new JGeoRaster(conn,rasterDataTable,rasterID);When a constructor is invoked to initiate a JGeoRaster object, the following tasks will be done in the init process:
* Validate connection, rdt, and rid, and make sure they identify a valid GeoRaster object in the target database. * Fetch rasterType, spatialExtent, and schema/table/column name of the target Georaster object to initiate attributes of JGeoRaster object. * Fetch metadata XML string of the target Georaster object to initiate the contained JGeoRasterMeta object, for JGeoRasterMeta initiation, check class JGeoRasterMeta. Note:If current GeoRaster object is an empty GeoRaster object(created by function init()), then the following xml string will be used to initiate JGeoRasterMeta "<georasterMetadata xmlns=\"http://xmlns.oracle.com/spatial/georaster\"/>"After a JGeoRaster is successfully initialized, the JGeoRaster object is associated with the corresponding GeoRaster object in the target database through RDT and rid, and it is also working as a root access point of all GeoRaster Java API operations, from which users can deal with different tasks, like:
* Retrieving and updating metadata * Retrieving and updating raster data * Visualizing GeoRaster objects * Accessing the server-side PL/SQL API through JDBCTo get other GeoRaster Java objects from a JGeoRaster object:
//get an instance of JGeoRasterMeta to deal with metadata public JGeoRasterMeta getMetadataObject() //get an instance of JRaster to deal with raster data public JRaster getRasterObject() //get an instance of GeoRasterImage to deal with visualization public GeoRasterImage getGeoRasterImageObject() //get an instance of SdoGeorPKG to access PL/SQL APIs in the package SOD_GEOR through JDBC public SdoGeorPKG getSdoGeorPKG()
Note that this class may not be synchronized with server-side changes.If one thread is reading this GeoRaster object and another is modifying it (such as changing its metadata), there may be inconsistencies. It is not synchronized with any raster data or metadata update through the SdoGeorPKG in the same thread either. In other words, the changes made by any other parties other than by the current JGeoRaster instance and its associated metadata and raster objects are not reflected in the current JGeoRaster instance.
Constructor and Description |
---|
JGeoRaster(java.sql.Connection conn, java.lang.String rasterDataTable, NUMBER rasterID)
Constructs an
GeoRaster object with given connection, rasterDataTable, and rasterID. |
JGeoRaster(oracle.sql.STRUCT georaster)
Deprecated.
|
JGeoRaster(java.sql.Struct georaster, java.sql.Connection conn)
Constructs an
GeoRaster object with the given Struct and connection. |
Modifier and Type | Method and Description |
---|---|
java.sql.Connection |
getConnection()
Returns the connection object associated with current GeoRaster object.
|
java.lang.String |
getGeoRasterColumn()
Returns the column where the current GeoRaster is stored.
|
GeoRasterImage |
getGeoRasterImageObject()
Deprecated.
|
java.lang.String |
getGeoRasterTable()
Returns the table where the current GeoRaster is stored.
|
JGeoRasterMeta |
getMetadataObject()
Returns the JGeoRasterMeta object contained in this JGeoRaster object.
|
static oracle.sql.STRUCT |
getOracleSTRUCT(java.lang.Object o)
Returns oracle.sql.STRUCT while running within WLS or any J2EE container such as OC4J, JBoss etc.
|
static java.sql.Struct |
getOracleSTRUCTJS(java.lang.Object o)
Returns java.sql.Struct while running within WLS or any J2EE container such as OC4J, JBoss etc.
|
java.lang.String |
getRasterDataTable()
Returns the raster data table where the current GeoRaster is stored.
|
NUMBER |
getRasterID()
Returns the raster ID assigned to the current GeoRaster.
|
JRaster |
getRasterObject()
Returns the JRaster object contained in this JGeoRaster object.
|
int |
getRasterType()
Returns the raster type.
|
java.lang.String |
getSchemaName()
Returns the schema where the current GeoRaster is stored.
|
SdoGeorPKG |
getSdoGeorPKG()
Returns a SdoGeorPKG object, which is used to remotely execute PL/SQL functions and procedures defined in the server-side package SDO_GEOR.
|
JGeometry |
getSpatialExtent()
Returns the spatial extent.
|
void |
loadFromDB()
Fetches data from GeoRaster object in the Oracle Database server, which is associated with current JGeoRaster object by RDT and RID, and reinitiates JGeoRaster instance with new data.
|
void |
setConnection(java.sql.Connection connection)
Sets the connection object associated with current GeoRaster object.
|
void |
setRasterType(int rasterType)
Sets the rasterType.
|
void |
setSpatialExtent(JGeometry spatialExtent)
Sets the spatial extent.
|
void |
storeToDB()
Updates the GeoRaster object in the Oracle Database server, which is associated with current JGeoRaster object by RDT and RID.
|
boolean |
validate()
Validates the current JGeoRaster object.
|
@Deprecated public JGeoRaster(oracle.sql.STRUCT georaster) throws java.lang.Exception
GeoRaster
object with the given STRUCT.georaster
- GeoRaster objectjava.lang.Exception
public JGeoRaster(java.sql.Struct georaster, java.sql.Connection conn) throws java.lang.Exception
GeoRaster
object with the given Struct and connection.georaster
- GeoRaster objectconn
- db connectionjava.lang.Exception
public JGeoRaster(java.sql.Connection conn, java.lang.String rasterDataTable, NUMBER rasterID) throws GeoRasterException
GeoRaster
object with given connection, rasterDataTable, and rasterID.conn
- connection to an oracle databaserasterDataTable
- raster data tablerasterID
- raster ID numberGeoRasterException
public int getRasterType()
public void setRasterType(int rasterType)
rasterType
- raster typepublic JGeoRasterMeta getMetadataObject()
public JRaster getRasterObject()
@Deprecated public GeoRasterImage getGeoRasterImageObject()
public SdoGeorPKG getSdoGeorPKG()
public java.sql.Connection getConnection()
public java.lang.String getSchemaName()
public java.lang.String getGeoRasterTable()
public java.lang.String getGeoRasterColumn()
public java.lang.String getRasterDataTable()
public NUMBER getRasterID()
public void setSpatialExtent(JGeometry spatialExtent)
public JGeometry getSpatialExtent()
public void storeToDB() throws java.lang.Exception
java.lang.Exception
public void loadFromDB() throws GeoRasterException
GeoRasterException
public boolean validate() throws java.lang.Exception
java.lang.Exception
public static oracle.sql.STRUCT getOracleSTRUCT(java.lang.Object o) throws java.lang.Exception
o
- object in a result setjava.lang.Exception
public static java.sql.Struct getOracleSTRUCTJS(java.lang.Object o) throws java.lang.Exception
o
- object in a result setjava.lang.Exception
public void setConnection(java.sql.Connection connection)
conn
- the connection object associated with current GeoRaster object