Protomatter Software v1.1.7

com.protomatter.j2ee.ejb
Class ProtoEJB

java.lang.Object
  |
  +--com.protomatter.j2ee.ejb.ProtoEJB
All Implemented Interfaces:
javax.ejb.EnterpriseBean, java.io.Serializable, SyslogChannelAware
Direct Known Subclasses:
ProtoEntityEJB, ProtoMessageEJB, ProtoSessionEJB

public abstract class ProtoEJB
extends java.lang.Object
implements javax.ejb.EnterpriseBean, SyslogChannelAware

Base class for all EJBs.

See Also:
Serialized Form

Field Summary
static java.lang.String COMP_ENV_CHANNEL_LIST
          The JNDI name of the syslog channel list.
 
Constructor Summary
ProtoEJB()
          Default constructor.
 
Method Summary
protected  boolean close(java.sql.Connection c)
          Close the given SQL Connection.
protected  boolean close(java.sql.ResultSet r)
          Close the given SQL ResultSet.
protected  boolean close(java.sql.Statement s)
          Close the given SQL Statement.
protected  javax.naming.Context getComponentContext()
          Get the environment context for this component.
 java.lang.Object getSyslogChannel()
          Get the list of channels to log to.
protected  void initSyslogChannelList()
          Initialize the syslog channel list from the component context.
protected  void setChannelList(java.util.List channelList)
          Set the list of channels to log messages to.
protected  void setChannelList(java.lang.String[] channelList)
          Set the list of channels to log messages to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMP_ENV_CHANNEL_LIST

public static final java.lang.String COMP_ENV_CHANNEL_LIST
The JNDI name of the syslog channel list. The value of this constant is "Syslog.channelList".
See Also:
initSyslogChannelList()
Constructor Detail

ProtoEJB

public ProtoEJB()
Default constructor.
Method Detail

getSyslogChannel

public java.lang.Object getSyslogChannel()
Get the list of channels to log to.
Specified by:
getSyslogChannel in interface SyslogChannelAware
See Also:
SyslogChannelAware

setChannelList

protected void setChannelList(java.lang.String[] channelList)
Set the list of channels to log messages to. The symbolic names "DEFAULT_CHANNEL" and "ALL_CHANNEL" are converted to their internal meanings.

setChannelList

protected void setChannelList(java.util.List channelList)
Set the list of channels to log messages to. The symbolic names "DEFAULT_CHANNEL" and "ALL_CHANNEL" are converted to their internal meanings.

getComponentContext

protected javax.naming.Context getComponentContext()
                                            throws javax.naming.NamingException
Get the environment context for this component. This method looks up the Context at the "java:comp/env" location.

initSyslogChannelList

protected void initSyslogChannelList()
Initialize the syslog channel list from the component context. Looks for the "Syslog.channelList" component environment entry, and parses it as a comma-separated list of channel names. The sumbolic names "DEFAULT_CHANNEL" and "ALL_CHANNEL" are converted to their internal meanings.

For example, the following snippet from an ejb-jar.xml file:


  ...
  <env-entry>
    <env-entry-name>Syslog.channelList</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>THIS_CHANNEL, THAT_CHANNEL</env-entry-value>
  </env-entry>
  ...
  

Will set the list of channels to contain "THIS_CHANNEL" and "THAT_CHANNEL". Also, whitespace around the edges of the value is stripped, so you can do pretty formatting in the XML file, like this:


  ...
  <env-entry>
    <env-entry-name>Syslog.channelList</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>
      THIS_CHANNEL,
      THAT_CHANNEL
    </env-entry-value>
  </env-entry>
  ...
  

And get the same result as above. Refer to the EJB spec, version 1.1, for more information about the component environment.


close

protected boolean close(java.sql.Connection c)
Close the given SQL Connection. If there is an exception, it is logged using Syslog.
See Also:
DatabaseUtil.close(Connection, Object)

close

protected boolean close(java.sql.Statement s)
Close the given SQL Statement. If there is an exception, it is logged using Syslog.
See Also:
DatabaseUtil.close(Statement, Object)

close

protected boolean close(java.sql.ResultSet r)
Close the given SQL ResultSet. If there is an exception, it is logged using Syslog.
See Also:
DatabaseUtil.close(ResultSet, Object)

Protomatter Software v1.1.7
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.7 http://protomatter.sourceforge.net/1.1.7