mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Remove a few uses of ServiceRegistry where dependencies on the relevant services are cleaner, and note where the ServiceRegistry really is required
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -429,6 +429,7 @@
|
||||
<property name="authorityService">
|
||||
<ref bean="authorityService"></ref>
|
||||
</property>
|
||||
<!-- The service registry is needed as TemplateNodes are used -->
|
||||
<property name="serviceRegistry">
|
||||
<ref bean="ServiceRegistry"></ref>
|
||||
</property>
|
||||
@@ -521,6 +522,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="script" class="org.alfresco.repo.action.executer.ScriptActionExecuter" parent="action-executer">
|
||||
<!-- The service registry is needed as ScriptAction needs it -->
|
||||
<property name="serviceRegistry">
|
||||
<ref bean="ServiceRegistry" />
|
||||
</property>
|
||||
@@ -565,7 +567,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- deprecated - see "wcm-submit" (wcm-services-context.xml) -->
|
||||
<!-- deprecated - see "wcm-submit" (wcm-services-context.xml) -->
|
||||
<bean id="simple-avm-submit" class="org.alfresco.repo.avm.actions.SimpleAVMSubmitAction" parent="action-executer">
|
||||
<property name="avmService">
|
||||
<ref bean="AVMService"/>
|
||||
@@ -581,7 +583,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- deprecated -->
|
||||
<!-- deprecated -->
|
||||
<bean id="start-avm-workflow" class="org.alfresco.repo.avm.actions.StartAVMWorkflowAction" parent="action-executer">
|
||||
<property name="workflowService">
|
||||
<ref bean="WorkflowService"/>
|
||||
@@ -594,7 +596,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- deprecated -->
|
||||
<!-- deprecated -->
|
||||
<bean id="simple-avm-promote" class="org.alfresco.repo.avm.actions.SimpleAVMPromoteAction" parent="action-executer">
|
||||
<property name="avmSyncService">
|
||||
<ref bean="avmSyncService"/>
|
||||
@@ -604,7 +606,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- deprecated - see "wcm-revert-snapshot" (wcm-services-context.xml) -->
|
||||
<!-- deprecated - see "wcm-revert-snapshot" (wcm-services-context.xml) -->
|
||||
<bean id="avm-revert-store" class="org.alfresco.repo.avm.actions.AVMRevertStoreAction" parent="action-executer">
|
||||
<property name="avmSyncService">
|
||||
<ref bean="avmSyncService"/>
|
||||
@@ -614,7 +616,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- deprecated -->
|
||||
<!-- deprecated -->
|
||||
<bean id="avm-revert-list" class="org.alfresco.repo.avm.actions.AVMRevertListAction" parent="action-executer">
|
||||
<property name="avmSyncService">
|
||||
<ref bean="avmSyncService"/>
|
||||
@@ -624,7 +626,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- deprecated - note: still used by Web-Client (FileDetailsBean) -->
|
||||
<!-- deprecated - note: still used by Web-Client (FileDetailsBean) -->
|
||||
<bean id="avm-revert-to-version" class="org.alfresco.repo.avm.actions.AVMRevertToVersionAction" parent = "action-executer">
|
||||
<property name="avmService">
|
||||
<ref bean="AVMLockingAwareService"/>
|
||||
@@ -634,7 +636,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- deprecated - see "wcm-undo" (wcm-services-context.xml) -->
|
||||
<!-- deprecated - see "wcm-undo" (wcm-services-context.xml) -->
|
||||
<bean id="avm-undo-list" class="org.alfresco.repo.avm.actions.AVMUndoSandboxListAction" parent="action-executer">
|
||||
<property name="avmService">
|
||||
<ref bean="AVMService"/>
|
||||
@@ -647,7 +649,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- deprecated - note: still used by Web-Client (*Deploy*) -->
|
||||
<!-- deprecated - note: still used by Web-Client (*Deploy*) -->
|
||||
<bean id="avm-deploy-website" class="org.alfresco.repo.avm.actions.AVMDeployWebsiteAction" parent="action-executer">
|
||||
|
||||
<!-- Run avm-deploy-website action on the deployment queue -->
|
||||
@@ -719,7 +721,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- deprecated -->
|
||||
<!-- deprecated -->
|
||||
<bean id="avm-link-validation" class="org.alfresco.linkvalidation.LinkValidationAction" parent="action-executer" lazy-init="true">
|
||||
<property name="linkValidationService">
|
||||
<ref bean="LinkValidationService"/>
|
||||
|
@@ -27,9 +27,10 @@ import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
@@ -56,8 +57,11 @@ public class MessageServiceImpl implements MessageService
|
||||
private Lock writeLock = lock.writeLock();
|
||||
|
||||
// dependencies
|
||||
private ServiceRegistry serviceRegistry;
|
||||
private TenantService tenantService;
|
||||
private SearchService searchService;
|
||||
private ContentService contentService;
|
||||
private NamespaceService namespaceService;
|
||||
private NodeService nodeService;
|
||||
|
||||
/**
|
||||
* List of registered bundles
|
||||
@@ -77,16 +81,29 @@ public class MessageServiceImpl implements MessageService
|
||||
|
||||
private List<MessageDeployer> messageDeployers = new ArrayList<MessageDeployer>();
|
||||
|
||||
|
||||
public void setServiceRegistry(ServiceRegistry serviceRegistry)
|
||||
public void setNamespaceService(NamespaceService namespaceService)
|
||||
{
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
public void setSearchService(SearchService searchService) {
|
||||
this.searchService = searchService;
|
||||
}
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
public void setTenantService(TenantService tenantService)
|
||||
{
|
||||
this.tenantService = tenantService;
|
||||
}
|
||||
|
||||
public void setContentService(ContentService contentService)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
}
|
||||
|
||||
public void setResourceBundleBaseNamesCache(SimpleCache<String, Set<String>> resourceBundleBaseNamesCache)
|
||||
{
|
||||
@@ -537,19 +554,16 @@ public class MessageServiceImpl implements MessageService
|
||||
// TODO - need to replace basic strategy with a more complete
|
||||
// search & instantiation strategy similar to ResourceBundle.getBundle()
|
||||
// Consider search query with basename* and then apply strategy ...
|
||||
|
||||
SearchService searchService = serviceRegistry.getSearchService();
|
||||
NamespaceService resolver = serviceRegistry.getNamespaceService();
|
||||
|
||||
NodeRef rootNode = serviceRegistry.getNodeService().getRootNode(storeRef);
|
||||
|
||||
NodeRef rootNode = nodeService.getRootNode(storeRef);
|
||||
|
||||
// first attempt - with locale
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(rootNode, path+"_"+locale+PROPERTIES_FILE_SUFFIX, null, resolver, false);
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(rootNode, path+"_"+locale+PROPERTIES_FILE_SUFFIX, null, namespaceService, false);
|
||||
|
||||
if ((nodeRefs == null) || (nodeRefs.size() == 0))
|
||||
{
|
||||
// second attempt - basename
|
||||
nodeRefs = searchService.selectNodes(rootNode, path+PROPERTIES_FILE_SUFFIX, null, resolver, false);
|
||||
nodeRefs = searchService.selectNodes(rootNode, path+PROPERTIES_FILE_SUFFIX, null, namespaceService, false);
|
||||
|
||||
if ((nodeRefs == null) || (nodeRefs.size() == 0))
|
||||
{
|
||||
@@ -566,7 +580,7 @@ public class MessageServiceImpl implements MessageService
|
||||
{
|
||||
NodeRef messageResourceNodeRef = nodeRefs.get(0);
|
||||
|
||||
ContentReader cr = serviceRegistry.getContentService().getReader(messageResourceNodeRef, ContentModel.PROP_CONTENT);
|
||||
ContentReader cr = contentService.getReader(messageResourceNodeRef, ContentModel.PROP_CONTENT);
|
||||
resBundle = new MessagePropertyResourceBundle(new InputStreamReader(cr.getContentInputStream(), cr.getEncoding()));
|
||||
}
|
||||
|
||||
|
@@ -32,10 +32,13 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransacti
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionDefinition;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
import org.mozilla.javascript.Wrapper;
|
||||
|
||||
@@ -54,12 +57,15 @@ public final class ScriptAction implements Serializable, Scopeable
|
||||
/** Converter with knowledge of action parameter values */
|
||||
private ActionValueConverter converter;
|
||||
|
||||
private ServiceRegistry services;
|
||||
|
||||
/** Action state */
|
||||
private Action action;
|
||||
|
||||
private ActionDefinition actionDef;
|
||||
|
||||
private ServiceRegistry services;
|
||||
private ActionService actionService;
|
||||
private NamespaceService namespaceService;
|
||||
private TransactionService transactionService;
|
||||
|
||||
private ScriptableParameterMap<String, Serializable> parameters = null;
|
||||
|
||||
@@ -72,6 +78,10 @@ public final class ScriptAction implements Serializable, Scopeable
|
||||
public ScriptAction(ServiceRegistry services, Action action, ActionDefinition actionDef)
|
||||
{
|
||||
this.services = services;
|
||||
this.actionService = services.getActionService();
|
||||
this.namespaceService = services.getNamespaceService();
|
||||
this.transactionService = services.getTransactionService();
|
||||
|
||||
this.action = action;
|
||||
this.actionDef = actionDef;
|
||||
this.converter = new ActionValueConverter();
|
||||
@@ -141,7 +151,7 @@ public final class ScriptAction implements Serializable, Scopeable
|
||||
actionParams.put(name, value);
|
||||
}
|
||||
}
|
||||
services.getActionService().executeAction(action, node.getNodeRef());
|
||||
actionService.executeAction(action, node.getNodeRef());
|
||||
|
||||
// Parameters may have been updated by action execution, so reset cache
|
||||
this.parameters = null;
|
||||
@@ -180,11 +190,11 @@ public final class ScriptAction implements Serializable, Scopeable
|
||||
{
|
||||
public Object execute() throws Throwable
|
||||
{
|
||||
services.getActionService().executeAction(action, node.getNodeRef());
|
||||
actionService.executeAction(action, node.getNodeRef());
|
||||
return null;
|
||||
}
|
||||
};
|
||||
services.getTransactionService().getRetryingTransactionHelper().doInTransaction(
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
executionActionCallback,
|
||||
readOnly,
|
||||
newTxn);
|
||||
@@ -218,7 +228,7 @@ public final class ScriptAction implements Serializable, Scopeable
|
||||
actionParams.put(name, value);
|
||||
}
|
||||
}
|
||||
services.getActionService().executeAction(action, nodeRef);
|
||||
actionService.executeAction(action, nodeRef);
|
||||
|
||||
// Parameters may have been updated by action execution, so reset cache
|
||||
this.parameters = null;
|
||||
@@ -254,11 +264,11 @@ public final class ScriptAction implements Serializable, Scopeable
|
||||
{
|
||||
public Object execute() throws Throwable
|
||||
{
|
||||
services.getActionService().executeAction(action, nodeRef);
|
||||
actionService.executeAction(action, nodeRef);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
services.getTransactionService().getRetryingTransactionHelper().doInTransaction(
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
executionActionCallback,
|
||||
readOnly,
|
||||
newTxn);
|
||||
@@ -289,7 +299,7 @@ public final class ScriptAction implements Serializable, Scopeable
|
||||
ParameterDefinition paramDef = actionDef.getParameterDefintion(paramName);
|
||||
if (paramDef != null && paramDef.getType().equals(DataTypeDefinition.QNAME))
|
||||
{
|
||||
return ((QName) value).toPrefixString(services.getNamespaceService());
|
||||
return ((QName) value).toPrefixString(namespaceService);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -331,7 +341,7 @@ public final class ScriptAction implements Serializable, Scopeable
|
||||
}
|
||||
else
|
||||
{
|
||||
return QName.createQName(stringQName, services.getNamespaceService());
|
||||
return QName.createQName(stringQName, namespaceService);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user