| java.lang.Object de.finix.contelligent.core.BasicComponentManager
All known Subclasses: de.finix.contelligent.core.LRUMapComponentManager, de.finix.contelligent.core.EditManager,
BasicComponentManager | public class BasicComponentManager implements ComponentManagerInternal(Code) | | A BasicComponentManager is a
ComponentManager which
directly operates on the underlying persistent store.
Since accessing the database for every component access is very slow, a
production environment should always use a cacheing subclass of this,
although this class can be used directly for development purposes.
|
Method Summary | |
final void | addClone(ComponentPath path, Component clone) | final void | addEvent(ComponentEvent event) | final public void | addToAllBlueprintInstances(ComponentPath path, CallData callData) | public void | afterCompletion(int status) Implementation of
TxSynchronization.afterCompletion . | public boolean | beforeCompletion() Implementation of
TxSynchronization.beforeCompletion . | final public boolean | callerHasPermission(CallData callData, Component component, ComponentPermission permission) | final public boolean | callerHasPermission(CallData callData, Component component, ComponentPermission permission, boolean ignoreAdmin) | final public boolean | callerHasPermission(ContelligentPrincipal caller, Component component, ComponentPermission permission) | final public boolean | callerHasPermission(ContelligentPrincipal caller, CallData callData, Component component, ComponentPermission permission) | final public boolean | callerHasPermission(ContelligentPrincipal caller, Component component, ComponentPermission permission, boolean ignoreAdmin) | final public boolean | callerHasPermission(ContelligentPrincipal caller, CallData callData, Component component, ComponentPermission permission, boolean ignoreAdmin) | final public boolean | callerHasPermissionForTree(CallData callData, ContelligentPrincipal caller, Component component, ComponentPermission permission) | public void | certifyComponent(String name, String key, int type, boolean subTree, ComponentPath path, CallData callData) | final public void | changeTypeOfBlueprintInstance(ComponentPath path, String typeName, CallData callData) | final void | checkAvailableLock(CallData callData, ComponentPath component) | protected void | checkContainsReadOnly(ComponentPath path) | final boolean | checkDeleted(ComponentPath path) | protected void | checkReadOnly(ComponentPath path) | final public void | checkRelations(CallData callData) | final void | checkRelations() Force a relation check (to be used by
AbstractCallDataImpl.doWithoutRelationsCheck only). | final void | checkUpgradedTypes() | public void | clean() | final public void | cleanMissingSubcomponent(SortedFolder parentContainer, String subcomponentName) Special cleanup routine for sorted folders whose namelist got out of sync
with the actual data. | final public void | cleanUpBlueprintInstances(ComponentPath path, CallData callData) | final public Component | cloneComponent(ComponentPath path, CallData callData) Implementation of
ComponentManager.cloneComponent(ComponentPathCallData) . | final public Component | cloneComponent(Component component) Implementation of
ComponentManager.cloneComponent(Component) . | final public void | commitServer(CallData callData) Implementation of
de.finix.contelligent.ComponentManager.commitServer . | final public void | commitSubtree(ComponentPath root, CallData callData) Implementation of
ComponentManager.commitSubtree . | final public boolean | componentExists(ComponentPath path) Implementation of
ComponentManager.componentExists(ComponentPath) . | final public boolean | componentExists(ComponentPath path, boolean inHierarchy) Implementation of
ComponentManager.componentExists(ComponentPathboolean) . | public boolean | containsReadOnly(ComponentPath path) | final public Component | copyComponentTree(CallData callData, ComponentPath sourcePath, ComponentPath targetParentPath, String toName) Implementation of
ComponentManager.copyComponentTree . | final public Component | copyComponentTree(CallData callData, ComponentPath sourcePath, ComponentPath targetParentPath, String toName, CopyMode mode, boolean cloningCopy) Implementation of
ComponentManager.copyComponentTree . | final Component | copyComponentTree(Container targetParent, User caller, CallData callData, Component source, String toName, CopyMode mode) Recursivly copies the component-tree starting with the given
Component to the specified dir without checking any permissions
nor asking the target container if its an
ObservingContainer . | final public Component | createComponent(Container parent, String name, String typeName, Map propertyMap, AccessControlList acl, CallData callData) Implementation of
ComponentManager.createComponent . | final protected Component | createComponent(Container parent, String name, Type type, Map propertyMap, AccessControlList acl, boolean postCreate, boolean updateRelations, CallData callData) | final public void | createComponent(ComponentElement componentElement, CallData callData) | final public List | createEventsForAllLocks() | final public ComponentLink | createLink(Component linkTarget, Container parent, String name, AccessControlList acl, CallData callData) Implementation of
ComponentManager.createLink . | final Container | createRootContainer() Creates the root component for the ComponentManager. | final public void | createType(TypeElement typeDefinition) Implementation of
ComponentManager.createType . | final public boolean | definesBlueprint(Component component) | final public void | deleteComponentTree(CallData callData, ComponentPath path) Implementation of
ComponentManager.deleteComponentTree . | final void | deleteComponentTree(ComponentPath path, CallData callData, boolean removeRelations, boolean checkRelations, boolean checkLinkContext) | final void | deleteComponentTree(ComponentPath path, CallData callData, boolean removeRelations, boolean checkRelations, boolean checkLinkContext, boolean committingDelete) | final public Set | deleteType(CallData callData, String typeName, boolean force, boolean includeBlueprintComponent) Implementation of
ComponentManager.deleteType . | final boolean | deleteTypeRaw(CallData callData, String typeName) Delete the given type without touching instances. | void | destroy(boolean includeFileAdapters) | final ComponentPath | exchangeCategories(ComponentPath path, Map categoryMap, CategoryManager categoryManager) Exchange all category tokens with valid values of the corresponding
category where a component does exist for in this or any parent manager.
This means the returned path does always exist either in this or a parent
manager. | final public void | exportTypes(Writer writer, boolean omitHeader, String prefix) | final void | fireAddEvent(Container parentContainer, Component subComponent) | final void | fireChangeEvent(Component component) | final void | fireDeleteEvent(Container parentContainer, Component subComponent, boolean committingDelete) | final void | flagTypeForUpgrade(CallData callData, String typeName) | final public AccessControlList | getACL() Answer the acl of this manager. | public int | getActualCacheSize() | final public Type | getBlueprintType(ComponentPath componentPath) | public long | getCacheCalls() | public long | getCacheMisses() | final Component | getClone(ComponentPath path) | final public Component | getComponent(ComponentPath path, CallData callData) Implementation of
ComponentManager.getComponent(ComponentPathCallData) . | final public Component | getComponent(ComponentPath path, CallData callData, boolean followLinks) Implementation of
ComponentManager.getComponent(ComponentPathCallDataboolean) . | ComponentFactory | getComponentFactory() | final protected ComponentPath | getComponentPath(ComponentElement componentElement) | final public ComponentPersistenceAdapter | getComponentPersistenceAdapter() | final public Set | getComponentsInSubtreeFilteredByType(ComponentPath treeRoot, Collection typeNames) Implementation of
ComponentManager.getComponentsInSubtreeFilteredByType . | final public User | getDefaultOwner() Returns the user principal representing the default owner of this
component-manager. | public Collection | getDeletedComponents() | final List | getEventList() | final ListIterator | getEvents() | final public LocalFileAdapter | getFileAdapter() | final public Set | getGlobalInstancesOfType(ComponentPath treeRoot, String typeName) Functions like getInstancesOfType, except that it searches across all
existing CMs. | final public long | getId() Implementation of
ComponentManager.getId . | final public long[] | getIdsUpToRoot() Returns all ids from this manager up to the root manager in order of the
hierarchy. | final public Set | getInstancesOfType(ComponentPath treeRoot, String typeName) Implementation of
ComponentManager.getInstancesOfType . | public int | getMaxCacheSize() | public Collection | getModifiedComponents(boolean filterBlueprintSubComponents) | final public String | getName() | final public ComponentManager | getParent() | final public Map | getPropertyMap(Component component, boolean includeRN) | final public Map | getPropertyMap(Component component, boolean includeRN, boolean includeW) | final public Container | getRootComponent() | final public ComponentPath | getRootPath() | final public Component | getSubcomponent(Container parentContainer, String subName, CallData callData) | final public Component | getSubcomponent(Container parentContainer, String relativePath, CallData callData, boolean followLinks) | final public Component | getSubcomponent(Container parentContainer, ComponentPath relativePath, CallData callData) | final public Component | getSubcomponent(Container parentContainer, ComponentPath relativePath, CallData callData, boolean followLinks) | final public int | getSubcomponentCount(Container container) | final public Set | getSubcomponentNames(Container container) Implementation of
ComponentManager.getSubcomponentNames . | final public Iterator | getSubcomponentNames(Container container, int start, int amount) | public long | getSubtreeComponents(Component subTree) | public long | getSubtreeSize(Component subTree) | public SystemIndex | getSystemIndex() | public SystemIndexer | getSystemIndexer() | public Collection | getTypesInSubTree(ComponentPath topMostPath) | final protected boolean | hasParent() | final boolean | hasRecreatedParent(ComponentPath path) | final void | initComponent(Component rawInstance, Container parentContainer) Initialize a raw component instance (set act and attributes inherited
from the parent. | public void | invalidateCache(ComponentPath path) | void | invalidatePath(ComponentPath path, boolean includeSubtree) | public void | invalidateTypes() | final public boolean | isBlueprintInstance(Component component) | final public boolean | isImport() Answer true whether this is an import manager. | final public boolean | isInstanceOf(Component component, String typeName) Implementation of
ComponentManager.isInstanceOf . | final protected boolean | isInstanceOf(ComponentPath path, String typeName) | final public boolean | isLocked(ComponentPath componentPath) Implementation of
ComponentManager.isLocked . | public boolean | isReadOnly(ComponentPath path) | final public boolean | isRoot() Answer true whether this is the root manager. | final public boolean | isRootPath(String path) | final public boolean | isRootPath(ComponentPath path) | protected boolean | isSubpathOfDeletedOrRecreated(ComponentPath path, CallData callData) | final Component | loadRawComponent(ComponentPath absolutePath, CallData callData) | final public boolean | lockComponent(ComponentPath componentPath, CallData callData) Implementation of
ComponentManager.lockComponent . | final protected boolean | lockComponent(ComponentPath componentPath, CallData callData, boolean checkLockContext) | final protected boolean | lockComponentForDelete(ComponentPath componentPath, CallData callData, boolean checkLockContext) | final public Set | moveComponentTree(ComponentPath source, ComponentPath destination, CallData callData) Implementation of
ComponentManager.moveComponentTree . | final Component | newInstanceFromType(Container parent, String name, String typeName, AccessControlList acl, Map propertyMap, ComponentContextImpl orgCtx) Returns a newly created (yet not persistent!) component instance using
the specified type, name, acl and property-map. | final public Container | parentContainer(Component component) Implementation of
ComponentManager.parentContainer . | final public void | passLock(ComponentPath componentPath, String toPrincipal, CallData callData) Implementation of
ComponentManager.passLock . | final public Set | renameType(CallData callData, String typeName, String newTypeName) Implementation of
ComponentManager.renameType . | Component | retrieveComponent(ComponentPath path, Container parentContainer, CallData callData, boolean followLinks) Returns the
Component associated with the given
ComponentPath path if it exists in this manager or in any parent
manager or otherwise throws a ComponentNotFoundException .
The path may be
ComponentPath.isAbsolute absolute or
ComponentPath.isRelative relative but in the latter case
parameter parentContainer must not be null. | final public void | rollbackChangesInSubtree(ComponentPath root, CallData callData) Rollback all changes in the given subtree. | public List | selectComponentsByName(Component root, String name) | public List | selectMetaContent(Component root, ComponentPath relative, String key, String value, String comparator) | final public void | setACL(CallData callData, AccessControlList acl) | final public void | setComponentFinal(ComponentPath path, boolean finalFlag, CallData callData) | public void | setMaxCacheSize(int maxSize) | public void | setReadOnlyPaths(Set readOnlyPaths) | public void | setSkipListener(boolean b) | public String | toString() | final public void | unlockComponent(ComponentPath componentPath, CallData callData) Implementation of
ComponentManager.unlockComponent . | final public void | updateComponent(Component component, CallData callData) Implementation of
ComponentManager.updateComponent . | final public Component | updateComponent(ComponentElement componentElement, CallData callData) | protected void | updateWrapper(ComponentContextImpl ctx) Wraps componentAdapter.update() call so that subclasses can do
centralized error handling for this call. | public void | validateBlueprintTypes() |
CERT_BASIC | final public static int CERT_BASIC(Code) | | Basic certification level using low-security but less cpu intensive
operations only.
|
CERT_SIGNED | final public static int CERT_SIGNED(Code) | | Extended certification level for higher security requirements (reserved;
not supported yet)
|
CERT_USER | final public static int CERT_USER(Code) | | Only certified as safe for execution by user name.
|
DEFAULT_LINK_TYPE | final public static String DEFAULT_LINK_TYPE(Code) | | This type is used for all links, for example if a final component should
be copied.
|
DEFAULT_LINK_TYPE_PATH_PROPERTY | final public static String DEFAULT_LINK_TYPE_PATH_PROPERTY(Code) | | This property must be passed in the map when creating a link.
|
PROPERTY_DISABLE_DEADRELATIONSCHECK | final static String PROPERTY_DISABLE_DEADRELATIONSCHECK(Code) | | |
SKIP_RELATIONS_CHECK | final static boolean SKIP_RELATIONS_CHECK(Code) | | |
deadRelationsCheckDisabled | final static boolean deadRelationsCheckDisabled(Code) | | |
log | final static org.apache.log4j.Logger log(Code) | | |
afterCompletion | public void afterCompletion(int status)(Code) | | Implementation of
TxSynchronization.afterCompletion . If any
subclass overwrites this method it must call this method at the end so
thread-locals are reseted!
|
clean | public void clean()(Code) | | |
cleanMissingSubcomponent | final public void cleanMissingSubcomponent(SortedFolder parentContainer, String subcomponentName) throws ModificationVetoException(Code) | | Special cleanup routine for sorted folders whose namelist got out of sync
with the actual data. This may be caused by direct manipulation of
components on the database level, bypassing the Contelligent server.
Due to the possibility of failure and subsequent rollback of the
transaction, this should only be called by the xml export class. One
reason this might fail is if the user viewing the component does not have
write permission to the sorted folder.
|
copyComponentTree | final public Component copyComponentTree(CallData callData, ComponentPath sourcePath, ComponentPath targetParentPath, String toName) throws ComponentNotFoundException, ComponentPersistenceException, ComponentPathException, NoReadPermissionException, NoWritePermissionException, ComponentAlreadyExistsException, ModificationVetoException, ComponentLockException(Code) | | Implementation of
ComponentManager.copyComponentTree .
|
copyComponentTree | final public Component copyComponentTree(CallData callData, ComponentPath sourcePath, ComponentPath targetParentPath, String toName, CopyMode mode, boolean cloningCopy) throws ComponentNotFoundException, ComponentPersistenceException, ComponentPathException, NoReadPermissionException, NoWritePermissionException, ComponentAlreadyExistsException, ModificationVetoException, ComponentLockException(Code) | | Implementation of
ComponentManager.copyComponentTree .
|
copyComponentTree | final Component copyComponentTree(Container targetParent, User caller, CallData callData, Component source, String toName, CopyMode mode) throws TypeException, ComponentCreationException, ComponentPathException, ComponentPersistenceException, ComponentLockException, ModificationVetoException(Code) | | Recursivly copies the component-tree starting with the given
Component to the specified dir without checking any permissions
nor asking the target container if its an
ObservingContainer .
Depending on parameter mode the copying of
de.finix.contelligent.ComponentContext.isFinal components varies:
the root of the copied component tree or null if nothing wascopied. |
createComponent | final public Component createComponent(Container parent, String name, String typeName, Map propertyMap, AccessControlList acl, CallData callData) throws TypeException, ComponentPersistenceException, ComponentCreationException, ModificationVetoException, ComponentPathException, ComponentLockException, ComponentAlreadyExistsException(Code) | | Implementation of
ComponentManager.createComponent .
|
createComponent | final protected Component createComponent(Container parent, String name, Type type, Map propertyMap, AccessControlList acl, boolean postCreate, boolean updateRelations, CallData callData) throws TypeException, ComponentPersistenceException, ComponentCreationException, ModificationVetoException, ComponentPathException, ComponentLockException, ComponentAlreadyExistsException(Code) | | |
createEventsForAllLocks | final public List createEventsForAllLocks()(Code) | | |
createRootContainer | final Container createRootContainer() throws Exception(Code) | | Creates the root component for the ComponentManager. This is a hardcoded
folder component that is not stored in the database.
|
definesBlueprint | final public boolean definesBlueprint(Component component)(Code) | | |
exchangeCategories | final ComponentPath exchangeCategories(ComponentPath path, Map categoryMap, CategoryManager categoryManager) throws ComponentNotFoundException(Code) | | Exchange all category tokens with valid values of the corresponding
category where a component does exist for in this or any parent manager.
This means the returned path does always exist either in this or a parent
manager. If no component is found for any catagory value (fallback values
are considered) a ComponentNotFoundException is thrown.
Note that this method does NOT check whether path contains categories nor
whether categoryMap is emtpy!
|
getActualCacheSize | public int getActualCacheSize()(Code) | | |
getCacheCalls | public long getCacheCalls()(Code) | | |
getCacheMisses | public long getCacheMisses()(Code) | | |
getDefaultOwner | final public User getDefaultOwner() throws ContelligentException(Code) | | Returns the user principal representing the default owner of this
component-manager. This user gets used whenever no caller is available,
for example when initially importing components.
a User value |
getIdsUpToRoot | final public long[] getIdsUpToRoot()(Code) | | Returns all ids from this manager up to the root manager in order of the
hierarchy. First entry is the id of this manager.
|
getMaxCacheSize | public int getMaxCacheSize()(Code) | | |
getSubcomponentCount | final public int getSubcomponentCount(Container container)(Code) | | |
hasParent | final protected boolean hasParent()(Code) | | |
invalidatePath | void invalidatePath(ComponentPath path, boolean includeSubtree)(Code) | | Use of this method is permitted for afterCompletion only!!!
Parameters: path - |
invalidateTypes | public void invalidateTypes()(Code) | | |
isBlueprintInstance | final public boolean isBlueprintInstance(Component component)(Code) | | |
isImport | final public boolean isImport()(Code) | | Answer true whether this is an import manager.
|
isRoot | final public boolean isRoot()(Code) | | Answer true whether this is the root manager.
|
isRootPath | final public boolean isRootPath(String path)(Code) | | |
moveComponentTree | final public Set moveComponentTree(ComponentPath source, ComponentPath destination, CallData callData) throws ContelligentException, ComponentPersistenceException, MissingPermissionException, ComponentAlreadyExistsException(Code) | | Implementation of
ComponentManager.moveComponentTree .
Algorithm works as follows:
- get paths of those components which have a relation into the moved
tree. (including those lying themselves inside the moved tree!)
- for each of those components: - clone it - if it lies within the
source tree just change any affected paths - else attempt to lock it and
then change any affected paths
- copy the source tree (using the cloned source components from step
2a with maybe changed paths)
- now update the components from step 2b. This can't be done before
step 3 or else the system may complain about missing link targets.
- delete source tree and all relations originating from it. If this is
the root server we may check for any relations still existing to this
tree (which would mean our algorithm has a fault). In a child server we
can't because we will sure have relations to this tree because our
modified components were not yet written to the root server.
- at the end we check for any dead-relations in the destination tree.
This would also reveal a bug in the algorithm.
Note that currently only one component tree per transaction may be
moved!
|
newInstanceFromType | final Component newInstanceFromType(Container parent, String name, String typeName, AccessControlList acl, Map propertyMap, ComponentContextImpl orgCtx) throws TypeException, ComponentCreationException, ComponentPathException(Code) | | Returns a newly created (yet not persistent!) component instance using
the specified type, name, acl and property-map. Note that
BasicComponentManager.initComponent gets called before returning the instance but NOT
Component.postCreate ! The calling method must invoke
Component.postCreate before any client code may access the
component!
If parameter propertyMap is non-null the instance gets those
properties set. A property may be overwritten only if the type does not
define that property as final. The map must contain either
(String,String) or (String,Double) entries.
exception: TypeException - if the type is unknown exception: ComponentCreationException - if the component could not be created exception: ComponentPathException - if the name contains invalid characters See Also: Type.setProperties |
parentContainer | final public Container parentContainer(Component component)(Code) | | Implementation of
ComponentManager.parentContainer .
If this implementation doesn't find the parent a
ContelligentRuntimeException is thrown to indicate this
fatal error as every component except the root container must have a
parent.
|
retrieveComponent | Component retrieveComponent(ComponentPath path, Container parentContainer, CallData callData, boolean followLinks) throws ComponentNotFoundException, ComponentCreationException(Code) | | Returns the
Component associated with the given
ComponentPath path if it exists in this manager or in any parent
manager or otherwise throws a ComponentNotFoundException .
The path may be
ComponentPath.isAbsolute absolute or
ComponentPath.isRelative relative but in the latter case
parameter parentContainer must not be null.
If the path
CategoryManager.containsCategory contains categories the category-tokens get replaced using the category map found in the
given calldata instance. Note that this may result in a significant
performance loss because for every category-token found we have to call
BasicComponentManager.componentExists maybe multiple times. Hereby the number of calls
depends on the number of fallbacks the category defines and which of
those values does actually exist.
The lookup of any component should be performed in the following order:
- if the
BasicComponentManager.getClone clone-map contains an entry for this path
return it. Note that any clone gets stored using its absolute path as
key.
- if the component exists within this manager return it either from
cache or
BasicComponentManager.loadRawComponent load it from the database. If the
component gets loaded
Component.postCreate have to be called.
- else ask the parent manager to retrieve the component
If the component was loaded or found in a cache and parameter
followLinks is true and the component is an instance of
ComponentLink the target of the link must be returned instead of
the component.
Parameters: path - the path of the component to return, may be relative orabsolute Parameters: parentContainer - the parent container of the component to return, is onlynecessary of path is relative. Parameters: callData - CallData instance of this call Parameters: followLinks - if true return target of ComponentLink links insteadof link itself. exception: ComponentNotFoundException - if the component does not exist in this manager nor in anyparent manager. exception: ComponentCreationException - if anything goes wrong during initialization of thecomponent, for example if Component.postCreatethrows an exception. See Also: LRUMapComponentManager See Also: for an implementation using a cache. |
setMaxCacheSize | public void setMaxCacheSize(int maxSize)(Code) | | |
setReadOnlyPaths | public void setReadOnlyPaths(Set readOnlyPaths)(Code) | | |
setSkipListener | public void setSkipListener(boolean b)(Code) | | |
|
|