Class AutoTranslateServiceImpl
- java.lang.Object
 - 
- com.composum.ai.aem.core.impl.autotranslate.AutoTranslateServiceImpl
 
 
- 
- All Implemented Interfaces:
 AutoTranslateService
public class AutoTranslateServiceImpl extends Object implements AutoTranslateService
A service that provides automatic translation of AEM pages. The actual work is done inAutoPageTranslateServiceImpl; this is for managing the translation queue and the thread pool.This is a proof-of-concept implementation, only available if explicitly enabled in the OSGi configuration.
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAutoTranslateServiceImpl.TranslationPageImplclassAutoTranslateServiceImpl.TranslationRunImpl- 
Nested classes/interfaces inherited from interface com.composum.ai.aem.core.impl.autotranslate.AutoTranslateService
AutoTranslateService.TranslationPage, AutoTranslateService.TranslationParameters, AutoTranslateService.TranslationRun, AutoTranslateService.TranslationRunMessage, AutoTranslateService.TranslationStatus 
 - 
 
- 
Field Summary
Fields Modifier and Type Field Description protected AutoTranslateConfigServiceautoTranslateConfigService 
- 
Constructor Summary
Constructors Constructor Description AutoTranslateServiceImpl() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidactivate()protected List<org.apache.sling.api.resource.Resource>collectPages(org.apache.sling.api.resource.Resource root, int maxDepth)voiddeactivate()protected voiddoRollback(org.apache.sling.api.resource.ResourceResolver resourceResolver, AutoTranslateServiceImpl.TranslationRunImpl translationRun)protected org.apache.sling.commons.threads.ThreadPoolgetThreadPool()List<AutoTranslateService.TranslationRun>getTranslationRuns()Retrieves all currently running translation processes.booleanisEnabled()voidrollback(org.apache.sling.api.resource.Resource resource)Rolls the translation results at this resource back - mostly for debugging.AutoTranslateService.TranslationRunstartTranslation(org.apache.sling.api.resource.ResourceResolver resourceResolver, String path, AutoTranslateService.TranslationParameters translationParameters)Starts a new translation run. 
 - 
 
- 
- 
Field Detail
- 
autoTranslateConfigService
protected volatile AutoTranslateConfigService autoTranslateConfigService
 
 - 
 
- 
Method Detail
- 
getTranslationRuns
public List<AutoTranslateService.TranslationRun> getTranslationRuns()
Description copied from interface:AutoTranslateServiceRetrieves all currently running translation processes.- Specified by:
 getTranslationRunsin interfaceAutoTranslateService
 
- 
activate
protected void activate()
 
- 
deactivate
public void deactivate()
 
- 
isEnabled
public boolean isEnabled()
- Specified by:
 isEnabledin interfaceAutoTranslateService
 
- 
getThreadPool
protected org.apache.sling.commons.threads.ThreadPool getThreadPool()
 
- 
startTranslation
public AutoTranslateService.TranslationRun startTranslation(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull String path, @Nonnull AutoTranslateService.TranslationParameters translationParameters) throws org.apache.sling.api.resource.LoginException
Description copied from interface:AutoTranslateServiceStarts a new translation run.- Specified by:
 startTranslationin interfaceAutoTranslateService- Throws:
 org.apache.sling.api.resource.LoginException
 
- 
collectPages
protected List<org.apache.sling.api.resource.Resource> collectPages(org.apache.sling.api.resource.Resource root, int maxDepth)
 
- 
rollback
public void rollback(org.apache.sling.api.resource.Resource resource) throws com.day.cq.wcm.api.WCMException, org.apache.sling.api.resource.PersistenceExceptionDescription copied from interface:AutoTranslateServiceRolls the translation results at this resource back - mostly for debugging.- Specified by:
 rollbackin interfaceAutoTranslateService- Throws:
 com.day.cq.wcm.api.WCMExceptionorg.apache.sling.api.resource.PersistenceException
 
- 
doRollback
protected void doRollback(org.apache.sling.api.resource.ResourceResolver resourceResolver, AutoTranslateServiceImpl.TranslationRunImpl translationRun) throws org.apache.sling.api.resource.PersistenceException, com.day.cq.wcm.api.WCMException- Throws:
 org.apache.sling.api.resource.PersistenceExceptioncom.day.cq.wcm.api.WCMException
 
 - 
 
 -