mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V4.1-BUG-FIX to HEAD
42902: Merged DEV to V4.1-BUG-FIX 42519: ALF-13588: Google Doc failed to authenticate after incorrect password being entered for google account Add ability to unregister class behaviours. Unregister googledocs behaviours when subsystem stops. 42903: Merged V3.4-BUG-FIX to V4.1-BUG-FIX 42901: Merged DEV to V3.4-BUG-FIX 42837: ALF-12833: Issues installing Alfresco on WebSphere when the server doesn't have internet access Create servlet-resources.jar(the same as servlet.jar but only with "resources") and add it into alfresco.war git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42905 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -21,7 +21,9 @@ package org.alfresco.repo.googledocs;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
@@ -35,6 +37,8 @@ import org.alfresco.repo.copy.DefaultCopyBehaviourCallback;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy;
|
||||
import org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy;
|
||||
import org.alfresco.repo.policy.BehaviourDefinition;
|
||||
import org.alfresco.repo.policy.ClassBehaviourBinding;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||
@@ -46,6 +50,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
|
||||
/**
|
||||
* Behaviour associated with google editable documents
|
||||
@@ -55,7 +60,8 @@ public class GoogleEditableAspect implements NodeServicePolicies.OnAddAspectPoli
|
||||
CheckOutCheckInServicePolicies.OnCheckOut,
|
||||
CheckOutCheckInServicePolicies.BeforeCheckIn,
|
||||
CheckOutCheckInServicePolicies.OnCheckIn,
|
||||
NodeServicePolicies.BeforeDeleteNodePolicy
|
||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
||||
DisposableBean
|
||||
{
|
||||
/** Policy component */
|
||||
private PolicyComponent policyComponent;
|
||||
@@ -72,6 +78,9 @@ public class GoogleEditableAspect implements NodeServicePolicies.OnAddAspectPoli
|
||||
/** Content service */
|
||||
private ContentService contentService;
|
||||
|
||||
/** binded behaviours definitions*/
|
||||
private Set<BehaviourDefinition<ClassBehaviourBinding>> behaviours;
|
||||
|
||||
/**
|
||||
* @param policyComponent policy component
|
||||
*/
|
||||
@@ -117,34 +126,35 @@ public class GoogleEditableAspect implements NodeServicePolicies.OnAddAspectPoli
|
||||
*/
|
||||
public void init()
|
||||
{
|
||||
behaviours = new HashSet<BehaviourDefinition<ClassBehaviourBinding>>();
|
||||
// GoogleEditable resource behaviours
|
||||
policyComponent.bindClassBehaviour(OnAddAspectPolicy.QNAME,
|
||||
behaviours.add(policyComponent.bindClassBehaviour(OnAddAspectPolicy.QNAME,
|
||||
GoogleDocsModel.ASPECT_GOOGLEEDITABLE ,
|
||||
new JavaBehaviour(this, "onAddAspect", NotificationFrequency.FIRST_EVENT));
|
||||
policyComponent.bindClassBehaviour(OnCheckOut.QNAME,
|
||||
new JavaBehaviour(this, "onAddAspect", NotificationFrequency.FIRST_EVENT)));
|
||||
behaviours.add(policyComponent.bindClassBehaviour(OnCheckOut.QNAME,
|
||||
GoogleDocsModel.ASPECT_GOOGLEEDITABLE,
|
||||
new JavaBehaviour(this, "onCheckOut", NotificationFrequency.FIRST_EVENT));
|
||||
new JavaBehaviour(this, "onCheckOut", NotificationFrequency.FIRST_EVENT)));
|
||||
|
||||
// Google resource behaviours
|
||||
policyComponent.bindClassBehaviour(BeforeCheckIn.QNAME,
|
||||
behaviours.add(policyComponent.bindClassBehaviour(BeforeCheckIn.QNAME,
|
||||
GoogleDocsModel.ASPECT_GOOGLERESOURCE,
|
||||
new JavaBehaviour(this, "beforeCheckIn", NotificationFrequency.FIRST_EVENT));
|
||||
policyComponent.bindClassBehaviour(OnCheckIn.QNAME,
|
||||
new JavaBehaviour(this, "beforeCheckIn", NotificationFrequency.FIRST_EVENT)));
|
||||
behaviours.add(policyComponent.bindClassBehaviour(OnCheckIn.QNAME,
|
||||
GoogleDocsModel.ASPECT_GOOGLERESOURCE,
|
||||
new JavaBehaviour(this, "onCheckIn", NotificationFrequency.FIRST_EVENT));
|
||||
policyComponent.bindClassBehaviour(BeforeDeleteNodePolicy.QNAME,
|
||||
new JavaBehaviour(this, "onCheckIn", NotificationFrequency.FIRST_EVENT)));
|
||||
behaviours.add(policyComponent.bindClassBehaviour(BeforeDeleteNodePolicy.QNAME,
|
||||
GoogleDocsModel.ASPECT_GOOGLERESOURCE,
|
||||
new JavaBehaviour(this, "beforeDeleteNode", NotificationFrequency.FIRST_EVENT));
|
||||
new JavaBehaviour(this, "beforeDeleteNode", NotificationFrequency.FIRST_EVENT)));
|
||||
|
||||
// Copy behaviours
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
behaviours.add(policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"),
|
||||
GoogleDocsModel.ASPECT_GOOGLEEDITABLE,
|
||||
new JavaBehaviour(this, "getGoogleEditableCopyCallback"));
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
new JavaBehaviour(this, "getGoogleEditableCopyCallback")));
|
||||
behaviours.add(policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"),
|
||||
GoogleDocsModel.ASPECT_GOOGLERESOURCE,
|
||||
new JavaBehaviour(this, "getGoogleResourceCopyCallback"));
|
||||
new JavaBehaviour(this, "getGoogleResourceCopyCallback")));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,4 +282,13 @@ public class GoogleEditableAspect implements NodeServicePolicies.OnAddAspectPoli
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() throws Exception
|
||||
{
|
||||
for(BehaviourDefinition<ClassBehaviourBinding> definition : behaviours)
|
||||
{
|
||||
policyComponent.removeClassDefinition(definition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -82,6 +82,23 @@ import java.util.Map;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove behavior from map
|
||||
*
|
||||
* @param behaviourDefinition
|
||||
*/
|
||||
public void remove(BehaviourDefinition<B> behaviourDefinition)
|
||||
{
|
||||
B binding = behaviourDefinition.getBinding();
|
||||
List<BehaviourDefinition<B>> existing = index.get(binding);
|
||||
if (existing != null && existing.contains(behaviourDefinition))
|
||||
{
|
||||
existing.remove(behaviourDefinition);
|
||||
size--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets a Behaviour from the Map
|
||||
|
@@ -30,7 +30,7 @@ import org.alfresco.service.namespace.QName;
|
||||
* @author David Caruana
|
||||
*
|
||||
*/
|
||||
/*package*/ class ClassBehaviourBinding implements BehaviourBinding
|
||||
public class ClassBehaviourBinding implements BehaviourBinding
|
||||
{
|
||||
// The dictionary service
|
||||
private DictionaryService dictionary;
|
||||
|
@@ -213,4 +213,22 @@ import org.alfresco.service.namespace.QName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove class behaviour
|
||||
*
|
||||
* @param behaviour
|
||||
*/
|
||||
public void removeClassBehaviour(BehaviourDefinition<B> behaviour)
|
||||
{
|
||||
lock.writeLock().lock();
|
||||
try
|
||||
{
|
||||
classMap.remove(behaviour);
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -206,6 +206,13 @@ public interface PolicyComponent
|
||||
*/
|
||||
public BehaviourDefinition<ServiceBehaviourBinding> bindAssociationBehaviour(QName policy, Object service, Behaviour behaviour);
|
||||
|
||||
/**
|
||||
* Unbind behaviour
|
||||
*
|
||||
* @param definition
|
||||
*/
|
||||
public void removeClassDefinition(BehaviourDefinition<ClassBehaviourBinding> definition);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -137,6 +137,11 @@ public class PolicyComponentImpl implements PolicyComponent
|
||||
return delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeClassDefinition(BehaviourDefinition<ClassBehaviourBinding> definition)
|
||||
{
|
||||
getClassBehaviourIndex(definition.getPolicy()).removeClassBehaviour(definition);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.policy.PolicyComponent#registerPropertyPolicy(java.lang.Class)
|
||||
|
Reference in New Issue
Block a user