Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.types
Class CDCDataValueFactory  view CDCDataValueFactory download CDCDataValueFactory.java

java.lang.Object
  extended byorg.apache.derby.iapi.types.DataValueFactoryImpl
      extended byorg.apache.derby.iapi.types.CDCDataValueFactory
All Implemented Interfaces:
DataValueFactory, org.apache.derby.iapi.services.monitor.ModuleControl, org.apache.derby.iapi.services.monitor.ModuleSupportable

public class CDCDataValueFactory
extends DataValueFactoryImpl
implements org.apache.derby.iapi.services.monitor.ModuleSupportable

DataValueFactory implementation for J2ME/CDC/Foundation. Cannot use SQLDecimal since that requires java.math.BigDecimal. Uses BigIntegerDecimal for DECIMAL support.


Field Summary
(package private)  org.apache.derby.iapi.services.i18n.LocaleFinder localeFinder
           
 
Constructor Summary
CDCDataValueFactory()
          Make the constructor public.
 
Method Summary
 void boot(boolean create, java.util.Properties properties)
          Boot this module with the given properties.
 boolean canSupport(java.util.Properties properties)
          See if this implementation can support any attributes that are listed in properties.
 BitDataValue getBitDataValue(byte[] value)
          Get a SQL bit with the given value.
 BitDataValue getBitDataValue(byte[] value, BitDataValue previous)
           
 BitDataValue getBlobDataValue(byte[] value)
          Get a SQL Blob with the given value.
 BitDataValue getBlobDataValue(byte[] value, BitDataValue previous)
           
 StringDataValue getCharDataValue(java.lang.String value)
          Get a SQL char with the given value.
 StringDataValue getCharDataValue(java.lang.String value, StringDataValue previous)
           
 StringDataValue getClobDataValue(java.lang.String value)
          Get a SQL Clob with the given value.
 StringDataValue getClobDataValue(java.lang.String value, StringDataValue previous)
           
 BooleanDataValue getDataValue(boolean value)
          Get a SQL boolean with the given value.
 BooleanDataValue getDataValue(java.lang.Boolean value)
          Get a SQL boolean with the given value.
 BooleanDataValue getDataValue(boolean value, BooleanDataValue previous)
           
 BooleanDataValue getDataValue(java.lang.Boolean value, BooleanDataValue previous)
           
 BooleanDataValue getDataValue(BooleanDataValue value)
          Get a SQL boolean with the given value.
 NumberDataValue getDataValue(byte value)
          Get a SQL TINYINT with the given value.
 NumberDataValue getDataValue(java.lang.Byte value)
          Get a SQL TINYINT with the given value.
 NumberDataValue getDataValue(byte value, NumberDataValue previous)
           
 NumberDataValue getDataValue(java.lang.Byte value, NumberDataValue previous)
           
 NumberDataValue getDataValue(char value)
          Get a SQL int with a char value.
 NumberDataValue getDataValue(char value, NumberDataValue previous)
           
 DateTimeDataValue getDataValue(java.sql.Date value)
          Get a SQL date with the given value.
 DateTimeDataValue getDataValue(java.sql.Date value, DateTimeDataValue previous)
           
 NumberDataValue getDataValue(double value)
          Get a SQL double precision with the given value.
 NumberDataValue getDataValue(java.lang.Double value)
          Get a SQL double precision with the given value.
 NumberDataValue getDataValue(double value, NumberDataValue previous)
           
 NumberDataValue getDataValue(java.lang.Double value, NumberDataValue previous)
           
 NumberDataValue getDataValue(float value)
          Get a SQL real with the given value.
 NumberDataValue getDataValue(java.lang.Float value)
          Get a SQL real with the given value.
 NumberDataValue getDataValue(float value, NumberDataValue previous)
           
 NumberDataValue getDataValue(java.lang.Float value, NumberDataValue previous)
           
 NumberDataValue getDataValue(int value)
          Get a SQL int with the given value.
 NumberDataValue getDataValue(java.lang.Integer value)
          Get a SQL int with the given value.
 NumberDataValue getDataValue(java.lang.Integer value, NumberDataValue previous)
           
 NumberDataValue getDataValue(int value, NumberDataValue previous)
           
 NumberDataValue getDataValue(long value)
          Get a SQL bigint with the given value.
 NumberDataValue getDataValue(java.lang.Long value)
          Get a SQL bigint with the given value.
 NumberDataValue getDataValue(long value, NumberDataValue previous)
           
 NumberDataValue getDataValue(java.lang.Long value, NumberDataValue previous)
           
 UserDataValue getDataValue(java.lang.Object value)
          Get a User-defined data value with the given value and type name.
 UserDataValue getDataValue(java.lang.Object value, UserDataValue previous)
           
 RefDataValue getDataValue(RowLocation value)
          Get a RefDataValue with the given value.
 RefDataValue getDataValue(RowLocation value, RefDataValue previous)
           
 NumberDataValue getDataValue(short value)
          Get a SQL SMALLINT with the given value.
 NumberDataValue getDataValue(java.lang.Short value)
          Get a SQL smallint with the given value.
 NumberDataValue getDataValue(short value, NumberDataValue previous)
           
 NumberDataValue getDataValue(java.lang.Short value, NumberDataValue previous)
           
 DateTimeDataValue getDataValue(java.sql.Time value)
          Get a SQL time with the given value.
 DateTimeDataValue getDataValue(java.sql.Time value, DateTimeDataValue previous)
           
 DateTimeDataValue getDataValue(java.sql.Timestamp value)
          Get a SQL timestamp with the given value.
 DateTimeDataValue getDataValue(java.sql.Timestamp value, DateTimeDataValue previous)
           
 DateTimeDataValue getDate(DataValueDescriptor operand)
          Implement the date SQL function: construct a SQL date from a string, number, or timestamp.
 DateTimeDataValue getDateValue(java.lang.String dateStr, boolean isJdbcEscape)
           
 NumberDataValue getDecimalDataValue(java.lang.Long value, NumberDataValue previous)
          Get a SQL DECIMAL with the given value.
 NumberDataValue getDecimalDataValue(java.lang.Number value)
          Get a SQL DECIMAL with the given value.
 NumberDataValue getDecimalDataValue(java.lang.Number value, NumberDataValue previous)
           
 NumberDataValue getDecimalDataValue(java.lang.String value)
          Get a SQL DECIMAL with the given value.
 NumberDataValue getDecimalDataValue(java.lang.String value, NumberDataValue previous)
           
 BitDataValue getLongVarbitDataValue(byte[] value)
          Get a SQL Long Bit Varying with the given value.
 BitDataValue getLongVarbitDataValue(byte[] value, BitDataValue previous)
           
 StringDataValue getLongvarcharDataValue(java.lang.String value)
          Get a SQL long varchar with the given value.
 StringDataValue getLongvarcharDataValue(java.lang.String value, StringDataValue previous)
           
 StringDataValue getNationalCharDataValue(java.lang.String value)
          Get a SQL national char with the given value.
 StringDataValue getNationalCharDataValue(java.lang.String value, StringDataValue previous)
           
 StringDataValue getNationalLongvarcharDataValue(java.lang.String value)
          Get a SQL national long varchar with the given value.
 StringDataValue getNationalLongvarcharDataValue(java.lang.String value, StringDataValue previous)
           
 StringDataValue getNationalVarcharDataValue(java.lang.String value)
          Get a SQL national varchar with the given value.
 StringDataValue getNationalVarcharDataValue(java.lang.String value, StringDataValue previous)
           
 StringDataValue getNClobDataValue(java.lang.String value)
          Get a SQL national blob with the given value.
 StringDataValue getNClobDataValue(java.lang.String value, StringDataValue previous)
           
 BitDataValue getNullBit(BitDataValue dataValue)
          Get a SQL Bit with a SQL null value.
 BitDataValue getNullBlob(BitDataValue dataValue)
          Get a SQL Blob with a SQL null value.
 BooleanDataValue getNullBoolean(BooleanDataValue dataValue)
          Get a SQL boolean with a SQL null value.
 NumberDataValue getNullByte(NumberDataValue dataValue)
          Get a SQL tinyint with a SQL null value.
 StringDataValue getNullChar(StringDataValue dataValue)
          Get a SQL char with a SQL null value.
 StringDataValue getNullClob(StringDataValue dataValue)
          Get a SQL long varchar with a SQL null value.
 DateTimeDataValue getNullDate(DateTimeDataValue dataValue)
          Get a SQL date with a SQL null value.
 NumberDataValue getNullDecimal(NumberDataValue dataValue)
          Get a SQL Decimal/Numeric with a SQL null value.
 NumberDataValue getNullDouble(NumberDataValue dataValue)
          Get a SQL double with a SQL null value.
 NumberDataValue getNullFloat(NumberDataValue dataValue)
          Get a SQL float with a SQL null value.
 NumberDataValue getNullInteger(NumberDataValue dataValue)
          Get a SQL int with a SQL null value.
 NumberDataValue getNullLong(NumberDataValue dataValue)
          Get a SQL bigint with a SQL null value.
 BitDataValue getNullLongVarbit(BitDataValue dataValue)
          Get a SQL Long Bit Varying with a SQL null value.
 StringDataValue getNullLongvarchar(StringDataValue dataValue)
          Get a SQL long varchar with a SQL null value.
 StringDataValue getNullNationalChar(StringDataValue dataValue)
          Get a SQL national char with a SQL null value.
 StringDataValue getNullNationalLongvarchar(StringDataValue dataValue)
          Get a SQL national long varchar with a SQL null value.
 StringDataValue getNullNationalVarchar(StringDataValue dataValue)
          Get a SQL national varchar with a SQL null value.
 StringDataValue getNullNClob(StringDataValue dataValue)
          Get a SQL NCLOB with a SQL null value.
 UserDataValue getNullObject(UserDataValue dataValue)
          Get a User-defined data value with a SQL null value.
 RefDataValue getNullRef(RefDataValue dataValue)
          Get a RefDataValue with a SQL null value.
 NumberDataValue getNullShort(NumberDataValue dataValue)
          Get a SQL smallint with a SQL null value.
 DateTimeDataValue getNullTime(DateTimeDataValue dataValue)
          Get a SQL time with a SQL null value.
 DateTimeDataValue getNullTimestamp(DateTimeDataValue dataValue)
          Get a SQL timestamp with a SQL null value.
 BitDataValue getNullVarbit(BitDataValue dataValue)
          Get a SQL Bit Varying with a SQL null value.
 StringDataValue getNullVarchar(StringDataValue dataValue)
          Get a SQL varchar with a SQL null value.
 XMLDataValue getNullXML(XMLDataValue dataValue)
          getNullXML: Get an XML with a SQL null value.
 DateTimeDataValue getTimestamp(DataValueDescriptor operand)
          Implement the timestamp SQL function: construct a SQL timestamp from a string, or timestamp.
 DateTimeDataValue getTimestamp(DataValueDescriptor date, DataValueDescriptor time)
          Construct a SQL timestamp from a date and time.
 DateTimeDataValue getTimestampValue(java.lang.String timestampStr, boolean isJdbcEscape)
           
 DateTimeDataValue getTimeValue(java.lang.String timeStr, boolean isJdbcEscape)
           
 BitDataValue getVarbitDataValue(byte[] value)
          Get a SQL bit with the given value.
 BitDataValue getVarbitDataValue(byte[] value, BitDataValue previous)
           
 StringDataValue getVarcharDataValue(java.lang.String value)
          Get a SQL varchar with the given value.
 StringDataValue getVarcharDataValue(java.lang.String value, StringDataValue previous)
           
 XMLDataValue getXMLDataValue()
          getXMLDataValue: Get a SQL null value with XML type.
 XMLDataValue getXMLDataValue(XMLDataValue previous)
          getXMLDataValue: Get a null XML value.
 void stop()
          Stop the module.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localeFinder

org.apache.derby.iapi.services.i18n.LocaleFinder localeFinder
Constructor Detail

CDCDataValueFactory

public CDCDataValueFactory()
Make the constructor public.

Method Detail

canSupport

public boolean canSupport(java.util.Properties properties)
Description copied from interface: org.apache.derby.iapi.services.monitor.ModuleSupportable
See if this implementation can support any attributes that are listed in properties. This call may be made on a newly created instance before the boot() method has been called, or after the boot method has been called for a running module.

The module can check for attributes in the properties to see if it can fulfill the required behaviour. E.g. the raw store may define an attribute called RawStore.Recoverable. If a temporary raw store is required the property RawStore.recoverable=false would be added to the properties before calling bootServiceModule. If a raw store cannot support this attribute its canSupport method would return null. Also see the Monitor class's prologue to see how the identifier is used in looking up properties.
Actually a better way maybe to have properties of the form RawStore.Attributes.mandatory=recoverable,smallfootprint and RawStore.Attributes.requested=oltp,fast

Specified by:
canSupport in interface org.apache.derby.iapi.services.monitor.ModuleSupportable

getDecimalDataValue

public NumberDataValue getDecimalDataValue(java.lang.Long value,
                                           NumberDataValue previous)
                                    throws org.apache.derby.iapi.error.StandardException
Description copied from interface: DataValueFactory
Get a SQL DECIMAL with the given value.

Specified by:
getDecimalDataValue in interface DataValueFactory

getDecimalDataValue

public NumberDataValue getDecimalDataValue(java.lang.String value)
                                    throws org.apache.derby.iapi.error.StandardException
Description copied from interface: DataValueFactory
Get a SQL DECIMAL with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.

Specified by:
getDecimalDataValue in interface DataValueFactory

getNullDecimal

public NumberDataValue getNullDecimal(NumberDataValue dataValue)
Description copied from interface: DataValueFactory
Get a SQL Decimal/Numeric with a SQL null value. If the supplied value is null then get a new value, otherwise set it to null and return that value.

Specified by:
getNullDecimal in interface DataValueFactory

boot

public void boot(boolean create,
                 java.util.Properties properties)
          throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.services.monitor.ModuleControl
Boot this module with the given properties. Creates a module instance that can be found using the findModule() methods of Monitor. The module can only be found using one of these findModule() methods once this method has returned.

An implementation's boot method can throw StandardException. If it is thrown the module is not registered by the monitor and therefore cannot be found through a findModule(). In this case the module's stop() method is not called, thus throwing this exception must free up any resources.

When create is true the contents of the properties object will be written to the service.properties of the persistent service. Thus any code that requires an entry in service.properties must explicitly place the value in this properties set using the put method.
Typically the properties object contains one or more default properties sets, which are not written out to service.properties. These default sets are how callers modify the create process. In a JDBC connection database create the first set of defaults is a properties object that contains the attributes that were set on the jdbc:derby: URL. This attributes properties set has the second default properties set as its default. This set (which could be null) contains the properties that the user set on their DriverManager.getConnection() call, and are thus not owned by cloudscape code, and thus must not be modified by cloudscape code.

When create is false the properties object contains all the properties set in the service.properties file plus a limited number of attributes from the JDBC URL attributes or connection properties set. This avoids properties set by the user compromising the boot process. An example of a property passed in from the JDBC world is the bootPassword for encrypted databases.

Code should not hold onto the passed in properties reference after boot time as its contents may change underneath it. At least after the complete boot is completed, the links to all the default sets will be removed.

Specified by:
boot in interface org.apache.derby.iapi.services.monitor.ModuleControl

stop

public void stop()
Description copied from interface: org.apache.derby.iapi.services.monitor.ModuleControl
Stop the module. The module may be found via a findModule() method until some time after this method returns. Therefore the factory must be prepared to reject requests to it once it has been stopped. In addition other modules may cache a reference to the module and make requests of it after it has been stopped, these requests should be rejected as well.

Specified by:
stop in interface org.apache.derby.iapi.services.monitor.ModuleControl

getDataValue

public NumberDataValue getDataValue(int value)
Description copied from interface: DataValueFactory
Get a SQL int with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(int value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Integer value)
Description copied from interface: DataValueFactory
Get a SQL int with the given value. A null argument means get a SQL null value. The second form uses the previous value (if non-null) to hold the return value.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Integer value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(char value)
Description copied from interface: DataValueFactory
Get a SQL int with a char value. A null argument means get a SQL null value. The second form uses the previous value (if non-null) to hold the return value.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(char value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(short value)
Description copied from interface: DataValueFactory
Get a SQL SMALLINT with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(short value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Short value)
Description copied from interface: DataValueFactory
Get a SQL smallint with the given value. A null argument means get a SQL null value. The second form uses the previous value (if non-null) to hold the return value.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Short value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(byte value)
Description copied from interface: DataValueFactory
Get a SQL TINYINT with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(byte value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Byte value)
Description copied from interface: DataValueFactory
Get a SQL TINYINT with the given value. A null argument means get a SQL null value. The second form uses the previous value (if non-null) to hold the return value.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Byte value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(long value)
Description copied from interface: DataValueFactory
Get a SQL bigint with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(long value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Long value)
Description copied from interface: DataValueFactory
Get a SQL bigint with the given value. A null argument means get a SQL null value. The second form uses the previous value (if non-null) to hold the return value.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Long value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(float value)
                             throws org.apache.derby.iapi.error.StandardException
Description copied from interface: DataValueFactory
Get a SQL real with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(float value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Float value)
                             throws org.apache.derby.iapi.error.StandardException
Description copied from interface: DataValueFactory
Get a SQL real with the given value. A null argument means get a SQL null value. The second form uses the previous value (if non-null) to hold the return value.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Float value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(double value)
                             throws org.apache.derby.iapi.error.StandardException
Description copied from interface: DataValueFactory
Get a SQL double precision with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(double value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Double value)
                             throws org.apache.derby.iapi.error.StandardException
Description copied from interface: DataValueFactory
Get a SQL double precision with the given value. A null argument means a SQL null value. The second form uses the previous value (if non-null) to hold the return value.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public NumberDataValue getDataValue(java.lang.Double value,
                                    NumberDataValue previous)
                             throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDecimalDataValue

public final NumberDataValue getDecimalDataValue(java.lang.Number value)
                                          throws org.apache.derby.iapi.error.StandardException
Description copied from interface: DataValueFactory
Get a SQL DECIMAL with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.

Specified by:
getDecimalDataValue in interface DataValueFactory

getDecimalDataValue

public final NumberDataValue getDecimalDataValue(java.lang.Number value,
                                                 NumberDataValue previous)
                                          throws org.apache.derby.iapi.error.StandardException
Specified by:
getDecimalDataValue in interface DataValueFactory

getDecimalDataValue

public final NumberDataValue getDecimalDataValue(java.lang.String value,
                                                 NumberDataValue previous)
                                          throws org.apache.derby.iapi.error.StandardException
Specified by:
getDecimalDataValue in interface DataValueFactory

getDataValue

public BooleanDataValue getDataValue(boolean value)
Description copied from interface: DataValueFactory
Get a SQL boolean with the given value. The second form re-uses the previous value, if non-null, as the data holder to return.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public BooleanDataValue getDataValue(boolean value,
                                     BooleanDataValue previous)
                              throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public BooleanDataValue getDataValue(java.lang.Boolean value)
Description copied from interface: DataValueFactory
Get a SQL boolean with the given value. A null argument means get a SQL null value. The second form uses the previous value (if non-null) to hold the return value.

Specified by:
getDataValue in interface DataValueFactory

getDataValue

public BooleanDataValue getDataValue(java.lang.Boolean value,
                                     BooleanDataValue previous)
                              throws org.apache.derby.iapi.error.StandardException
Specified by:
getDataValue in interface DataValueFactory

getDataValue

public