CJB Module

CJB Module

The CJB Module generates Client Java Beans (CJB).

CJB's are 'smart-stubs' that encapsulate EJBObjects, EJBHomes and EJBSessions.

CJB's encapsulate EJB issues, such as: -

  • Vendor specific JNDI Lookups.
  • Dereferencing Foreign Keys to Beans.
  • Handling Many-One relationships.
  • Managing Enumerated Types.
  • Optimizing Remote Method calls.
  • Handling dirty beans, with modified flags.
  • Persisting graphs of dependent beans.
  • Caching Beans for performance.
  • Hiding Remote Server Failover.

The EJB Module contains the following classes:-

  • com.javelin.generator.cjb.CWriterBeanClassWriter
  • com.javelin.generator.cjb.CJBSessionClassWriter
  • com.javelin.generator.cjb.CJBHomeClassWriter
  • com.javelin.generator.ejb.EJBContextPropertiesWriter

In order to use the CJB module you need to include the following writer

$GENERATOR.AggregateWriter cjb

Class Hierarchy

The top-level CJB Writer class hierarchy is illustrated below: -

CJB Properties

The

Abstract CJB Writer

The AbstractCJBWriter is a super class that all CJB writers extend.

The AbstractCJBWriter has the following methods: -

  • public String getCJBBeanClassName()
  • public String getCJBHomeClassName()
  • public String getCJBSessionClassName()
  • public String getContextPropertiesClassName()

CJB Bean Class Writer

The CJB Bean Class Writer is responsible for writing out the CJBBeans that encapsulate the EJBObjects.

By default the classes generated have the name and pattern: -

$CJBBEAN=public class $PACKAGE.cjb.$THIS extends $PACKAGE

CJB Session Class Writer

The CJB Session Class Writer is responsible for writing out the CJBBeans that encapsulate the EJBSessionHomes, EJBSessions and CJBHomes.

By default the classes generated have the name and pattern: -

$CJBSESSION=public class $PACKAGE.cjb.$THIS extends $BEANS.CJBSession implements $PACKAGE

CJB Home Class Writer

The CJB Home Class Writer is responsible for writing out the EJBHomes.

By default the classes generated have the name and pattern: -

$CJBHOME=public class $PACKAGE.cjb.$THIS extends $BEANS.CJBHome implements $PACKAGE

CJB Properties Writer (com.javelin.generator.cjb.CJBContextPropertiesWriter)

The CJB Context Properties Writer creates a Context Properties file in the cjb package, with the name: -

CJBContextProperties

The CJBContextProperties class is responsible for binding the JBeans interface names to implementations. The binding patterns are as follows: -

<packageName>.<ClassName>=<packageName>.<ClassName>

<packageName>.<ClassName>=<packageName>.cjb.CJB<ClassName>
<packageName>.<ClassName>Session=<packageName>.cjb.CJB<ClassName>Session
<packageName>.<ClassName>Home=<packageName>.cjb.CJB<ClassName>Home
<packageName>.<ClassName>Validator =<packageName>.<ClassName>Validator

To override the bindings in the cjb properties class do the following: -

<ClassName>.cjb.Object=<fully qualified class name>

<ClassName>.cjb.Bean=<fully qualified class name>
<ClassName>.cjb.Session=<fully qualified class name>
<ClassName>.cjb.Home=<fully qualified class name>
<ClassName>.cjb.Validator=<fully qualified class name>