SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.kodo.ee
Class JDOBean

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

public abstract class JDOBean
extends java.lang.Object
implements javax.ejb.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 java.lang.String CM_JNDI_SUFFIX
           
 
Constructor Summary
JDOBean()
           
 
Method Summary
 void bindConnectionFactory(java.lang.String name, javax.resource.cci.ConnectionFactory cm, javax.naming.Context context)
           
 javax.ejb.EJBException ejbException(java.lang.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(java.lang.String msg)
          Log a message.
abstract  void ejbLog(java.lang.String msg, java.lang.Throwable t, java.io.PrintWriter writer)
          Allows the implementor to log messages.
 java.lang.Object getById(java.lang.Object id)
           
 javax.resource.cci.ConnectionFactory getConnectionFactory()
          Obtain a ConnectionFactory.
 javax.resource.cci.ConnectionFactory getConnectionFactory(java.lang.String jndi)
           
 javax.naming.Context getContext()
          Return a lazily cached Context.
 java.lang.String getJNDIName()
          Returns the name that we should check in JNDI for the bound ConnectionFactory.
 javax.jdo.PersistenceManager getPersistenceManager()
          Obtain a PersistenceManager.
 java.lang.Object lookup(java.lang.String name, java.lang.Class narrow)
          Utility method to lookup and narrow a name in JNDI.
 javax.resource.cci.ConnectionFactory lookupConnectionFactory(javax.naming.Context ctx)
           
 void setConnectionFactory()
           
 void setLogWriter(java.io.PrintWriter writer)
          Set the PrintWriter for debug messages.
 void setPropertiesResource(java.lang.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 java.lang.String CM_JNDI_SUFFIX
See Also:
Constant Field Values
Constructor Detail

JDOBean

public JDOBean()
Method Detail

setConnectionFactory

public void setConnectionFactory()
                          throws javax.naming.NamingException
javax.naming.NamingException

unsetConnectionFactory

public void unsetConnectionFactory()

getConnectionFactory

public javax.resource.cci.ConnectionFactory getConnectionFactory()
                                                          throws javax.jdo.JDOException,
                                                                 javax.ejb.EJBException,
                                                                 javax.naming.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:
javax.naming.NamingException - Whan a JNDI exception occures
javax.ejb.EJBException - For an EJB-related exception
javax.jdo.JDOException - For a JDO-related exception

getJNDIName

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


setPropertiesResource

public void setPropertiesResource(java.lang.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(java.io.PrintWriter writer)
Set the PrintWriter for debug messages.

Parameters:
writer - The PrintWriter to use for logging debugging messages

getContext

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

javax.naming.NamingException

getConnectionFactory

public javax.resource.cci.ConnectionFactory getConnectionFactory(java.lang.String jndi)
                                                          throws javax.jdo.JDOException,
                                                                 javax.ejb.EJBException,
                                                                 javax.naming.NamingException
javax.jdo.JDOException
javax.ejb.EJBException
javax.naming.NamingException

lookupConnectionFactory

public javax.resource.cci.ConnectionFactory lookupConnectionFactory(javax.naming.Context ctx)
                                                             throws javax.naming.NamingException
javax.naming.NamingException

bindConnectionFactory

public void bindConnectionFactory(java.lang.String name,
                                  javax.resource.cci.ConnectionFactory cm,
                                  javax.naming.Context context)
                           throws javax.naming.NamingException
javax.naming.NamingException

getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager()
                                                   throws javax.ejb.EJBException
Obtain a PersistenceManager. Per the JDO specification, the PersistenceManager 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.

javax.ejb.EJBException

getById

public java.lang.Object getById(java.lang.Object id)
                         throws javax.ejb.EJBException,
                                javax.jdo.JDOException
javax.ejb.EJBException
javax.jdo.JDOException

lookup

public java.lang.Object lookup(java.lang.String name,
                               java.lang.Class narrow)
                        throws javax.ejb.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:
javax.ejb.EJBException - Wraps a NamingException.

ejbException

public javax.ejb.EJBException ejbException(java.lang.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(java.lang.String msg)
Log a message.


ejbLog

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


SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

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