diff --git a/config/alfresco/avm-services-context.xml b/config/alfresco/avm-services-context.xml
index d597028a3a..8ac5b08c7b 100644
--- a/config/alfresco/avm-services-context.xml
+++ b/config/alfresco/avm-services-context.xml
@@ -7,7 +7,7 @@
+ depends-on="avmDAOs" init-method="init">
node
@@ -17,7 +17,7 @@
+ depends-on="avmDAOs" init-method="init">
layer
@@ -90,7 +90,7 @@
-
+
@@ -123,6 +123,8 @@
+
+
diff --git a/source/java/org/alfresco/repo/avm/AVMContext.java b/source/java/org/alfresco/repo/avm/AVMContext.java
deleted file mode 100644
index 355b61f6f0..0000000000
--- a/source/java/org/alfresco/repo/avm/AVMContext.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/**
- *
- */
-package org.alfresco.repo.avm;
-
-import org.alfresco.repo.content.ContentStore;
-import org.alfresco.repo.security.authentication.AuthenticationComponent;
-import org.alfresco.service.cmr.avm.AVMService;
-import org.alfresco.service.cmr.dictionary.DictionaryService;
-import org.alfresco.service.cmr.repository.ContentService;
-import org.alfresco.service.cmr.repository.MimetypeService;
-import org.alfresco.service.cmr.repository.NodeService;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-/**
- * This is the (shudder) global context for AVM. It a rendezvous
- * point for access to needed global instances.
- * @author britt
- */
-public class AVMContext implements ApplicationContextAware
-{
- /**
- * The single instance of an AVMContext.
- */
- public static AVMContext fgInstance;
-
- AVMContext()
- {
- fgInstance = this;
- }
-
- /**
- * The IssuerDAO.
- */
- public IssuerDAO fIssuerDAO;
-
- /**
- * The AVMNodeDAO.
- */
- public AVMNodeDAO fAVMNodeDAO;
-
- /**
- * The AVMStore DAO.
- */
- public AVMStoreDAO fAVMStoreDAO;
-
- /**
- * The VersionRootDAO.
- */
- public VersionRootDAO fVersionRootDAO;
-
- /**
- * The ChildEntryDAO.
- */
- public ChildEntryDAO fChildEntryDAO;
-
- /**
- * The HistoryLinkDAO.
- */
- public HistoryLinkDAO fHistoryLinkDAO;
-
- /**
- * The MergeLinkDAO.
- */
- public MergeLinkDAO fMergeLinkDAO;
-
- /**
- * The AVMNodePropertyDAO
- */
- public AVMNodePropertyDAO fAVMNodePropertyDAO;
-
- /**
- * The AVMStorePropertyDAO
- */
- public AVMStorePropertyDAO fAVMStorePropertyDAO;
-
- /**
- * The AVMAspectNameDAO
- */
- public AVMAspectNameDAO fAVMAspectNameDAO;
-
- /**
- * The ContentService.
- */
- private ContentService fContentService;
-
- /**
- * The Mimetype Service.
- */
- private MimetypeService fMimetypeService;
-
- /**
- * The AVMService.
- */
- private AVMService fAVMService;
-
- /**
- * The Content Store.
- */
- private ContentStore fContentStore;
-
- /**
- * The DictionaryService
- */
- private DictionaryService fDictionaryService;
-
- /**
- * The Node Service.
- */
- private NodeService fNodeService;
-
- private AuthenticationComponent fAuthenticationComponent;
-
- /**
- * The application context.
- */
- public ApplicationContext fAppContext;
-
- public void setApplicationContext(ApplicationContext context)
- {
- fAppContext = context;
- }
-
- /**
- * @param nodeDAO the fAVMNodeDAO to set
- */
- public void setNodeDAO(AVMNodeDAO nodeDAO)
- {
- fAVMNodeDAO = nodeDAO;
- }
-
- /**
- * @param childEntryDAO the fChildEntryDAO to set
- */
- public void setChildEntryDAO(ChildEntryDAO childEntryDAO)
- {
- fChildEntryDAO = childEntryDAO;
- }
-
- /**
- * @param historyLinkDAO the fHistoryLinkDAO to set
- */
- public void setHistoryLinkDAO(HistoryLinkDAO historyLinkDAO)
- {
- fHistoryLinkDAO = historyLinkDAO;
- }
-
- /**
- * @param mergeLinkDAO the fMergeLinkDAO to set
- */
- public void setMergeLinkDAO(MergeLinkDAO mergeLinkDAO)
- {
- fMergeLinkDAO = mergeLinkDAO;
- }
-
- /**
- * @param aVMStoreDAO The fAVMStoreDAO to set
- */
- public void setAvmStoreDAO(AVMStoreDAO aVMStoreDAO)
- {
- fAVMStoreDAO = aVMStoreDAO;
- }
-
- /**
- * @param versionRootDAO the fVersionRootDAO to set
- */
- public void setVersionRootDAO(VersionRootDAO versionRootDAO)
- {
- fVersionRootDAO = versionRootDAO;
- }
-
- /**
- * @param issuerDAO the fIssuerDAO to set
- */
- public void setIssuerDAO(IssuerDAO issuerDAO)
- {
- fIssuerDAO = issuerDAO;
- }
-
- public void setAvmNodePropertyDAO(AVMNodePropertyDAO avmNodePropertyDAO)
- {
- fAVMNodePropertyDAO = avmNodePropertyDAO;
- }
-
- public void setAvmStorePropertyDAO(AVMStorePropertyDAO avmStorePropertyDAO)
- {
- fAVMStorePropertyDAO = avmStorePropertyDAO;
- }
-
- public void setAvmAspectNameDAO(AVMAspectNameDAO avmAspectNameDAO)
- {
- fAVMAspectNameDAO = avmAspectNameDAO;
- }
-
- /**
- * Get the Content Service.
- * @return The ContentService object.
- */
- public ContentService getContentService()
- {
- if (fContentService == null)
- {
- fContentService = (ContentService)fAppContext.getBean("contentService");
- }
- return fContentService;
- }
-
- /**
- * Get the mime type service.
- * @return The mime type service.
- */
- public MimetypeService getMimetypeService()
- {
- if (fMimetypeService == null)
- {
- fMimetypeService = (MimetypeService)fAppContext.getBean("mimetypeService");
- }
- return fMimetypeService;
- }
-
- /**
- * Get the AVM Service.
- * @return The AVMService instance.
- */
- public AVMService getAVMService()
- {
- if (fAVMService == null)
- {
- fAVMService = (AVMService)fAppContext.getBean("avmService");
- }
- return fAVMService;
- }
-
- /**
- * Get the ContentStore.
- * @return The content store.
- */
- public ContentStore getContentStore()
- {
- if (fContentStore == null)
- {
- fContentStore = (ContentStore)fAppContext.getBean("fileContentStore");
- }
- return fContentStore;
- }
-
- /**
- * Get the DictionaryService.
- * @return The dictionary service.
- */
- public DictionaryService getDictionaryService()
- {
- if (fDictionaryService == null)
- {
- // TODO Should this be DictionaryService or dictionaryService.
- fDictionaryService = (DictionaryService)fAppContext.getBean("dictionaryService");
- }
- return fDictionaryService;
- }
-
- /**
- * Get the NodeService
- * @return The Node service.
- */
- public NodeService getNodeService()
- {
- if (fNodeService == null)
- {
- fNodeService = (NodeService)fAppContext.getBean("nodeService");
- }
- return fNodeService;
- }
-
- public AuthenticationComponent getAuthenticationComponent()
- {
- if (fAuthenticationComponent == null)
- {
- fAuthenticationComponent = (AuthenticationComponent)fAppContext.getBean("authenticationComponentImpl");
- }
- return fAuthenticationComponent;
- }
-}
diff --git a/source/java/org/alfresco/repo/avm/AVMDAOs.java b/source/java/org/alfresco/repo/avm/AVMDAOs.java
new file mode 100644
index 0000000000..13f611b67a
--- /dev/null
+++ b/source/java/org/alfresco/repo/avm/AVMDAOs.java
@@ -0,0 +1,152 @@
+/**
+ *
+ */
+package org.alfresco.repo.avm;
+
+/**
+ * This is the (shudder) global context for AVM. It a rendezvous
+ * point for access to needed global instances.
+ * @author britt
+ */
+public class AVMDAOs
+{
+ /**
+ * The single instance of an AVMContext.
+ */
+ private static AVMDAOs fgInstance;
+
+ AVMDAOs()
+ {
+ fgInstance = this;
+ }
+
+ /**
+ * Get the instance of this.
+ * @return
+ */
+ public static AVMDAOs Instance()
+ {
+ return fgInstance;
+ }
+
+ /**
+ * The IssuerDAO.
+ */
+ public IssuerDAO fIssuerDAO;
+
+ /**
+ * The AVMNodeDAO.
+ */
+ public AVMNodeDAO fAVMNodeDAO;
+
+ /**
+ * The AVMStore DAO.
+ */
+ public AVMStoreDAO fAVMStoreDAO;
+
+ /**
+ * The VersionRootDAO.
+ */
+ public VersionRootDAO fVersionRootDAO;
+
+ /**
+ * The ChildEntryDAO.
+ */
+ public ChildEntryDAO fChildEntryDAO;
+
+ /**
+ * The HistoryLinkDAO.
+ */
+ public HistoryLinkDAO fHistoryLinkDAO;
+
+ /**
+ * The MergeLinkDAO.
+ */
+ public MergeLinkDAO fMergeLinkDAO;
+
+ /**
+ * The AVMNodePropertyDAO
+ */
+ public AVMNodePropertyDAO fAVMNodePropertyDAO;
+
+ /**
+ * The AVMStorePropertyDAO
+ */
+ public AVMStorePropertyDAO fAVMStorePropertyDAO;
+
+ /**
+ * The AVMAspectNameDAO
+ */
+ public AVMAspectNameDAO fAVMAspectNameDAO;
+
+ /**
+ * @param nodeDAO the fAVMNodeDAO to set
+ */
+ public void setNodeDAO(AVMNodeDAO nodeDAO)
+ {
+ fAVMNodeDAO = nodeDAO;
+ }
+
+ /**
+ * @param childEntryDAO the fChildEntryDAO to set
+ */
+ public void setChildEntryDAO(ChildEntryDAO childEntryDAO)
+ {
+ fChildEntryDAO = childEntryDAO;
+ }
+
+ /**
+ * @param historyLinkDAO the fHistoryLinkDAO to set
+ */
+ public void setHistoryLinkDAO(HistoryLinkDAO historyLinkDAO)
+ {
+ fHistoryLinkDAO = historyLinkDAO;
+ }
+
+ /**
+ * @param mergeLinkDAO the fMergeLinkDAO to set
+ */
+ public void setMergeLinkDAO(MergeLinkDAO mergeLinkDAO)
+ {
+ fMergeLinkDAO = mergeLinkDAO;
+ }
+
+ /**
+ * @param aVMStoreDAO The fAVMStoreDAO to set
+ */
+ public void setAvmStoreDAO(AVMStoreDAO aVMStoreDAO)
+ {
+ fAVMStoreDAO = aVMStoreDAO;
+ }
+
+ /**
+ * @param versionRootDAO the fVersionRootDAO to set
+ */
+ public void setVersionRootDAO(VersionRootDAO versionRootDAO)
+ {
+ fVersionRootDAO = versionRootDAO;
+ }
+
+ /**
+ * @param issuerDAO the fIssuerDAO to set
+ */
+ public void setIssuerDAO(IssuerDAO issuerDAO)
+ {
+ fIssuerDAO = issuerDAO;
+ }
+
+ public void setAvmNodePropertyDAO(AVMNodePropertyDAO avmNodePropertyDAO)
+ {
+ fAVMNodePropertyDAO = avmNodePropertyDAO;
+ }
+
+ public void setAvmStorePropertyDAO(AVMStorePropertyDAO avmStorePropertyDAO)
+ {
+ fAVMStorePropertyDAO = avmStorePropertyDAO;
+ }
+
+ public void setAvmAspectNameDAO(AVMAspectNameDAO avmAspectNameDAO)
+ {
+ fAVMAspectNameDAO = avmAspectNameDAO;
+ }
+}
diff --git a/source/java/org/alfresco/repo/avm/AVMNodeImpl.java b/source/java/org/alfresco/repo/avm/AVMNodeImpl.java
index 217185e172..9b677244d7 100644
--- a/source/java/org/alfresco/repo/avm/AVMNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/AVMNodeImpl.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.alfresco.repo.avm.util.RawServices;
import org.alfresco.repo.domain.DbAccessControlList;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.namespace.QName;
@@ -87,10 +88,10 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
fIsRoot = false;
long time = System.currentTimeMillis();
String user =
- AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName();
+ RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
if (user == null)
{
- user = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName();
+ user = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
}
fBasicAttributes = new BasicAttributesImpl(user,
user,
@@ -114,7 +115,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
HistoryLinkImpl link = new HistoryLinkImpl();
link.setAncestor(ancestor);
link.setDescendent(this);
- AVMContext.fgInstance.fHistoryLinkDAO.save(link);
+ AVMDAOs.Instance().fHistoryLinkDAO.save(link);
}
/**
@@ -123,7 +124,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
*/
public AVMNode getAncestor()
{
- return AVMContext.fgInstance.fAVMNodeDAO.getAncestor(this);
+ return AVMDAOs.Instance().fAVMNodeDAO.getAncestor(this);
}
/**
@@ -139,7 +140,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
MergeLinkImpl link = new MergeLinkImpl();
link.setMfrom(mergedFrom);
link.setMto(this);
- AVMContext.fgInstance.fMergeLinkDAO.save(link);
+ AVMDAOs.Instance().fMergeLinkDAO.save(link);
}
/**
@@ -148,7 +149,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
*/
public AVMNode getMergedFrom()
{
- return AVMContext.fgInstance.fAVMNodeDAO.getMergedFrom(this);
+ return AVMDAOs.Instance().fAVMNodeDAO.getMergedFrom(this);
}
/**
@@ -284,10 +285,10 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
public void updateModTime()
{
String user =
- AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName();
+ RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
if (user == null)
{
- user = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName();
+ user = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
}
fBasicAttributes.setModDate(System.currentTimeMillis());
fBasicAttributes.setLastModifier(user);
@@ -306,7 +307,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
newProp.setNode(this);
newProp.setName(name);
newProp.setValue(properties.get(name));
- AVMContext.fgInstance.fAVMNodePropertyDAO.save(newProp);
+ AVMDAOs.Instance().fAVMNodePropertyDAO.save(newProp);
}
}
@@ -317,14 +318,14 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
protected void copyAspects(AVMNode other)
{
List aspects =
- AVMContext.fgInstance.fAVMAspectNameDAO.get(other);
+ AVMDAOs.Instance().fAVMAspectNameDAO.get(other);
for (AVMAspectName name : aspects)
{
AVMAspectName newName =
new AVMAspectNameImpl();
newName.setName(name.getName());
newName.setNode(this);
- AVMContext.fgInstance.fAVMAspectNameDAO.save(newName);
+ AVMDAOs.Instance().fAVMAspectNameDAO.save(newName);
}
}
@@ -355,18 +356,18 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
*/
public void setProperty(QName name, PropertyValue value)
{
- AVMNodeProperty prop = AVMContext.fgInstance.fAVMNodePropertyDAO.get(this, name);
+ AVMNodeProperty prop = AVMDAOs.Instance().fAVMNodePropertyDAO.get(this, name);
if (prop != null)
{
prop.setValue(value);
- AVMContext.fgInstance.fAVMNodePropertyDAO.update(prop);
+ AVMDAOs.Instance().fAVMNodePropertyDAO.update(prop);
return;
}
prop = new AVMNodePropertyImpl();
prop.setNode(this);
prop.setName(name);
prop.setValue(value);
- AVMContext.fgInstance.fAVMNodePropertyDAO.save(prop);
+ AVMDAOs.Instance().fAVMNodePropertyDAO.save(prop);
}
/**
@@ -388,7 +389,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
*/
public PropertyValue getProperty(QName name)
{
- AVMNodeProperty prop = AVMContext.fgInstance.fAVMNodePropertyDAO.get(this, name);
+ AVMNodeProperty prop = AVMDAOs.Instance().fAVMNodePropertyDAO.get(this, name);
if (prop == null)
{
return null;
@@ -403,7 +404,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
public Map getProperties()
{
Map retVal = new HashMap();
- List props = AVMContext.fgInstance.fAVMNodePropertyDAO.get(this);
+ List props = AVMDAOs.Instance().fAVMNodePropertyDAO.get(this);
for (AVMNodeProperty prop : props)
{
retVal.put(prop.getName(), prop.getValue());
@@ -417,7 +418,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
*/
public void deleteProperty(QName name)
{
- AVMContext.fgInstance.fAVMNodePropertyDAO.delete(this, name);
+ AVMDAOs.Instance().fAVMNodePropertyDAO.delete(this, name);
}
/**
@@ -425,7 +426,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
*/
public void deleteProperties()
{
- AVMContext.fgInstance.fAVMNodePropertyDAO.deleteAll(this);
+ AVMDAOs.Instance().fAVMNodePropertyDAO.deleteAll(this);
}
/**
diff --git a/source/java/org/alfresco/repo/avm/AVMRepository.java b/source/java/org/alfresco/repo/avm/AVMRepository.java
index 1183754cdf..5fa339d9f0 100644
--- a/source/java/org/alfresco/repo/avm/AVMRepository.java
+++ b/source/java/org/alfresco/repo/avm/AVMRepository.java
@@ -161,7 +161,7 @@ public class AVMRepository
*/
public AVMNodeDescriptor createDirectory(AVMNodeDescriptor parent, String name)
{
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(parent.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(parent.getId());
if (node == null)
{
throw new AVMNotFoundException(parent.getId() + " not found.");
@@ -562,7 +562,7 @@ public class AVMRepository
}
AVMNode root = store.getRoot();
root.setIsRoot(false);
- VersionRootDAO vrDAO = AVMContext.fgInstance.fVersionRootDAO;
+ VersionRootDAO vrDAO = AVMDAOs.Instance().fVersionRootDAO;
List vRoots = vrDAO.getAllInAVMStore(store);
for (VersionRoot vr : vRoots)
{
@@ -570,13 +570,13 @@ public class AVMRepository
node.setIsRoot(false);
vrDAO.delete(vr);
}
- List newGuys = AVMContext.fgInstance.fAVMNodeDAO.getNewInStore(store);
+ List newGuys = AVMDAOs.Instance().fAVMNodeDAO.getNewInStore(store);
for (AVMNode newGuy : newGuys)
{
newGuy.setStoreNew(null);
}
- AVMContext.fgInstance.fAVMStorePropertyDAO.delete(store);
- AVMContext.fgInstance.fAVMStoreDAO.delete(store);
+ AVMDAOs.Instance().fAVMStorePropertyDAO.delete(store);
+ AVMDAOs.Instance().fAVMStoreDAO.delete(store);
}
/**
@@ -660,7 +660,7 @@ public class AVMRepository
public SortedMap
getListingDirect(AVMNodeDescriptor dir, boolean includeDeleted)
{
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(dir.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(dir.getId());
if (node == null)
{
throw new AVMBadArgumentException("Invalid Node.");
@@ -685,7 +685,7 @@ public class AVMRepository
public SortedMap getListing(AVMNodeDescriptor dir, boolean includeDeleted)
{
fLookupCount.set(1);
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(dir.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(dir.getId());
if (node == null)
{
throw new AVMBadArgumentException("Invalid Node.");
@@ -724,7 +724,7 @@ public class AVMRepository
@SuppressWarnings("unchecked")
public List getAVMStores()
{
- List l = AVMContext.fgInstance.fAVMStoreDAO.getAll();
+ List l = AVMDAOs.Instance().fAVMStoreDAO.getAll();
List result = new ArrayList();
for (AVMStore store : l)
{
@@ -839,7 +839,7 @@ public class AVMRepository
*/
private AVMStore getAVMStoreByName(String name)
{
- return AVMContext.fgInstance.fAVMStoreDAO.getByName(name);
+ return AVMDAOs.Instance().fAVMStoreDAO.getByName(name);
}
/**
@@ -910,7 +910,7 @@ public class AVMRepository
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name, boolean includeDeleted)
{
fLookupCount.set(0);
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(dir.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(dir.getId());
if (node == null)
{
throw new AVMNotFoundException("Not found: " + dir.getId());
@@ -931,7 +931,7 @@ public class AVMRepository
*/
public List> getPaths(AVMNodeDescriptor desc)
{
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(desc.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(desc.getId());
if (node == null)
{
throw new AVMNotFoundException("Not found: " + desc.getPath());
@@ -949,7 +949,7 @@ public class AVMRepository
*/
public List> getHeadPaths(AVMNodeDescriptor desc)
{
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(desc.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(desc.getId());
if (node == null)
{
throw new AVMNotFoundException("Not found: " + desc.getPath());
@@ -967,7 +967,7 @@ public class AVMRepository
{
throw new AVMNotFoundException("Store not found: " + store);
}
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(desc.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(desc.getId());
if (node == null)
{
throw new AVMNotFoundException("Not found: " + desc.getPath());
@@ -989,20 +989,20 @@ public class AVMRepository
{
if (node.getIsRoot())
{
- AVMStore store = AVMContext.fgInstance.fAVMStoreDAO.getByRoot(node);
+ AVMStore store = AVMDAOs.Instance().fAVMStoreDAO.getByRoot(node);
if (store != null)
{
addPath(components, -1, store.getName(), paths);
return;
}
- VersionRoot vr = AVMContext.fgInstance.fVersionRootDAO.getByRoot(node);
+ VersionRoot vr = AVMDAOs.Instance().fVersionRootDAO.getByRoot(node);
if (vr != null)
{
addPath(components, vr.getVersionID(), vr.getAvmStore().getName(), paths);
}
return;
}
- List entries = AVMContext.fgInstance.fChildEntryDAO.getByChild(node);
+ List entries = AVMDAOs.Instance().fChildEntryDAO.getByChild(node);
for (ChildEntry entry : entries)
{
String name = entry.getName();
@@ -1024,7 +1024,7 @@ public class AVMRepository
{
if (node.getIsRoot())
{
- AVMStore store = AVMContext.fgInstance.fAVMStoreDAO.getByRoot(node);
+ AVMStore store = AVMDAOs.Instance().fAVMStoreDAO.getByRoot(node);
if (store != null)
{
addPath(components, -1, store.getName(), paths);
@@ -1032,7 +1032,7 @@ public class AVMRepository
}
return;
}
- List entries = AVMContext.fgInstance.fChildEntryDAO.getByChild(node);
+ List entries = AVMDAOs.Instance().fChildEntryDAO.getByChild(node);
for (ChildEntry entry : entries)
{
String name = entry.getName();
@@ -1058,7 +1058,7 @@ public class AVMRepository
addPath(components, -1, storeName, paths);
return;
}
- List entries = AVMContext.fgInstance.fChildEntryDAO.getByChild(node);
+ List entries = AVMDAOs.Instance().fChildEntryDAO.getByChild(node);
for (ChildEntry entry : entries)
{
String name = entry.getName();
@@ -1198,7 +1198,7 @@ public class AVMRepository
*/
public List getHistory(AVMNodeDescriptor desc, int count)
{
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(desc.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(desc.getId());
if (node == null)
{
throw new AVMNotFoundException("Not found.");
@@ -1408,7 +1408,7 @@ public class AVMRepository
throw new AVMNotFoundException("Store not found.");
}
List matches =
- AVMContext.fgInstance.fAVMStorePropertyDAO.queryByKeyPattern(st,
+ AVMDAOs.Instance().fAVMStorePropertyDAO.queryByKeyPattern(st,
keyPattern);
Map results = new HashMap();
for (AVMStoreProperty prop : matches)
@@ -1427,7 +1427,7 @@ public class AVMRepository
queryStoresPropertyKeys(QName keyPattern)
{
List matches =
- AVMContext.fgInstance.fAVMStorePropertyDAO.queryByKeyPattern(keyPattern);
+ AVMDAOs.Instance().fAVMStorePropertyDAO.queryByKeyPattern(keyPattern);
Map> results =
new HashMap>();
for (AVMStoreProperty prop : matches)
@@ -1493,8 +1493,8 @@ public class AVMRepository
public AVMNodeDescriptor getCommonAncestor(AVMNodeDescriptor left,
AVMNodeDescriptor right)
{
- AVMNode lNode = AVMContext.fgInstance.fAVMNodeDAO.getByID(left.getId());
- AVMNode rNode = AVMContext.fgInstance.fAVMNodeDAO.getByID(right.getId());
+ AVMNode lNode = AVMDAOs.Instance().fAVMNodeDAO.getByID(left.getId());
+ AVMNode rNode = AVMDAOs.Instance().fAVMNodeDAO.getByID(right.getId());
if (lNode == null || rNode == null)
{
throw new AVMNotFoundException("Node not found.");
@@ -1590,7 +1590,7 @@ public class AVMRepository
{
throw new AVMNotFoundException("Store not found: " + pathParts[0]);
}
- AVMNode fromNode = AVMContext.fgInstance.fAVMNodeDAO.getByID(from.getId());
+ AVMNode fromNode = AVMDAOs.Instance().fAVMNodeDAO.getByID(from.getId());
if (fromNode == null)
{
throw new AVMNotFoundException("Node not found: " + from.getPath());
@@ -1732,7 +1732,7 @@ public class AVMRepository
*/
public void link(AVMNodeDescriptor parent, String name, AVMNodeDescriptor child)
{
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(parent.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(parent.getId());
if (!(node instanceof DirectoryNode))
{
throw new AVMWrongTypeException("Not a Directory.");
@@ -1772,7 +1772,7 @@ public class AVMRepository
}
LayeredDirectoryNode dir = (LayeredDirectoryNode)node;
dir.flatten(name);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
}
/**
diff --git a/source/java/org/alfresco/repo/avm/AVMStoreImpl.java b/source/java/org/alfresco/repo/avm/AVMStoreImpl.java
index e4b846f778..784d7f2466 100644
--- a/source/java/org/alfresco/repo/avm/AVMStoreImpl.java
+++ b/source/java/org/alfresco/repo/avm/AVMStoreImpl.java
@@ -30,6 +30,7 @@ import java.util.SortedMap;
import java.util.TreeMap;
import org.alfresco.model.ContentModel;
+import org.alfresco.repo.avm.util.RawServices;
import org.alfresco.repo.domain.DbAccessControlList;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
@@ -104,11 +105,11 @@ public class AVMStoreImpl implements AVMStore, Serializable
fName = name;
fNextVersionID = 0;
fRoot = null;
- AVMContext.fgInstance.fAVMStoreDAO.save(this);
- String creator = AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName();
+ AVMDAOs.Instance().fAVMStoreDAO.save(this);
+ String creator = RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
if (creator == null)
{
- creator = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName();
+ creator = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
}
setProperty(ContentModel.PROP_CREATOR, new PropertyValue(null, creator));
setProperty(ContentModel.PROP_CREATED, new PropertyValue(null, new Date(System.currentTimeMillis())));
@@ -116,14 +117,14 @@ public class AVMStoreImpl implements AVMStore, Serializable
long time = System.currentTimeMillis();
fRoot = new PlainDirectoryNodeImpl(this);
fRoot.setIsRoot(true);
- AVMContext.fgInstance.fAVMNodeDAO.save(fRoot);
+ AVMDAOs.Instance().fAVMNodeDAO.save(fRoot);
VersionRoot versionRoot = new VersionRootImpl(this,
fRoot,
fNextVersionID,
time,
creator);
fNextVersionID++;
- AVMContext.fgInstance.fVersionRootDAO.save(versionRoot);
+ AVMDAOs.Instance().fVersionRootDAO.save(versionRoot);
}
/**
@@ -147,26 +148,26 @@ public class AVMStoreImpl implements AVMStore, Serializable
if (!fRoot.getIsNew())
{
// So we just return the most recent snapshot.
- return AVMContext.fgInstance.fVersionRootDAO.getMaxVersionID(this);
+ return AVMDAOs.Instance().fVersionRootDAO.getMaxVersionID(this);
}
// Clear out the new nodes.
- List newInRep = AVMContext.fgInstance.fAVMNodeDAO.getNewInStore(this);
+ List newInRep = AVMDAOs.Instance().fAVMNodeDAO.getNewInStore(this);
for (AVMNode newGuy : newInRep)
{
newGuy.setStoreNew(null);
}
// Make up a new version record.
- String user = AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName();
+ String user = RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
if (user == null)
{
- user = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName();
+ user = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
}
VersionRoot versionRoot = new VersionRootImpl(this,
fRoot,
fNextVersionID,
System.currentTimeMillis(),
user);
- AVMContext.fgInstance.fVersionRootDAO.save(versionRoot);
+ AVMDAOs.Instance().fVersionRootDAO.save(versionRoot);
// Increment the version id.
fNextVersionID++;
return fNextVersionID - 1;
@@ -269,7 +270,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
dir.putChild(name, file);
dir.updateModTime();
file.setContentData(new ContentData(null,
- AVMContext.fgInstance.getMimetypeService().guessMimetype(name),
+ RawServices.Instance().getMimetypeService().guessMimetype(name),
-1,
"UTF-8"));
ContentWriter writer = getWriter(AVMNodeConverter.ExtendAVMPath(path, name));
@@ -299,7 +300,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
dir.putChild(name, file);
dir.updateModTime();
file.setContentData(new ContentData(null,
- AVMContext.fgInstance.getMimetypeService().guessMimetype(name),
+ RawServices.Instance().getMimetypeService().guessMimetype(name),
-1,
"UTF-8"));
ContentWriter writer = getWriter(AVMNodeConverter.ExtendAVMPath(path, name));
@@ -359,7 +360,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
private ContentReader getReader(int version, String path)
{
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(version, fName + ":" + path);
- return AVMContext.fgInstance.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT);
+ return RawServices.Instance().getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT);
}
/**
@@ -371,7 +372,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, fName + ":" + path);
ContentWriter writer =
- AVMContext.fgInstance.getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
+ RawServices.Instance().getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
return writer;
}
@@ -518,7 +519,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
@SuppressWarnings("unchecked")
public List getVersions()
{
- List versions = AVMContext.fgInstance.fVersionRootDAO.getAllInAVMStore(this);
+ List versions = AVMDAOs.Instance().fVersionRootDAO.getAllInAVMStore(this);
List descs = new ArrayList();
for (VersionRoot vr : versions)
{
@@ -542,7 +543,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
@SuppressWarnings("unchecked")
public List getVersions(Date from, Date to)
{
- List versions = AVMContext.fgInstance.fVersionRootDAO.getByDates(this, from, to);
+ List versions = AVMDAOs.Instance().fVersionRootDAO.getByDates(this, from, to);
List descs = new ArrayList();
for (VersionRoot vr : versions)
{
@@ -598,7 +599,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
}
else
{
- dir = AVMContext.fgInstance.fAVMNodeDAO.getAVMStoreRoot(this, version);
+ dir = AVMDAOs.Instance().fAVMNodeDAO.getAVMStoreRoot(this, version);
}
// Add an entry for the root.
result.add(dir, "", write);
@@ -650,7 +651,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
}
else
{
- root = AVMContext.fgInstance.fAVMNodeDAO.getAVMStoreRoot(this, version);
+ root = AVMDAOs.Instance().fAVMNodeDAO.getAVMStoreRoot(this, version);
}
return root.getDescriptor("main:", "", null);
}
@@ -863,22 +864,22 @@ public class AVMStoreImpl implements AVMStore, Serializable
{
throw new AVMBadArgumentException("Cannot purge initial version");
}
- VersionRoot vRoot = AVMContext.fgInstance.fVersionRootDAO.getByVersionID(this, version);
+ VersionRoot vRoot = AVMDAOs.Instance().fVersionRootDAO.getByVersionID(this, version);
if (vRoot == null)
{
throw new AVMNotFoundException("Version not found.");
}
AVMNode root = vRoot.getRoot();
root.setIsRoot(false);
- AVMContext.fgInstance.fAVMNodeDAO.update(root);
- AVMContext.fgInstance.fVersionRootDAO.delete(vRoot);
+ AVMDAOs.Instance().fAVMNodeDAO.update(root);
+ AVMDAOs.Instance().fVersionRootDAO.delete(vRoot);
if (root.equals(fRoot))
{
// We have to set a new current root.
// TODO More hibernate goofiness to compensate for: fSuper.getSession().flush();
- vRoot = AVMContext.fgInstance.fVersionRootDAO.getMaxVersion(this);
+ vRoot = AVMDAOs.Instance().fVersionRootDAO.getMaxVersion(this);
fRoot = vRoot.getRoot();
- AVMContext.fgInstance.fAVMStoreDAO.update(this);
+ AVMDAOs.Instance().fAVMStoreDAO.update(this);
}
}
@@ -1026,7 +1027,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
prop.setStore(this);
prop.setName(name);
prop.setValue(value);
- AVMContext.fgInstance.fAVMStorePropertyDAO.save(prop);
+ AVMDAOs.Instance().fAVMStorePropertyDAO.save(prop);
}
/**
@@ -1048,7 +1049,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
*/
public PropertyValue getProperty(QName name)
{
- AVMStoreProperty prop = AVMContext.fgInstance.fAVMStorePropertyDAO.get(this, name);
+ AVMStoreProperty prop = AVMDAOs.Instance().fAVMStorePropertyDAO.get(this, name);
if (prop == null)
{
return null;
@@ -1063,7 +1064,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
public Map getProperties()
{
List props =
- AVMContext.fgInstance.fAVMStorePropertyDAO.get(this);
+ AVMDAOs.Instance().fAVMStorePropertyDAO.get(this);
Map retVal = new HashMap();
for (AVMStoreProperty prop : props)
{
@@ -1078,7 +1079,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
*/
public void deleteProperty(QName name)
{
- AVMContext.fgInstance.fAVMStorePropertyDAO.delete(this, name);
+ AVMDAOs.Instance().fAVMStorePropertyDAO.delete(this, name);
}
/**
@@ -1172,7 +1173,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path not found.");
}
AVMNode node = lPath.getCurrentNode();
- if (AVMContext.fgInstance.fAVMAspectNameDAO.exists(node, aspectName))
+ if (AVMDAOs.Instance().fAVMAspectNameDAO.exists(node, aspectName))
{
throw new AVMExistsException("Aspect exists.");
}
@@ -1180,7 +1181,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
new AVMAspectNameImpl();
newName.setNode(node);
newName.setName(aspectName);
- AVMContext.fgInstance.fAVMAspectNameDAO.save(newName);
+ AVMDAOs.Instance().fAVMAspectNameDAO.save(newName);
}
/**
@@ -1198,7 +1199,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
}
AVMNode node = lPath.getCurrentNode();
List names =
- AVMContext.fgInstance.fAVMAspectNameDAO.get(node);
+ AVMDAOs.Instance().fAVMAspectNameDAO.get(node);
ArrayList result = new ArrayList();
for (AVMAspectName name : names)
{
@@ -1220,13 +1221,13 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path not found.");
}
AVMNode node = lPath.getCurrentNode();
- AVMContext.fgInstance.fAVMAspectNameDAO.delete(node, aspectName);
- AspectDefinition def = AVMContext.fgInstance.getDictionaryService().getAspect(aspectName);
+ AVMDAOs.Instance().fAVMAspectNameDAO.delete(node, aspectName);
+ AspectDefinition def = RawServices.Instance().getDictionaryService().getAspect(aspectName);
Map properties =
def.getProperties();
for (QName name : properties.keySet())
{
- AVMContext.fgInstance.fAVMNodePropertyDAO.delete(node, name);
+ AVMDAOs.Instance().fAVMNodePropertyDAO.delete(node, name);
}
}
@@ -1245,7 +1246,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
throw new AVMNotFoundException("Path not found.");
}
AVMNode node = lPath.getCurrentNode();
- return AVMContext.fgInstance.fAVMAspectNameDAO.exists(node, aspectName);
+ return AVMDAOs.Instance().fAVMAspectNameDAO.exists(node, aspectName);
}
/**
diff --git a/source/java/org/alfresco/repo/avm/DirectoryNodeImpl.java b/source/java/org/alfresco/repo/avm/DirectoryNodeImpl.java
index 4f47d8efb8..9594465e35 100644
--- a/source/java/org/alfresco/repo/avm/DirectoryNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/DirectoryNodeImpl.java
@@ -52,7 +52,7 @@ abstract class DirectoryNodeImpl extends AVMNodeImpl implements DirectoryNode
*/
public void link(String name, AVMNodeDescriptor toLink)
{
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(toLink.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(toLink.getId());
if (node == null)
{
throw new AVMNotFoundException("Child node not found.");
@@ -64,6 +64,6 @@ abstract class DirectoryNodeImpl extends AVMNodeImpl implements DirectoryNode
}
// Make the new ChildEntry and save.
ChildEntry newChild = new ChildEntryImpl(name, this, node);
- AVMContext.fgInstance.fChildEntryDAO.save(newChild);
+ AVMDAOs.Instance().fChildEntryDAO.save(newChild);
}
}
diff --git a/source/java/org/alfresco/repo/avm/Issuer.java b/source/java/org/alfresco/repo/avm/Issuer.java
index cbea7b217e..712ab3d24f 100644
--- a/source/java/org/alfresco/repo/avm/Issuer.java
+++ b/source/java/org/alfresco/repo/avm/Issuer.java
@@ -71,7 +71,7 @@ public class Issuer
{
public Long doWork() throws Exception
{
- return AVMContext.fgInstance.fIssuerDAO.getIssuerValue(fName);
+ return AVMDAOs.Instance().fIssuerDAO.getIssuerValue(fName);
}
}
Long result = TransactionUtil.executeInUserTransaction(fTransactionService,
diff --git a/source/java/org/alfresco/repo/avm/LayeredDirectoryNodeImpl.java b/source/java/org/alfresco/repo/avm/LayeredDirectoryNodeImpl.java
index bde9a21eb8..69d33d905c 100644
--- a/source/java/org/alfresco/repo/avm/LayeredDirectoryNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/LayeredDirectoryNodeImpl.java
@@ -81,8 +81,8 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
fIndirection = indirection;
fPrimaryIndirection = true;
fOpacity = false;
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
if (toCopy != null)
{
copyProperties(toCopy);
@@ -105,15 +105,15 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
fPrimaryIndirection = other.getPrimaryIndirection();
fLayerID = -1;
fOpacity = false;
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ for (ChildEntry child : AVMDAOs.Instance().fChildEntryDAO.getByParent(other))
{
ChildEntryImpl newChild = new ChildEntryImpl(child.getName(),
this,
child.getChild());
- AVMContext.fgInstance.fChildEntryDAO.save(newChild);
+ AVMDAOs.Instance().fChildEntryDAO.save(newChild);
}
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
copyProperties(other);
copyAspects(other);
copyACLs(other);
@@ -137,18 +137,18 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
fPrimaryIndirection = false;
fLayerID = -1;
fOpacity = false;
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
if (copyContents)
{
- for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
+ for (ChildEntry child : AVMDAOs.Instance().fChildEntryDAO.getByParent(other))
{
ChildEntryImpl newChild = new ChildEntryImpl(child.getName(),
this,
child.getChild());
- AVMContext.fgInstance.fChildEntryDAO.save(newChild);
+ AVMDAOs.Instance().fChildEntryDAO.save(newChild);
}
}
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
copyProperties(other);
copyAspects(other);
copyACLs(other);
@@ -172,8 +172,8 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
fPrimaryIndirection = true;
fLayerID = -1;
fOpacity = false;
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
copyProperties(dir);
copyAspects(dir);
copyACLs(dir);
@@ -280,17 +280,17 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
*/
public void putChild(String name, AVMNode node)
{
- ChildEntry existing = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry existing = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (existing != null)
{
existing.setChild(node);
- AVMContext.fgInstance.fChildEntryDAO.update(existing);
+ AVMDAOs.Instance().fChildEntryDAO.update(existing);
}
else
{
ChildEntry entry = new ChildEntryImpl(name, this, node);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
- AVMContext.fgInstance.fChildEntryDAO.save(entry);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fChildEntryDAO.save(entry);
}
}
@@ -302,7 +302,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
*/
public boolean directlyContains(AVMNode node)
{
- return AVMContext.fgInstance.fChildEntryDAO.getByParentChild(this, node) != null;
+ return AVMDAOs.Instance().fChildEntryDAO.getByParentChild(this, node) != null;
}
/**
@@ -333,7 +333,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
listing = new HashMap();
}
}
- for (ChildEntry entry : AVMContext.fgInstance.fChildEntryDAO.getByParent(this))
+ for (ChildEntry entry : AVMDAOs.Instance().fChildEntryDAO.getByParent(this))
{
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
{
@@ -355,7 +355,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
public Map getListingDirect(Lookup lPath, boolean includeDeleted)
{
Map listing = new HashMap();
- for (ChildEntry entry : AVMContext.fgInstance.fChildEntryDAO.getByParent(this))
+ for (ChildEntry entry : AVMDAOs.Instance().fChildEntryDAO.getByParent(this))
{
if (includeDeleted || entry.getChild().getType() != AVMNodeType.DELETED_NODE)
{
@@ -374,7 +374,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
public SortedMap getListingDirect(AVMNodeDescriptor dir,
boolean includeDeleted)
{
- List children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
+ List children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
SortedMap listing = new TreeMap();
for (ChildEntry child : children)
{
@@ -420,7 +420,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
}
}
}
- List children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
+ List children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
for (ChildEntry child : children)
{
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
@@ -444,7 +444,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
*/
public List getDeletedNames()
{
- List children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
+ List children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
List listing = new ArrayList();
for (ChildEntry entry : children)
{
@@ -468,7 +468,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
public AVMNode lookupChild(Lookup lPath, String name, int version, boolean write,
boolean includeDeleted)
{
- ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (entry != null)
{
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
@@ -509,7 +509,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
{
throw new AVMBadArgumentException("Illegal null argument.");
}
- ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (entry != null)
{
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
@@ -550,7 +550,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
@SuppressWarnings("unchecked")
public void removeChild(Lookup lPath, String name)
{
- ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
AVMNode child = null;
if (entry != null)
{
@@ -559,7 +559,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
{
return;
}
- AVMContext.fgInstance.fChildEntryDAO.delete(entry);
+ AVMDAOs.Instance().fChildEntryDAO.delete(entry);
}
else
{
@@ -567,8 +567,8 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
}
AVMNode ghost = new DeletedNodeImpl(lPath.getAVMStore().getAVMRepository().issueID(),
lPath.getAVMStore());
- AVMContext.fgInstance.fAVMNodeDAO.save(ghost);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.save(ghost);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
ghost.setAncestor(child);
this.putChild(name, ghost);
}
@@ -628,14 +628,14 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
*/
public void uncover(Lookup lPath, String name)
{
- ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (entry.getChild().getType() != AVMNodeType.DELETED_NODE)
{
throw new AVMException("One can only uncover deleted nodes.");
}
if (entry != null)
{
- AVMContext.fgInstance.fChildEntryDAO.delete(entry);
+ AVMDAOs.Instance().fChildEntryDAO.delete(entry);
}
}
@@ -787,7 +787,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
*/
public void link(Lookup lPath, String name, AVMNodeDescriptor toLink)
{
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(toLink.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(toLink.getId());
if (node == null)
{
throw new AVMNotFoundException("Not Found: " + toLink.getId());
@@ -810,14 +810,14 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
// directory do we delete it.
if (directlyContains(existing))
{
- ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
- AVMContext.fgInstance.fChildEntryDAO.delete(entry);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
+ AVMDAOs.Instance().fChildEntryDAO.delete(entry);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
}
}
// Make the new ChildEntry and save.
ChildEntry newChild = new ChildEntryImpl(name, this, node);
- AVMContext.fgInstance.fChildEntryDAO.save(newChild);
+ AVMDAOs.Instance().fChildEntryDAO.save(newChild);
}
/**
@@ -826,10 +826,10 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
*/
public void flatten(String name)
{
- ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (entry != null)
{
- AVMContext.fgInstance.fChildEntryDAO.delete(entry);
+ AVMDAOs.Instance().fChildEntryDAO.delete(entry);
}
}
}
diff --git a/source/java/org/alfresco/repo/avm/LayeredFileNodeImpl.java b/source/java/org/alfresco/repo/avm/LayeredFileNodeImpl.java
index 3385740d3c..89127489d3 100644
--- a/source/java/org/alfresco/repo/avm/LayeredFileNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/LayeredFileNodeImpl.java
@@ -51,8 +51,8 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
{
super(store.getAVMRepository().issueID(), store);
fIndirection = other.getIndirection();
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
copyProperties(other);
copyAspects(other);
copyACLs(other);
@@ -67,8 +67,8 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
{
super(store.getAVMRepository().issueID(), store);
fIndirection = indirection;
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
}
/**
@@ -94,7 +94,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
getBasicAttributes(),
getContentData(lPath),
indirect.getProperties(),
- AVMContext.fgInstance.fAVMAspectNameDAO.get(indirect),
+ AVMDAOs.Instance().fAVMAspectNameDAO.get(indirect),
indirect.getAcl());
newMe.setAncestor(this);
return newMe;
diff --git a/source/java/org/alfresco/repo/avm/Lookup.java b/source/java/org/alfresco/repo/avm/Lookup.java
index 5321dc697d..d75402d5ac 100644
--- a/source/java/org/alfresco/repo/avm/Lookup.java
+++ b/source/java/org/alfresco/repo/avm/Lookup.java
@@ -199,7 +199,7 @@ class Lookup
{
// Inform the store of a new root.
fAVMStore.setNewRoot((DirectoryNode)node);
- AVMContext.fgInstance.fAVMStoreDAO.update(fAVMStore);
+ AVMDAOs.Instance().fAVMStoreDAO.update(fAVMStore);
return;
}
// Not the root. Check if we are the top layer and insert this into it's parent.
diff --git a/source/java/org/alfresco/repo/avm/OrphanReaper.java b/source/java/org/alfresco/repo/avm/OrphanReaper.java
index e2707776da..c28daca7de 100644
--- a/source/java/org/alfresco/repo/avm/OrphanReaper.java
+++ b/source/java/org/alfresco/repo/avm/OrphanReaper.java
@@ -20,6 +20,7 @@ package org.alfresco.repo.avm;
import java.util.LinkedList;
import java.util.List;
+import org.alfresco.repo.avm.util.RawServices;
import org.alfresco.repo.domain.DbAccessControlList;
import org.alfresco.repo.transaction.TransactionUtil;
import org.alfresco.service.transaction.TransactionService;
@@ -239,7 +240,7 @@ public class OrphanReaper implements Runnable
{
if (fPurgeQueue == null)
{
- List nodes = AVMContext.fgInstance.fAVMNodeDAO.getOrphans(fQueueLength);
+ List nodes = AVMDAOs.Instance().fAVMNodeDAO.getOrphans(fQueueLength);
if (nodes.size() == 0)
{
fActive = false;
@@ -259,25 +260,25 @@ public class OrphanReaper implements Runnable
fPurgeQueue = null;
return null;
}
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(fPurgeQueue.removeFirst());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(fPurgeQueue.removeFirst());
// Save away the ancestor and merged from fields from this node.
- HistoryLink hlink = AVMContext.fgInstance.fHistoryLinkDAO.getByDescendent(node);
+ HistoryLink hlink = AVMDAOs.Instance().fHistoryLinkDAO.getByDescendent(node);
AVMNode ancestor = null;
if (hlink != null)
{
ancestor = hlink.getAncestor();
- AVMContext.fgInstance.fHistoryLinkDAO.delete(hlink);
+ AVMDAOs.Instance().fHistoryLinkDAO.delete(hlink);
}
- MergeLink mlink = AVMContext.fgInstance.fMergeLinkDAO.getByTo(node);
+ MergeLink mlink = AVMDAOs.Instance().fMergeLinkDAO.getByTo(node);
AVMNode mergedFrom = null;
if (mlink != null)
{
mergedFrom = mlink.getMfrom();
- AVMContext.fgInstance.fMergeLinkDAO.delete(mlink);
+ AVMDAOs.Instance().fMergeLinkDAO.delete(mlink);
}
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
// Get all the nodes that have this node as ancestor.
- List links = AVMContext.fgInstance.fHistoryLinkDAO.getByAncestor(node);
+ List links = AVMDAOs.Instance().fHistoryLinkDAO.getByAncestor(node);
for (HistoryLink link : links)
{
AVMNode desc = link.getDescendent();
@@ -286,19 +287,19 @@ public class OrphanReaper implements Runnable
{
desc.setMergedFrom(mergedFrom);
}
- AVMContext.fgInstance.fHistoryLinkDAO.delete(link);
+ AVMDAOs.Instance().fHistoryLinkDAO.delete(link);
}
// Get all the nodes that have this node as mergedFrom
- List mlinks = AVMContext.fgInstance.fMergeLinkDAO.getByFrom(node);
+ List mlinks = AVMDAOs.Instance().fMergeLinkDAO.getByFrom(node);
for (MergeLink link : mlinks)
{
link.getMto().setMergedFrom(ancestor);
- AVMContext.fgInstance.fMergeLinkDAO.delete(link);
+ AVMDAOs.Instance().fMergeLinkDAO.delete(link);
}
// Get rid of all properties belonging to this node.
- AVMContext.fgInstance.fAVMNodePropertyDAO.deleteAll(node);
+ AVMDAOs.Instance().fAVMNodePropertyDAO.deleteAll(node);
// Get rid of all aspects belonging to this node.
- AVMContext.fgInstance.fAVMAspectNameDAO.delete(node);
+ AVMDAOs.Instance().fAVMAspectNameDAO.delete(node);
// Get rid of ACL.
DbAccessControlList acl = node.getAcl();
node.setAcl(null);
@@ -312,7 +313,7 @@ public class OrphanReaper implements Runnable
node.getType() == AVMNodeType.LAYERED_DIRECTORY)
{
// First get rid of all child entries for the node.
- AVMContext.fgInstance.fChildEntryDAO.deleteByParent(node);
+ AVMDAOs.Instance().fChildEntryDAO.deleteByParent(node);
}
else if (node.getType() == AVMNodeType.PLAIN_FILE)
{
@@ -320,10 +321,10 @@ public class OrphanReaper implements Runnable
String url = file.getContentData(null).getContentUrl();
if (url != null)
{
- AVMContext.fgInstance.getContentStore().delete(url);
+ RawServices.Instance().getContentStore().delete(url);
}
}
- AVMContext.fgInstance.fAVMNodeDAO.delete(node);
+ AVMDAOs.Instance().fAVMNodeDAO.delete(node);
}
return null;
}
diff --git a/source/java/org/alfresco/repo/avm/PlainDirectoryNodeImpl.java b/source/java/org/alfresco/repo/avm/PlainDirectoryNodeImpl.java
index fc3d217737..d1f994beac 100644
--- a/source/java/org/alfresco/repo/avm/PlainDirectoryNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/PlainDirectoryNodeImpl.java
@@ -44,8 +44,8 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
public PlainDirectoryNodeImpl(AVMStore store)
{
super(store.getAVMRepository().issueID(), store);
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
}
/**
@@ -65,15 +65,15 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
AVMStore store)
{
super(store.getAVMRepository().issueID(), store);
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ for (ChildEntry child : AVMDAOs.Instance().fChildEntryDAO.getByParent(other))
{
ChildEntry newChild = new ChildEntryImpl(child.getName(),
this,
child.getChild());
- AVMContext.fgInstance.fChildEntryDAO.save(newChild);
+ AVMDAOs.Instance().fChildEntryDAO.save(newChild);
}
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
copyProperties(other);
copyAspects(other);
copyACLs(other);
@@ -86,7 +86,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
*/
public boolean directlyContains(AVMNode node)
{
- return AVMContext.fgInstance.fChildEntryDAO.getByParentChild(this, node) != null;
+ return AVMDAOs.Instance().fChildEntryDAO.getByParentChild(this, node) != null;
}
/**
@@ -98,7 +98,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
public Map getListing(Lookup lPath, boolean includeDeleted)
{
Map result = new HashMap();
- List children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
+ List children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
for (ChildEntry child : children)
{
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
@@ -144,7 +144,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
throw new AVMBadArgumentException("Path is null.");
}
SortedMap result = new TreeMap();
- List children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
+ List children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
for (ChildEntry child : children)
{
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
@@ -178,7 +178,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
public AVMNode lookupChild(Lookup lPath, String name, int version, boolean write,
boolean includeDeleted)
{
- ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (entry == null ||
(!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE))
{
@@ -201,7 +201,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
{
throw new AVMBadArgumentException("Path is null.");
}
- ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (entry == null ||
(!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE))
{
@@ -218,7 +218,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
@SuppressWarnings("unchecked")
public void removeChild(Lookup lPath, String name)
{
- ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (entry != null)
{
AVMNode child = entry.getChild();
@@ -228,9 +228,9 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
}
AVMNode ghost = new DeletedNodeImpl(lPath.getAVMStore().getAVMRepository().issueID(),
lPath.getAVMStore());
- AVMContext.fgInstance.fChildEntryDAO.delete(entry);
- AVMContext.fgInstance.fAVMNodeDAO.save(ghost);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fChildEntryDAO.delete(entry);
+ AVMDAOs.Instance().fAVMNodeDAO.save(ghost);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
ghost.setAncestor(child);
putChild(name, ghost);
}
@@ -243,17 +243,17 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
*/
public void putChild(String name, AVMNode node)
{
- ChildEntry existing = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry existing = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (existing != null)
{
existing.setChild(node);
- AVMContext.fgInstance.fChildEntryDAO.update(existing);
+ AVMDAOs.Instance().fChildEntryDAO.update(existing);
}
else
{
ChildEntry entry = new ChildEntryImpl(name, this, node);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
- AVMContext.fgInstance.fChildEntryDAO.save(entry);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fChildEntryDAO.save(entry);
}
}
@@ -424,7 +424,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
public void link(Lookup lPath, String name, AVMNodeDescriptor toLink)
{
// Assure that the incoming node exists.
- AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(toLink.getId());
+ AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(toLink.getId());
if (node == null)
{
throw new AVMNotFoundException("Node not found: " + toLink.getId());
@@ -435,7 +435,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
throw new AVMBadArgumentException("Non primary layered directories cannot be linked.");
}
// Check for an existing child by the given name.
- ChildEntry child = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
+ ChildEntry child = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
if (child != null)
{
if (child.getChild().getType() != AVMNodeType.DELETED_NODE)
@@ -444,13 +444,13 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
throw new AVMExistsException(name + " exists.");
}
// Get rid of the DELETED_NODE child.
- AVMContext.fgInstance.fChildEntryDAO.delete(child);
+ AVMDAOs.Instance().fChildEntryDAO.delete(child);
// Another &*#*$ flush.
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
}
// Make the new entry and save.
ChildEntry newChild = new ChildEntryImpl(name, this, node);
- AVMContext.fgInstance.fChildEntryDAO.save(newChild);
+ AVMDAOs.Instance().fChildEntryDAO.save(newChild);
}
}
diff --git a/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java b/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java
index f8442ff1b9..54744a4c9e 100644
--- a/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java
+++ b/source/java/org/alfresco/repo/avm/PlainFileNodeImpl.java
@@ -20,6 +20,7 @@ package org.alfresco.repo.avm;
import java.util.List;
import java.util.Map;
+import org.alfresco.repo.avm.util.RawServices;
import org.alfresco.repo.domain.DbAccessControlList;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.avm.AVMException;
@@ -73,8 +74,8 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
{
super(store.getAVMRepository().issueID(), store);
// AVMContext.fgInstance.fAVMNodeDAO.flush();
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
}
/**
@@ -89,8 +90,8 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
// The null is OK because the Lookup argument is only use by
// layered files.
setContentData(other.getContentData(null));
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
copyProperties(other);
copyAspects(other);
copyACLs(other);
@@ -113,8 +114,8 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
super(store.getAVMRepository().issueID(), store);
setContentData(content);
setBasicAttributes(attrs);
- AVMContext.fgInstance.fAVMNodeDAO.save(this);
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.save(this);
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
setProperties(props);
for (AVMAspectName name : aspects)
{
@@ -122,7 +123,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
new AVMAspectNameImpl();
newName.setName(name.getName());
newName.setNode(this);
- AVMContext.fgInstance.fAVMAspectNameDAO.save(newName);
+ AVMDAOs.Instance().fAVMAspectNameDAO.save(newName);
}
if (acl != null)
{
@@ -307,7 +308,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
{
return 0L;
}
- ContentReader reader = AVMContext.fgInstance.getContentStore().getReader(fContentURL);
+ ContentReader reader = RawServices.Instance().getContentStore().getReader(fContentURL);
return reader.getSize();
}
diff --git a/source/java/org/alfresco/repo/avm/actions/SimpleAVMSubmitAction.java b/source/java/org/alfresco/repo/avm/actions/SimpleAVMSubmitAction.java
index 1b954b1197..8a99c6fdf0 100644
--- a/source/java/org/alfresco/repo/avm/actions/SimpleAVMSubmitAction.java
+++ b/source/java/org/alfresco/repo/avm/actions/SimpleAVMSubmitAction.java
@@ -20,7 +20,7 @@ package org.alfresco.repo.avm.actions;
import java.util.List;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
-import org.alfresco.repo.avm.AVMContext;
+import org.alfresco.repo.avm.AVMDAOs;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.service.cmr.action.Action;
@@ -117,7 +117,7 @@ public class SimpleAVMSubmitAction extends ActionExecuterAbstractBase
// Do the update.
fAVMSyncService.update(diffs, true, true, false, false);
// Cleanup by flattening the source relative to the destination.
- AVMContext.fgInstance.fAVMNodeDAO.flush();
+ AVMDAOs.Instance().fAVMNodeDAO.flush();
fAVMSyncService.flatten(storePath[0] + ":/appBase", websiteName + "-staging:/appBase");
}
diff --git a/source/java/org/alfresco/repo/avm/util/RawServices.java b/source/java/org/alfresco/repo/avm/util/RawServices.java
new file mode 100644
index 0000000000..4fb9b79780
--- /dev/null
+++ b/source/java/org/alfresco/repo/avm/util/RawServices.java
@@ -0,0 +1,122 @@
+/**
+ *
+ */
+package org.alfresco.repo.avm.util;
+
+import org.alfresco.repo.content.ContentStore;
+import org.alfresco.repo.security.authentication.AuthenticationComponent;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
+import org.alfresco.service.cmr.repository.ContentService;
+import org.alfresco.service.cmr.repository.MimetypeService;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * Simple access to Raw versions of service singletons.
+ * @author britt
+ */
+public class RawServices implements ApplicationContextAware
+{
+ /**
+ * The instance of RawServices
+ */
+ private static RawServices fgInstance;
+
+ /**
+ * The Application Context.
+ */
+ private ApplicationContext fContext;
+
+ /**
+ * The AuthenticationComponent.
+ */
+ private AuthenticationComponent fAuthenticationComponent;
+
+ /**
+ * The Content Service.
+ */
+ private ContentService fContentService;
+
+ /**
+ * The Mimetype Service.
+ */
+ private MimetypeService fMimetypeService;
+
+ /**
+ * The Dictionary Service.
+ */
+ private DictionaryService fDictionaryService;
+
+ /**
+ * The Content Store.
+ */
+ private ContentStore fContentStore;
+
+ /**
+ * Default constructor.
+ */
+ public RawServices()
+ {
+ fgInstance = this;
+ }
+
+ public static RawServices Instance()
+ {
+ return fgInstance;
+ }
+
+ public void setApplicationContext(ApplicationContext applicationContext)
+ {
+ fContext = applicationContext;
+ }
+
+ public AuthenticationComponent getAuthenticationComponent()
+ {
+ if (fAuthenticationComponent == null)
+ {
+ fAuthenticationComponent =
+ (AuthenticationComponent)fContext.getBean("authenticationComponent");
+ }
+ return fAuthenticationComponent;
+ }
+
+ public ContentService getContentService()
+ {
+ if (fContentService == null)
+ {
+ fContentService =
+ (ContentService)fContext.getBean("contentService");
+ }
+ return fContentService;
+ }
+
+ public MimetypeService getMimetypeService()
+ {
+ if (fMimetypeService == null)
+ {
+ fMimetypeService =
+ (MimetypeService)fContext.getBean("mimetypeService");
+ }
+ return fMimetypeService;
+ }
+
+ public DictionaryService getDictionaryService()
+ {
+ if (fDictionaryService == null)
+ {
+ fDictionaryService =
+ (DictionaryService)fContext.getBean("dictionaryService");
+ }
+ return fDictionaryService;
+ }
+
+ public ContentStore getContentStore()
+ {
+ if (fContentStore == null)
+ {
+ fContentStore =
+ (ContentStore)fContext.getBean("fileContentStore");
+ }
+ return fContentStore;
+ }
+}