Business Components

oracle.jbo.server
Class ApplicationModuleImpl

java.lang.Object
  |
  +--oracle.jbo.common.BaseObject
        |
        +--oracle.jbo.server.NamedObjectImpl
              |
              +--oracle.jbo.server.ComponentObjectImpl
                    |
                    +--oracle.jbo.server.ContainerObjectImpl
                          |
                          +--oracle.jbo.server.ApplicationModuleImpl

public class ApplicationModuleImpl
extends ContainerObjectImpl
implements ApplicationModule, TransPostControl

The base class of Application Modules. An Application Module is a logical container for coordinated objects related to a particular task, with optional programming logic. Application Modules provide a simple runtime data connection model (one connection per Application Module) and a context for defining and executing transactions. The framework provides an AppRegistry class that clients can use to manage and share a pool of Application Modules. An Application Module provides the following functionality:

Clients can use a generic Application Module provided by the Business Component framework. Your Java code can customize the Application Module and the View Objects it contains.

Application Modules can be nested. That is, an Application Module can (logically) contain one or more other Application Modules as well as View Objects. When Application Modules are nested, the outer-most (top-level) Application Module provides the transaction context for the others.

Since:
JDevloper 3.0
See Also:
oracle.jbo.common.appmgr.AppRegistry

Field Summary
static java.lang.String DEFAULT_DEF_NAME
           
 
Fields inherited from class oracle.jbo.server.ContainerObjectImpl
mComponentList, mComponents
 
Fields inherited from class oracle.jbo.server.NamedObjectImpl
mFullName, mName, mParent, mProperties
 
Fields inherited from class oracle.jbo.common.BaseObject
TRACE_EVERY_ALLOC, TRACE_NONE, TRACE_OCCASIONAL, TRACE_UNINITIALIZED
 
Fields inherited from interface oracle.jbo.ApplicationModule
DEFAULT_DEF_FULL_NAME, DEFAULT_ROOT_APP_MOD_NAME, SYNC_IMMEDIATE, SYNC_LAZY
 
Fields inherited from interface oracle.jbo.common.TransPostControl
TRANS_POST_GET_ATTR_BY_INDEX, TRANS_POST_GET_ATTR_BY_NAME, TRANS_POST_GET_ATTR_COUNT, TRANS_POST_GET_ATTR_INDEX_OF, TRANS_POST_PUSHBACK, TRANS_POST_REMOVE, TRANS_POST_REVERT, TRANS_POST_SET_ATTR_BY_INDEX, TRANS_POST_SET_ATTR_BY_NAME
 
Constructor Summary
protected ApplicationModuleImpl()
          Constructs a new Application Module.
 
Method Summary
protected  void activate(Session session)
          This method is called by the framweork when a root application module is created.
protected  void addChild(ComponentObjectImpl object)
          Adds names to this Application Module's own list of child components.
 void addWarning(JboWarning warn)
          Adds a warning handler.
protected  void create()
           
 ApplicationModule createApplicationModule(java.lang.String amName, java.lang.String defName)
          Creates an Application Module.
 ComponentObject createComponentObject(java.lang.String coName, java.lang.String comDefName)
          Creates a Component Object from the name of a ComponentObject metadata definition.
static ApplicationModuleImpl createRootApplicationModule(java.lang.String applicationModuleDefName, Session sess)
          A factory method for creating a root Application Module.
static void createSharedDataHandle()
          User of app module knows when the def objects are ready User calls this fucntion to register a shared data handle with MOM and later uses it
 ViewLink createViewLink(java.lang.String viewLinkName, java.lang.String viewLinkDefName, ViewObject master, ViewObject detail)
          Creates a View Link.
 ViewLink createViewLinkBetweenViewObjects(java.lang.String viewLinkName, java.lang.String accessorName, ViewObject master, AttributeDef[] srcAttrs, ViewObject detail, AttributeDef[] destAttrs, java.lang.String assocClause)
          Creates a View Link.
 ViewLink createViewLinkFromEntityAssocName(java.lang.String viewLinkName, java.lang.String entityAssocName, ViewObject master, ViewObject detail)
          Creates a View Link.
 ViewObject createViewObject(java.lang.String voName, java.lang.String vDefName)
          Creates a View Object.
 ViewObject createViewObjectFromQueryClauses(java.lang.String vuName, java.lang.String eoName, java.lang.String selectClause, java.lang.String fromClause, java.lang.String whereClause, java.lang.String orderByClause)
          Creates an updateable View Object.
 ViewObject createViewObjectFromQueryStmt(java.lang.String qName, java.lang.String query)
          Creates a View Object.
static void createXMLSharedDataHandle()
          User of app module knows when the JboElementImpl's are ready User calls this fucntion to register a shared data handle with MOM and later uses it
 java.lang.String dumpQueryResult(java.lang.String query, java.lang.String dumpClassName, java.lang.String[] data)
           
 int executeCommand(java.lang.String command)
           
 ApplicationModule findApplicationModule(java.lang.String amName)
          Gets the named Application Module.
 ComponentObject findComponentObject(java.lang.String compName)
          Find the component Object from the AppModule, This can be a generic component
 RowSetIterator findRSIForEntity(RowSetIterator[] rsis, int eRowHandle)
          Finds the appropriate RowSetIterator for an entity row handle.
 ViewLink findViewLink(java.lang.String vlName)
          Finds a named View Link.
 ViewObject findViewObject(java.lang.String voName)
          Finds a named View Object.
protected  ApplicationModuleDefImpl getApplicationModuleDef()
          Returns the definition associated with this Application Module.
 ApplicationModuleImpl[] getApplicationModuleImpls()
          Creates an array of Application Modules.
 java.lang.String[] getApplicationModuleNames()
          Constructs an array of Application Module names.
 java.lang.String getClientProxyClassName()
          Return the client proxy's class name for this Application Module.
 DBTransaction getDBTransaction()
          Gets the root Application Module's database transaction.
 java.lang.String getDefFullName()
          Gets the fully-qualified name of this Application Module's definition.
 java.lang.String getDefName()
          Gets the name of this Application Module's definition.
 Row getEntityRowFromHandle(int eRowHandle)
           
 oracle.jbo.common.remote.rAttributeDescription[] getQueryInfo(ViewObject vo)
          Constructs an array of a View Object's attribute descriptors.
 Session getSession()
          Gets the session information.
 ClientDocument getStyles(java.lang.String name)
          Gets the Application Module's style definitions from the middle tier.
 int getSyncMode()
          Gets the current sync mode.
 Transaction getTransaction()
          Gets the transaction information.
 java.lang.String[] getViewLinkNames()
          Construct an array of the names of the Application Module's View Links.
 ViewLinkImpl[] getViewLinks()
          Construct an array of the Application Module's View Links.
 java.lang.String[] getViewObjectNames()
          Construct an array of the names of the Application Module's View Objects.
 ViewObject[] getViewObjects()
          Constructs an array of this Application Module's View Objects.
 boolean isRoot()
          Determines if this is the root Application Module.
 void remove()
          Deletes this Application Module.
protected  void removeChild(ComponentObjectImpl object)
          Removes names from this Application Module's own list of child components.
 void setExceptionHandler(JboExceptionHandler hndlr)
          Sets the exception handler.
 void setStyles(java.lang.String name, ClientDocument clientDocument)
          Saves the Application Module's style definitions to the middle tier.
 void setSyncMode(int mode)
          Sets the syncronization mode between the client and the middle tier.
 void sync()
          Synchronizes all the result sets defined in this Application Module with the server.
 java.lang.Object transPostGetAttr(int op, int hdl, int index, java.lang.String name)
           
 void transPostPushback(int hdl)
          Internal: Applications should not use this method.
 void transPostRemove(int hdl)
          Internal: Applications should not use this method.
 void transPostRevert(int hdl)
          Internal: Applications should not use this method.
 void transPostRowOp(int op, int hdl)
           
 void transPostSetAttr(int op, int hdl, int index, java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class oracle.jbo.server.ContainerObjectImpl
addContainerListener, removeContainerListener
 
Methods inherited from class oracle.jbo.server.ComponentObjectImpl
addListener, createRef, getApplicationModule, getCompListeners, getProxyClassName, getProxyClassName, getRootApplicationModule, isRegWithPiggyMan, setProxyClassName
 
Methods inherited from class oracle.jbo.server.NamedObjectImpl
getFullName, getName, getParent, getProperties, getPropertiesAsStrings, getProperty, setFullName, setProperty
 
Methods inherited from class oracle.jbo.common.BaseObject
dumpState, setTraceLevel, setTraceWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DEF_NAME

public static final java.lang.String DEFAULT_DEF_NAME
Constructor Detail

ApplicationModuleImpl

protected ApplicationModuleImpl()
Constructs a new Application Module.
Method Detail

create

protected void create()

createRootApplicationModule

public static ApplicationModuleImpl createRootApplicationModule(java.lang.String applicationModuleDefName,
                                                                Session sess)
A factory method for creating a root Application Module.
Parameters:
applicationModuleDefName - the name of an Application Module definition.
sess - the session.

createSharedDataHandle

public static void createSharedDataHandle()
User of app module knows when the def objects are ready User calls this fucntion to register a shared data handle with MOM and later uses it

createXMLSharedDataHandle

public static void createXMLSharedDataHandle()
User of app module knows when the JboElementImpl's are ready User calls this fucntion to register a shared data handle with MOM and later uses it

activate

protected void activate(Session session)
                 throws java.lang.IllegalStateException
This method is called by the framweork when a root application module is created. Unlike the create() method which is called even when nested Application Modules are created, this method is called only for the root Application Module. Subclasses can override this method to perform customizations. If this method is overriden, then subclasses must call the super class implementation first when writing custom implementations.

getApplicationModuleDef

protected ApplicationModuleDefImpl getApplicationModuleDef()
Returns the definition associated with this Application Module.

isRoot

public boolean isRoot()
Determines if this is the root Application Module.
Returns:
true if this is the root.

addChild

protected void addChild(ComponentObjectImpl object)
Adds names to this Application Module's own list of child components. The child components can be View Objects, View Links, or other Application Modules. This method overrides addChild in NamedObjectImpl.
Parameters:
object - an object to add to the component list
See Also:
NamedObjectImpl

removeChild

protected void removeChild(ComponentObjectImpl object)
Removes names from this Application Module's own list of child components. The child components can be View Objects, View Links, or other Application Modules. This method overrides removeChild in NamedObjectImpl.
Parameters:
object - an object to add to the component list
See Also:
NamedObjectImpl

getDefName

public java.lang.String getDefName()
Gets the name of this Application Module's definition.
Overrides:
getDefName in class ComponentObjectImpl
Returns:
a name.

getDefFullName

public java.lang.String getDefFullName()
Gets the fully-qualified name of this Application Module's definition.
Overrides:
getDefFullName in class ComponentObjectImpl
Returns:
a fully-qualified name.

createApplicationModule

public ApplicationModule createApplicationModule(java.lang.String amName,
                                                 java.lang.String defName)
Creates an Application Module.
Specified by:
createApplicationModule in interface ApplicationModule
Parameters:
amName - the name to be given to the Application Module. If amName is empty a name is generated.
defName - the name of the Application Module definition to be used. If null a default definition is used.
Returns:
a new Application Module.

findApplicationModule

public ApplicationModule findApplicationModule(java.lang.String amName)
Gets the named Application Module.
Specified by:
findApplicationModule in interface ApplicationModule
Parameters:
amName - the name of the Application Module. If amName is empty the root Application Module is returned.
Returns:
the Application Module.
Throws:
InvalidObjNameException - if the name cannot be found.

getApplicationModuleNames

public java.lang.String[] getApplicationModuleNames()
Constructs an array of Application Module names.
Specified by:
getApplicationModuleNames in interface ApplicationModule
Returns:
the array of names.

transPostPushback

public void transPostPushback(int hdl)
Description copied from interface: TransPostControl
Internal: Applications should not use this method.
Specified by:
transPostPushback in interface TransPostControl

transPostRemove

public void transPostRemove(int hdl)
Description copied from interface: TransPostControl
Internal: Applications should not use this method.
Specified by:
transPostRemove in interface TransPostControl

transPostRevert

public void transPostRevert(int hdl)
Description copied from interface: TransPostControl
Internal: Applications should not use this method.
Specified by:
transPostRevert in interface TransPostControl

transPostRowOp

public void transPostRowOp(int op,
                           int hdl)

transPostGetAttr

public java.lang.Object transPostGetAttr(int op,
                                         int hdl,
                                         int index,
                                         java.lang.String name)

transPostSetAttr

public void transPostSetAttr(int op,
                             int hdl,
                             int index,
                             java.lang.String name,
                             java.lang.Object value)

getEntityRowFromHandle

public Row getEntityRowFromHandle(int eRowHandle)

sync

public void sync()
Description copied from interface: ApplicationModule
Synchronizes all the result sets defined in this Application Module with the server.

Any changes in the result sets are uploaded to the server and the server updates are downloaded to the client.

Specified by:
sync in interface ApplicationModule

setSyncMode

public void setSyncMode(int mode)
Description copied from interface: ApplicationModule
Sets the syncronization mode between the client and the middle tier.
Specified by:
setSyncMode in interface ApplicationModule
Tags copied from interface: ApplicationModule
Parameters:
mode - the new syncronization mode:

If SYNC_LAZY, operations on middle-tier objects are batched until sync() is called, or until an operation causes new data to be fetched from the server.

If SYNC_IMMEDIATE, all operations on middle-tier objects are performed immediately.


getSyncMode

public int getSyncMode()
Description copied from interface: ApplicationModule
Gets the current sync mode.
Specified by:
getSyncMode in interface ApplicationModule
Tags copied from interface: ApplicationModule
Returns:
SYNC_LAZY or SYNC_IMMEDIATE.

getViewObjectNames

public java.lang.String[] getViewObjectNames()
Construct an array of the names of the Application Module's View Objects.
Specified by:
getViewObjectNames in interface ApplicationModule
Returns:
the array of names.

getViewLinkNames

public java.lang.String[] getViewLinkNames()
Construct an array of the names of the Application Module's View Links.
Specified by:
getViewLinkNames in interface ApplicationModule
Returns:
the array of names.

getViewLinks

public ViewLinkImpl[] getViewLinks()
Construct an array of the Application Module's View Links.
Returns:
the array of View Links.

createViewLink

public ViewLink createViewLink(java.lang.String viewLinkName,
                               java.lang.String viewLinkDefName,
                               ViewObject master,
                               ViewObject detail)
Creates a View Link.
Specified by:
createViewLink in interface ApplicationModule
Parameters:
viewLinkName - the name to be given to the View Link. If empty a name is generated.
viewLinkDefName - the name of the definition to be used to create the link. If empty a default definition will be used.
master - the link's source.
detail - the link's destination.
Throws:
InvalidParamException - if master or detail are invalid.
InvalidObjNameException - if viewLinkName is invalid.
NameClashException - if viewLinkName already exists.

createViewLinkFromEntityAssocName

public ViewLink createViewLinkFromEntityAssocName(java.lang.String viewLinkName,
                                                  java.lang.String entityAssocName,
                                                  ViewObject master,
                                                  ViewObject detail)
Creates a View Link.
Specified by:
createViewLinkFromEntityAssocName in interface ApplicationModule
Parameters:
viewLinkName - the name to be given to the View Link. If empty a name is generated.
entityAssocName - the entity association that the View Link will represent.
master - the link's source.
detail - the link's destination.
Throws:
InvalidParamException - if master, detail, or entityAssocName are invalid.
InvalidObjNameException - if viewLinkName is invalid.
NameClashException - if viewLinkName already exists.

createViewLinkBetweenViewObjects

public ViewLink createViewLinkBetweenViewObjects(java.lang.String viewLinkName,
                                                 java.lang.String accessorName,
                                                 ViewObject master,
                                                 AttributeDef[] srcAttrs,
                                                 ViewObject detail,
                                                 AttributeDef[] destAttrs,
                                                 java.lang.String assocClause)
Creates a View Link.
Specified by:
createViewLinkBetweenViewObjects in interface ApplicationModule
Parameters:
viewLinkName - the name to be given to the View Link. If empty a name is generated.
accessorName - the name to be given to the View Link's accessor.
master - the link's source.
srcAttrs - link attributes taken from the master View Object.
detail - the link's destination.
destAttrs - link attributes taken from the detail View Object.
assocClause -  
Throws:
InvalidParamException - if master or detail are invalid.
InvalidObjNameException - if viewLinkName or accessorName are invalid.
NameClashException - if viewLinkName or accessorName already exist.

findViewObject

public ViewObject findViewObject(java.lang.String voName)
Description copied from interface: ApplicationModule
Finds a named View Object.
Specified by:
findViewObject in interface ApplicationModule
Tags copied from interface: ApplicationModule
Parameters:
voName - a View Object name.
Returns:
a View Object.

findComponentObject

public ComponentObject findComponentObject(java.lang.String compName)
Find the component Object from the AppModule, This can be a generic component
Specified by:
findComponentObject in interface ApplicationModule
Overrides:
findComponentObject in class ContainerObjectImpl
Tags copied from interface: ApplicationModule
Parameters:
coName - a Component Object name.
Returns:
a Component Object.

findViewLink

public ViewLink findViewLink(java.lang.String vlName)
Description copied from interface: ApplicationModule
Finds a named View Link.
Specified by:
findViewLink in interface ApplicationModule
Tags copied from interface: ApplicationModule
Parameters:
viewLinkName - a name.
Returns:
a ViewLink.

getDBTransaction

public DBTransaction getDBTransaction()
Gets the root Application Module's database transaction.
Returns:
a transaction.
Throws:
NotConnectedException - if the transaction does not exist.

getViewObjects

public ViewObject[] getViewObjects()
Constructs an array of this Application Module's View Objects.
Returns:
the array.

createViewObjectFromQueryStmt

public ViewObject createViewObjectFromQueryStmt(java.lang.String qName,
                                                java.lang.String query)
Creates a View Object.
Specified by:
createViewObjectFromQueryStmt in interface ApplicationModule
Parameters:
qName - the name to be given to the View Object. If empty a name is generated.
query - the SQL query that defines the View Object.
Returns:
a new View Object.
Throws:
InvalidObjNameException - if qName is invalid.
NoObjException - if qName does not exist.

createViewObjectFromQueryClauses

public ViewObject createViewObjectFromQueryClauses(java.lang.String vuName,
                                                   java.lang.String eoName,
                                                   java.lang.String selectClause,
                                                   java.lang.String fromClause,
                                                   java.lang.String whereClause,
                                                   java.lang.String orderByClause)
Creates an updateable View Object.
Specified by:
createViewObjectFromQueryClauses in interface ApplicationModule
Parameters:
vuName - the name to be given to the View Object. If empty a name is generated.
eoName - the name of the EntityObject from which the View Object is to be derived.
selectClause - a SQL statement SELECT clause.
fromClause - a SQL statement FROM clause.
whereClause - a SQL statement WHERE clause.
orderbyClause - a SQL statement ORDERBY clause.
Returns:
a new View Object.
Throws:
InvalidParamException - if vuName is invalid.
NameClashException - if vuName already exists.

executeCommand

public int executeCommand(java.lang.String command)

dumpQueryResult

public java.lang.String dumpQueryResult(java.lang.String query,
                                        java.lang.String dumpClassName,
                                        java.lang.String[] data)

createViewObject

public ViewObject createViewObject(java.lang.String voName,
                                   java.lang.String vDefName)
Creates a View Object.
Specified by:
createViewObject in interface ApplicationModule
Parameters:
voName - the name to be given to the View Object. If empty a name is generated.
vDefName - the name of a view definition.
Returns:
a new View Object.
Throws:
InvalidObjNameException - if voName is invalid.
NoObjException - if voName does not exist.

createComponentObject

public ComponentObject createComponentObject(java.lang.String coName,
                                             java.lang.String comDefName)
Description copied from interface: ApplicationModule
Creates a Component Object from the name of a ComponentObject metadata definition.
Specified by:
createComponentObject in interface ApplicationModule
Overrides:
createComponentObject in class ContainerObjectImpl
Tags copied from interface: ApplicationModule
Parameters:
coName - the name that will be given to the ComponentObject. If null, a system-generated name is assigned.
coName - the name of the ComponentObject metadata definition.
Returns:
a Component Object.

getApplicationModuleImpls

public ApplicationModuleImpl[] getApplicationModuleImpls()
Creates an array of Application Modules.
Returns:
the array.

getQueryInfo

public oracle.jbo.common.remote.rAttributeDescription[] getQueryInfo(ViewObject vo)
Constructs an array of a View Object's attribute descriptors.
Parameters:
vo - a View Object.
Returns:
the attribute descriptors array.

remove

public void remove()
Deletes this Application Module.
Overrides:
remove in class ComponentObjectImpl

getClientProxyClassName

public java.lang.String getClientProxyClassName()
Return the client proxy's class name for this Application Module.

setExceptionHandler

public void setExceptionHandler(JboExceptionHandler hndlr)
Sets the exception handler.
Specified by:
setExceptionHandler in interface ApplicationModule
Parameters:
an - exception handler.

addWarning

public void addWarning(JboWarning warn)
Adds a warning handler.
Specified by:
addWarning in interface ApplicationModule
Parameters:
a - warning.

setStyles

public void setStyles(java.lang.String name,
                      ClientDocument clientDocument)
Saves the Application Module's style definitions to the middle tier.
Specified by:
setStyles in interface ApplicationModule
Parameters:
name - a name under which the style definitions are to be stored.
clientDocument - the ClientDocument to be saved.

getStyles

public ClientDocument getStyles(java.lang.String name)
Gets the Application Module's style definitions from the middle tier.
Specified by:
getStyles in interface ApplicationModule
Parameters:
name - a name under which the style definitions are stored.

getSession

public Session getSession()
Gets the session information.
Specified by:
getSession in interface ApplicationModule
Tags copied from interface: ApplicationModule
Returns:
a Session.

getTransaction

public Transaction getTransaction()
Gets the transaction information.
Specified by:
getTransaction in interface ApplicationModule
Tags copied from interface: ApplicationModule
Returns:
a Transaction.

findRSIForEntity

public RowSetIterator findRSIForEntity(RowSetIterator[] rsis,
                                       int eRowHandle)
Description copied from interface: ApplicationModule
Finds the appropriate RowSetIterator for an entity row handle.
Specified by:
findRSIForEntity in interface ApplicationModule
Tags copied from interface: ApplicationModule
Parameters:
rsis - an array of RowSetIterator's to look through.
eRowHandle - the entity row handle.
Returns:
the RowSetIterator.

Business Components