Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.1.0)

E10653-02

oracle.jbo.server.util
Class Canonizer

java.lang.Object
  extended by oracle.jbo.server.util.Canonizer

public class Canonizer
extends java.lang.Object

This class provides functions to help test harnesses coerce Strings into various canonical forms.


Field Summary
static java.lang.String CANONIZED
           
static int JDBC_TIMESTAMP
           
static int ORACLE_DDMONYY
           
 
Method Summary
static void addClassNameTransform(java.lang.String canonicalClassName, java.lang.String[][] productClassNames)
           
static void addMessageTransform(int id, java.lang.String canonicalMessage, java.lang.String[][] productMessages)
          adds a message transformation to the list, messages which are not for the SQLBuilder currently in force are ignored so the caller can write: aMT("drop table error", new String[][] { {SQLBuilder.OLITE, "POL-123 dropped table", "drop table error"}, {SQLBuilder.ORACLE, "ORA-456 droop the tibble", "drop table error"} });
static void addStandardCanonizers()
           
static void addTypeNameTransform(java.lang.String canonicalTypeName, java.lang.String[][] productTypeNames)
           
static java.lang.String canonizeExceptionClassName(java.lang.Exception ex)
           
static java.lang.String canonizeMessage(java.lang.String productMessage, boolean doMassage, boolean appendRest)
          this method searches through the list of registered messages, and transforms the message if a match is found.
static int canonizeSqlType(int sqlType)
          Converts standard JDBC SQL types to Oracle-compliant types to support Kava tests.
static java.lang.String canonizeString(java.lang.Object data)
          An attempt to insulate the Kava test from the format vagaries of different JDBC drivers.
static java.lang.String canonizeWhereClause(java.lang.String where)
           
static int getDateFormat()
           
static java.lang.String massageExceptionMsg(java.lang.String s)
          as the name suggests, removes random irregularities from exception messages - different versions of JDBC drivers have slightly different line terminating strategies...sigh Tnis converts all line separators to \r\n and always returms \r\n at the end of a message TODO: retval should be a StringBuffer for efficiency
static java.lang.String productTypeName(java.lang.String canonTypeName)
           
static void removeClassNameTransforms()
           
static void removeMessageTransforms()
           
static void removeTypeNameTransforms()
           
static void setDateFormat(int format)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANONIZED

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

JDBC_TIMESTAMP

public static final int JDBC_TIMESTAMP
See Also:
Constant Field Values

ORACLE_DDMONYY

public static final int ORACLE_DDMONYY
See Also:
Constant Field Values
Method Detail

setDateFormat

public static void setDateFormat(int format)

getDateFormat

public static int getDateFormat()

addMessageTransform

public static void addMessageTransform(int id,
                                       java.lang.String canonicalMessage,
                                       java.lang.String[][] productMessages)
adds a message transformation to the list, messages which are not for the SQLBuilder currently in force are ignored so the caller can write: aMT("drop table error", new String[][] { {SQLBuilder.OLITE, "POL-123 dropped table", "drop table error"}, {SQLBuilder.ORACLE, "ORA-456 droop the tibble", "drop table error"} });


addClassNameTransform

public static void addClassNameTransform(java.lang.String canonicalClassName,
                                         java.lang.String[][] productClassNames)

addTypeNameTransform

public static void addTypeNameTransform(java.lang.String canonicalTypeName,
                                        java.lang.String[][] productTypeNames)

removeMessageTransforms

public static void removeMessageTransforms()

removeClassNameTransforms

public static void removeClassNameTransforms()

removeTypeNameTransforms

public static void removeTypeNameTransforms()

canonizeMessage

public static java.lang.String canonizeMessage(java.lang.String productMessage,
                                               boolean doMassage,
                                               boolean appendRest)
this method searches through the list of registered messages, and transforms the message if a match is found. eg: The message passed in is "JBO-423 Bad Thing in expression: wombat billy and there is a registered transform "JBO-423 Bad Thing" --> "$CANON-423 Bad Thing" we get "$CANON-423 Bad Thing in expression wombat billy


productTypeName

public static java.lang.String productTypeName(java.lang.String canonTypeName)

canonizeExceptionClassName

public static java.lang.String canonizeExceptionClassName(java.lang.Exception ex)

canonizeWhereClause

public static java.lang.String canonizeWhereClause(java.lang.String where)

canonizeString

public static java.lang.String canonizeString(java.lang.Object data)
An attempt to insulate the Kava test from the format vagaries of different JDBC drivers. For example: if you perform a getObject on a database column that is of type NUMBER(7,2), then the Olite JDBC driver returns a BigDecimal with a scale of 2 - reasonable. Sadly, the 816 JDBC driver has the controversial behaviou that it returns a BigDecimal with scale that id **Data Dependent*! So if the value is 800.00 you get a scale of zero, and if value is 3.14 you get a scale of 2. So, this function is a collection of ad-hoc rules which canonizes the string form of a data attribute to minimize the change in output scripts.


canonizeSqlType

public static int canonizeSqlType(int sqlType)
Converts standard JDBC SQL types to Oracle-compliant types to support Kava tests.

Parameters:
sqlType - A SQL type from either java.sql.Types or oracle.jdbc.OracleTypes
Returns:
An Oracle SQL type, i.e. oracle.jdbc.OracleTypes

massageExceptionMsg

public static java.lang.String massageExceptionMsg(java.lang.String s)
as the name suggests, removes random irregularities from exception messages - different versions of JDBC drivers have slightly different line terminating strategies...sigh Tnis converts all line separators to \r\n and always returms \r\n at the end of a message TODO: retval should be a StringBuffer for efficiency


addStandardCanonizers

public static void addStandardCanonizers()

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.1.0)

E10653-02

Copyright © 1997, 2009, Oracle. All rights reserved.