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 class
AutoTranslateServiceImpl.TranslationPageImpl
class
AutoTranslateServiceImpl.TranslationRunImpl
-
Nested classes/interfaces inherited from interface com.composum.ai.aem.core.impl.autotranslate.AutoTranslateService
AutoTranslateService.TranslationPage, AutoTranslateService.TranslationParameters, AutoTranslateService.TranslationRun, AutoTranslateService.TranslationStatus
-
-
Field Summary
Fields Modifier and Type Field Description protected AutoTranslateConfigService
autoTranslateConfigService
-
Constructor Summary
Constructors Constructor Description AutoTranslateServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate()
protected List<org.apache.sling.api.resource.Resource>
collectPages(org.apache.sling.api.resource.Resource root, int maxDepth)
void
deactivate()
protected void
doRollback(org.apache.sling.api.resource.ResourceResolver resourceResolver, AutoTranslateServiceImpl.TranslationRunImpl translationRun)
protected org.apache.sling.commons.threads.ThreadPool
getThreadPool()
List<AutoTranslateService.TranslationRun>
getTranslationRuns()
Retrieves all currently running translation processes.boolean
isEnabled()
void
rollback(org.apache.sling.api.resource.Resource resource)
Rolls the translation results at this resource back - mostly for debugging.AutoTranslateService.TranslationRun
startTranslation(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:AutoTranslateService
Retrieves all currently running translation processes.- Specified by:
getTranslationRuns
in interfaceAutoTranslateService
-
activate
protected void activate()
-
deactivate
public void deactivate()
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in 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:AutoTranslateService
Starts a new translation run.- Specified by:
startTranslation
in 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.PersistenceException
Description copied from interface:AutoTranslateService
Rolls the translation results at this resource back - mostly for debugging.- Specified by:
rollback
in interfaceAutoTranslateService
- Throws:
com.day.cq.wcm.api.WCMException
org.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.PersistenceException
com.day.cq.wcm.api.WCMException
-
-