diff --git a/config/alfresco/node-services-context.xml b/config/alfresco/node-services-context.xml
index af5fcd6233..ddc9e8539a 100644
--- a/config/alfresco/node-services-context.xml
+++ b/config/alfresco/node-services-context.xml
@@ -57,6 +57,9 @@
+
+
+
diff --git a/source/java/org/alfresco/repo/avm/AVMNodeConverter.java b/source/java/org/alfresco/repo/avm/AVMNodeConverter.java
index 4a5bf9fc43..592db678d5 100644
--- a/source/java/org/alfresco/repo/avm/AVMNodeConverter.java
+++ b/source/java/org/alfresco/repo/avm/AVMNodeConverter.java
@@ -99,6 +99,13 @@ public class AVMNodeConverter
*/
public static String [] SplitBase(String path)
{
+ if (path.endsWith(":/"))
+ {
+ String [] res = new String[2];
+ res[0] = null;
+ res[1] = "";
+ return res;
+ }
int off = path.lastIndexOf("/");
if (off == -1)
{
@@ -106,6 +113,10 @@ public class AVMNodeConverter
}
String [] decomposed = new String[2];
decomposed[0] = path.substring(0, off);
+ if (decomposed[0].endsWith(":"))
+ {
+ decomposed[0] = decomposed[0] + "/";
+ }
decomposed[1] = path.substring(off + 1);
return decomposed;
}
diff --git a/source/java/org/alfresco/repo/avm/AVMNodeService.java b/source/java/org/alfresco/repo/avm/AVMNodeService.java
index b5b480436c..81aae4efb1 100644
--- a/source/java/org/alfresco/repo/avm/AVMNodeService.java
+++ b/source/java/org/alfresco/repo/avm/AVMNodeService.java
@@ -356,7 +356,7 @@ public class AVMNodeService implements NodeService
throw new InvalidNodeRefException("Invalid src path.", nodeToMoveRef);
}
String srcParent = splitSrc[0];
- if (srcParent.endsWith(":"))
+ if (srcParent == null)
{
throw new InvalidNodeRefException("Cannot rename root node.", nodeToMoveRef);
}
@@ -549,7 +549,7 @@ public class AVMNodeService implements NodeService
throw new InvalidNodeRefException("Read only store.", nodeRef);
}
String [] avmPathBase = AVMNodeConverter.SplitBase((String)avmVersionPath[1]);
- if (avmPathBase[0].endsWith(":"))
+ if (avmPathBase[0] == null)
{
throw new InvalidNodeRefException("Cannot delete root node.", nodeRef);
}
@@ -609,7 +609,7 @@ public class AVMNodeService implements NodeService
String parentPath = (String)parentVersionPath[1];
String childPath = (String)childVersionPath[1];
String [] childPathBase = AVMNodeConverter.SplitBase(childPath);
- if (!childPathBase[0].equals(parentPath))
+ if (childPathBase[0] == null || !childPathBase[0].equals(parentPath))
{
throw new InvalidNodeRefException("Not a child.", childRef);
}
@@ -875,7 +875,10 @@ public class AVMNodeService implements NodeService
String path = (String)avmVersionPath[1];
List result = new ArrayList();
String [] splitPath = AVMNodeConverter.SplitBase(path);
- if (splitPath[0].endsWith(":"))
+ // TODO Remove when you figure this out.
+ fgLogger.error(splitPath[0]);
+ fgLogger.error(splitPath[1]);
+ if (splitPath[0] == null)
{
return result;
}
@@ -1029,7 +1032,7 @@ public class AVMNodeService implements NodeService
List parents = getParentAssocs(nodeRef);
if (parents.size() == 0)
{
- return null;
+ return new ChildAssociationRef(null, null, null, nodeRef);
}
return parents.get(0);
}
@@ -1123,6 +1126,8 @@ public class AVMNodeService implements NodeService
String [] splitPath = AVMNodeConverter.SplitBase(currPath);
String parentPath = splitPath[0];
String name = splitPath[1];
+ // TODO Remove when understood.
+ fgLogger.error("parentpath = " + parentPath);
ChildAssociationRef caRef =
new ChildAssociationRef(ContentModel.ASSOC_CONTAINS,
AVMNodeConverter.ToNodeRef(version, parentPath),
@@ -1132,7 +1137,14 @@ public class AVMNodeService implements NodeService
true,
-1);
path.prepend(new Path.ChildAssocElement(caRef));
+ currPath = parentPath;
}
+ ChildAssociationRef caRef = new ChildAssociationRef(null, null, null,
+ AVMNodeConverter.ToNodeRef(version,
+ currPath));
+ path.prepend(new Path.ChildAssocElement(caRef));
+ // TODO Get rid of this when you figure this out.
+ fgLogger.error(path);
return path;
}
diff --git a/source/java/org/alfresco/repo/avm/HibernateRetryingTransactionHelper.java b/source/java/org/alfresco/repo/avm/HibernateRetryingTransactionHelper.java
index 503b8d8cef..fd1c60db9a 100644
--- a/source/java/org/alfresco/repo/avm/HibernateRetryingTransactionHelper.java
+++ b/source/java/org/alfresco/repo/avm/HibernateRetryingTransactionHelper.java
@@ -96,12 +96,16 @@ class HibernateRetryingTransactionHelper extends HibernateTemplate implements Re
t.printStackTrace(System.err);
throw new AVMException("Unrecoverable error.", t);
}
- if (!status.isCompleted())
+ if (newTxn && !status.isCompleted())
{
fTransactionManager.rollback(status);
}
if (!newTxn)
{
+ if (t instanceof AVMException)
+ {
+ throw (AVMException)t;
+ }
throw new AVMException("Unrecoverable error.", t);
}
// If we've lost a race or we've deadlocked, retry.
diff --git a/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java b/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java
index 23224667dc..0f990fb943 100644
--- a/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java
+++ b/source/java/org/alfresco/repo/node/db/DbNodeServiceImpl.java
@@ -56,6 +56,7 @@ import org.alfresco.service.cmr.repository.InvalidChildAssociationRefException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.InvalidStoreRefException;
import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.cmr.repository.StoreExistsException;
import org.alfresco.service.cmr.repository.StoreRef;
@@ -79,6 +80,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
private DictionaryService dictionaryService;
private NodeDaoService nodeDaoService;
private StoreArchiveMap storeArchiveMap;
+ private NodeService avmNodeService;
public DbNodeServiceImpl()
{
@@ -100,6 +102,11 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
this.storeArchiveMap = storeArchiveMap;
}
+ public void setAvmNodeService(NodeService avmNodeService)
+ {
+ this.avmNodeService = avmNodeService;
+ }
+
/**
* Performs a null-safe get of the node
*
@@ -159,7 +166,10 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
{
storeRefs.add(store.getStoreRef());
}
- // done
+ // Now get the AVMStores.
+ List avmStores = avmNodeService.getStores();
+ storeRefs.addAll(avmStores);
+ // Return them all.
return storeRefs;
}