Methods Summary |
---|
public void | assertValidLocalObject(java.lang.Object o, java.lang.Object container)Verify that this instance is of a valid local interface type for
a given Container helper.
The Container instance is acquired via #getContainer(Object).
This is SunContainerHelper specific code.
((Container)container).assertValidLocalObject(o);
|
public void | assertValidRemoteObject(java.lang.Object o, java.lang.Object container)Verify that this instance is of a valid remote interface type for
a given Container helper.
The Container instance is acquired via #getContainer(Object).
This is SunContainerHelper specific code.
((Container)container).assertValidRemoteObject(o);
|
public void | beginInternalTransaction(com.sun.jdo.api.persistence.support.PersistenceManager pm)Called in a unspecified transaction context of a managed environment.
According to p.364 of EJB 2.0 spec, CMP may need to manage
its own transaction when its transaction attribute is
NotSupported, Never, Supports.
This is a generic implementation.
Application server may like to overwrite this if necessary.
pm.currentTransaction().begin();
|
public void | commitInternalTransaction(com.sun.jdo.api.persistence.support.PersistenceManager pm)Called in a unspecified transaction context of a managed environment.
According to p.364 of EJB 2.0 spec, CMP may need to manage
its own transaction when its transaction attribute is
NotSupported, Never, Supports.
This is a generic implementation.
Application server may like to overwrite this if necessary.
pm.currentTransaction().commit();
|
public java.lang.Object | getContainer(java.lang.Object info)Get a Container helper instance that will be passed unchanged to the
required methods.
This is SunContainerHelper specific code.
The info argument is an Object array that consistes of a class to use
for the class loader and concreteImpl bean class name.
Object[] params = (Object[])info;
Class cls = (Class)params[0];
ApplicationRegistry reg = ApplicationRegistry.getInstance();
Application app = reg.getApplication(cls.getClassLoader());
EjbCMPEntityDescriptor desc = app.getCMPDescriptorFor((String)params[1]);
return reg.getContainer(desc);
|
public javax.ejb.EJBLocalObject | getEJBLocalObject(java.lang.Object pk, java.lang.Object container)Get an EJBLocalObject reference for this primary key and Container helper.
The Container instance is acquired via #getContainer(Object).
This is SunContainerHelper specific code.
try {
return ((Container)container).getEJBLocalObjectForPrimaryKey(pk);
} catch (Exception ex) {
throw new JDOFatalInternalException(ex.getMessage(), ex);
}
|
public javax.ejb.EJBLocalObject | getEJBLocalObject(java.lang.Object pk, java.lang.Object container, javax.ejb.EJBContext context)Get an EJBLocalObject reference for this primary key and Container helper,
and EJBContext of the calling bean.
Allows the container to check if this method is called during ejbRemove
that is part of a cascade-delete remove.
The Container instance is acquired via #getContainer(Object).
This is SunContainerHelper specific code.
EJBLocalObject rc = null;
try {
rc = ((Container)container).getEJBLocalObjectForPrimaryKey(pk, context);
} catch (Exception ex) {
processContainerException(ex);
}
return rc;
|
public javax.ejb.EJBObject | getEJBObject(java.lang.Object pk, java.lang.Object container)Get an EJBObject reference for this primary key and Container helper.
The Container instance is acquired via #getContainer(Object).
This is SunContainerHelper specific code.
try {
return ((Container)container).getEJBObjectForPrimaryKey(pk);
} catch (Exception ex) {
throw new JDOFatalInternalException(ex.getMessage(), ex);
}
|
public int | getNumericConverterPolicy(java.lang.Object container)Called in CMP environment to get NumericConverter policy referenced
by this Container instance.
return NumericConverter.DEFAULT_POLICY;
|
public com.sun.jdo.api.persistence.support.PersistenceManagerFactory | getPersistenceManagerFactory(java.lang.Object container)Called in a CMP environment to lookup PersistenceManagerFactory
referenced by this Container instance as the CMP resource.
The Container instance is acquired via #getContainer(Object).
This is SunContainerHelper specific code.
Object rc = null;
PersistenceManagerFactoryImpl pmf = null;
ResourceReferenceDescriptor cmpResource = ((Container)container).getEjbDescriptor().
getEjbBundleDescriptor().getCMPResourceReference();
String name = cmpResource.getJndiName();
try {
InitialContext ic = new InitialContext();
rc = ic.lookup(name);
if (rc instanceof PersistenceManagerFactoryImpl) {
pmf = (PersistenceManagerFactoryImpl)rc;
} else if (rc instanceof javax.sql.DataSource) {
pmf = new PersistenceManagerFactoryImpl();
pmf.setConnectionFactoryName(ResourceInstaller.getPMJndiName(name));
Iterator it = cmpResource.getProperties();
if (it != null) {
while (it.hasNext()) {
NameValuePairDescriptor prop = (NameValuePairDescriptor)it.next();
String n = prop.getName();
// Any value that is not "true" is treated as "false":
boolean value = Boolean.valueOf(prop.getValue()).booleanValue();
pmf.setBooleanProperty(n, value);
}
}
} else {
RuntimeException e = new JDOFatalUserException(I18NHelper.getMessage(
messages, "ejb.jndi.unexpectedinstance", //NOI18N
name, rc.getClass().getName()));
logger.severe(e.toString());
throw e;
}
} catch (javax.naming.NamingException ex) {
RuntimeException e = new JDOFatalUserException(I18NHelper.getMessage(
messages, "ejb.jndi.lookupfailed", name), ex); //NOI18N
logger.severe(e.toString());
throw e;
}
return pmf;
|
public void | preSelect(java.lang.Object container)Called in a CMP supported environment. Notifies the container that
ejbSelect had been called.
The Container instance is acquired via #getContainer(Object).
This is SunContainerHelper specific code.
((Container)container).preSelect();
|
private void | processContainerException(java.lang.Exception ex)Checks the caught Exception, and rethrows it if it is
of one of known types, or converts to an EJBException
otherwise.
if (ex instanceof EJBException) {
throw (EJBException)ex;
} else if (ex instanceof IllegalArgumentException
|| ex instanceof IllegalStateException) {
throw (RuntimeException)ex;
} else if (ex instanceof JDOException) {
throw (JDOException)ex;
} else {
throw new EJBException(ex);
}
|
public void | removeByEJBLocalObject(javax.ejb.EJBLocalObject ejb, java.lang.Object container)Remove a bean for a given EJBLocalObject and Container helper.
The Container instance is acquired via #getContainer(Object).
This is SunContainerHelper specific code.
try {
((Container)container).removeBeanUnchecked(ejb);
} catch (Exception ex) {
processContainerException(ex);
}
|
public void | removeByPK(java.lang.Object pk, java.lang.Object container)Remove a bean for a given primary key and Container helper.
The Container instance is acquired via #getContainer(Object).
This is SunContainerHelper specific code.
try {
((Container)container).removeBeanUnchecked(pk);
} catch (Exception ex) {
processContainerException(ex);
}
|
public void | resumeCurrentTransaction(javax.transaction.Transaction tx)Called from read-only beans to resume current transaction.
This will guarantee that the transaction continues to run after
read-only bean accessed its PersistenceManager.
try {
// Resume only real (i.e. not null transaction)
if (tx != null) {
getLocalTransactionManager().resume(tx);
}
} catch (Exception ex) {
processContainerException(ex);
}
|
public void | rollbackInternalTransaction(com.sun.jdo.api.persistence.support.PersistenceManager pm)Called in a unspecified transaction context of a managed environment.
According to p.364 of EJB 2.0 spec, CMP may need to manage
its own transaction when its transaction attribute is
NotSupported, Never, Supports.
This is a generic implementation.
Application server may like to overwrite this if necessary.
pm.currentTransaction().rollback();
|
public void | setCascadeDeleteAfterSuperEJBRemove(javax.ejb.EntityContext context)Mark the bean as already removed during cascade-delete
operation for a given EntityContext.
Called by the generated ejbRemove method before calling ejbRemove of the
related beans (via removeByEJBLocalObject) that are to be cascade-deleted.
This is SunContainerHelper specific code.
try {
((com.sun.ejb.containers.EntityContextImpl)context).setCascadeDeleteAfterSuperEJBRemove(true);
} catch (Exception ex) {
processContainerException(ex);
}
|
public javax.transaction.Transaction | suspendCurrentTransaction()Called from read-only beans to suspend current transaction.
This will guarantee that PersistenceManager is not bound to
any transaction.
javax.transaction.Transaction tx = null;
try {
tx = getLocalTransactionManager().suspend();
} catch (Exception ex) {
processContainerException(ex);
}
return tx;
|