mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-09 17:45:10 +00:00
Reorganized AVMContext convenience class for accessing various singletons
into AVMDAOs for accessing AVM DAO singletons and RawServices for accessing uninstrumented versions of some services. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3980 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
752e46e0f1
commit
5e36db4b45
@ -7,7 +7,7 @@
|
|||||||
<!-- ID Issuers. -->
|
<!-- ID Issuers. -->
|
||||||
|
|
||||||
<bean id="nodeIssuer" class="org.alfresco.repo.avm.Issuer"
|
<bean id="nodeIssuer" class="org.alfresco.repo.avm.Issuer"
|
||||||
depends-on="avmContext" init-method="init">
|
depends-on="avmDAOs" init-method="init">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<value>node</value>
|
<value>node</value>
|
||||||
</property>
|
</property>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="layerIssuer" class="org.alfresco.repo.avm.Issuer"
|
<bean id="layerIssuer" class="org.alfresco.repo.avm.Issuer"
|
||||||
depends-on="avmContext" init-method="init">
|
depends-on="avmDAOs" init-method="init">
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<value>layer</value>
|
<value>layer</value>
|
||||||
</property>
|
</property>
|
||||||
@ -90,7 +90,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="avmContext" class="org.alfresco.repo.avm.AVMContext">
|
<bean id="avmDAOs" class="org.alfresco.repo.avm.AVMDAOs">
|
||||||
<property name="issuerDAO">
|
<property name="issuerDAO">
|
||||||
<ref bean="issuerDAO"/>
|
<ref bean="issuerDAO"/>
|
||||||
</property>
|
</property>
|
||||||
@ -123,6 +123,8 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="rawServices" class="org.alfresco.repo.avm.util.RawServices"/>
|
||||||
|
|
||||||
<bean id="orphanReaper" class="org.alfresco.repo.avm.OrphanReaper"
|
<bean id="orphanReaper" class="org.alfresco.repo.avm.OrphanReaper"
|
||||||
init-method="init" destroy-method="shutDown" depends-on="AVMService">
|
init-method="init" destroy-method="shutDown" depends-on="AVMService">
|
||||||
<property name="inactiveBaseSleep">
|
<property name="inactiveBaseSleep">
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
152
source/java/org/alfresco/repo/avm/AVMDAOs.java
Normal file
152
source/java/org/alfresco/repo/avm/AVMDAOs.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.avm.util.RawServices;
|
||||||
import org.alfresco.repo.domain.DbAccessControlList;
|
import org.alfresco.repo.domain.DbAccessControlList;
|
||||||
import org.alfresco.repo.domain.PropertyValue;
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@ -87,10 +88,10 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
|||||||
fIsRoot = false;
|
fIsRoot = false;
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
String user =
|
String user =
|
||||||
AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName();
|
RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
user = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName();
|
user = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
|
||||||
}
|
}
|
||||||
fBasicAttributes = new BasicAttributesImpl(user,
|
fBasicAttributes = new BasicAttributesImpl(user,
|
||||||
user,
|
user,
|
||||||
@ -114,7 +115,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
|||||||
HistoryLinkImpl link = new HistoryLinkImpl();
|
HistoryLinkImpl link = new HistoryLinkImpl();
|
||||||
link.setAncestor(ancestor);
|
link.setAncestor(ancestor);
|
||||||
link.setDescendent(this);
|
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()
|
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();
|
MergeLinkImpl link = new MergeLinkImpl();
|
||||||
link.setMfrom(mergedFrom);
|
link.setMfrom(mergedFrom);
|
||||||
link.setMto(this);
|
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()
|
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()
|
public void updateModTime()
|
||||||
{
|
{
|
||||||
String user =
|
String user =
|
||||||
AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName();
|
RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
user = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName();
|
user = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
|
||||||
}
|
}
|
||||||
fBasicAttributes.setModDate(System.currentTimeMillis());
|
fBasicAttributes.setModDate(System.currentTimeMillis());
|
||||||
fBasicAttributes.setLastModifier(user);
|
fBasicAttributes.setLastModifier(user);
|
||||||
@ -306,7 +307,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
|||||||
newProp.setNode(this);
|
newProp.setNode(this);
|
||||||
newProp.setName(name);
|
newProp.setName(name);
|
||||||
newProp.setValue(properties.get(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)
|
protected void copyAspects(AVMNode other)
|
||||||
{
|
{
|
||||||
List<AVMAspectName> aspects =
|
List<AVMAspectName> aspects =
|
||||||
AVMContext.fgInstance.fAVMAspectNameDAO.get(other);
|
AVMDAOs.Instance().fAVMAspectNameDAO.get(other);
|
||||||
for (AVMAspectName name : aspects)
|
for (AVMAspectName name : aspects)
|
||||||
{
|
{
|
||||||
AVMAspectName newName =
|
AVMAspectName newName =
|
||||||
new AVMAspectNameImpl();
|
new AVMAspectNameImpl();
|
||||||
newName.setName(name.getName());
|
newName.setName(name.getName());
|
||||||
newName.setNode(this);
|
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)
|
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)
|
if (prop != null)
|
||||||
{
|
{
|
||||||
prop.setValue(value);
|
prop.setValue(value);
|
||||||
AVMContext.fgInstance.fAVMNodePropertyDAO.update(prop);
|
AVMDAOs.Instance().fAVMNodePropertyDAO.update(prop);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
prop = new AVMNodePropertyImpl();
|
prop = new AVMNodePropertyImpl();
|
||||||
prop.setNode(this);
|
prop.setNode(this);
|
||||||
prop.setName(name);
|
prop.setName(name);
|
||||||
prop.setValue(value);
|
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)
|
public PropertyValue getProperty(QName name)
|
||||||
{
|
{
|
||||||
AVMNodeProperty prop = AVMContext.fgInstance.fAVMNodePropertyDAO.get(this, name);
|
AVMNodeProperty prop = AVMDAOs.Instance().fAVMNodePropertyDAO.get(this, name);
|
||||||
if (prop == null)
|
if (prop == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -403,7 +404,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
|||||||
public Map<QName, PropertyValue> getProperties()
|
public Map<QName, PropertyValue> getProperties()
|
||||||
{
|
{
|
||||||
Map<QName, PropertyValue> retVal = new HashMap<QName, PropertyValue>();
|
Map<QName, PropertyValue> retVal = new HashMap<QName, PropertyValue>();
|
||||||
List<AVMNodeProperty> props = AVMContext.fgInstance.fAVMNodePropertyDAO.get(this);
|
List<AVMNodeProperty> props = AVMDAOs.Instance().fAVMNodePropertyDAO.get(this);
|
||||||
for (AVMNodeProperty prop : props)
|
for (AVMNodeProperty prop : props)
|
||||||
{
|
{
|
||||||
retVal.put(prop.getName(), prop.getValue());
|
retVal.put(prop.getName(), prop.getValue());
|
||||||
@ -417,7 +418,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
|||||||
*/
|
*/
|
||||||
public void deleteProperty(QName name)
|
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()
|
public void deleteProperties()
|
||||||
{
|
{
|
||||||
AVMContext.fgInstance.fAVMNodePropertyDAO.deleteAll(this);
|
AVMDAOs.Instance().fAVMNodePropertyDAO.deleteAll(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +161,7 @@ public class AVMRepository
|
|||||||
*/
|
*/
|
||||||
public AVMNodeDescriptor createDirectory(AVMNodeDescriptor parent, String name)
|
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)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException(parent.getId() + " not found.");
|
throw new AVMNotFoundException(parent.getId() + " not found.");
|
||||||
@ -562,7 +562,7 @@ public class AVMRepository
|
|||||||
}
|
}
|
||||||
AVMNode root = store.getRoot();
|
AVMNode root = store.getRoot();
|
||||||
root.setIsRoot(false);
|
root.setIsRoot(false);
|
||||||
VersionRootDAO vrDAO = AVMContext.fgInstance.fVersionRootDAO;
|
VersionRootDAO vrDAO = AVMDAOs.Instance().fVersionRootDAO;
|
||||||
List<VersionRoot> vRoots = vrDAO.getAllInAVMStore(store);
|
List<VersionRoot> vRoots = vrDAO.getAllInAVMStore(store);
|
||||||
for (VersionRoot vr : vRoots)
|
for (VersionRoot vr : vRoots)
|
||||||
{
|
{
|
||||||
@ -570,13 +570,13 @@ public class AVMRepository
|
|||||||
node.setIsRoot(false);
|
node.setIsRoot(false);
|
||||||
vrDAO.delete(vr);
|
vrDAO.delete(vr);
|
||||||
}
|
}
|
||||||
List<AVMNode> newGuys = AVMContext.fgInstance.fAVMNodeDAO.getNewInStore(store);
|
List<AVMNode> newGuys = AVMDAOs.Instance().fAVMNodeDAO.getNewInStore(store);
|
||||||
for (AVMNode newGuy : newGuys)
|
for (AVMNode newGuy : newGuys)
|
||||||
{
|
{
|
||||||
newGuy.setStoreNew(null);
|
newGuy.setStoreNew(null);
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fAVMStorePropertyDAO.delete(store);
|
AVMDAOs.Instance().fAVMStorePropertyDAO.delete(store);
|
||||||
AVMContext.fgInstance.fAVMStoreDAO.delete(store);
|
AVMDAOs.Instance().fAVMStoreDAO.delete(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -660,7 +660,7 @@ public class AVMRepository
|
|||||||
public SortedMap<String, AVMNodeDescriptor>
|
public SortedMap<String, AVMNodeDescriptor>
|
||||||
getListingDirect(AVMNodeDescriptor dir, boolean includeDeleted)
|
getListingDirect(AVMNodeDescriptor dir, boolean includeDeleted)
|
||||||
{
|
{
|
||||||
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(dir.getId());
|
AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(dir.getId());
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMBadArgumentException("Invalid Node.");
|
throw new AVMBadArgumentException("Invalid Node.");
|
||||||
@ -685,7 +685,7 @@ public class AVMRepository
|
|||||||
public SortedMap<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir, boolean includeDeleted)
|
public SortedMap<String, AVMNodeDescriptor> getListing(AVMNodeDescriptor dir, boolean includeDeleted)
|
||||||
{
|
{
|
||||||
fLookupCount.set(1);
|
fLookupCount.set(1);
|
||||||
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(dir.getId());
|
AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(dir.getId());
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMBadArgumentException("Invalid Node.");
|
throw new AVMBadArgumentException("Invalid Node.");
|
||||||
@ -724,7 +724,7 @@ public class AVMRepository
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<AVMStoreDescriptor> getAVMStores()
|
public List<AVMStoreDescriptor> getAVMStores()
|
||||||
{
|
{
|
||||||
List<AVMStore> l = AVMContext.fgInstance.fAVMStoreDAO.getAll();
|
List<AVMStore> l = AVMDAOs.Instance().fAVMStoreDAO.getAll();
|
||||||
List<AVMStoreDescriptor> result = new ArrayList<AVMStoreDescriptor>();
|
List<AVMStoreDescriptor> result = new ArrayList<AVMStoreDescriptor>();
|
||||||
for (AVMStore store : l)
|
for (AVMStore store : l)
|
||||||
{
|
{
|
||||||
@ -839,7 +839,7 @@ public class AVMRepository
|
|||||||
*/
|
*/
|
||||||
private AVMStore getAVMStoreByName(String name)
|
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)
|
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name, boolean includeDeleted)
|
||||||
{
|
{
|
||||||
fLookupCount.set(0);
|
fLookupCount.set(0);
|
||||||
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(dir.getId());
|
AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(dir.getId());
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Not found: " + dir.getId());
|
throw new AVMNotFoundException("Not found: " + dir.getId());
|
||||||
@ -931,7 +931,7 @@ public class AVMRepository
|
|||||||
*/
|
*/
|
||||||
public List<Pair<Integer, String>> getPaths(AVMNodeDescriptor desc)
|
public List<Pair<Integer, String>> getPaths(AVMNodeDescriptor desc)
|
||||||
{
|
{
|
||||||
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(desc.getId());
|
AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(desc.getId());
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Not found: " + desc.getPath());
|
throw new AVMNotFoundException("Not found: " + desc.getPath());
|
||||||
@ -949,7 +949,7 @@ public class AVMRepository
|
|||||||
*/
|
*/
|
||||||
public List<Pair<Integer, String>> getHeadPaths(AVMNodeDescriptor desc)
|
public List<Pair<Integer, String>> getHeadPaths(AVMNodeDescriptor desc)
|
||||||
{
|
{
|
||||||
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(desc.getId());
|
AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(desc.getId());
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Not found: " + desc.getPath());
|
throw new AVMNotFoundException("Not found: " + desc.getPath());
|
||||||
@ -967,7 +967,7 @@ public class AVMRepository
|
|||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Store not found: " + store);
|
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)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Not found: " + desc.getPath());
|
throw new AVMNotFoundException("Not found: " + desc.getPath());
|
||||||
@ -989,20 +989,20 @@ public class AVMRepository
|
|||||||
{
|
{
|
||||||
if (node.getIsRoot())
|
if (node.getIsRoot())
|
||||||
{
|
{
|
||||||
AVMStore store = AVMContext.fgInstance.fAVMStoreDAO.getByRoot(node);
|
AVMStore store = AVMDAOs.Instance().fAVMStoreDAO.getByRoot(node);
|
||||||
if (store != null)
|
if (store != null)
|
||||||
{
|
{
|
||||||
addPath(components, -1, store.getName(), paths);
|
addPath(components, -1, store.getName(), paths);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VersionRoot vr = AVMContext.fgInstance.fVersionRootDAO.getByRoot(node);
|
VersionRoot vr = AVMDAOs.Instance().fVersionRootDAO.getByRoot(node);
|
||||||
if (vr != null)
|
if (vr != null)
|
||||||
{
|
{
|
||||||
addPath(components, vr.getVersionID(), vr.getAvmStore().getName(), paths);
|
addPath(components, vr.getVersionID(), vr.getAvmStore().getName(), paths);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<ChildEntry> entries = AVMContext.fgInstance.fChildEntryDAO.getByChild(node);
|
List<ChildEntry> entries = AVMDAOs.Instance().fChildEntryDAO.getByChild(node);
|
||||||
for (ChildEntry entry : entries)
|
for (ChildEntry entry : entries)
|
||||||
{
|
{
|
||||||
String name = entry.getName();
|
String name = entry.getName();
|
||||||
@ -1024,7 +1024,7 @@ public class AVMRepository
|
|||||||
{
|
{
|
||||||
if (node.getIsRoot())
|
if (node.getIsRoot())
|
||||||
{
|
{
|
||||||
AVMStore store = AVMContext.fgInstance.fAVMStoreDAO.getByRoot(node);
|
AVMStore store = AVMDAOs.Instance().fAVMStoreDAO.getByRoot(node);
|
||||||
if (store != null)
|
if (store != null)
|
||||||
{
|
{
|
||||||
addPath(components, -1, store.getName(), paths);
|
addPath(components, -1, store.getName(), paths);
|
||||||
@ -1032,7 +1032,7 @@ public class AVMRepository
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<ChildEntry> entries = AVMContext.fgInstance.fChildEntryDAO.getByChild(node);
|
List<ChildEntry> entries = AVMDAOs.Instance().fChildEntryDAO.getByChild(node);
|
||||||
for (ChildEntry entry : entries)
|
for (ChildEntry entry : entries)
|
||||||
{
|
{
|
||||||
String name = entry.getName();
|
String name = entry.getName();
|
||||||
@ -1058,7 +1058,7 @@ public class AVMRepository
|
|||||||
addPath(components, -1, storeName, paths);
|
addPath(components, -1, storeName, paths);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<ChildEntry> entries = AVMContext.fgInstance.fChildEntryDAO.getByChild(node);
|
List<ChildEntry> entries = AVMDAOs.Instance().fChildEntryDAO.getByChild(node);
|
||||||
for (ChildEntry entry : entries)
|
for (ChildEntry entry : entries)
|
||||||
{
|
{
|
||||||
String name = entry.getName();
|
String name = entry.getName();
|
||||||
@ -1198,7 +1198,7 @@ public class AVMRepository
|
|||||||
*/
|
*/
|
||||||
public List<AVMNodeDescriptor> getHistory(AVMNodeDescriptor desc, int count)
|
public List<AVMNodeDescriptor> getHistory(AVMNodeDescriptor desc, int count)
|
||||||
{
|
{
|
||||||
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(desc.getId());
|
AVMNode node = AVMDAOs.Instance().fAVMNodeDAO.getByID(desc.getId());
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Not found.");
|
throw new AVMNotFoundException("Not found.");
|
||||||
@ -1408,7 +1408,7 @@ public class AVMRepository
|
|||||||
throw new AVMNotFoundException("Store not found.");
|
throw new AVMNotFoundException("Store not found.");
|
||||||
}
|
}
|
||||||
List<AVMStoreProperty> matches =
|
List<AVMStoreProperty> matches =
|
||||||
AVMContext.fgInstance.fAVMStorePropertyDAO.queryByKeyPattern(st,
|
AVMDAOs.Instance().fAVMStorePropertyDAO.queryByKeyPattern(st,
|
||||||
keyPattern);
|
keyPattern);
|
||||||
Map<QName, PropertyValue> results = new HashMap<QName, PropertyValue>();
|
Map<QName, PropertyValue> results = new HashMap<QName, PropertyValue>();
|
||||||
for (AVMStoreProperty prop : matches)
|
for (AVMStoreProperty prop : matches)
|
||||||
@ -1427,7 +1427,7 @@ public class AVMRepository
|
|||||||
queryStoresPropertyKeys(QName keyPattern)
|
queryStoresPropertyKeys(QName keyPattern)
|
||||||
{
|
{
|
||||||
List<AVMStoreProperty> matches =
|
List<AVMStoreProperty> matches =
|
||||||
AVMContext.fgInstance.fAVMStorePropertyDAO.queryByKeyPattern(keyPattern);
|
AVMDAOs.Instance().fAVMStorePropertyDAO.queryByKeyPattern(keyPattern);
|
||||||
Map<String, Map<QName, PropertyValue>> results =
|
Map<String, Map<QName, PropertyValue>> results =
|
||||||
new HashMap<String, Map<QName, PropertyValue>>();
|
new HashMap<String, Map<QName, PropertyValue>>();
|
||||||
for (AVMStoreProperty prop : matches)
|
for (AVMStoreProperty prop : matches)
|
||||||
@ -1493,8 +1493,8 @@ public class AVMRepository
|
|||||||
public AVMNodeDescriptor getCommonAncestor(AVMNodeDescriptor left,
|
public AVMNodeDescriptor getCommonAncestor(AVMNodeDescriptor left,
|
||||||
AVMNodeDescriptor right)
|
AVMNodeDescriptor right)
|
||||||
{
|
{
|
||||||
AVMNode lNode = AVMContext.fgInstance.fAVMNodeDAO.getByID(left.getId());
|
AVMNode lNode = AVMDAOs.Instance().fAVMNodeDAO.getByID(left.getId());
|
||||||
AVMNode rNode = AVMContext.fgInstance.fAVMNodeDAO.getByID(right.getId());
|
AVMNode rNode = AVMDAOs.Instance().fAVMNodeDAO.getByID(right.getId());
|
||||||
if (lNode == null || rNode == null)
|
if (lNode == null || rNode == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Node not found.");
|
throw new AVMNotFoundException("Node not found.");
|
||||||
@ -1590,7 +1590,7 @@ public class AVMRepository
|
|||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Store not found: " + pathParts[0]);
|
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)
|
if (fromNode == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Node not found: " + from.getPath());
|
throw new AVMNotFoundException("Node not found: " + from.getPath());
|
||||||
@ -1732,7 +1732,7 @@ public class AVMRepository
|
|||||||
*/
|
*/
|
||||||
public void link(AVMNodeDescriptor parent, String name, AVMNodeDescriptor child)
|
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))
|
if (!(node instanceof DirectoryNode))
|
||||||
{
|
{
|
||||||
throw new AVMWrongTypeException("Not a Directory.");
|
throw new AVMWrongTypeException("Not a Directory.");
|
||||||
@ -1772,7 +1772,7 @@ public class AVMRepository
|
|||||||
}
|
}
|
||||||
LayeredDirectoryNode dir = (LayeredDirectoryNode)node;
|
LayeredDirectoryNode dir = (LayeredDirectoryNode)node;
|
||||||
dir.flatten(name);
|
dir.flatten(name);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,6 +30,7 @@ import java.util.SortedMap;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.avm.util.RawServices;
|
||||||
import org.alfresco.repo.domain.DbAccessControlList;
|
import org.alfresco.repo.domain.DbAccessControlList;
|
||||||
import org.alfresco.repo.domain.PropertyValue;
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
|
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
|
||||||
@ -104,11 +105,11 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
fName = name;
|
fName = name;
|
||||||
fNextVersionID = 0;
|
fNextVersionID = 0;
|
||||||
fRoot = null;
|
fRoot = null;
|
||||||
AVMContext.fgInstance.fAVMStoreDAO.save(this);
|
AVMDAOs.Instance().fAVMStoreDAO.save(this);
|
||||||
String creator = AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName();
|
String creator = RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
|
||||||
if (creator == null)
|
if (creator == null)
|
||||||
{
|
{
|
||||||
creator = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName();
|
creator = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
|
||||||
}
|
}
|
||||||
setProperty(ContentModel.PROP_CREATOR, new PropertyValue(null, creator));
|
setProperty(ContentModel.PROP_CREATOR, new PropertyValue(null, creator));
|
||||||
setProperty(ContentModel.PROP_CREATED, new PropertyValue(null, new Date(System.currentTimeMillis())));
|
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();
|
long time = System.currentTimeMillis();
|
||||||
fRoot = new PlainDirectoryNodeImpl(this);
|
fRoot = new PlainDirectoryNodeImpl(this);
|
||||||
fRoot.setIsRoot(true);
|
fRoot.setIsRoot(true);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(fRoot);
|
AVMDAOs.Instance().fAVMNodeDAO.save(fRoot);
|
||||||
VersionRoot versionRoot = new VersionRootImpl(this,
|
VersionRoot versionRoot = new VersionRootImpl(this,
|
||||||
fRoot,
|
fRoot,
|
||||||
fNextVersionID,
|
fNextVersionID,
|
||||||
time,
|
time,
|
||||||
creator);
|
creator);
|
||||||
fNextVersionID++;
|
fNextVersionID++;
|
||||||
AVMContext.fgInstance.fVersionRootDAO.save(versionRoot);
|
AVMDAOs.Instance().fVersionRootDAO.save(versionRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,26 +148,26 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
if (!fRoot.getIsNew())
|
if (!fRoot.getIsNew())
|
||||||
{
|
{
|
||||||
// So we just return the most recent snapshot.
|
// 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.
|
// Clear out the new nodes.
|
||||||
List<AVMNode> newInRep = AVMContext.fgInstance.fAVMNodeDAO.getNewInStore(this);
|
List<AVMNode> newInRep = AVMDAOs.Instance().fAVMNodeDAO.getNewInStore(this);
|
||||||
for (AVMNode newGuy : newInRep)
|
for (AVMNode newGuy : newInRep)
|
||||||
{
|
{
|
||||||
newGuy.setStoreNew(null);
|
newGuy.setStoreNew(null);
|
||||||
}
|
}
|
||||||
// Make up a new version record.
|
// Make up a new version record.
|
||||||
String user = AVMContext.fgInstance.getAuthenticationComponent().getCurrentUserName();
|
String user = RawServices.Instance().getAuthenticationComponent().getCurrentUserName();
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
user = AVMContext.fgInstance.getAuthenticationComponent().getSystemUserName();
|
user = RawServices.Instance().getAuthenticationComponent().getSystemUserName();
|
||||||
}
|
}
|
||||||
VersionRoot versionRoot = new VersionRootImpl(this,
|
VersionRoot versionRoot = new VersionRootImpl(this,
|
||||||
fRoot,
|
fRoot,
|
||||||
fNextVersionID,
|
fNextVersionID,
|
||||||
System.currentTimeMillis(),
|
System.currentTimeMillis(),
|
||||||
user);
|
user);
|
||||||
AVMContext.fgInstance.fVersionRootDAO.save(versionRoot);
|
AVMDAOs.Instance().fVersionRootDAO.save(versionRoot);
|
||||||
// Increment the version id.
|
// Increment the version id.
|
||||||
fNextVersionID++;
|
fNextVersionID++;
|
||||||
return fNextVersionID - 1;
|
return fNextVersionID - 1;
|
||||||
@ -269,7 +270,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
dir.putChild(name, file);
|
dir.putChild(name, file);
|
||||||
dir.updateModTime();
|
dir.updateModTime();
|
||||||
file.setContentData(new ContentData(null,
|
file.setContentData(new ContentData(null,
|
||||||
AVMContext.fgInstance.getMimetypeService().guessMimetype(name),
|
RawServices.Instance().getMimetypeService().guessMimetype(name),
|
||||||
-1,
|
-1,
|
||||||
"UTF-8"));
|
"UTF-8"));
|
||||||
ContentWriter writer = getWriter(AVMNodeConverter.ExtendAVMPath(path, name));
|
ContentWriter writer = getWriter(AVMNodeConverter.ExtendAVMPath(path, name));
|
||||||
@ -299,7 +300,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
dir.putChild(name, file);
|
dir.putChild(name, file);
|
||||||
dir.updateModTime();
|
dir.updateModTime();
|
||||||
file.setContentData(new ContentData(null,
|
file.setContentData(new ContentData(null,
|
||||||
AVMContext.fgInstance.getMimetypeService().guessMimetype(name),
|
RawServices.Instance().getMimetypeService().guessMimetype(name),
|
||||||
-1,
|
-1,
|
||||||
"UTF-8"));
|
"UTF-8"));
|
||||||
ContentWriter writer = getWriter(AVMNodeConverter.ExtendAVMPath(path, name));
|
ContentWriter writer = getWriter(AVMNodeConverter.ExtendAVMPath(path, name));
|
||||||
@ -359,7 +360,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
private ContentReader getReader(int version, String path)
|
private ContentReader getReader(int version, String path)
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(version, fName + ":" + 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);
|
NodeRef nodeRef = AVMNodeConverter.ToNodeRef(-1, fName + ":" + path);
|
||||||
ContentWriter writer =
|
ContentWriter writer =
|
||||||
AVMContext.fgInstance.getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
|
RawServices.Instance().getContentService().getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
|
||||||
return writer;
|
return writer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,7 +519,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<VersionDescriptor> getVersions()
|
public List<VersionDescriptor> getVersions()
|
||||||
{
|
{
|
||||||
List<VersionRoot> versions = AVMContext.fgInstance.fVersionRootDAO.getAllInAVMStore(this);
|
List<VersionRoot> versions = AVMDAOs.Instance().fVersionRootDAO.getAllInAVMStore(this);
|
||||||
List<VersionDescriptor> descs = new ArrayList<VersionDescriptor>();
|
List<VersionDescriptor> descs = new ArrayList<VersionDescriptor>();
|
||||||
for (VersionRoot vr : versions)
|
for (VersionRoot vr : versions)
|
||||||
{
|
{
|
||||||
@ -542,7 +543,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<VersionDescriptor> getVersions(Date from, Date to)
|
public List<VersionDescriptor> getVersions(Date from, Date to)
|
||||||
{
|
{
|
||||||
List<VersionRoot> versions = AVMContext.fgInstance.fVersionRootDAO.getByDates(this, from, to);
|
List<VersionRoot> versions = AVMDAOs.Instance().fVersionRootDAO.getByDates(this, from, to);
|
||||||
List<VersionDescriptor> descs = new ArrayList<VersionDescriptor>();
|
List<VersionDescriptor> descs = new ArrayList<VersionDescriptor>();
|
||||||
for (VersionRoot vr : versions)
|
for (VersionRoot vr : versions)
|
||||||
{
|
{
|
||||||
@ -598,7 +599,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dir = AVMContext.fgInstance.fAVMNodeDAO.getAVMStoreRoot(this, version);
|
dir = AVMDAOs.Instance().fAVMNodeDAO.getAVMStoreRoot(this, version);
|
||||||
}
|
}
|
||||||
// Add an entry for the root.
|
// Add an entry for the root.
|
||||||
result.add(dir, "", write);
|
result.add(dir, "", write);
|
||||||
@ -650,7 +651,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
root = AVMContext.fgInstance.fAVMNodeDAO.getAVMStoreRoot(this, version);
|
root = AVMDAOs.Instance().fAVMNodeDAO.getAVMStoreRoot(this, version);
|
||||||
}
|
}
|
||||||
return root.getDescriptor("main:", "", null);
|
return root.getDescriptor("main:", "", null);
|
||||||
}
|
}
|
||||||
@ -863,22 +864,22 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
{
|
{
|
||||||
throw new AVMBadArgumentException("Cannot purge initial version");
|
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)
|
if (vRoot == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Version not found.");
|
throw new AVMNotFoundException("Version not found.");
|
||||||
}
|
}
|
||||||
AVMNode root = vRoot.getRoot();
|
AVMNode root = vRoot.getRoot();
|
||||||
root.setIsRoot(false);
|
root.setIsRoot(false);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.update(root);
|
AVMDAOs.Instance().fAVMNodeDAO.update(root);
|
||||||
AVMContext.fgInstance.fVersionRootDAO.delete(vRoot);
|
AVMDAOs.Instance().fVersionRootDAO.delete(vRoot);
|
||||||
if (root.equals(fRoot))
|
if (root.equals(fRoot))
|
||||||
{
|
{
|
||||||
// We have to set a new current root.
|
// We have to set a new current root.
|
||||||
// TODO More hibernate goofiness to compensate for: fSuper.getSession().flush();
|
// 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();
|
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.setStore(this);
|
||||||
prop.setName(name);
|
prop.setName(name);
|
||||||
prop.setValue(value);
|
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)
|
public PropertyValue getProperty(QName name)
|
||||||
{
|
{
|
||||||
AVMStoreProperty prop = AVMContext.fgInstance.fAVMStorePropertyDAO.get(this, name);
|
AVMStoreProperty prop = AVMDAOs.Instance().fAVMStorePropertyDAO.get(this, name);
|
||||||
if (prop == null)
|
if (prop == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@ -1063,7 +1064,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
public Map<QName, PropertyValue> getProperties()
|
public Map<QName, PropertyValue> getProperties()
|
||||||
{
|
{
|
||||||
List<AVMStoreProperty> props =
|
List<AVMStoreProperty> props =
|
||||||
AVMContext.fgInstance.fAVMStorePropertyDAO.get(this);
|
AVMDAOs.Instance().fAVMStorePropertyDAO.get(this);
|
||||||
Map<QName, PropertyValue> retVal = new HashMap<QName, PropertyValue>();
|
Map<QName, PropertyValue> retVal = new HashMap<QName, PropertyValue>();
|
||||||
for (AVMStoreProperty prop : props)
|
for (AVMStoreProperty prop : props)
|
||||||
{
|
{
|
||||||
@ -1078,7 +1079,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
*/
|
*/
|
||||||
public void deleteProperty(QName name)
|
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.");
|
throw new AVMNotFoundException("Path not found.");
|
||||||
}
|
}
|
||||||
AVMNode node = lPath.getCurrentNode();
|
AVMNode node = lPath.getCurrentNode();
|
||||||
if (AVMContext.fgInstance.fAVMAspectNameDAO.exists(node, aspectName))
|
if (AVMDAOs.Instance().fAVMAspectNameDAO.exists(node, aspectName))
|
||||||
{
|
{
|
||||||
throw new AVMExistsException("Aspect exists.");
|
throw new AVMExistsException("Aspect exists.");
|
||||||
}
|
}
|
||||||
@ -1180,7 +1181,7 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
new AVMAspectNameImpl();
|
new AVMAspectNameImpl();
|
||||||
newName.setNode(node);
|
newName.setNode(node);
|
||||||
newName.setName(aspectName);
|
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();
|
AVMNode node = lPath.getCurrentNode();
|
||||||
List<AVMAspectName> names =
|
List<AVMAspectName> names =
|
||||||
AVMContext.fgInstance.fAVMAspectNameDAO.get(node);
|
AVMDAOs.Instance().fAVMAspectNameDAO.get(node);
|
||||||
ArrayList<QName> result = new ArrayList<QName>();
|
ArrayList<QName> result = new ArrayList<QName>();
|
||||||
for (AVMAspectName name : names)
|
for (AVMAspectName name : names)
|
||||||
{
|
{
|
||||||
@ -1220,13 +1221,13 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
|||||||
throw new AVMNotFoundException("Path not found.");
|
throw new AVMNotFoundException("Path not found.");
|
||||||
}
|
}
|
||||||
AVMNode node = lPath.getCurrentNode();
|
AVMNode node = lPath.getCurrentNode();
|
||||||
AVMContext.fgInstance.fAVMAspectNameDAO.delete(node, aspectName);
|
AVMDAOs.Instance().fAVMAspectNameDAO.delete(node, aspectName);
|
||||||
AspectDefinition def = AVMContext.fgInstance.getDictionaryService().getAspect(aspectName);
|
AspectDefinition def = RawServices.Instance().getDictionaryService().getAspect(aspectName);
|
||||||
Map<QName, PropertyDefinition> properties =
|
Map<QName, PropertyDefinition> properties =
|
||||||
def.getProperties();
|
def.getProperties();
|
||||||
for (QName name : properties.keySet())
|
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.");
|
throw new AVMNotFoundException("Path not found.");
|
||||||
}
|
}
|
||||||
AVMNode node = lPath.getCurrentNode();
|
AVMNode node = lPath.getCurrentNode();
|
||||||
return AVMContext.fgInstance.fAVMAspectNameDAO.exists(node, aspectName);
|
return AVMDAOs.Instance().fAVMAspectNameDAO.exists(node, aspectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +52,7 @@ abstract class DirectoryNodeImpl extends AVMNodeImpl implements DirectoryNode
|
|||||||
*/
|
*/
|
||||||
public void link(String name, AVMNodeDescriptor toLink)
|
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)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Child node not found.");
|
throw new AVMNotFoundException("Child node not found.");
|
||||||
@ -64,6 +64,6 @@ abstract class DirectoryNodeImpl extends AVMNodeImpl implements DirectoryNode
|
|||||||
}
|
}
|
||||||
// Make the new ChildEntry and save.
|
// Make the new ChildEntry and save.
|
||||||
ChildEntry newChild = new ChildEntryImpl(name, this, node);
|
ChildEntry newChild = new ChildEntryImpl(name, this, node);
|
||||||
AVMContext.fgInstance.fChildEntryDAO.save(newChild);
|
AVMDAOs.Instance().fChildEntryDAO.save(newChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class Issuer
|
|||||||
{
|
{
|
||||||
public Long doWork() throws Exception
|
public Long doWork() throws Exception
|
||||||
{
|
{
|
||||||
return AVMContext.fgInstance.fIssuerDAO.getIssuerValue(fName);
|
return AVMDAOs.Instance().fIssuerDAO.getIssuerValue(fName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Long result = TransactionUtil.executeInUserTransaction(fTransactionService,
|
Long result = TransactionUtil.executeInUserTransaction(fTransactionService,
|
||||||
|
@ -81,8 +81,8 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
fIndirection = indirection;
|
fIndirection = indirection;
|
||||||
fPrimaryIndirection = true;
|
fPrimaryIndirection = true;
|
||||||
fOpacity = false;
|
fOpacity = false;
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
if (toCopy != null)
|
if (toCopy != null)
|
||||||
{
|
{
|
||||||
copyProperties(toCopy);
|
copyProperties(toCopy);
|
||||||
@ -105,15 +105,15 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
fPrimaryIndirection = other.getPrimaryIndirection();
|
fPrimaryIndirection = other.getPrimaryIndirection();
|
||||||
fLayerID = -1;
|
fLayerID = -1;
|
||||||
fOpacity = false;
|
fOpacity = false;
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
|
for (ChildEntry child : AVMDAOs.Instance().fChildEntryDAO.getByParent(other))
|
||||||
{
|
{
|
||||||
ChildEntryImpl newChild = new ChildEntryImpl(child.getName(),
|
ChildEntryImpl newChild = new ChildEntryImpl(child.getName(),
|
||||||
this,
|
this,
|
||||||
child.getChild());
|
child.getChild());
|
||||||
AVMContext.fgInstance.fChildEntryDAO.save(newChild);
|
AVMDAOs.Instance().fChildEntryDAO.save(newChild);
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
copyAspects(other);
|
copyAspects(other);
|
||||||
copyACLs(other);
|
copyACLs(other);
|
||||||
@ -137,18 +137,18 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
fPrimaryIndirection = false;
|
fPrimaryIndirection = false;
|
||||||
fLayerID = -1;
|
fLayerID = -1;
|
||||||
fOpacity = false;
|
fOpacity = false;
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
if (copyContents)
|
if (copyContents)
|
||||||
{
|
{
|
||||||
for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
|
for (ChildEntry child : AVMDAOs.Instance().fChildEntryDAO.getByParent(other))
|
||||||
{
|
{
|
||||||
ChildEntryImpl newChild = new ChildEntryImpl(child.getName(),
|
ChildEntryImpl newChild = new ChildEntryImpl(child.getName(),
|
||||||
this,
|
this,
|
||||||
child.getChild());
|
child.getChild());
|
||||||
AVMContext.fgInstance.fChildEntryDAO.save(newChild);
|
AVMDAOs.Instance().fChildEntryDAO.save(newChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
copyAspects(other);
|
copyAspects(other);
|
||||||
copyACLs(other);
|
copyACLs(other);
|
||||||
@ -172,8 +172,8 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
fPrimaryIndirection = true;
|
fPrimaryIndirection = true;
|
||||||
fLayerID = -1;
|
fLayerID = -1;
|
||||||
fOpacity = false;
|
fOpacity = false;
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
copyProperties(dir);
|
copyProperties(dir);
|
||||||
copyAspects(dir);
|
copyAspects(dir);
|
||||||
copyACLs(dir);
|
copyACLs(dir);
|
||||||
@ -280,17 +280,17 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
*/
|
*/
|
||||||
public void putChild(String name, AVMNode node)
|
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)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
existing.setChild(node);
|
existing.setChild(node);
|
||||||
AVMContext.fgInstance.fChildEntryDAO.update(existing);
|
AVMDAOs.Instance().fChildEntryDAO.update(existing);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ChildEntry entry = new ChildEntryImpl(name, this, node);
|
ChildEntry entry = new ChildEntryImpl(name, this, node);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fChildEntryDAO.save(entry);
|
AVMDAOs.Instance().fChildEntryDAO.save(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
*/
|
*/
|
||||||
public boolean directlyContains(AVMNode node)
|
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<String, AVMNode>();
|
listing = new HashMap<String, AVMNode>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ChildEntry entry : AVMContext.fgInstance.fChildEntryDAO.getByParent(this))
|
for (ChildEntry entry : AVMDAOs.Instance().fChildEntryDAO.getByParent(this))
|
||||||
{
|
{
|
||||||
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
|
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
|
||||||
{
|
{
|
||||||
@ -355,7 +355,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
public Map<String, AVMNode> getListingDirect(Lookup lPath, boolean includeDeleted)
|
public Map<String, AVMNode> getListingDirect(Lookup lPath, boolean includeDeleted)
|
||||||
{
|
{
|
||||||
Map<String, AVMNode> listing = new HashMap<String, AVMNode>();
|
Map<String, AVMNode> listing = new HashMap<String, AVMNode>();
|
||||||
for (ChildEntry entry : AVMContext.fgInstance.fChildEntryDAO.getByParent(this))
|
for (ChildEntry entry : AVMDAOs.Instance().fChildEntryDAO.getByParent(this))
|
||||||
{
|
{
|
||||||
if (includeDeleted || entry.getChild().getType() != AVMNodeType.DELETED_NODE)
|
if (includeDeleted || entry.getChild().getType() != AVMNodeType.DELETED_NODE)
|
||||||
{
|
{
|
||||||
@ -374,7 +374,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
public SortedMap<String, AVMNodeDescriptor> getListingDirect(AVMNodeDescriptor dir,
|
public SortedMap<String, AVMNodeDescriptor> getListingDirect(AVMNodeDescriptor dir,
|
||||||
boolean includeDeleted)
|
boolean includeDeleted)
|
||||||
{
|
{
|
||||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
|
||||||
SortedMap<String, AVMNodeDescriptor> listing = new TreeMap<String, AVMNodeDescriptor>();
|
SortedMap<String, AVMNodeDescriptor> listing = new TreeMap<String, AVMNodeDescriptor>();
|
||||||
for (ChildEntry child : children)
|
for (ChildEntry child : children)
|
||||||
{
|
{
|
||||||
@ -420,7 +420,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
|
||||||
for (ChildEntry child : children)
|
for (ChildEntry child : children)
|
||||||
{
|
{
|
||||||
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
|
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
|
||||||
@ -444,7 +444,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
*/
|
*/
|
||||||
public List<String> getDeletedNames()
|
public List<String> getDeletedNames()
|
||||||
{
|
{
|
||||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
|
||||||
List<String> listing = new ArrayList<String>();
|
List<String> listing = new ArrayList<String>();
|
||||||
for (ChildEntry entry : children)
|
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,
|
public AVMNode lookupChild(Lookup lPath, String name, int version, boolean write,
|
||||||
boolean includeDeleted)
|
boolean includeDeleted)
|
||||||
{
|
{
|
||||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
{
|
{
|
||||||
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
|
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
|
||||||
@ -509,7 +509,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
{
|
{
|
||||||
throw new AVMBadArgumentException("Illegal null argument.");
|
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 (entry != null)
|
||||||
{
|
{
|
||||||
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
|
if (!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE)
|
||||||
@ -550,7 +550,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void removeChild(Lookup lPath, String name)
|
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;
|
AVMNode child = null;
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
{
|
{
|
||||||
@ -559,7 +559,7 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fChildEntryDAO.delete(entry);
|
AVMDAOs.Instance().fChildEntryDAO.delete(entry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -567,8 +567,8 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
}
|
}
|
||||||
AVMNode ghost = new DeletedNodeImpl(lPath.getAVMStore().getAVMRepository().issueID(),
|
AVMNode ghost = new DeletedNodeImpl(lPath.getAVMStore().getAVMRepository().issueID(),
|
||||||
lPath.getAVMStore());
|
lPath.getAVMStore());
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(ghost);
|
AVMDAOs.Instance().fAVMNodeDAO.save(ghost);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
ghost.setAncestor(child);
|
ghost.setAncestor(child);
|
||||||
this.putChild(name, ghost);
|
this.putChild(name, ghost);
|
||||||
}
|
}
|
||||||
@ -628,14 +628,14 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
*/
|
*/
|
||||||
public void uncover(Lookup lPath, String name)
|
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)
|
if (entry.getChild().getType() != AVMNodeType.DELETED_NODE)
|
||||||
{
|
{
|
||||||
throw new AVMException("One can only uncover deleted nodes.");
|
throw new AVMException("One can only uncover deleted nodes.");
|
||||||
}
|
}
|
||||||
if (entry != null)
|
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)
|
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)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Not Found: " + toLink.getId());
|
throw new AVMNotFoundException("Not Found: " + toLink.getId());
|
||||||
@ -810,14 +810,14 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
// directory do we delete it.
|
// directory do we delete it.
|
||||||
if (directlyContains(existing))
|
if (directlyContains(existing))
|
||||||
{
|
{
|
||||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
|
||||||
AVMContext.fgInstance.fChildEntryDAO.delete(entry);
|
AVMDAOs.Instance().fChildEntryDAO.delete(entry);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make the new ChildEntry and save.
|
// Make the new ChildEntry and save.
|
||||||
ChildEntry newChild = new ChildEntryImpl(name, this, node);
|
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)
|
public void flatten(String name)
|
||||||
{
|
{
|
||||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
{
|
{
|
||||||
AVMContext.fgInstance.fChildEntryDAO.delete(entry);
|
AVMDAOs.Instance().fChildEntryDAO.delete(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,8 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
|
|||||||
{
|
{
|
||||||
super(store.getAVMRepository().issueID(), store);
|
super(store.getAVMRepository().issueID(), store);
|
||||||
fIndirection = other.getIndirection();
|
fIndirection = other.getIndirection();
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
copyAspects(other);
|
copyAspects(other);
|
||||||
copyACLs(other);
|
copyACLs(other);
|
||||||
@ -67,8 +67,8 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
|
|||||||
{
|
{
|
||||||
super(store.getAVMRepository().issueID(), store);
|
super(store.getAVMRepository().issueID(), store);
|
||||||
fIndirection = indirection;
|
fIndirection = indirection;
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,7 +94,7 @@ class LayeredFileNodeImpl extends FileNodeImpl implements LayeredFileNode
|
|||||||
getBasicAttributes(),
|
getBasicAttributes(),
|
||||||
getContentData(lPath),
|
getContentData(lPath),
|
||||||
indirect.getProperties(),
|
indirect.getProperties(),
|
||||||
AVMContext.fgInstance.fAVMAspectNameDAO.get(indirect),
|
AVMDAOs.Instance().fAVMAspectNameDAO.get(indirect),
|
||||||
indirect.getAcl());
|
indirect.getAcl());
|
||||||
newMe.setAncestor(this);
|
newMe.setAncestor(this);
|
||||||
return newMe;
|
return newMe;
|
||||||
|
@ -199,7 +199,7 @@ class Lookup
|
|||||||
{
|
{
|
||||||
// Inform the store of a new root.
|
// Inform the store of a new root.
|
||||||
fAVMStore.setNewRoot((DirectoryNode)node);
|
fAVMStore.setNewRoot((DirectoryNode)node);
|
||||||
AVMContext.fgInstance.fAVMStoreDAO.update(fAVMStore);
|
AVMDAOs.Instance().fAVMStoreDAO.update(fAVMStore);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Not the root. Check if we are the top layer and insert this into it's parent.
|
// Not the root. Check if we are the top layer and insert this into it's parent.
|
||||||
|
@ -20,6 +20,7 @@ package org.alfresco.repo.avm;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.repo.avm.util.RawServices;
|
||||||
import org.alfresco.repo.domain.DbAccessControlList;
|
import org.alfresco.repo.domain.DbAccessControlList;
|
||||||
import org.alfresco.repo.transaction.TransactionUtil;
|
import org.alfresco.repo.transaction.TransactionUtil;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
@ -239,7 +240,7 @@ public class OrphanReaper implements Runnable
|
|||||||
{
|
{
|
||||||
if (fPurgeQueue == null)
|
if (fPurgeQueue == null)
|
||||||
{
|
{
|
||||||
List<AVMNode> nodes = AVMContext.fgInstance.fAVMNodeDAO.getOrphans(fQueueLength);
|
List<AVMNode> nodes = AVMDAOs.Instance().fAVMNodeDAO.getOrphans(fQueueLength);
|
||||||
if (nodes.size() == 0)
|
if (nodes.size() == 0)
|
||||||
{
|
{
|
||||||
fActive = false;
|
fActive = false;
|
||||||
@ -259,25 +260,25 @@ public class OrphanReaper implements Runnable
|
|||||||
fPurgeQueue = null;
|
fPurgeQueue = null;
|
||||||
return 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.
|
// 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;
|
AVMNode ancestor = null;
|
||||||
if (hlink != null)
|
if (hlink != null)
|
||||||
{
|
{
|
||||||
ancestor = hlink.getAncestor();
|
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;
|
AVMNode mergedFrom = null;
|
||||||
if (mlink != null)
|
if (mlink != null)
|
||||||
{
|
{
|
||||||
mergedFrom = mlink.getMfrom();
|
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.
|
// Get all the nodes that have this node as ancestor.
|
||||||
List<HistoryLink> links = AVMContext.fgInstance.fHistoryLinkDAO.getByAncestor(node);
|
List<HistoryLink> links = AVMDAOs.Instance().fHistoryLinkDAO.getByAncestor(node);
|
||||||
for (HistoryLink link : links)
|
for (HistoryLink link : links)
|
||||||
{
|
{
|
||||||
AVMNode desc = link.getDescendent();
|
AVMNode desc = link.getDescendent();
|
||||||
@ -286,19 +287,19 @@ public class OrphanReaper implements Runnable
|
|||||||
{
|
{
|
||||||
desc.setMergedFrom(mergedFrom);
|
desc.setMergedFrom(mergedFrom);
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fHistoryLinkDAO.delete(link);
|
AVMDAOs.Instance().fHistoryLinkDAO.delete(link);
|
||||||
}
|
}
|
||||||
// Get all the nodes that have this node as mergedFrom
|
// Get all the nodes that have this node as mergedFrom
|
||||||
List<MergeLink> mlinks = AVMContext.fgInstance.fMergeLinkDAO.getByFrom(node);
|
List<MergeLink> mlinks = AVMDAOs.Instance().fMergeLinkDAO.getByFrom(node);
|
||||||
for (MergeLink link : mlinks)
|
for (MergeLink link : mlinks)
|
||||||
{
|
{
|
||||||
link.getMto().setMergedFrom(ancestor);
|
link.getMto().setMergedFrom(ancestor);
|
||||||
AVMContext.fgInstance.fMergeLinkDAO.delete(link);
|
AVMDAOs.Instance().fMergeLinkDAO.delete(link);
|
||||||
}
|
}
|
||||||
// Get rid of all properties belonging to this node.
|
// 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.
|
// Get rid of all aspects belonging to this node.
|
||||||
AVMContext.fgInstance.fAVMAspectNameDAO.delete(node);
|
AVMDAOs.Instance().fAVMAspectNameDAO.delete(node);
|
||||||
// Get rid of ACL.
|
// Get rid of ACL.
|
||||||
DbAccessControlList acl = node.getAcl();
|
DbAccessControlList acl = node.getAcl();
|
||||||
node.setAcl(null);
|
node.setAcl(null);
|
||||||
@ -312,7 +313,7 @@ public class OrphanReaper implements Runnable
|
|||||||
node.getType() == AVMNodeType.LAYERED_DIRECTORY)
|
node.getType() == AVMNodeType.LAYERED_DIRECTORY)
|
||||||
{
|
{
|
||||||
// First get rid of all child entries for the node.
|
// 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)
|
else if (node.getType() == AVMNodeType.PLAIN_FILE)
|
||||||
{
|
{
|
||||||
@ -320,10 +321,10 @@ public class OrphanReaper implements Runnable
|
|||||||
String url = file.getContentData(null).getContentUrl();
|
String url = file.getContentData(null).getContentUrl();
|
||||||
if (url != null)
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
public PlainDirectoryNodeImpl(AVMStore store)
|
public PlainDirectoryNodeImpl(AVMStore store)
|
||||||
{
|
{
|
||||||
super(store.getAVMRepository().issueID(), store);
|
super(store.getAVMRepository().issueID(), store);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,15 +65,15 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
AVMStore store)
|
AVMStore store)
|
||||||
{
|
{
|
||||||
super(store.getAVMRepository().issueID(), store);
|
super(store.getAVMRepository().issueID(), store);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
for (ChildEntry child : AVMContext.fgInstance.fChildEntryDAO.getByParent(other))
|
for (ChildEntry child : AVMDAOs.Instance().fChildEntryDAO.getByParent(other))
|
||||||
{
|
{
|
||||||
ChildEntry newChild = new ChildEntryImpl(child.getName(),
|
ChildEntry newChild = new ChildEntryImpl(child.getName(),
|
||||||
this,
|
this,
|
||||||
child.getChild());
|
child.getChild());
|
||||||
AVMContext.fgInstance.fChildEntryDAO.save(newChild);
|
AVMDAOs.Instance().fChildEntryDAO.save(newChild);
|
||||||
}
|
}
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
copyAspects(other);
|
copyAspects(other);
|
||||||
copyACLs(other);
|
copyACLs(other);
|
||||||
@ -86,7 +86,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
*/
|
*/
|
||||||
public boolean directlyContains(AVMNode node)
|
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<String, AVMNode> getListing(Lookup lPath, boolean includeDeleted)
|
public Map<String, AVMNode> getListing(Lookup lPath, boolean includeDeleted)
|
||||||
{
|
{
|
||||||
Map<String, AVMNode> result = new HashMap<String, AVMNode>();
|
Map<String, AVMNode> result = new HashMap<String, AVMNode>();
|
||||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
|
||||||
for (ChildEntry child : children)
|
for (ChildEntry child : children)
|
||||||
{
|
{
|
||||||
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
|
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
|
||||||
@ -144,7 +144,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
throw new AVMBadArgumentException("Path is null.");
|
throw new AVMBadArgumentException("Path is null.");
|
||||||
}
|
}
|
||||||
SortedMap<String, AVMNodeDescriptor> result = new TreeMap<String, AVMNodeDescriptor>();
|
SortedMap<String, AVMNodeDescriptor> result = new TreeMap<String, AVMNodeDescriptor>();
|
||||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
List<ChildEntry> children = AVMDAOs.Instance().fChildEntryDAO.getByParent(this);
|
||||||
for (ChildEntry child : children)
|
for (ChildEntry child : children)
|
||||||
{
|
{
|
||||||
if (!includeDeleted && child.getChild().getType() == AVMNodeType.DELETED_NODE)
|
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,
|
public AVMNode lookupChild(Lookup lPath, String name, int version, boolean write,
|
||||||
boolean includeDeleted)
|
boolean includeDeleted)
|
||||||
{
|
{
|
||||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
ChildEntry entry = AVMDAOs.Instance().fChildEntryDAO.getByNameParent(name, this);
|
||||||
if (entry == null ||
|
if (entry == null ||
|
||||||
(!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE))
|
(!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE))
|
||||||
{
|
{
|
||||||
@ -201,7 +201,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
{
|
{
|
||||||
throw new AVMBadArgumentException("Path is null.");
|
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 ||
|
if (entry == null ||
|
||||||
(!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE))
|
(!includeDeleted && entry.getChild().getType() == AVMNodeType.DELETED_NODE))
|
||||||
{
|
{
|
||||||
@ -218,7 +218,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void removeChild(Lookup lPath, String name)
|
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)
|
if (entry != null)
|
||||||
{
|
{
|
||||||
AVMNode child = entry.getChild();
|
AVMNode child = entry.getChild();
|
||||||
@ -228,9 +228,9 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
}
|
}
|
||||||
AVMNode ghost = new DeletedNodeImpl(lPath.getAVMStore().getAVMRepository().issueID(),
|
AVMNode ghost = new DeletedNodeImpl(lPath.getAVMStore().getAVMRepository().issueID(),
|
||||||
lPath.getAVMStore());
|
lPath.getAVMStore());
|
||||||
AVMContext.fgInstance.fChildEntryDAO.delete(entry);
|
AVMDAOs.Instance().fChildEntryDAO.delete(entry);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(ghost);
|
AVMDAOs.Instance().fAVMNodeDAO.save(ghost);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
ghost.setAncestor(child);
|
ghost.setAncestor(child);
|
||||||
putChild(name, ghost);
|
putChild(name, ghost);
|
||||||
}
|
}
|
||||||
@ -243,17 +243,17 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
*/
|
*/
|
||||||
public void putChild(String name, AVMNode node)
|
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)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
existing.setChild(node);
|
existing.setChild(node);
|
||||||
AVMContext.fgInstance.fChildEntryDAO.update(existing);
|
AVMDAOs.Instance().fChildEntryDAO.update(existing);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ChildEntry entry = new ChildEntryImpl(name, this, node);
|
ChildEntry entry = new ChildEntryImpl(name, this, node);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fChildEntryDAO.save(entry);
|
AVMDAOs.Instance().fChildEntryDAO.save(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
public void link(Lookup lPath, String name, AVMNodeDescriptor toLink)
|
public void link(Lookup lPath, String name, AVMNodeDescriptor toLink)
|
||||||
{
|
{
|
||||||
// Assure that the incoming node exists.
|
// 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)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new AVMNotFoundException("Node not found: " + toLink.getId());
|
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.");
|
throw new AVMBadArgumentException("Non primary layered directories cannot be linked.");
|
||||||
}
|
}
|
||||||
// Check for an existing child by the given name.
|
// 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 != null)
|
||||||
{
|
{
|
||||||
if (child.getChild().getType() != AVMNodeType.DELETED_NODE)
|
if (child.getChild().getType() != AVMNodeType.DELETED_NODE)
|
||||||
@ -444,13 +444,13 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
|||||||
throw new AVMExistsException(name + " exists.");
|
throw new AVMExistsException(name + " exists.");
|
||||||
}
|
}
|
||||||
// Get rid of the DELETED_NODE child.
|
// Get rid of the DELETED_NODE child.
|
||||||
AVMContext.fgInstance.fChildEntryDAO.delete(child);
|
AVMDAOs.Instance().fChildEntryDAO.delete(child);
|
||||||
// Another &*#*&#$ flush.
|
// Another &*#*&#$ flush.
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
}
|
}
|
||||||
// Make the new entry and save.
|
// Make the new entry and save.
|
||||||
ChildEntry newChild = new ChildEntryImpl(name, this, node);
|
ChildEntry newChild = new ChildEntryImpl(name, this, node);
|
||||||
AVMContext.fgInstance.fChildEntryDAO.save(newChild);
|
AVMDAOs.Instance().fChildEntryDAO.save(newChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ package org.alfresco.repo.avm;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.avm.util.RawServices;
|
||||||
import org.alfresco.repo.domain.DbAccessControlList;
|
import org.alfresco.repo.domain.DbAccessControlList;
|
||||||
import org.alfresco.repo.domain.PropertyValue;
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
import org.alfresco.service.cmr.avm.AVMException;
|
import org.alfresco.service.cmr.avm.AVMException;
|
||||||
@ -73,8 +74,8 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
{
|
{
|
||||||
super(store.getAVMRepository().issueID(), store);
|
super(store.getAVMRepository().issueID(), store);
|
||||||
// AVMContext.fgInstance.fAVMNodeDAO.flush();
|
// AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
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
|
// The null is OK because the Lookup argument is only use by
|
||||||
// layered files.
|
// layered files.
|
||||||
setContentData(other.getContentData(null));
|
setContentData(other.getContentData(null));
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
copyProperties(other);
|
copyProperties(other);
|
||||||
copyAspects(other);
|
copyAspects(other);
|
||||||
copyACLs(other);
|
copyACLs(other);
|
||||||
@ -113,8 +114,8 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
super(store.getAVMRepository().issueID(), store);
|
super(store.getAVMRepository().issueID(), store);
|
||||||
setContentData(content);
|
setContentData(content);
|
||||||
setBasicAttributes(attrs);
|
setBasicAttributes(attrs);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.save(this);
|
AVMDAOs.Instance().fAVMNodeDAO.save(this);
|
||||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
setProperties(props);
|
setProperties(props);
|
||||||
for (AVMAspectName name : aspects)
|
for (AVMAspectName name : aspects)
|
||||||
{
|
{
|
||||||
@ -122,7 +123,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
new AVMAspectNameImpl();
|
new AVMAspectNameImpl();
|
||||||
newName.setName(name.getName());
|
newName.setName(name.getName());
|
||||||
newName.setNode(this);
|
newName.setNode(this);
|
||||||
AVMContext.fgInstance.fAVMAspectNameDAO.save(newName);
|
AVMDAOs.Instance().fAVMAspectNameDAO.save(newName);
|
||||||
}
|
}
|
||||||
if (acl != null)
|
if (acl != null)
|
||||||
{
|
{
|
||||||
@ -307,7 +308,7 @@ class PlainFileNodeImpl extends FileNodeImpl implements PlainFileNode
|
|||||||
{
|
{
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
ContentReader reader = AVMContext.fgInstance.getContentStore().getReader(fContentURL);
|
ContentReader reader = RawServices.Instance().getContentStore().getReader(fContentURL);
|
||||||
return reader.getSize();
|
return reader.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package org.alfresco.repo.avm.actions;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
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.avm.AVMNodeConverter;
|
||||||
import org.alfresco.repo.domain.PropertyValue;
|
import org.alfresco.repo.domain.PropertyValue;
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
@ -117,7 +117,7 @@ public class SimpleAVMSubmitAction extends ActionExecuterAbstractBase
|
|||||||
// Do the update.
|
// Do the update.
|
||||||
fAVMSyncService.update(diffs, true, true, false, false);
|
fAVMSyncService.update(diffs, true, true, false, false);
|
||||||
// Cleanup by flattening the source relative to the destination.
|
// 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");
|
fAVMSyncService.flatten(storePath[0] + ":/appBase", websiteName + "-staging:/appBase");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
122
source/java/org/alfresco/repo/avm/util/RawServices.java
Normal file
122
source/java/org/alfresco/repo/avm/util/RawServices.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user