Turned off policy callbacks in AVMNodeService. The right place for those

is in AVMService.  Until then these speeds things up considerably.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3982 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-09-30 15:22:11 +00:00
parent 20bff37610
commit 0db9ace91f

View File

@@ -118,14 +118,14 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
public StoreRef createStore(String protocol, String identifier) throws StoreExistsException public StoreRef createStore(String protocol, String identifier) throws StoreExistsException
{ {
StoreRef result = new StoreRef(StoreRef.PROTOCOL_AVM, identifier); StoreRef result = new StoreRef(StoreRef.PROTOCOL_AVM, identifier);
invokeBeforeCreateStore(ContentModel.TYPE_STOREROOT, result); // invokeBeforeCreateStore(ContentModel.TYPE_STOREROOT, result);
try try
{ {
fAVMService.createAVMStore(identifier); fAVMService.createAVMStore(identifier);
NodeRef rootRef = getRootNode(result); NodeRef rootRef = getRootNode(result);
addAspect(rootRef, ContentModel.ASPECT_ROOT, addAspect(rootRef, ContentModel.ASPECT_ROOT,
Collections.<QName, Serializable>emptyMap()); Collections.<QName, Serializable>emptyMap());
invokeOnCreateStore(rootRef); // invokeOnCreateStore(rootRef);
return result; return result;
} }
catch (AVMExistsException e) catch (AVMExistsException e)
@@ -243,8 +243,8 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
} }
String avmPath = (String)avmVersionPath[1]; String avmPath = (String)avmVersionPath[1];
// Invoke policy behavior. // Invoke policy behavior.
invokeBeforeUpdateNode(parentRef); // invokeBeforeUpdateNode(parentRef);
invokeBeforeCreateNode(parentRef, assocTypeQName, assocQName, nodeTypeQName); // invokeBeforeCreateNode(parentRef, assocTypeQName, assocQName, nodeTypeQName);
// Look up the type definition in the dictionary. // Look up the type definition in the dictionary.
TypeDefinition nodeTypeDef = dictionaryService.getType(nodeTypeQName); TypeDefinition nodeTypeDef = dictionaryService.getType(nodeTypeQName);
// Do the creates for supported types, or error out. // Do the creates for supported types, or error out.
@@ -316,12 +316,12 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
childRef, childRef,
true, true,
-1); -1);
invokeOnCreateNode(ref); // invokeOnCreateNode(ref);
invokeOnUpdateNode(parentRef); // invokeOnUpdateNode(parentRef);
if (properties.size() != 0) // if (properties.size() != 0)
{ // {
invokeOnUpdateProperties(childRef, new HashMap<QName, Serializable>(), properties); // invokeOnUpdateProperties(childRef, new HashMap<QName, Serializable>(), properties);
} // }
return ref; return ref;
} }
@@ -390,20 +390,20 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
String dstParent = (String)dst[1]; String dstParent = (String)dst[1];
String dstName = assocQName.getLocalName(); String dstName = assocQName.getLocalName();
// TODO Invoke policy behavior. Not quite sure how to translate this. // TODO Invoke policy behavior. Not quite sure how to translate this.
NodeRef oldParentRef = AVMNodeConverter.ToNodeRef(-1, srcParent); // NodeRef oldParentRef = AVMNodeConverter.ToNodeRef(-1, srcParent);
ChildAssociationRef oldAssocRef = // ChildAssociationRef oldAssocRef =
new ChildAssociationRef(assocTypeQName, // new ChildAssociationRef(assocTypeQName,
oldParentRef, // oldParentRef,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, srcName), // QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, srcName),
nodeToMoveRef, // nodeToMoveRef,
true, // true,
-1); // -1);
invokeBeforeDeleteChildAssociation(oldAssocRef); // invokeBeforeDeleteChildAssociation(oldAssocRef);
String dstPath = AVMNodeConverter.ExtendAVMPath(dstParent, dstName); String dstPath = AVMNodeConverter.ExtendAVMPath(dstParent, dstName);
NodeRef newChildRef = AVMNodeConverter.ToNodeRef(-1, dstPath); NodeRef newChildRef = AVMNodeConverter.ToNodeRef(-1, dstPath);
invokeBeforeCreateChildAssociation(newParentRef, newChildRef, assocTypeQName, assocQName); // invokeBeforeCreateChildAssociation(newParentRef, newChildRef, assocTypeQName, assocQName);
invokeBeforeUpdateNode(oldParentRef); // invokeBeforeUpdateNode(oldParentRef);
invokeBeforeUpdateNode(newParentRef); // invokeBeforeUpdateNode(newParentRef);
// Actually perform the rename and return a pseudo // Actually perform the rename and return a pseudo
// ChildAssociationRef. // ChildAssociationRef.
try try
@@ -416,10 +416,10 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
newChildRef, newChildRef,
true, true,
-1); -1);
invokeOnCreateChildAssociation(newAssocRef); // invokeOnCreateChildAssociation(newAssocRef);
invokeOnDeleteChildAssociation(oldAssocRef); // invokeOnDeleteChildAssociation(oldAssocRef);
invokeOnUpdateNode(oldParentRef); // invokeOnUpdateNode(oldParentRef);
invokeOnUpdateNode(newParentRef); // invokeOnUpdateNode(newParentRef);
return newAssocRef; return newAssocRef;
} }
catch (AVMNotFoundException e) catch (AVMNotFoundException e)
@@ -537,8 +537,8 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
aspectTypeQName); aspectTypeQName);
} }
// Invoke policy behaviors. // Invoke policy behaviors.
invokeBeforeUpdateNode(nodeRef); // invokeBeforeUpdateNode(nodeRef);
invokeBeforeAddAspect(nodeRef, aspectTypeQName); // invokeBeforeAddAspect(nodeRef, aspectTypeQName);
// Crack the nodeRef. // Crack the nodeRef.
Object [] avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef); Object [] avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
int version = (Integer)avmVersionPath[0]; int version = (Integer)avmVersionPath[0];
@@ -569,8 +569,8 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
{ {
fAVMService.addAspect(avmPath, aspectTypeQName); fAVMService.addAspect(avmPath, aspectTypeQName);
// Invoke policy behaviors. // Invoke policy behaviors.
invokeOnUpdateNode(nodeRef); // invokeOnUpdateNode(nodeRef);
invokeOnAddAspect(nodeRef, aspectTypeQName); // invokeOnAddAspect(nodeRef, aspectTypeQName);
} }
catch (AVMNotFoundException e) catch (AVMNotFoundException e)
{ {
@@ -593,10 +593,10 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
// add all the aspects (and there dependent aspects recursively). // add all the aspects (and there dependent aspects recursively).
for (AspectDefinition def : defaultAspectDefs) for (AspectDefinition def : defaultAspectDefs)
{ {
invokeBeforeAddAspect(nodeRef, def.getName()); // invokeBeforeAddAspect(nodeRef, def.getName());
addAspect(nodeRef, def.getName(), Collections.<QName, Serializable>emptyMap()); addAspect(nodeRef, def.getName(), Collections.<QName, Serializable>emptyMap());
addDefaultPropertyValues(def, properties); addDefaultPropertyValues(def, properties);
invokeOnAddAspect(nodeRef, def.getName()); // invokeOnAddAspect(nodeRef, def.getName());
// recurse // recurse
addDefaultAspects(def, path, properties); addDefaultAspects(def, path, properties);
} }
@@ -615,8 +615,8 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
throws InvalidNodeRefException, InvalidAspectException throws InvalidNodeRefException, InvalidAspectException
{ {
// Invoke policy behaviors. // Invoke policy behaviors.
invokeBeforeUpdateNode(nodeRef); // invokeBeforeUpdateNode(nodeRef);
invokeBeforeRemoveAspect(nodeRef, aspectTypeQName); // invokeBeforeRemoveAspect(nodeRef, aspectTypeQName);
AspectDefinition def = dictionaryService.getAspect(aspectTypeQName); AspectDefinition def = dictionaryService.getAspect(aspectTypeQName);
if (def == null) if (def == null)
{ {
@@ -646,8 +646,8 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
} }
} }
// Invoke policy behaviors. // Invoke policy behaviors.
invokeOnUpdateNode(nodeRef); // invokeOnUpdateNode(nodeRef);
invokeOnRemoveAspect(nodeRef, aspectTypeQName); // invokeOnRemoveAspect(nodeRef, aspectTypeQName);
} }
catch (AVMNotFoundException e) catch (AVMNotFoundException e)
{ {
@@ -746,7 +746,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
public void deleteNode(NodeRef nodeRef) throws InvalidNodeRefException public void deleteNode(NodeRef nodeRef) throws InvalidNodeRefException
{ {
// Invoke policy behaviors. // Invoke policy behaviors.
invokeBeforeDeleteNode(nodeRef); // invokeBeforeDeleteNode(nodeRef);
Object [] avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef); Object [] avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
if ((Integer)avmVersionPath[0] != -1) if ((Integer)avmVersionPath[0] != -1)
{ {
@@ -759,16 +759,16 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
} }
try try
{ {
QName nodeTypeQName = getType(nodeRef); // QName nodeTypeQName = getType(nodeRef);
Set<QName> aspects = getAspects(nodeRef); // Set<QName> aspects = getAspects(nodeRef);
fAVMService.removeNode(avmPathBase[0], avmPathBase[1]); fAVMService.removeNode(avmPathBase[0], avmPathBase[1]);
ChildAssociationRef childAssocRef = // ChildAssociationRef childAssocRef =
new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, // new ChildAssociationRef(ContentModel.ASSOC_CHILDREN,
AVMNodeConverter.ToNodeRef(-1, avmPathBase[0]), // AVMNodeConverter.ToNodeRef(-1, avmPathBase[0]),
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, // QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
avmPathBase[1]), // avmPathBase[1]),
nodeRef); // nodeRef);
invokeOnDeleteNode(childAssocRef, nodeTypeQName, aspects, false); // invokeOnDeleteNode(childAssocRef, nodeTypeQName, aspects, false);
} }
catch (AVMNotFoundException e) catch (AVMNotFoundException e)
{ {
@@ -832,16 +832,16 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
} }
try try
{ {
ChildAssociationRef assocRef = // ChildAssociationRef assocRef =
new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, // new ChildAssociationRef(ContentModel.ASSOC_CHILDREN,
AVMNodeConverter.ToNodeRef(-1, parentPath), // AVMNodeConverter.ToNodeRef(-1, parentPath),
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, // QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
childPathBase[1]), // childPathBase[1]),
AVMNodeConverter.ToNodeRef(-1, childPath)); // AVMNodeConverter.ToNodeRef(-1, childPath));
invokeBeforeDeleteChildAssociation(assocRef); // invokeBeforeDeleteChildAssociation(assocRef);
fAVMService.removeNode(childPathBase[0], childPathBase[1]); fAVMService.removeNode(childPathBase[0], childPathBase[1]);
invokeOnDeleteChildAssociation(assocRef); // invokeOnDeleteChildAssociation(assocRef);
invokeOnUpdateNode(AVMNodeConverter.ToNodeRef(-1, parentPath)); // invokeOnUpdateNode(AVMNodeConverter.ToNodeRef(-1, parentPath));
} }
catch (AVMNotFoundException e) catch (AVMNotFoundException e)
{ {
@@ -1062,8 +1062,8 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
try try
{ {
// Invoke policy behaviors. // Invoke policy behaviors.
invokeBeforeUpdateNode(nodeRef); // invokeBeforeUpdateNode(nodeRef);
Map<QName, Serializable> oldProps = getProperties(nodeRef); // Map<QName, Serializable> oldProps = getProperties(nodeRef);
fAVMService.deleteNodeProperties((String)avmVersionPath[1]); fAVMService.deleteNodeProperties((String)avmVersionPath[1]);
Map<QName, PropertyValue> values = new HashMap<QName, PropertyValue>(); Map<QName, PropertyValue> values = new HashMap<QName, PropertyValue>();
for (QName qName : properties.keySet()) for (QName qName : properties.keySet())
@@ -1089,8 +1089,8 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
} }
fAVMService.setNodeProperties((String)avmVersionPath[1], values); fAVMService.setNodeProperties((String)avmVersionPath[1], values);
// Invoke policy behaviors. // Invoke policy behaviors.
invokeOnUpdateNode(nodeRef); // invokeOnUpdateNode(nodeRef);
invokeOnUpdateProperties(nodeRef, oldProps, properties); // invokeOnUpdateProperties(nodeRef, oldProps, properties);
} }
catch (AVMNotFoundException e) catch (AVMNotFoundException e)
{ {
@@ -1147,7 +1147,7 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
public void setProperty(NodeRef nodeRef, QName qname, Serializable value) throws InvalidNodeRefException public void setProperty(NodeRef nodeRef, QName qname, Serializable value) throws InvalidNodeRefException
{ {
// Invoke policy behaviors. // Invoke policy behaviors.
invokeBeforeUpdateNode(nodeRef); // invokeBeforeUpdateNode(nodeRef);
Object [] avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef); Object [] avmVersionPath = AVMNodeConverter.ToAVMVersionPath(nodeRef);
if ((Integer)avmVersionPath[0] >= 0) if ((Integer)avmVersionPath[0] >= 0)
{ {
@@ -1170,12 +1170,12 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
} }
try try
{ {
Map<QName, Serializable> propsBefore = getProperties(nodeRef); // Map<QName, Serializable> propsBefore = getProperties(nodeRef);
fAVMService.setNodeProperty((String)avmVersionPath[1], qname, new PropertyValue(null, value)); fAVMService.setNodeProperty((String)avmVersionPath[1], qname, new PropertyValue(null, value));
Map<QName, Serializable> propsAfter = getProperties(nodeRef); // Map<QName, Serializable> propsAfter = getProperties(nodeRef);
// Invoke policy behaviors. // Invoke policy behaviors.
invokeOnUpdateNode(nodeRef); // invokeOnUpdateNode(nodeRef);
invokeOnUpdateProperties(nodeRef, propsBefore, propsAfter); // invokeOnUpdateProperties(nodeRef, propsBefore, propsAfter);
} }
catch (AVMNotFoundException e) catch (AVMNotFoundException e)
{ {