final class DmoClass extends java.lang.Object implements DmoAsmTypes, org.objectweb.asm.Opcodes
AsmClassLoader
. A DMO implementation class extends either
Record
(for converted, persistent tables) or TempRecord
(for converted
temp-tables). It implements a DMO interface which specifies getter and setter methods, and
which contains annotations describing the legacy table which the DMO represents.
Once assembled and loaded, a DMO implementation class is cached (mapped to its DMO interface),
so it can be fetched again later. A class is loaded/fetched using the static assembleImplementation(DmoMeta)
method, which accepts as its only parameter the DMO interface which
the implementation class implements.
Modifier and Type | Class and Description |
---|---|
private static class |
DmoClass.BaseDataAccess
Helper class which holds information needed to assemble bytecode instructions to invoke
the low level, BDT-aware getter and setter methods in the
Record class. |
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.Class<? extends BaseDataType>,DmoClass.BaseDataAccess> |
baseDataAccess
Information used when assembling getter and setter methods
|
private java.lang.String |
binaryName
DMO implementation class name, as a JVM binary type name (dot separators)
|
private org.objectweb.asm.ClassWriter |
cw
ASM class writer
|
private static java.lang.String |
DESC_RECORDMETA
Internal type name of
RecordMeta class |
static java.lang.String |
FLD_METADATA
Name of the
RecordMeta static field of the DMO implementation class |
private static java.lang.String |
FLD_MULTIPLEX
Name of the
_multiplex instance variable used for temp-table DMOs |
private static java.lang.String |
IMPL_SUFFIX
Suffix added to DMO interface name to create DMO implementation class name
|
private java.lang.String |
internalName
DMO implementation class name, as a JVM internal type name (slash separators)
|
private static java.lang.String |
METH_RECORDMETA
Internal name of the
BaseRecord._recordMeta() method |
private static java.lang.String |
PERSISTABLE
Internal name of
Persistable interface |
private static java.lang.String |
PKG_ORM
Internal type name of the
orm package |
private static java.lang.String |
RECORD
Internal name of
Record class |
private static java.lang.String |
RECORDMETA
Internal name of
RecordMeta class |
private static java.lang.String |
SIG_CLASS_VOID
Method signature taking one class argument and returning void
|
private static java.lang.String |
SIG_INTEGER_VOID
Method signature taking taking one
Integer argument and returning void |
private static java.lang.String |
SIG_NOARG_RECORDMETA |
private static java.lang.String |
SIG_NOARG_VOID
Method signature taking no arguments and returning void
|
private static java.lang.String |
TEMPRECORD
Internal name of
TempRecord class |
private static java.lang.String |
TEMPTABLERECORD
Internal name of
TempTableRecord interface |
ALOAD_0, ALOAD_1, ALOAD_2, ALOAD_3, ANNOTATION_DESC_PREFIX, ASTORE_0, ASTORE_1, ASTORE_2, ASTORE_3, BUF, BUF_SUFFIX, BUFFER_IFACE, DESC_ARRAYLIST, DESC_DATE, DESC_JAVA_INTEGER, DESC_JAVA_STRING, DESC_LIST, ILOAD_0, ILOAD_1, ILOAD_2, ILOAD_3, ISTORE_0, ISTORE_1, ISTORE_2, ISTORE_3, METH_ADD, METH_ASSIGN, METH_CHKXRNG, METH_CLINIT, METH_GET, METH_INIT, METH_INTVALUE, METH_ISUNK, METH_MIN, METH_OOBE, METH_SETUNK, METH_SIZE, PKG_P2J, PKG_PERSIST, PKG_UTIL, SIG_ADD, SIG_CHKXRNG, SIG_DEF_INIT, SIG_DMO_ASSIGN, SIG_GET, SIG_INT_INIT, SIG_INTVALUE, SIG_ISUNK, SIG_MIN, SIG_OOBE, SIG_SETUNK, SIG_SIZE, TEMP_TABLE_BUFFER_IFACE, TYPE_ARRAYLIST, TYPE_BINARYDATA, TYPE_BLOB, TYPE_BUFFERIMPL, TYPE_CHARACTER, TYPE_CLOB, TYPE_DATE, TYPE_DATETIME, TYPE_DATETIMETZ, TYPE_DECIMAL, TYPE_HANDLE, TYPE_INT64, TYPE_INTEGER, TYPE_LIST, TYPE_LOGICAL, TYPE_LONGCHAR, TYPE_MATH, TYPE_MEMPTR, TYPE_NUMBERTYPE, TYPE_OBJECT, TYPE_PERSISTABLE, TYPE_RAW, TYPE_RECID, TYPE_ROWID, TYPE_SERIALIZABLE, TYPE_TEMPORARY, TYPE_TEMPTABLERECORD, TYPE_TEXT, TYPE_UNDOABLE
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_MANDATED, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASM4, ASM5, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DOUBLE, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F_APPEND, F_CHOP, F_FULL, F_NEW, F_SAME, F_SAME1, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FLOAT, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, H_GETFIELD, H_GETSTATIC, H_INVOKEINTERFACE, H_INVOKESPECIAL, H_INVOKESTATIC, H_INVOKEVIRTUAL, H_NEWINVOKESPECIAL, H_PUTFIELD, H_PUTSTATIC, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INTEGER, INVOKEDYNAMIC, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LONG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, NULL, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, TOP, UNINITIALIZED_THIS, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8
Modifier | Constructor and Description |
---|---|
private |
DmoClass(java.lang.Class<? extends DataModelObject> dmoIface,
PropertyMeta[] propMeta)
Constructor which assembles the DMO implementation class bytecode, but which does not load
it into the JVM.
|
Modifier and Type | Method and Description |
---|---|
private void |
addMultiplexSupport()
Add a constructor to the temp-table flavor of the DMO implementation class, which accepts
an
Integer for the multiplex ID. |
(package private) static java.lang.Class<? extends Record> |
assembleImplementation(DmoMeta dmoMeta)
This method is the main external entry point into this class, used to assemble and load a
DMO implementation class for the given DMO interface.
|
private void |
createAssignMethod()
Deprecated.
|
private void |
createBulkGetter(PropertyMeta meta,
DmoClass.BaseDataAccess bda,
int offset)
Create a bulk getter for to obtain the full set of value of the extent field.
|
private void |
createBulkSetter(PropertyMeta meta,
DmoClass.BaseDataAccess bda,
int offset)
Create a bulk setter for setting the full extent field.
|
private void |
createConstructor(java.lang.String superClass)
Creates the default constructor, which invokes the superclass' default constructor.
|
private void |
createDeepCopyMethod()
Deprecated.
|
private void |
createGetter(PropertyMeta meta,
DmoClass.BaseDataAccess bda,
int offset,
boolean extent,
boolean bdtIndex)
Create a standard getter method for one of the DMO's data properties.
|
private void |
createInlineBulkGetter(PropertyMeta meta,
DmoClass.BaseDataAccess bda,
int offset)
Create a bulk getter for to obtain the full set of value of the extent field.
|
private void |
createInlineBulkSetter(PropertyMeta meta,
DmoClass.BaseDataAccess bda,
int offset)
Create a bulk setter for setting the full extent field.
|
private void |
createInlineMassSetter(PropertyMeta meta,
DmoClass.BaseDataAccess bda,
int offset)
Create a mass getter for filling the full set of value of the extent field with a given
scalar BDT value.
|
private void |
createMassSetter(PropertyMeta meta,
DmoClass.BaseDataAccess bda,
int offset)
Create a mass getter for filling the full set of value of the extent field with a given
scalar BDT value.
|
private void |
createRecordMetaMethod()
Implement the
_recordMeta method. |
private void |
createSetter(PropertyMeta meta,
DmoClass.BaseDataAccess bda,
int offset,
boolean extent,
boolean bdtIndex)
Create a standard setter method for one of the DMO's data properties.
|
private void |
createStaticInitializer(java.lang.String ifaceDesc)
Create static initializer, which instantiates RecordMeta object and stores it in
_metadata class variable. |
private void |
createStaticInitializer2(java.lang.String ifaceDesc)
Create static initializer, which instantiates RecordMeta object and stores it in
_metadata class variable. |
private java.lang.Class<? extends Record> |
load()
Load the DMO implementation class into the JVM, using the
AsmClassLoader . |
public static final java.lang.String FLD_METADATA
RecordMeta
static field of the DMO implementation classprivate static final java.lang.String FLD_MULTIPLEX
_multiplex
instance variable used for temp-table DMOsprivate static final java.lang.String PKG_ORM
orm
packageprivate static final java.lang.String RECORD
Record
classprivate static final java.lang.String TEMPRECORD
TempRecord
classprivate static final java.lang.String PERSISTABLE
Persistable
interfaceprivate static final java.lang.String TEMPTABLERECORD
TempTableRecord
interfaceprivate static final java.lang.String RECORDMETA
RecordMeta
classprivate static final java.lang.String DESC_RECORDMETA
RecordMeta
classprivate static final java.lang.String IMPL_SUFFIX
private static final java.lang.String METH_RECORDMETA
BaseRecord._recordMeta()
methodprivate static final java.lang.String SIG_NOARG_VOID
private static final java.lang.String SIG_INTEGER_VOID
Integer
argument and returning voidprivate static final java.lang.String SIG_CLASS_VOID
private static final java.lang.String SIG_NOARG_RECORDMETA
private static final java.util.Map<java.lang.Class<? extends BaseDataType>,DmoClass.BaseDataAccess> baseDataAccess
private final org.objectweb.asm.ClassWriter cw
private final java.lang.String binaryName
private final java.lang.String internalName
private DmoClass(java.lang.Class<? extends DataModelObject> dmoIface, PropertyMeta[] propMeta)
dmoIface
- DMO interface from which to extract information for the implementation class.propMeta
- The set of meta property of the generated class.static java.lang.Class<? extends Record> assembleImplementation(DmoMeta dmoMeta) throws java.lang.ClassNotFoundException, java.lang.NoSuchFieldException, java.lang.IllegalAccessException, ConfigurationException
dmoMeta
- The meta information of the DMO interface.java.lang.ClassNotFoundException
- if the class is not found. This should not be possible, since we are providing the
byte code to the class loader and the search should not fail.ConfigurationException
- If the AsmClassLoader
was not added in Java command line parameters so the dynamically
assembled class implementation cannot be loaded.java.lang.NoSuchFieldException
java.lang.IllegalAccessException
private void createStaticInitializer2(java.lang.String ifaceDesc)
_metadata
class variable.ifaceDesc
- Type descriptor of DMO interface.private void createStaticInitializer(java.lang.String ifaceDesc)
_metadata
class variable.ifaceDesc
- Type descriptor of DMO interface.private void createRecordMetaMethod()
_recordMeta
method. (declared abstract in Record
), which
returns the RecordMeta
instance associated with this DMO implementation class.private void addMultiplexSupport()
Integer
for the multiplex ID.private void createConstructor(java.lang.String superClass)
superClass
- The name of the super class whose default c'tor will be called.private void createGetter(PropertyMeta meta, DmoClass.BaseDataAccess bda, int offset, boolean extent, boolean bdtIndex)
BaseDataType
subclass.meta
- Metadata describing the DMO property to be accessed.bda
- Helper object which holds type-specific data for bytecode instructions.offset
- Zero-based offset of the beginning of the data associated with the target property
in the underlying BaseRecord
data array.extent
- true
if it sets an element of an array property (i.e., converted extent
field); false
if the method sets a scalar property. Array setter methods
take two parameters; the first is an index within the array, the second is the
BDT object to be set. Scalar methods take only the BDT parameter.bdtIndex
- Generate the getter using BDT index instead of native java. Only for extents.private void createSetter(PropertyMeta meta, DmoClass.BaseDataAccess bda, int offset, boolean extent, boolean bdtIndex)
BaseDataType
subclass and has no return value.meta
- Metadata describing the DMO property to be accessed.bda
- Helper object which holds type-specific data for bytecode instructions.offset
- Zero-based offset of the beginning of the data associated with the target property
in the underlying BaseRecord
data array.extent
- true
if it sets an element of an array property (i.e., converted extent
field); false
if the method sets a scalar property. Array setter methods
take two parameters; the first is an index within the array, the second is the
BDT object to be set. Scalar methods take only the BDT parameter.bdtIndex
- Generate the getter using BDT index instead of native java. Only for extents.private void createInlineBulkGetter(PropertyMeta meta, DmoClass.BaseDataAccess bda, int offset)
BDT[] getFieldK()
.meta
- Metadata describing the DMO property to be accessed.bda
- Helper object which holds type-specific data for bytecode instructions.offset
- Zero-based offset of the beginning of the data associated with the target property
in the underlying BaseRecord
data array.private void createInlineBulkSetter(PropertyMeta meta, DmoClass.BaseDataAccess bda, int offset)
void setFieldK(BDT[])
.meta
- Metadata describing the DMO property to be accessed.bda
- Helper object which holds type-specific data for bytecode instructions.offset
- Zero-based offset of the beginning of the data associated with the target property
in the underlying BaseRecord
data array.private void createInlineMassSetter(PropertyMeta meta, DmoClass.BaseDataAccess bda, int offset)
void setFieldK(BDT)
.meta
- Metadata describing the DMO property to be accessed.bda
- Helper object which holds type-specific data for bytecode instructions.offset
- Zero-based offset of the beginning of the data associated with the target property
in the underlying BaseRecord
data array.private void createBulkGetter(PropertyMeta meta, DmoClass.BaseDataAccess bda, int offset)
BDT[] getFieldK()
.meta
- Metadata describing the DMO property to be accessed.bda
- Helper object which holds type-specific data for bytecode instructions.offset
- Zero-based offset of the beginning of the data associated with the target property
in the underlying BaseRecord
data array.private void createBulkSetter(PropertyMeta meta, DmoClass.BaseDataAccess bda, int offset)
void setFieldK(BDT[])
.meta
- Metadata describing the DMO property to be accessed.bda
- Helper object which holds type-specific data for bytecode instructions.offset
- Zero-based offset of the beginning of the data associated with the target property
in the underlying BaseRecord
data array.private void createMassSetter(PropertyMeta meta, DmoClass.BaseDataAccess bda, int offset)
void setFieldK(BDT)
.meta
- Metadata describing the DMO property to be accessed.bda
- Helper object which holds type-specific data for bytecode instructions.offset
- Zero-based offset of the beginning of the data associated with the target property
in the underlying BaseRecord
data array.@Deprecated private void createDeepCopyMethod()
Undoable.deepCopy()
method. The method delegates
the call to Record.snapshot()
method.
This method became deprecated and is not being called any more as the Persistable
does not extends Undoable
interface.
@Deprecated private void createAssignMethod()
Undoable.assign(Undoable)
method. The method
delegates the call to BaseRecord.copy(BaseRecord)
method and return its result.
This method became deprecated and is not being called any more as the Persistable
does not extends Undoable
interface.
private java.lang.Class<? extends Record> load() throws java.lang.ClassNotFoundException, ConfigurationException
AsmClassLoader
.java.lang.ClassNotFoundException
- if the class is not found. This should not be possible, since we are providing the
byte code to the class loader and the search should not fail.ConfigurationException
- If the AsmClassLoader
was not added in Java command line parameters so the dynamically
assembled class implementation cannot be loaded.