From 8ac2f6540e2ca61b1bc27bd3da88647acad5a2cf Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Tue, 30 Sep 2014 22:17:28 +0000 Subject: [PATCH] Reverse Merge HEAD (5.0/Cloud) << Appears to be cause of 7 failures in https://bamboo.alfresco.com/bamboo/browse/ALF-ENT-150 >> 86040: ACE-2173 : EOL RMI Services git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@86050 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco-global.properties.sample | 6 + config/alfresco/application-context-core.xml | 1 - .../application-context-highlevel.xml | 1 + config/alfresco/core-services-context.xml | 69 ++++- .../remote-email-service-test-context.xml | 31 ++ config/alfresco/remote-services-context.xml | 133 +++++++++ config/alfresco/repository.properties | 13 +- .../action/ActionServiceTransportImpl.java | 265 ++++++++++++++++++ .../cmr/action/ActionServiceTransport.java | 240 ++++++++++++++++ 9 files changed, 754 insertions(+), 5 deletions(-) create mode 100644 config/alfresco/remote-email-service-test-context.xml create mode 100644 config/alfresco/remote-services-context.xml create mode 100644 source/java/org/alfresco/repo/action/ActionServiceTransportImpl.java create mode 100644 source/java/org/alfresco/service/cmr/action/ActionServiceTransport.java diff --git a/config/alfresco-global.properties.sample b/config/alfresco-global.properties.sample index c2f7a96b66..e8be6393b7 100644 --- a/config/alfresco-global.properties.sample +++ b/config/alfresco-global.properties.sample @@ -149,10 +149,16 @@ alfresco.rmi.services.host=0.0.0.0 # +# RMI service ports for the individual services. +# These seven services are available remotely. # # Assign individual ports for each service for best performance # or run several services on the same port. You can even run everything on 50500 if needed. # # Select 0 to use a random unused port. # +#attribute.rmi.service.port=50503 +#authentication.rmi.service.port=50504 +#repo.rmi.service.port=50505 +#action.rmi.service.port=50506 #monitor.rmi.service.port=50508 \ No newline at end of file diff --git a/config/alfresco/application-context-core.xml b/config/alfresco/application-context-core.xml index c350107e8c..d0ba295912 100644 --- a/config/alfresco/application-context-core.xml +++ b/config/alfresco/application-context-core.xml @@ -12,7 +12,6 @@ - diff --git a/config/alfresco/application-context-highlevel.xml b/config/alfresco/application-context-highlevel.xml index 17779fc04c..a5ed3aea0f 100644 --- a/config/alfresco/application-context-highlevel.xml +++ b/config/alfresco/application-context-highlevel.xml @@ -5,6 +5,7 @@ + diff --git a/config/alfresco/core-services-context.xml b/config/alfresco/core-services-context.xml index d628b03752..502965a418 100644 --- a/config/alfresco/core-services-context.xml +++ b/config/alfresco/core-services-context.xml @@ -4,7 +4,17 @@ - + + + + + + + + + + + @@ -104,6 +114,21 @@ + + + + classpath:alfresco/alfresco-shared.properties + + + + 10 + + + false + + + @@ -116,7 +141,47 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + jmx.remote.rmi.server.socket.factory + + + + + + diff --git a/config/alfresco/remote-email-service-test-context.xml b/config/alfresco/remote-email-service-test-context.xml new file mode 100644 index 0000000000..f780f9dd0d --- /dev/null +++ b/config/alfresco/remote-email-service-test-context.xml @@ -0,0 +1,31 @@ + + + + + + + + true + + + + classpath:alfresco/remote-email-service-test.properties + + + + false + + + + + + + ${email.service.rmi.registry.host} + + + ${email.service.rmi.registry.port} + + + + diff --git a/config/alfresco/remote-services-context.xml b/config/alfresco/remote-services-context.xml new file mode 100644 index 0000000000..b4aa7171d0 --- /dev/null +++ b/config/alfresco/remote-services-context.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + org.alfresco.service.cmr.security.AuthenticationService + + + authentication + + + ${authentication.rmi.service.enabled} + + + ${authentication.rmi.service.port} + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.service.cmr.remote.RepoRemote + + + + + + + + + + ${server.transaction.mode.default} + ${server.transaction.mode.readOnly} + ${server.transaction.mode.readOnly} + ${server.transaction.mode.readOnly} + ${server.transaction.mode.default} + ${server.transaction.mode.default} + ${server.transaction.mode.default} + + + + + + + + + + + + + + 30000 + + + + + + + + + + org.alfresco.service.cmr.remote.RepoRemoteTransport + + + repo + + + ${repo.rmi.service.enabled} + + + ${repo.rmi.service.port} + + + + + + + + + + + + + + + + + + + + + + + org.alfresco.service.cmr.action.ActionServiceTransport + + + action + + + ${action.rmi.service.enabled} + + + ${action.rmi.service.port} + + + + + + diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties index a09ecfbf0d..c347119a32 100644 --- a/config/alfresco/repository.properties +++ b/config/alfresco/repository.properties @@ -584,11 +584,14 @@ home.folder.creation.disabled=false # for some clients such as Mac OS X Finder policy.content.update.ignoreEmpty=true +# The well known RMI registry port and external host name published in the stubs +# is defined in the alfresco-shared.properties file +# +# alfresco.rmi.services.port=50500 + # Default value of alfresco.rmi.services.host is 0.0.0.0 which means 'listen on all adapters'. # This allows connections to JMX both remotely and locally. # -alfresco.rmi.services.port=50500 -alfresco.rmi.services.external.host=localhost alfresco.rmi.services.host=0.0.0.0 # If the RMI address is in-use, how many retries should be done before aborting @@ -606,11 +609,17 @@ alfresco.rmi.services.retryInterval=250 # # Specify 0 to use a random unused port. # +authentication.rmi.service.port=50504 +repo.rmi.service.port=50505 +action.rmi.service.port=50506 monitor.rmi.service.port=50508 # # enable or disable individual RMI services # +authentication.rmi.service.enabled=true +repo.rmi.service.enabled=true +action.rmi.service.enabled=true monitor.rmi.service.enabled=true diff --git a/source/java/org/alfresco/repo/action/ActionServiceTransportImpl.java b/source/java/org/alfresco/repo/action/ActionServiceTransportImpl.java new file mode 100644 index 0000000000..2e2aa57622 --- /dev/null +++ b/source/java/org/alfresco/repo/action/ActionServiceTransportImpl.java @@ -0,0 +1,265 @@ +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +package org.alfresco.repo.action; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ActionCondition; +import org.alfresco.service.cmr.action.ActionConditionDefinition; +import org.alfresco.service.cmr.action.ActionDefinition; +import org.alfresco.service.cmr.action.ActionService; +import org.alfresco.service.cmr.action.ActionServiceTransport; +import org.alfresco.service.cmr.action.CompositeAction; +import org.alfresco.service.cmr.action.ParameterConstraint; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AuthenticationService; + +/** + * Server side implementation for transport of ActionService. + * @author britt + */ +public class ActionServiceTransportImpl implements ActionServiceTransport +{ + private ActionService fActionService; + + private AuthenticationService fAuthenticationService; + + public void setActionService(ActionService service) + { + fActionService = service; + } + + public void setAuthenticationService(AuthenticationService service) + { + fAuthenticationService = service; + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#createAction(java.lang.String, java.lang.String) + */ + public Action createAction(String ticket, String name) + { + fAuthenticationService.validate(ticket); + return fActionService.createAction(name); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#createAction(java.lang.String, java.lang.String, java.util.Map) + */ + public Action createAction(String ticket, String name, + Map params) + { + fAuthenticationService.validate(ticket); + return fActionService.createAction(name, params); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#createActionCondition(java.lang.String, java.lang.String) + */ + public ActionCondition createActionCondition(String ticket, String name) + { + fAuthenticationService.validate(ticket); + return fActionService.createActionCondition(name); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#createActionCondition(java.lang.String, java.lang.String, java.util.Map) + */ + public ActionCondition createActionCondition(String ticket, String name, + Map params) + { + fAuthenticationService.validate(ticket); + return fActionService.createActionCondition(name, params); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#createCompositeAction(java.lang.String) + */ + public CompositeAction createCompositeAction(String ticket) + { + fAuthenticationService.validate(ticket); + return fActionService.createCompositeAction(); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#evaluateAction(java.lang.String, org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + public boolean evaluateAction(String ticket, Action action, + NodeRef actionedUponNodeRef) + { + fAuthenticationService.validate(ticket); + return fActionService.evaluateAction(action, actionedUponNodeRef); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#evaluateActionCondition(java.lang.String, org.alfresco.service.cmr.action.ActionCondition, org.alfresco.service.cmr.repository.NodeRef) + */ + public boolean evaluateActionCondition(String ticket, + ActionCondition condition, NodeRef actionedUponNodeRef) + { + fAuthenticationService.validate(ticket); + return fActionService.evaluateActionCondition(condition, actionedUponNodeRef); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#executeAction(java.lang.String, org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) + */ + public void executeAction(String ticket, Action action, + NodeRef actionedUponNodeRef) + { + fAuthenticationService.validate(ticket); + fActionService.executeAction(action, actionedUponNodeRef); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#executeAction(java.lang.String, org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef, boolean) + */ + public void executeAction(String ticket, Action action, + NodeRef actionedUponNodeRef, boolean checkConditions) + { + fAuthenticationService.validate(ticket); + fActionService.executeAction(action, actionedUponNodeRef, checkConditions); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#executeAction(java.lang.String, org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef, boolean, boolean) + */ + public void executeAction(String ticket, Action action, + NodeRef actionedUponNodeRef, boolean checkConditions, + boolean executeAsynchronously) + { + fAuthenticationService.validate(ticket); + fActionService.executeAction(action, actionedUponNodeRef, checkConditions, executeAsynchronously); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#getAction(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, java.lang.String) + */ + public Action getAction(String ticket, NodeRef nodeRef, String actionId) + { + fAuthenticationService.validate(ticket); + return fActionService.getAction(nodeRef, actionId); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#getActionConditionDefinition(java.lang.String, java.lang.String) + */ + public ActionConditionDefinition getActionConditionDefinition( + String ticket, String name) + { + fAuthenticationService.validate(ticket); + return fActionService.getActionConditionDefinition(name); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#getActionConditionDefinitions(java.lang.String) + */ + public List getActionConditionDefinitions( + String ticket) + { + fAuthenticationService.validate(ticket); + return fActionService.getActionConditionDefinitions(); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#getActionDefinition(java.lang.String, java.lang.String) + */ + public ActionDefinition getActionDefinition(String ticket, String name) + { + fAuthenticationService.validate(ticket); + return fActionService.getActionDefinition(name); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#getActionDefinitions(java.lang.String) + */ + public List getActionDefinitions(String ticket) + { + fAuthenticationService.validate(ticket); + return fActionService.getActionDefinitions(); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#getActionDefinitions(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) + */ + public List getActionDefinitions(String ticket, + NodeRef nodeRef) + { + fAuthenticationService.validate(ticket); + return fActionService.getActionDefinitions(nodeRef); + } + + /** + * @see org.alfresco.service.cmr.action.ActionServiceTransport#getParameterConstraint(java.lang.String, java.lang.String) + */ + public ParameterConstraint getParameterConstraint(String ticket, String name) + { + fAuthenticationService.validate(ticket); + return fActionService.getParameterConstraint(name); + } + + /** + * @see org.alfresco.service.cmr.action.ActionServiceTransport#getParameterConstraints(java.lang.String) + */ + public List getParameterConstraints(String ticket) + { + fAuthenticationService.validate(ticket); + return fActionService.getParameterConstraints(); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#getActions(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) + */ + public List getActions(String ticket, NodeRef nodeRef) + { + fAuthenticationService.validate(ticket); + return fActionService.getActions(nodeRef); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#removeAction(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.action.Action) + */ + public void removeAction(String ticket, NodeRef nodeRef, Action action) + { + fAuthenticationService.validate(ticket); + fActionService.removeAction(nodeRef, action); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#removeAllActions(java.lang.String, org.alfresco.service.cmr.repository.NodeRef) + */ + public void removeAllActions(String ticket, NodeRef nodeRef) + { + fAuthenticationService.validate(ticket); + fActionService.removeAllActions(nodeRef); + } + + /* (non-Javadoc) + * @see org.alfresco.service.cmr.action.ActionServiceTransport#saveAction(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.action.Action) + */ + public void saveAction(String ticket, NodeRef nodeRef, Action action) + { + fAuthenticationService.validate(ticket); + fActionService.saveAction(nodeRef, action); + } +} diff --git a/source/java/org/alfresco/service/cmr/action/ActionServiceTransport.java b/source/java/org/alfresco/service/cmr/action/ActionServiceTransport.java new file mode 100644 index 0000000000..c5585ed394 --- /dev/null +++ b/source/java/org/alfresco/service/cmr/action/ActionServiceTransport.java @@ -0,0 +1,240 @@ +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +package org.alfresco.service.cmr.action; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * This is the interface for over the transport of ActionService. + * It's job is to tunnel an authentication token for each call. + * @author britt + */ +public interface ActionServiceTransport +{ + /** + * Get a named action definition + * + * @param name the name of the action definition + * @return the action definition + */ + ActionDefinition getActionDefinition(String ticket, String name); + + /** + * Get all the action definitions + * + * @return the list action definitions + */ + List getActionDefinitions(String ticket); + + /** + * Get all the action definitions that are applicable for the given node, based on + * its type and aspects. + * + * @param nodeRef the node reference + * @return a list of applicable action definitions + */ + List getActionDefinitions(String ticket, NodeRef nodeRef); + + /** + * Get a named action condition definition + * + * @param name the name of the action condition definition + * @return the action condition definition + */ + ActionConditionDefinition getActionConditionDefinition(String ticket, String name); + + /** + * Get all the action condition definitions + * + * @return the list of action condition definitions + */ + List getActionConditionDefinitions(String ticket); + + /** + * Get a named parameter constraint + * + * @param name the name of the parameter constraint + * @return this parameter condition + */ + ParameterConstraint getParameterConstraint(String ticket, String name); + + /** + * Get all the parameter constraints + * + * @return the list of all parameter constraints + */ + List getParameterConstraints(String ticket); + + /** + * Create a new action + * + * @param name the action definition name + * @return the action + */ + Action createAction(String ticket, String name); + + /** + * Create a new action specifying the initial set of parameter values + * + * @param name the action definition name + * @param params the parameter values + * @return the action + */ + Action createAction(String ticket, String name, Map params); + + /** + * Create a composite action + * + * @return the composite action + */ + CompositeAction createCompositeAction(String ticket); + + /** + * Create an action condition + * + * @param name the action condition definition name + * @return the action condition + */ + ActionCondition createActionCondition(String ticket, String name); + + /** + * Create an action condition specifying the initial set of parameter values + * + * @param name the action condition definition name + * @param params the parameter values + * @return the action condition + */ + ActionCondition createActionCondition(String ticket, String name, Map params); + + /** + * The actions conditions are always checked. + * + * @see ActionService#executeAction(Action, NodeRef, boolean) + * + * @param action the action + * @param actionedUponNodeRef the actioned upon node reference + */ + void executeAction(String ticket, Action action, NodeRef actionedUponNodeRef); + + /** + * The action is executed based on the asynchronous attribute of the action. + * + * @see ActionService#executeAction(Action, NodeRef, boolean, boolean) + * + * @param action the action + * @param actionedUponNodeRef the actioned upon node reference + * @param checkConditions indicates whether the conditions should be checked + */ + void executeAction(String ticket, Action action, NodeRef actionedUponNodeRef, boolean checkConditions); + + /** + * Executes the specified action upon the node reference provided. + *

+ * If specified that the conditions should be checked then any conditions + * set on the action are evaluated. + *

+ * If the conditions fail then the action is not executed. + *

+ * If an action has no conditions then the action will always be executed. + *

+ * If the conditions are not checked then the action will always be executed. + * + * @param action the action + * @param actionedUponNodeRef the actioned upon node reference + * @param checkConditions indicates whether the conditions should be checked before + * executing the action + * @param executeAsynchronously indicates whether the action should be executed asychronously or not, this value overrides + * the value set on the action its self + */ + void executeAction(String ticket, Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executeAsynchronously); + + /** + * Evaluted the conditions set on an action. + *

+ * Returns true if the action has no conditions. + *

+ * If the action has more than one condition their results are combined using the 'AND' + * logical operator. + * + * @param action the action + * @param actionedUponNodeRef the actioned upon node reference + * @return true if the condition succeeds, false otherwise + */ + boolean evaluateAction(String ticket, Action action, NodeRef actionedUponNodeRef); + + /** + * Evaluate an action condition. + * + * @param condition the action condition + * @param actionedUponNodeRef the actioned upon node reference + * @return true if the condition succeeds, false otherwise + */ + boolean evaluateActionCondition(String ticket, ActionCondition condition, NodeRef actionedUponNodeRef); + + /** + * Save an action against a node reference. + *

+ * The node will be made configurable if it is not already. + *

+ * If the action already exists then its details will be updated. + * + * @param nodeRef the node reference + * @param action the action + */ + void saveAction(String ticket, NodeRef nodeRef, Action action); + + /** + * Gets all the actions currently saved on the given node reference. + * + * @param nodeRef the node reference + * @return the list of actions + */ + List getActions(String ticket, NodeRef nodeRef); + + /** + * Gets an action stored against a given node reference. + *

+ * Returns null if the action can not be found. + * + * @param nodeRef the node reference + * @param actionId the action id + * @return the action + */ + Action getAction(String ticket, NodeRef nodeRef, String actionId); + + /** + * Removes an action associated with a node reference. + * + * @param nodeRef the node reference + * @param action the action + */ + void removeAction(String ticket, NodeRef nodeRef, Action action); + + /** + * Removes all actions associated with a node reference + * + * @param nodeRef the node reference + */ + void removeAllActions(String ticket, NodeRef nodeRef); +}