SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

com.solarmetric.kodo.ee
Class JDOBean

java.lang.Object
  |
  +--com.solarmetric.kodo.ee.JDOBean
All Implemented Interfaces:
EnterpriseBean, Serializable
Direct Known Subclasses:
JDOEntityBean, JDOSessionBean

public abstract class JDOBean
extends Object
implements EnterpriseBean

Base JDO-aware EnterpriseBean class. Its behaviour is discussed in chapter 16 of the JDO 1.0 specification.

See Also:
JDOEntityBean, JDOSessionBean, Serialized Form

Field Summary
static String CM_JNDI_SUFFIX
           
 
Constructor Summary
JDOBean()
           
 
Method Summary
 void bindConnectionFactory(String name, ConnectionFactory cm, Context context)
           
 EJBException ejbException(Exception e)
          Since JDO Exceptions' throwable list is transient, and since some application servers don't send the entire exception back to the client, it is very useful for debugging if the client can have the entire exception message.
 void ejbLog(String msg)
           
abstract  void ejbLog(String msg, Throwable t, PrintWriter writer)
          Allows the implementor to log messages.
 Object getById(Object id)
           
 ConnectionFactory getConnectionFactory()
          Obtain a ConnectionFactory.
 ConnectionFactory getConnectionFactory(String jndi)
           
 Context getContext()
          Return a lazily cached Context.
 String getJNDIName()
          Returns the name that we should check in JNDI for the bound ConnectionFactory.
 PersistenceManager getPersistenceManager()
          Obtain a PersistenceManagerFactory from JNDI.
 Object lookup(String name, Class narrow)
          Utility method to lookup and narrow a name in JNDI.
 ConnectionFactory lookupConnectionFactory(Context ctx)
           
 void setConnectionFactory()
           
 void setLogWriter(PrintWriter writer)
          Set the PrintWriter for debug messages.
 void setPropertiesResource(String propertiesResource)
          In a typical EJB application, the ConnectionFactory will be already bound externally (using its resource adaptor, a startup class, or an MBean).
 void unsetConnectionFactory()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CM_JNDI_SUFFIX

public static final String CM_JNDI_SUFFIX
Constructor Detail

JDOBean

public JDOBean()
Method Detail

setConnectionFactory

public void setConnectionFactory()
                          throws NamingException

unsetConnectionFactory

public void unsetConnectionFactory()

getConnectionFactory

public ConnectionFactory getConnectionFactory()
                                       throws JDOException,
                                              EJBException,
                                              NamingException
Obtain a ConnectionFactory. This method can be overridden if the default lookup of "java:comp/env/jdo/PersistenceManagerFactory" should not be used. See section 16.1 of the JDO specification.
Throws:
NamingException - Whan a JNDI exception occures
EJBException - For an EJB-related exception
JDOException - For a JDO-related exception

getJNDIName

public String getJNDIName()
Returns the name that we should check in JNDI for the bound ConnectionFactory.

setPropertiesResource

public void setPropertiesResource(String propertiesResource)
In a typical EJB application, the ConnectionFactory will be already bound externally (using its resource adaptor, a startup class, or an MBean). However, for rapid application development, it is often useful to just have the bean manually bind the PMF into JNDI if it does not find it so that JDO debugging does not need to be complicated by EJB container debugging. This method sets the properties resource that will be looked up in order to create a new PMF and bind it into JNDI.

setLogWriter

public void setLogWriter(PrintWriter writer)
Set the PrintWriter for debug messages.
Parameters:
writer - The PrintWriter to use for logging debugging messages

getContext

public Context getContext()
                   throws NamingException
Return a lazily cached Context.

getConnectionFactory

public ConnectionFactory getConnectionFactory(String jndi)
                                       throws JDOException,
                                              EJBException,
                                              NamingException

lookupConnectionFactory

public ConnectionFactory lookupConnectionFactory(Context ctx)
                                          throws NamingException

bindConnectionFactory

public void bindConnectionFactory(String name,
                                  ConnectionFactory cm,
                                  Context context)
                           throws NamingException

getPersistenceManager

public PersistenceManager getPersistenceManager()
                                         throws EJBException
Obtain a PersistenceManagerFactory from JNDI. Per the JDO specification, the PersistenceManagerFactory will be synchronized with the container's global transaction, such that in the context of a single transaction the same PersistenceManager will always be returned by the PersistenceManagerFactory.getPersistenceManager() method.

getById

public Object getById(Object id)
               throws EJBException,
                      JDOException

lookup

public Object lookup(String name,
                     Class narrow)
              throws EJBException
Utility method to lookup and narrow a name in JNDI.
Parameters:
name - the name to look up
narrow - the class to narrow the reference to
Throws:
EJBException - Wraps a NamingException.

ejbException

public EJBException ejbException(Exception e)
Since JDO Exceptions' throwable list is transient, and since some application servers don't send the entire exception back to the client, it is very useful for debugging if the client can have the entire exception message. This, we will embed the entire nested stack trace in the message of a new EJB Exception.

ejbLog

public void ejbLog(String msg)

ejbLog

public abstract void ejbLog(String msg,
                            Throwable t,
                            PrintWriter writer)
Allows the implementor to log messages.

SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.