Skip navigation links

Oracle® Spatial Java API Reference
11g Release 1 (11.1)
B28401-01


oracle.spatial.util
Class Util

java.lang.Object
  extended by oracle.spatial.util.Util


public class Util
extends java.lang.Object

some useful utility routines used by SDOVIS. These are not clearly documented so use at your own risk!!


Constructor Summary
Util()
           

 

Method Summary
static void center(java.awt.Component c)
          Centers an awt component w.r.t.
static java.sql.Connection connect(java.lang.String host, java.lang.String sid, java.lang.String port, java.lang.String user, java.lang.String passwd, java.lang.String mode, int rowPref)
          Establishes an Oracle JDBC connection to the specified database.
static double[] convert(java.lang.String str)
          Converts a string of coordinates into a double array.
static java.lang.String getConnStr(java.lang.String mode, java.lang.String host, java.lang.String port, java.lang.String sid)
          connects to the database using supplied information.
static java.lang.String getDBVersion(java.sql.Connection conn)
          Gets the version of the database connected.
static java.lang.String getJDBCDriverVersion(java.sql.Connection conn)
          Gets the oracle JDBC driver version string.
static java.awt.Shape getShape(double[] coords, boolean close)
          converts the coordinate array into a GeneralPath shape.
static boolean isGeodetic(int srid)
          Using an Oracle convention to determin if a srid is geodetic
static boolean isPre9i(java.sql.Connection conn)
          Determin if a database is pre-9i version.
static void main(java.lang.String[] args)
           
static java.awt.geom.Rectangle2D.Double mbr(double[] coords)
           
static byte[] readFile(java.lang.String f)
           
static java.util.ArrayList splitBy(java.lang.String str, java.lang.String delim)
          gets an array list of strings that are separated by delimiters such as commas

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Util

public Util()

Method Detail

convert

public static double[] convert(java.lang.String str)
Converts a string of coordinates into a double array. The delimiter between the numbers can be white space, comma, semicolon, or CR.

splitBy

public static java.util.ArrayList splitBy(java.lang.String str,
                                          java.lang.String delim)
gets an array list of strings that are separated by delimiters such as commas
Parameters:
str - the input string to be tokenized
delim - the delimiter to be used in tokenizing the string
an - arrary list of all the tokens

getShape

public static java.awt.Shape getShape(double[] coords,
                                      boolean close)
converts the coordinate array into a GeneralPath shape.

mbr

public static java.awt.geom.Rectangle2D.Double mbr(double[] coords)

readFile

public static byte[] readFile(java.lang.String f)
                       throws java.io.IOException
Throws:
java.io.IOException

connect

public static java.sql.Connection connect(java.lang.String host,
                                          java.lang.String sid,
                                          java.lang.String port,
                                          java.lang.String user,
                                          java.lang.String passwd,
                                          java.lang.String mode,
                                          int rowPref)
Establishes an Oracle JDBC connection to the specified database. If a OCI mode connection is requested but failed, then a "thin" JDBC connection is automatically attempted.
Parameters:
host - name of the host machine where the database runs
sid - instance id of the database
port - which port the database is listening at
user - the database user to connect to
passwd - the database user's password
mode - the connection mode; possible values are "thin", "oci" or "oci8". If null value is supplied the default "oci8" mode is attempted.
rowPref - the row prefetch to be set with the connection. If a value less than or equal to zero is supplied, the defualt value of 32 will be used for this connection.
Returns:
an Oracle JDBC connection if successful, otherwise null.

getJDBCDriverVersion

public static java.lang.String getJDBCDriverVersion(java.sql.Connection conn)
Gets the oracle JDBC driver version string.

getDBVersion

public static java.lang.String getDBVersion(java.sql.Connection conn)
Gets the version of the database connected.

isPre9i

public static boolean isPre9i(java.sql.Connection conn)
Determin if a database is pre-9i version.

isGeodetic

public static boolean isGeodetic(int srid)
Using an Oracle convention to determin if a srid is geodetic

getConnStr

public static java.lang.String getConnStr(java.lang.String mode,
                                          java.lang.String host,
                                          java.lang.String port,
                                          java.lang.String sid)
connects to the database using supplied information. If any one of the following parameters are null, then the connection will be made to a (default) local database instance.
   mode, host, port, sid
 
If user requires OCI-mode connection but failed, then a "Thin" mode connection is automatically attempted.
Parameters:
mode - the mode of connection. It could either be a THIN or an OCI connection. THIN is slower but pure java, while OCI is faster but requires Oracle OCI library.
host - the host where the database is located.
port - the port where the database instance listens (default is 1521)
sid - the instance id of the database.
user - the user to login on
passwd - the password of the user
rowPref - the row prefetch to be set with the connection
Returns:
a JDBC connection to specified Oracle Database.

center

public static void center(java.awt.Component c)
Centers an awt component w.r.t. the screen.

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        java.lang.Exception,
                        java.sql.SQLException
Throws:
java.io.IOException
java.lang.Exception
java.sql.SQLException

Skip navigation links

Oracle® Spatial Java API Reference
11g Release 1 (11.1)
B28401-01


Copyright © 2007, Oracle. All Rights Reserved.