Turned subscription service into a subsystem

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28919 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Florian Mü
2011-07-11 15:10:55 +00:00
parent 9adcac3910
commit 10a9817d08
7 changed files with 43 additions and 8 deletions

View File

@@ -18,7 +18,6 @@
<import resource="classpath:alfresco/preference-service-context.xml"/>
<import resource="classpath:alfresco/swf-transform-context.xml"/>
<import resource="classpath:alfresco/form-services-context.xml"/>
<import resource="classpath:alfresco/subscription-service-context.xml" />
<import resource="classpath:alfresco/cmis-api-context.xml" />
<import resource="classpath:alfresco/opencmis-context.xml" />
<import resource="classpath:alfresco/period-type-context.xml" />

View File

@@ -614,6 +614,30 @@
<value>true</value>
</property>
</bean>
<!-- Subscription Service subsystem -->
<bean id="subscriptions" class="org.alfresco.repo.management.subsystems.ChildApplicationContextFactory" parent="abstractPropertyBackedBean">
<property name="category">
<value>Subscriptions</value>
</property>
<property name="autoStart">
<value>true</value>
</property>
</bean>
<bean id="SubscriptionService" class="org.alfresco.repo.management.subsystems.SubsystemProxyFactory">
<property name="sourceApplicationContextFactory">
<ref bean="subscriptions" />
</property>
<property name="sourceBeanName">
<value>SubscriptionServiceImpl</value>
</property>
<property name="interfaces">
<list>
<value>org.alfresco.service.cmr.subscriptions.SubscriptionService</value>
</list>
</property>
</bean>
<!-- Start the quartz scheduler -->

View File

@@ -2,8 +2,9 @@
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Subscription service bean -->
<bean id="SubscriptionService" class="org.springframework.aop.framework.ProxyFactoryBean">
<bean id="SubscriptionServiceImpl" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>org.alfresco.service.cmr.subscriptions.SubscriptionService</value>
</property>
@@ -29,6 +30,7 @@
<property name="searchService" ref="SearchService" />
<property name="namespaceService" ref="NamespaceService" />
<property name="fileFolderService" ref="FileFolderService" />
<property name="active" value="${subscriptions.enabled}" />
</bean>
</beans>

View File

@@ -0,0 +1,2 @@
# Enables the subscription service
subscriptions.enabled=true

View File

@@ -451,7 +451,7 @@ public class LocalFeedTaskProcessor extends FeedTaskProcessor implements Applica
{
Set<String> result = new HashSet<String>();
if (subscriptionService.subscriptionsEnabled())
if (subscriptionService.isActive())
{
PagingFollowingResults fr = subscriptionService.getFollowers(userId, new PagingRequest(1000000, null));

View File

@@ -89,6 +89,8 @@ public class SubscriptionServiceImpl implements SubscriptionService
protected NamespaceService namespaceService;
protected FileFolderService fileFolderService;
protected boolean active;
/**
* Sets the subscriptions DAO.
*/
@@ -161,6 +163,11 @@ public class SubscriptionServiceImpl implements SubscriptionService
this.fileFolderService = fileFolderService;
}
public final void setActive(boolean active)
{
this.active = active;
}
@Override
public PagingSubscriptionResults getSubscriptions(String userId, SubscriptionItemTypeEnum type,
PagingRequest pagingRequest)
@@ -352,9 +359,9 @@ public class SubscriptionServiceImpl implements SubscriptionService
}
@Override
public boolean subscriptionsEnabled()
public boolean isActive()
{
return true;
return active;
}
/**
@@ -362,7 +369,7 @@ public class SubscriptionServiceImpl implements SubscriptionService
*/
protected void checkEnabled()
{
if (!subscriptionsEnabled())
if (!isActive())
{
throw new SubscriptionsDisabledException("subscription_service.err.disabled");
}

View File

@@ -19,6 +19,7 @@
package org.alfresco.service.cmr.subscriptions;
import org.alfresco.query.PagingRequest;
import org.alfresco.repo.management.subsystems.ActivateableBean;
import org.alfresco.service.Auditable;
import org.alfresco.service.NotAuditable;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -29,7 +30,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
* @author Florian Mueller
* @since 4.0
*/
public interface SubscriptionService
public interface SubscriptionService extends ActivateableBean
{
// --- subscription ---
@@ -204,5 +205,5 @@ public interface SubscriptionService
* Returns if subscription are enabled for this system.
*/
@NotAuditable
boolean subscriptionsEnabled();
boolean isActive();
}