Methods Summary |
---|
public abstract void | assertInstanceOfRemoteInterfaceImpl(java.lang.Object o)Validates that this instance is of the correct implementation class
of a remote interface type.
|
protected void | assertInstanceOfRemoteInterfaceImpl(java.lang.Object o, java.lang.String beanName)Validates that this instance is of the correct implementation class
of bean remote interface.
Throws IllegalArgumentException if the argument is of a wrong type.
// We can't check if null is the correct type or not. So
// we let it succeed.
if (o == null)
return;
try {
CMPHelper.assertValidRemoteObject(o, getContainer());
} catch (EJBException ex) {
String msg = I18NHelper.getMessage(messages, "EXC_WrongRemoteInstance", // NOI18N
new Object[] {o.getClass().getName(), beanName,
ex.getMessage()});
logger.log(Logger.WARNING, msg);
throw new IllegalArgumentException(msg);
}
|
protected void | assertObjectIdNotNull(java.lang.Object oid)Validates that the object id instance is not null.
Throws JDOFatalInternalException otherwise.
if (oid == null) {
throw new JDOFatalInternalException(I18NHelper.getMessage(
messages, "EXC_oidnull_exception")); // NOI18N
}
|
public void | assertPrimaryKeyFieldNotNull(java.lang.Object pkfield, java.lang.String pkfieldName, java.lang.String beanName)Validates that the primary key field of an Object type is not null.
Throws IllegalArgumentException otherwise.
if (pkfield == null) {
throw new IllegalArgumentException(I18NHelper.getMessage(
messages, "EXC_pkfieldnull_exception", // NOI18N
pkfieldName, beanName));
}
|
protected void | assertPrimaryKeyNotNull(java.lang.Object pk)Validates that the primary key instance is not null.
Throws IllegalArgumentException otherwise.
if (pk == null) {
throw new IllegalArgumentException(I18NHelper.getMessage(
messages, "EXC_pknull_exception")); // NOI18N
}
|
public java.util.Collection | convertCollectionEJBObjectToPC(java.util.Collection coll, com.sun.jdo.api.persistence.support.PersistenceManager pm, boolean validate)Converts Collection of EJBObjects to a Collection of
persistence-capable instances.
Collection rc = new java.util.ArrayList();
Object o = null;
for (java.util.Iterator it = coll.iterator(); it.hasNext();) {
o = convertEJBObjectToPC((EJBObject)it.next(), pm, validate);
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest(
"\n---JDOEJB11HelperImpl.convertCollectionEJBObjectToPC() adding: " + o);// NOI18N
}
rc.add(o);
}
return rc;
|
public java.util.Collection | convertCollectionObjectIdToPrimaryKey(java.util.Collection oids)Converts Collection of Object Id's of persistence-capable instances to a
Collection of of the PrimaryKey instances.
Collection rc = new java.util.ArrayList();
Object o = null;
for (java.util.Iterator it = oids.iterator(); it.hasNext();) {
o = convertObjectIdToPrimaryKey(it.next());
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest(
"\n---JDOEJB11HelperImpl.convertCollectionObjectIdToPrimaryKey() adding: " + o);// NOI18N
}
rc.add(o);
}
return rc;
|
public java.util.Collection | convertCollectionPCToEJBObject(java.util.Collection pcs, com.sun.jdo.api.persistence.support.PersistenceManager pm)Converts Collection of persistence-capable instances to a Collection of
EJBObjects.
Collection rc = new java.util.ArrayList();
Object o = null;
for (java.util.Iterator it = pcs.iterator(); it.hasNext();) {
o = convertPCToEJBObject((Object)it.next(), pm);
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest(
"\n---JDOEJB11HelperImpl.convertCollectionPCToEJBObject() adding: " + o);// NOI18N
}
rc.add(o);
}
return rc;
|
public java.util.Set | convertCollectionPCToEJBObjectSet(java.util.Collection pcs, com.sun.jdo.api.persistence.support.PersistenceManager pm)Converts Collection of persistence-capable instances to a Set of
EJBObjects.
java.util.Set rc = new java.util.HashSet();
Object o = null;
for (java.util.Iterator it = pcs.iterator(); it.hasNext();) {
o = convertPCToEJBObject((Object)it.next(), pm);
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest(
"\n---JDOEJB11HelperImpl.convertCollectionPCToEJBObjectSet() adding: " + o);// NOI18N
}
rc.add(o);
}
return rc;
|
public java.util.Collection | convertCollectionPCToPrimaryKey(java.util.Collection pcs, com.sun.jdo.api.persistence.support.PersistenceManager pm)Converts Collection of persistence-capable instances to a Collection of
the PrimaryKey Class instances.
Collection rc = new java.util.ArrayList();
Object o = null;
for (java.util.Iterator it = pcs.iterator(); it.hasNext();) {
o = convertPCToPrimaryKey(it.next(), pm);
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest(
"\n---JDOEJB11HelperImpl.convertCollectionPCToPrimaryKey() adding: " + o);// NOI18N
}
rc.add(o);
}
return rc;
|
public java.util.Collection | convertCollectionPrimaryKeyToObjectId(java.util.Collection keys)Converts Collection of PrimaryKey instances to a Collection of Object Id's
of a corresponding persistence-capable Class.
Collection rc = new java.util.ArrayList();
Object o = null;
for (java.util.Iterator it = keys.iterator(); it.hasNext();) {
o = convertPrimaryKeyToObjectId(it.next());
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest(
"\n---JDOEJB11HelperImpl.convertCollectionPrimaryKeyToObjectId() adding: " + o);// NOI18N
}
rc.add(o);
}
return rc;
|
public java.lang.Object | convertEJBObjectToPC(javax.ejb.EJBObject o, com.sun.jdo.api.persistence.support.PersistenceManager pm, boolean validate)Converts EJBObject to persistence-capable instance.
Object key = null;
try {
key = o.getPrimaryKey();
} catch (Exception ex) {
EJBException e = new EJBException(I18NHelper.getMessage(messages,
"EXC_ConvertEJBObjectToPC", o.getClass().getName()), ex);// NOI18N
logger.throwing("JDOEJB11HelperImpl", "convertEJBObjectToPC", e); // NOI18N
throw e;
}
return convertPrimaryKeyToPC(key, pm, validate);
|
public abstract java.lang.Object | convertObjectIdToPrimaryKey(java.lang.Object objectId)Converts Object Id of a persistence-capable instance to an instance of the
PrimaryKey Class.
|
public javax.ejb.EJBObject | convertPCToEJBObject(java.lang.Object pc, com.sun.jdo.api.persistence.support.PersistenceManager pm)Converts persistence-capable instance to EJBObject.
if (pc == null) return null;
Object jdoObjectId = pm.getObjectId(pc);
Object key = convertObjectIdToPrimaryKey(jdoObjectId);
try {
return CMPHelper.getEJBObject(key, getContainer());
} catch (Exception ex) {
EJBException e = new EJBException(I18NHelper.getMessage(messages,
"EXC_ConvertPCToEJBObject", key.toString()), ex);// NOI18N
logger.throwing("JDOEJB11HelperImpl", "convertPCToEJBObject", e); // NOI18N
throw e;
}
|
public java.lang.Object | convertPCToPrimaryKey(java.lang.Object pc, com.sun.jdo.api.persistence.support.PersistenceManager pm)Converts persistence-capable instance to an instance of the PrimaryKey Class.
if (pc == null) return null;
Object rc = convertObjectIdToPrimaryKey(pm.getObjectId(pc));
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest("\n---JDOEJB11HelperImpl.convertPCToPrimaryKey() PK: " + rc);// NOI18N
}
return rc;
|
public abstract java.lang.Object | convertPrimaryKeyToObjectId(java.lang.Object key)Converts instance of a PrimaryKey Class to an instance of the Object Id of a
corresponding persistence-capable Class.
|
protected java.lang.Object | convertPrimaryKeyToPC(java.lang.Object key, com.sun.jdo.api.persistence.support.PersistenceManager pm, boolean validate)Converts PrimaryKey object to persistence-capable instance.
Object pc = null;
try {
Object jdoObjectId = convertPrimaryKeyToObjectId(key);
pc = pm.getObjectById(jdoObjectId, validate);
} catch (JDOObjectNotFoundException ex) {
logger.fine("---JDOEJB11HelperImpl.convertPrimaryKeyToPC: Object not found for: " + key); // NOI18N
throw new IllegalArgumentException(I18NHelper.getMessage(messages,
"EXC_DeletedInstanceOtherTx", key.toString()));// NOI18N
}
if (validate && JDOHelper.isDeleted(pc)) {
logger.fine("---JDOEJB11HelperImpl.convertPrimaryKeyToPC: Object is deleted for: " + key); // NOI18N
throw new IllegalArgumentException(I18NHelper.getMessage(messages,
"EXC_DeletedInstanceThisTx", key.toString()));// NOI18N
}
return pc;
|
public com.sun.jdo.spi.persistence.support.sqlstore.utility.NumericConverter | getNumericConverter()Return NumericConverter for conversion from Number to BigDecimal or
BigInteger for this bean type. It is responsible for passing the
correct policy value to the NumericConverterFactory.
int policy = CMPHelper.getNumericConverterPolicy(getContainer());
return NumericConverterFactory.getNumericConverter(policy);
|
public abstract java.lang.Class | getPCClass()Returns the class object of the corresponding persistence-capable class
of the concrete bean class.
|
public java.io.Serializable | readSerializableObjectFromByteArray(byte[] byteArray)Constructs a Serializable object from byteArray. It is expected that
byteArray was constructed using a previous call to writeSerializableObjectToByteArray
Serializable serializableObject = null;
if(byteArray != null)
{
ByteArrayInputStream bis = new ByteArrayInputStream(byteArray);
HelperObjectInputStream ois = null;
//
// Take the current class loader to resolve the class to be deserialized.
//
ClassLoader cl = this.getClass().getClassLoader();
try
{
ois = new HelperObjectInputStream(bis, cl);
serializableObject = (Serializable) ois.readObject();
}
catch (ClassNotFoundException e)
{
throw new JDOFatalDataStoreException(I18NHelper.getMessage(messages,
"EXC_CNFReadSerializableObject"), e);// NOI18N
}
catch(java.io.IOException e)
{
throw new JDOFatalDataStoreException(I18NHelper.getMessage(messages,
"EXC_IOReadSerializableObject"), e);// NOI18N
}
}
return serializableObject;
|
public byte[] | writeSerializableObjectToByteArray(java.io.Serializable serializableObject)Serializes serializableObject into a byte array
byte[] byteArray = null;
if(serializableObject != null)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = null;
try
{
oos = new ObjectOutputStream(bos);
oos.writeObject(serializableObject);
byteArray = bos.toByteArray();
}
catch(java.io.IOException e)
{
String clsName = serializableObject.getClass().getName();
throw new JDOUserException(I18NHelper.getMessage(messages,
"EXC_IOWriteSerializableObject", clsName), e);// NOI18N
}
}
return byteArray;
|