Merged V3.0 to HEAD

11899: (Recorded, skipped) Embedded agreed HeartBeat server URL http://hbrx.alfresco.com/hearbeat/ into repository HeartBeat client (recorded)
  11900: (Recorded, skipped) Corrected typo in heartbeat URL (not hearbeat)
  11901: (Recorded, skipped) Fix failing unit test by disabling shutdownBackstop
  12164: (Recorded, partially skipped) Fix failing LicenseComponentTest. LicenseComponent was calling PersonService from an unauthenticated thread and this no longer works.
  12165: (Recorded, skipped) Ensure License verify loop runs in authenticated thread.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12512 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-12-19 12:50:54 +00:00
parent cd09266213
commit af99a1d872

View File

@@ -28,6 +28,8 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.descriptor.Descriptor; import org.alfresco.service.descriptor.Descriptor;
import org.alfresco.service.descriptor.DescriptorService; import org.alfresco.service.descriptor.DescriptorService;
@@ -162,7 +164,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
{ {
// initialise the repository descriptor // initialise the repository descriptor
// note: this requires that the repository schema has already been initialised // note: this requires that the repository schema has already been initialised
RetryingTransactionCallback<Descriptor> createDescriptorWork = new RetryingTransactionCallback<Descriptor>() final RetryingTransactionCallback<Descriptor> createDescriptorWork = new RetryingTransactionCallback<Descriptor>()
{ {
public Descriptor execute() public Descriptor execute()
{ {
@@ -181,8 +183,14 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean implements Desc
return installed == null ? new UnknownDescriptor() : installed; return installed == null ? new UnknownDescriptor() : installed;
} }
}; };
installedRepoDescriptor = transactionService.getRetryingTransactionHelper().doInTransaction( this.installedRepoDescriptor = AuthenticationUtil.runAs(new RunAsWork<Descriptor>()
createDescriptorWork, transactionService.isReadOnly(), false); {
public Descriptor doWork() throws Exception
{
return transactionService.getRetryingTransactionHelper().doInTransaction(createDescriptorWork,
transactionService.isReadOnly(), false);
}
}, AuthenticationUtil.getSystemUserName());
((ApplicationContext)event.getSource()).publishEvent(new DescriptorServiceAvailableEvent(this)); ((ApplicationContext)event.getSource()).publishEvent(new DescriptorServiceAvailableEvent(this));
} }