use of org.alfresco.repo.transaction.TransactionServiceImpl in project alfresco-repository by Alfresco.
the class SysAdminParamsImpl method afterPropertiesSet.
@Override
public void afterPropertiesSet() throws Exception {
// Set the transaction read-write state by veto
// There is no need to attempt to check the dictionary or any other component as they will handle
// their own vetoes (MNT-14579)
// No logging is required here: it is done in the TransactionService code, already
TransactionServiceImpl transactionService = (TransactionServiceImpl) ctx.getBean("transactionService");
transactionService.setAllowWrite(allowWrite, VETO);
}
use of org.alfresco.repo.transaction.TransactionServiceImpl in project alfresco-repository by Alfresco.
the class ThumbnailServiceImplParameterTest method initMockObjects.
@Before
public void initMockObjects() {
renditionService = new RenditionServiceImpl() {
@Override
public RenditionDefinition loadRenditionDefinition(QName renditionDefinitionName) {
// We're intentionally returning null for this test.
return null;
}
};
renditionService.setActionService(mockActionService);
renditionService.setServiceRegistry(new MockedTestServiceRegistry());
renditionService.setRenditionService2(mockRenditionService2);
when(mockRenditionService2.isCreatedByRenditionService2(any(), any())).thenReturn(false);
ThumbnailServiceImpl thumbs = new ThumbnailServiceImpl() {
@Override
public NodeRef getThumbnailByName(NodeRef node, QName contentProperty, String thumbnailName) {
return null;
}
/**
* In this test the thumbnailRef will be null, so we need to ensure
* it is not dereferenced here.
*/
@Override
public NodeRef getThumbnailNode(ChildAssociationRef thumbnailRef) {
return null;
}
};
thumbs.setRenditionService(renditionService);
thumbs.setThumbnailRegistry(new ThumbnailRegistry() {
@Override
public ThumbnailRenditionConvertor getThumbnailRenditionConvertor() {
return new ThumbnailRenditionConvertor();
}
});
thumbs.setNodeService(mock(NodeService.class));
TransactionServiceImpl transactionServiceImpl = new TransactionServiceImpl() {
@Override
public boolean getAllowWrite() {
return true;
}
@Override
public boolean isReadOnly() {
return false;
}
@Override
public RetryingTransactionHelper getRetryingTransactionHelper() {
RetryingTransactionHelper rth = new RetryingTransactionHelper() {
@Override
public <R> R doInTransaction(RetryingTransactionCallback<R> cb, boolean readOnly, boolean requiresNew) {
try {
return cb.execute();
} catch (Throwable e) {
e.printStackTrace();
}
return null;
}
};
return rth;
}
};
thumbs.setTransactionService(transactionServiceImpl);
thumbnailService = thumbs;
}
use of org.alfresco.repo.transaction.TransactionServiceImpl in project alfresco-repository by Alfresco.
the class DescriptorServiceTest method testReadOnlyLicenseLoad_ALF10110.
@Test
public void testReadOnlyLicenseLoad_ALF10110() throws Exception {
QName vetoName = QName.createQName("{test}veto");
TransactionServiceImpl txnService = (TransactionServiceImpl) applicationContext.getBean("TransactionService");
ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
DescriptorService descriptorService = registry.getDescriptorService();
// Veto writes
try {
txnService.setAllowWrite(false, vetoName);
// Now reload the license
descriptorService.loadLicense();
} finally {
txnService.setAllowWrite(true, vetoName);
}
}
Aggregations