com.jdbwc.util
Class Util

java.lang.Object
  extended by com.jdbwc.util.Util

public final class Util
extends java.lang.Object

General utility class to assist the JDBWC Driver.

Version:
2008-05-29, 2010-04-10, 2010-04-17
Author:
Tim Gall

Field Summary
static int CASE_LOWER
           
static int CASE_MIXED
           
static int CASE_UPPER
           
static java.lang.String DT_IMPL_VER
          DataHandler implementation used by this driver
static int ID_DEFAULT
           
static int ID_MYSQL
           
static int ID_POSTGRESQL
           
static java.lang.String OUR_ACTION
           
static java.lang.String OUR_AUTH
           
static java.lang.String OUR_DBTYPE
           
static boolean OUR_DEBUG_MODE
          users debug trigger for JDBC and server-side (WC)
static java.lang.String OUR_DEBUG_TAG
           
static java.lang.String OUR_SEC_PASS
           
static java.lang.String OUR_SEC_USER
           
static java.lang.String OUR_SQL
           
static boolean OUR_UA_FIX
          Workaround to enable the use of a dummy User-Agent if you think the HttpClient agent is being blocked by your host.
static java.lang.String OUR_USER_AGENT
          Dummy User-Agent
This is only used if OUR_UA_FIX = true
static java.lang.String WC_ERROR_TAG
          Indetifier for errors being sent from the server API
static java.lang.String WC_NL
          systems line break property
 
Method Summary
static boolean checkForExceptions(java.lang.String response)
          Look for errors from the server.
Chuck a wobbly (alias: throw exception) back to the requesting method with a few details about the problem if one [or more] are found.

NOTE: This release will only throw one exception for the first found (instead of java's usual exception trail) but will include details for all in the message.
static java.lang.String csvFormat(java.lang.String input)
           
static java.lang.String csvUnFormat(java.lang.String input)
           
static com.ozdevworx.dtype.DataHandler getCaseSafeHandler(int caseType)
          DataHandler Factory method.

Get a DataHandler object with keys matching the required caseType to satisfy various database engine requirements.

All DataHandler objects used by this driver come from this method, making the use of different DataHandler implementations very simple.
static java.lang.String parseResponse(java.io.InputStream ins)
           
static org.apache.commons.httpclient.NameValuePair[] prepareForWeb(com.ozdevworx.dtype.DataHandler input)
           
static java.lang.String stripTags(java.lang.String input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WC_NL

public static final java.lang.String WC_NL
systems line break property


OUR_SQL

public static final java.lang.String OUR_SQL
See Also:
Constant Field Values

OUR_ACTION

public static final java.lang.String OUR_ACTION
See Also:
Constant Field Values

OUR_AUTH

public static final java.lang.String OUR_AUTH
See Also:
Constant Field Values

OUR_SEC_USER

public static final java.lang.String OUR_SEC_USER
See Also:
Constant Field Values

OUR_SEC_PASS

public static final java.lang.String OUR_SEC_PASS
See Also:
Constant Field Values

OUR_DBTYPE

public static final java.lang.String OUR_DBTYPE
See Also:
Constant Field Values

OUR_DEBUG_TAG

public static final java.lang.String OUR_DEBUG_TAG
See Also:
Constant Field Values

OUR_DEBUG_MODE

public static boolean OUR_DEBUG_MODE
users debug trigger for JDBC and server-side (WC)


DT_IMPL_VER

public static final java.lang.String DT_IMPL_VER
DataHandler implementation used by this driver


OUR_UA_FIX

public static boolean OUR_UA_FIX
Workaround to enable the use of a dummy User-Agent if you think the HttpClient agent is being blocked by your host.


OUR_USER_AGENT

public static final java.lang.String OUR_USER_AGENT
Dummy User-Agent
This is only used if OUR_UA_FIX = true

See Also:
Constant Field Values

ID_DEFAULT

public static final int ID_DEFAULT
See Also:
Constant Field Values

ID_MYSQL

public static final int ID_MYSQL
See Also:
Constant Field Values

ID_POSTGRESQL

public static final int ID_POSTGRESQL
See Also:
Constant Field Values

CASE_LOWER

public static final int CASE_LOWER
See Also:
Constant Field Values

CASE_UPPER

public static final int CASE_UPPER
See Also:
Constant Field Values

CASE_MIXED

public static final int CASE_MIXED
See Also:
Constant Field Values

WC_ERROR_TAG

public static final java.lang.String WC_ERROR_TAG
Indetifier for errors being sent from the server API

See Also:
Constant Field Values
Method Detail

stripTags

public static java.lang.String stripTags(java.lang.String input)

parseResponse

public static java.lang.String parseResponse(java.io.InputStream ins)
                                      throws java.sql.SQLException,
                                             java.io.IOException
Throws:
java.sql.SQLException
java.io.IOException

checkForExceptions

public static boolean checkForExceptions(java.lang.String response)
                                  throws java.sql.SQLException
Look for errors from the server.
Chuck a wobbly (alias: throw exception) back to the requesting method with a few details about the problem if one [or more] are found.

NOTE: This release will only throw one exception for the first found (instead of java's usual exception trail) but will include details for all in the message.

Parameters:
response - The Server response String.
Returns:
false if no errors are found.
Throws:
java.sql.SQLException - if any errors are detected.

prepareForWeb

public static org.apache.commons.httpclient.NameValuePair[] prepareForWeb(com.ozdevworx.dtype.DataHandler input)
Parameters:
input - LabeledArray
Returns:
A single NameValuePair[] of NameValuePair's representing the input param

getCaseSafeHandler

public static com.ozdevworx.dtype.DataHandler getCaseSafeHandler(int caseType)
DataHandler Factory method.

Get a DataHandler object with keys matching the required caseType to satisfy various database engine requirements.

All DataHandler objects used by this driver come from this method, making the use of different DataHandler implementations very simple.

Parameters:
caseType - One of Util.CASE_LOWER, Util.CASE_UPPER, Util.CASE_MIXED
Returns:
A new DataHandler object with keys forced to caseType

csvFormat

public static java.lang.String csvFormat(java.lang.String input)

csvUnFormat

public static java.lang.String csvUnFormat(java.lang.String input)