mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Tidyup as part of RM-1945 and RM-1946. Attempt to fix the failing build.
Although the Alfresco server starts fine on my machine, there is a timing/dependency issue which means that on Bamboo, ClassificationServiceImpl.initConfiguredClassificationLevels attempts to use the Alfresco DB before it is fully ready. This check-in changes the service startup so that instead of using a spring init-method, it uses a LifecycleBean to run the initialisation after the server has fully started up. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@99962 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -49,4 +49,11 @@
|
|||||||
</value>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="classificationServiceBootstrap"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceBootstrap">
|
||||||
|
<constructor-arg ref="rm.authenticationUtil"/>
|
||||||
|
<constructor-arg ref="classificationService"/> <!-- Intentionally using the small 'c' here -->
|
||||||
|
<constructor-arg ref="TransactionService"/>
|
||||||
|
</bean>
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2015 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.classification;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is responsible for initialising any Classification-specific data on server bootstrap.
|
||||||
|
*
|
||||||
|
* @author Neil Mc Erlean
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public class ClassificationServiceBootstrap extends AbstractLifecycleBean
|
||||||
|
{
|
||||||
|
private final AuthenticationUtil authenticationUtil;
|
||||||
|
private final ClassificationServiceImpl classificationService;
|
||||||
|
private final TransactionService transactionService;
|
||||||
|
|
||||||
|
public ClassificationServiceBootstrap(AuthenticationUtil authUtil,
|
||||||
|
ClassificationServiceImpl cService,
|
||||||
|
TransactionService txService)
|
||||||
|
{
|
||||||
|
this.authenticationUtil = authUtil;
|
||||||
|
this.classificationService = cService;
|
||||||
|
this.transactionService = txService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override protected void onBootstrap(ApplicationEvent event)
|
||||||
|
{
|
||||||
|
authenticationUtil.runAsSystem(new org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork()
|
||||||
|
{
|
||||||
|
RetryingTransactionCallback<Void> callback = new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
public Void execute()
|
||||||
|
{
|
||||||
|
classificationService.initConfiguredClassificationLevels();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
transactionService.getRetryingTransactionHelper().doInTransaction(callback);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override protected void onShutdown(ApplicationEvent event)
|
||||||
|
{
|
||||||
|
// Intentionally empty.
|
||||||
|
}
|
||||||
|
}
|
@@ -54,7 +54,7 @@ public class ClassificationServiceImpl extends ServiceBaseImpl
|
|||||||
|
|
||||||
public void setAttributeService(AttributeService service) { this.attributeService = service; }
|
public void setAttributeService(AttributeService service) { this.attributeService = service; }
|
||||||
|
|
||||||
public void initConfiguredClassificationLevels()
|
void initConfiguredClassificationLevels()
|
||||||
{
|
{
|
||||||
final List<ClassificationLevel> allPersistedLevels = getPersistedLevels();
|
final List<ClassificationLevel> allPersistedLevels = getPersistedLevels();
|
||||||
final List<ClassificationLevel> configuredLevels = getConfiguredLevels();
|
final List<ClassificationLevel> configuredLevels = getConfiguredLevels();
|
||||||
|
Reference in New Issue
Block a user