com.bea.content.controls.extensible
Class CmxControlImpl

java.lang.Object
  extended by com.bea.content.controls.extensible.CmxControlImpl
All Implemented Interfaces
CmxControl, Serializable, org.apache.beehive.controls.api.bean.Extensible

public class CmxControlImpl
extends Object
implements CmxControl, org.apache.beehive.controls.api.bean.Extensible, Serializable

Copyright (c) 2005-2006 by BEA Systems, Inc. All Rights Reserved.

The implementation class for the content management system controller.

CmxControl defines an extensibility model that allows extended operations to be declared using a @ControlExtension

The interface provides the invoke method, that is called whenever an extended operation is called by the client at run time.

The protected methods can be overridden to add general sorts of functionality like logging, security, etc.

Declarative instantiation (@Control fooControl;) from a PageFlow or from another control is the preferred method of instantiating controls (as this will supply the control a proper Control Container Context (CCC)). Should the control be instantiated programmatically, from a different context or with an application scope (rather than webapp), extra measures should be taken:

See Also
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bea.content.controls.extensible.CmxControl
CmxControl.Create, CmxControl.Delete, CmxControl.DynamicProperties, CmxControl.FindBy, CmxControl.FindById, CmxControl.Id, CmxControl.Move, CmxControl.ParentId, CmxControl.Property, CmxControl.PropertyPair, CmxControl.RepositoryInfo, CmxControl.SearchPaths, CmxControl.SortOrder, CmxControl.Update
 
Field Summary
protected static String CMX_CONTROL_CREATE_SEQUENCER_ID
           
protected static Class[] constructorArgClasses
          Resource context, for onAcquire(), is NOT avaiable to us on ApplicationLifecycleListener callbacks, so we can't use it.
protected  ContentContext contentContext
           
protected static int DEFAULT_LIST_SIZE
           
protected static ID IGNORED_ID
           
protected static int MAX_NAME_LENGTH
           
protected  INodeManager nodeManager
           
protected  CmxControl.RepositoryInfo repositoryInfo
           
protected  ISearchManager searchManager
           
protected  ID topLevelID
           
protected  ITypeManager typeManager
           
 
Constructor Summary
CmxControlImpl()
          no-op default empty Constructor...perform initialization in onCreate
 
Method Summary
protected  Node addNode(ContentContext cc, CmxControl.Create methodCreate, ObjectClass objectClass, Property[] nodeProps, ID parentId)
           
protected  Node addNodeSecure(ContentContext cc, int nodeHierarchyContentType, ID parentId, String nodeName, String ocName, Property[] nodeProps)
          Actually add the node, going thru security in derived classes if necessay.
protected  void checkAccess(String capability, ID idOfAffectedNode)
          Default no-op method for checking security access
protected  void checkAccess(String capability, String workingPath)
          Default no-op method for checking security access
protected  Object constructReturnValueFromNode(Node tmpNode, Constructor returnTypeNodeConstructor, com.bea.content.nodemappers.NodeMapper nodeMapper, boolean isNodeReturnType)
           
protected  Object create(CmxControl.Create methodCreate, Method method, Type[] types, Object[] args, Class returnType)
           
protected  ObjectClass createObjectClass(String nodeType, List propertyDefs, String parentTypeName, Boolean isSearchable)
          Create the ObjectClass
protected static Value createValue(Object object)
          Value factory...
protected static Value[] createValues(Object object)
          Values factory...
protected  Object delete(Method method, Object[] args)
           
protected  Object findBy(Method method, CmxControl.FindBy methodFindBy, Type[] argTypes, String[] argNames, Object[] args, Class returnTypeClass, Type returnType)
           
protected  Object findById(Method method, CmxControl.FindBy methodFindBy, Type[] argTypes, String[] argNames, Object[] args, Class returnTypeClass, Type returnType)
           
protected  ID findIdInArgs(Object[] args, Method method)
           
protected  ID findParentIdInArgs(Object[] args, Method method)
          Get the parentId
protected  ObjectClass getObjectClass(ContentContext cc, String nodeType)
          Search for ObjectClass before creating it
protected  List getPropertyDefinitions(Object[] args, Method method, ArrayList<String> keyFieldsReturned, String parentTypeName)
          Get Property definitions in case we need to create a new ObjectClass This methods in addition to returned the Property Definitions for the ObjectClass updated an ArrayList which contains primary key fields the ObjectClass.
 Object invoke(Method method, Object[] args)
          Called by the Controls runtime to handle calls to methods of an extensible control.
protected  Object move(Method method, Object[] args)
           
 void onCreate()
          Invoked by the controls runtime when a new instance of this class is instantiated by the runtime
protected  Object update(Method method, Object[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

constructorArgClasses

protected static final Class[] constructorArgClasses
Resource context, for onAcquire(), is NOT avaiable to us on ApplicationLifecycleListener callbacks, so we can't use it. ContentContext will have to be set somewhere else


IGNORED_ID

protected static final ID IGNORED_ID

CMX_CONTROL_CREATE_SEQUENCER_ID

protected static final String CMX_CONTROL_CREATE_SEQUENCER_ID
See Also
Constants Summary

MAX_NAME_LENGTH

protected static final int MAX_NAME_LENGTH
See Also
Constants Summary

DEFAULT_LIST_SIZE

protected static final int DEFAULT_LIST_SIZE
See Also
Constants Summary

topLevelID

protected ID topLevelID

nodeManager

protected transient INodeManager nodeManager

searchManager

protected transient ISearchManager searchManager

typeManager

protected transient ITypeManager typeManager

repositoryInfo

protected transient CmxControl.RepositoryInfo repositoryInfo

contentContext

protected transient ContentContext contentContext
Constructor Detail

CmxControlImpl

public CmxControlImpl()
no-op default empty Constructor...perform initialization in onCreate

Method Detail

onCreate

public void onCreate()
              throws org.apache.beehive.controls.api.ControlException
Invoked by the controls runtime when a new instance of this class is instantiated by the runtime

Throws
org.apache.beehive.controls.api.ControlException

invoke

public Object invoke(Method method,
                     Object[] args)
              throws Throwable
Called by the Controls runtime to handle calls to methods of an extensible control.

Specified by:
invoke in interface org.apache.beehive.controls.api.bean.Extensible
Parameters
method - The extended operation that was called.
args - Parameters of the operation.
Returns
The value that should be returned by the operation.
Throws
Throwable - any exception declared on the extended operation may be thrown. If a checked exception is thrown from the implementation that is not declared on the original interface, it will be wrapped in a ControlException.

create

protected Object create(CmxControl.Create methodCreate,
                        Method method,
                        Type[] types,
                        Object[] args,
                        Class returnType)
                 throws AuthenticationException,
                        AuthorizationException,
                        NodeExistsException,
                        NoSuchObjectClassException,
                        RepositoryException,
                        InstantiationException,
                        IllegalAccessException,
                        InvocationTargetException,
                        SQLException,
                        GSNonUniqueContentException
Parameters
methodCreate -
method -
types -
args -
returnType -
Returns
Throws
AuthenticationException
AuthorizationException
NodeExistsException
NoSuchObjectClassException
RepositoryException
InstantiationException
IllegalAccessException
InvocationTargetException
SQLException
GSNonUniqueContentException

findBy

protected Object findBy(Method method,
                        CmxControl.FindBy methodFindBy,
                        Type[] argTypes,
                        String[] argNames,
                        Object[] args,
                        Class returnTypeClass,
                        Type returnType)
                 throws InstantiationException,
                        IllegalAccessException,
                        InvocationTargetException,
                        com.bea.content.nodemappers.NodeMapper.NodeMapperException,
                        AuthenticationException,
                        AuthorizationException,
                        NoSuchNodeException,
                        RepositoryException
Parameters
method -
methodFindBy -
argTypes -
argNames -
args -
returnTypeClass -
returnType -
Returns
Throws
InstantiationException
IllegalAccessException
InvocationTargetException
NodeMapper.NodeMapperException
AuthenticationException
AuthorizationException
NoSuchNodeException
RepositoryException

findById

protected Object findById(Method method,
                          CmxControl.FindBy methodFindBy,
                          Type[] argTypes,
                          String[] argNames,
                          Object[] args,
                          Class returnTypeClass,
                          Type returnType)
                   throws InstantiationException,
                          IllegalAccessException,
                          InvocationTargetException,
                          com.bea.content.nodemappers.NodeMapper.NodeMapperException,
                          AuthenticationException,
                          AuthorizationException,
                          NoSuchNodeException,
                          RepositoryException
Throws
InstantiationException
IllegalAccessException
InvocationTargetException
com.bea.content.nodemappers.NodeMapper.NodeMapperException
AuthenticationException
AuthorizationException
NoSuchNodeException
RepositoryException

constructReturnValueFromNode

protected Object constructReturnValueFromNode(Node tmpNode,
                                              Constructor returnTypeNodeConstructor,
                                              com.bea.content.nodemappers.NodeMapper nodeMapper,
                                              boolean isNodeReturnType)
                                       throws RepositoryException,
                                              InstantiationException,
                                              IllegalAccessException,
                                              InvocationTargetException,
                                              com.bea.content.nodemappers.NodeMapper.NodeMapperException
Throws
RepositoryException
InstantiationException
IllegalAccessException
InvocationTargetException
com.bea.content.nodemappers.NodeMapper.NodeMapperException

update

protected Object update(Method method,
                        Object[] args)
                 throws AuthenticationException,
                        AuthorizationException,
                        NoSuchNodeException,
                        NoSuchPropertyException,
                        RepositoryException,
                        IOException,
                        GSNonUniqueContentException
Throws
AuthenticationException
AuthorizationException
NoSuchNodeException
NoSuchPropertyException
RepositoryException
IOException
GSNonUniqueContentException

delete

protected Object delete(Method method,
                        Object[] args)
                 throws AuthenticationException,
                        AuthorizationException,
                        NoSuchNodeException,
                        RepositoryException
Throws
AuthenticationException
AuthorizationException
NoSuchNodeException
RepositoryException

move

protected Object move(Method method,
                      Object[] args)
               throws AuthenticationException,
                      AuthorizationException,
                      NoSuchNodeException,
                      RepositoryException,
                      GSNonUniqueContentException
Throws
AuthenticationException
AuthorizationException
NoSuchNodeException
RepositoryException
GSNonUniqueContentException

getObjectClass

protected ObjectClass getObjectClass(ContentContext cc,
                                     String nodeType)
                              throws AuthorizationException,
                                     RepositoryException
Search for ObjectClass before creating it

Throws
AuthorizationException
RepositoryException

checkAccess

protected void checkAccess(String capability,
                           String workingPath)
                    throws AuthorizationException
Default no-op method for checking security access

Throws
AuthorizationException

checkAccess

protected void checkAccess(String capability,
                           ID idOfAffectedNode)
                    throws AuthorizationException,
                           NoSuchNodeException,
                           RepositoryException
Default no-op method for checking security access

Throws
AuthorizationException
NoSuchNodeException
RepositoryException

createObjectClass

protected ObjectClass createObjectClass(String nodeType,
                                        List propertyDefs,
                                        String parentTypeName,
                                        Boolean isSearchable)
Create the ObjectClass


getPropertyDefinitions

protected List getPropertyDefinitions(Object[] args,
                                      Method method,
                                      ArrayList<String> keyFieldsReturned,
                                      String parentTypeName)
                               throws AuthorizationException,
                                      RepositoryException
Get Property definitions in case we need to create a new ObjectClass This methods in addition to returned the Property Definitions for the ObjectClass updated an ArrayList which contains primary key fields the ObjectClass. The ArrayList name is keyFieldsReturned

Throws
AuthorizationException
RepositoryException

addNode

protected Node addNode(ContentContext cc,
                       CmxControl.Create methodCreate,
                       ObjectClass objectClass,
                       Property[] nodeProps,
                       ID parentId)
                throws AuthorizationException,
                       NoSuchObjectClassException,
                       RepositoryException
Parameters
methodCreate -
objectClass -
nodeProps -
parentId -
Throws
AuthorizationException
NoSuchObjectClassException
RepositoryException

addNodeSecure

protected Node addNodeSecure(ContentContext cc,
                             int nodeHierarchyContentType,
                             ID parentId,
                             String nodeName,
                             String ocName,
                             Property[] nodeProps)
                      throws AuthorizationException,
                             NoSuchObjectClassException,
                             RepositoryException
Actually add the node, going thru security in derived classes if necessay.

Throws
AuthorizationException
NoSuchObjectClassException
RepositoryException

findIdInArgs

protected ID findIdInArgs(Object[] args,
                          Method method)

findParentIdInArgs

protected ID findParentIdInArgs(Object[] args,
                                Method method)
Get the parentId


createValue

protected static Value createValue(Object object)
Value factory...


createValues

protected static Value[] createValues(Object object)
Values factory...



Copyright © 2006 BEA Systems, Inc. All Rights Reserved