diff --git a/core/pom.xml b/core/pom.xml index 37958df..de4031a 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -19,16 +19,20 @@ 4.0.0 com.adobe.granite.translation.connector - bootstrap-connector - 2.0-SNAPSHOT + lilt-connector + 1.0.2 ../pom.xml - bootstrap-connector.core + lilt-connector.core bundle Bootstrap Translation Connector - Core Core bundle for Bootstrap Translation Connector + + org.apache.felix + maven-scr-plugin + org.apache.sling maven-sling-plugin @@ -55,6 +59,10 @@ + + org.apache.felix + org.apache.felix.scr.annotations + org.osgi osgi.core @@ -82,8 +90,7 @@ com.adobe.aem - uber-jar - apis + aem-sdk-api org.apache.sling @@ -91,12 +98,23 @@ 1.1.0 provided + + javax.annotation + javax.annotation-api + 1.3.2 + + + org.apache.httpcomponents + httpclient + + + com.google.code.gson + gson + com.adobe.granite.translation bootstrap-tms.core - 2.0-SNAPSHOT - system - ${project.basedir}/../ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/install/bootstrap-tms.core-2.0-SNAPSHOT.jar + provided diff --git a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/install/bootstrap-tms.core-2.0-SNAPSHOT.jar b/core/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.jar similarity index 82% rename from ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/install/bootstrap-tms.core-2.0-SNAPSHOT.jar rename to core/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.jar index df8dd16..7d92f57 100644 Binary files a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/install/bootstrap-tms.core-2.0-SNAPSHOT.jar and b/core/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.jar differ diff --git a/core/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.pom b/core/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.pom new file mode 100644 index 0000000..f6f57a3 --- /dev/null +++ b/core/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.pom @@ -0,0 +1,9 @@ + + + 4.0.0 + com.adobe.granite.translation + bootstrap-tms.core + 4.0 + POM was created from install:install-file + diff --git a/core/repository/com/adobe/granite/translation/bootstrap-tms.core/maven-metadata-local.xml b/core/repository/com/adobe/granite/translation/bootstrap-tms.core/maven-metadata-local.xml new file mode 100644 index 0000000..48dee04 --- /dev/null +++ b/core/repository/com/adobe/granite/translation/bootstrap-tms.core/maven-metadata-local.xml @@ -0,0 +1,12 @@ + + + com.adobe.granite.translation + bootstrap-tms.core + + 4.0 + + 4.0 + + 20200730102223 + + diff --git a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/BootstrapTranslationCloudConfig.java b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/BootstrapTranslationCloudConfig.java index 9f696b4..7579d58 100644 --- a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/BootstrapTranslationCloudConfig.java +++ b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/BootstrapTranslationCloudConfig.java @@ -15,16 +15,16 @@ public interface BootstrapTranslationCloudConfig { - public static final String PROPERTY_DUMMY_SERVER_URL = "dummyserverurl"; - public static final String PROPERTY_DUMMY_CONFIG_ID = "dummyconfigid"; + public static final String PROPERTY_LILT_SERVER_URL = "liltserverurl"; + public static final String PROPERTY_LILT_CONFIG_ID = "liltconfigid"; public static final String PROPERTY_PREVIEW_PATH = "previewPath"; - public static final String RESOURCE_TYPE = "bootstrap-connector/components/bootstrap-connector-cloudconfig"; - public static final String ROOT_PATH = "/etc/cloudservices/bootstrap-translation"; + public static final String RESOURCE_TYPE = "cq/translation/components/mt-cloudconfig"; + public static final String ROOT_PATH = "/etc/cloudservices/lilt-translation"; - String getDummyServerUrl(); + String getLiltServerUrl(); - String getDummyConfigId(); + String getLiltConfigId(); String getPreviewPath(); -} \ No newline at end of file +} diff --git a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapConstants.java b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapConstants.java index 884da16..8f1bbbc 100644 --- a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapConstants.java +++ b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapConstants.java @@ -17,6 +17,9 @@ public class BootstrapConstants { /** The Constant EXPORT_FORMAT_XLIFF_2_0. */ public static final String EXPORT_FORMAT_XLIFF_2_0 = "xliff_2.0"; + + /** The Constant EXPORT JSON */ + public static final String EXPORT_FORMAT_JSON = "json"; /** The Constant PREVIEW_ENABLED. */ public static final String PREVIEW_ENABLED = "preview.enabled"; diff --git a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapServiceConfiguration.java b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapServiceConfiguration.java index e7f87df..a4fee97 100644 --- a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapServiceConfiguration.java +++ b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapServiceConfiguration.java @@ -9,7 +9,7 @@ public @interface BootstrapServiceConfiguration { @AttributeDefinition(name = "Bootstrap Translation Factory Name", description = "The Unique ID associated with this Translation Factory Connector") - String getTranslationFactory() default "Bootstrap Connector"; + String getTranslationFactory() default "Lilt Connector"; @AttributeDefinition(name = "Enable Preview", description="Preview Enabled for Translation Objects") boolean isPreviewEnabled() default false; @@ -19,7 +19,8 @@ @AttributeDefinition(name = "Export Format", description = "Number values", options = { @Option(label = "XML", value = BootstrapConstants.EXPORT_FORMAT_XML), @Option(label = "XLIFF 1.2", value = BootstrapConstants.EXPORT_FORMAT_XLIFF_1_2), - @Option(label = "XLIFF 2.0", value = BootstrapConstants.EXPORT_FORMAT_XLIFF_2_0)}) + @Option(label = "XLIFF 2.0", value = BootstrapConstants.EXPORT_FORMAT_XLIFF_2_0), + @Option(label = "JSON", value = BootstrapConstants.EXPORT_FORMAT_JSON)}) String getExportFormat() default BootstrapConstants.EXPORT_FORMAT_XML; -} \ No newline at end of file +} diff --git a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapTranslationServiceFactoryImpl.java b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapTranslationServiceFactoryImpl.java index d211c1b..1383f59 100644 --- a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapTranslationServiceFactoryImpl.java +++ b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapTranslationServiceFactoryImpl.java @@ -17,6 +17,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Collections; import org.osgi.framework.Constants; import org.osgi.service.component.annotations.Activate; @@ -35,7 +36,13 @@ import com.adobe.granite.translation.api.TranslationServiceFactory; import com.adobe.granite.translation.bootstrap.tms.core.BootstrapTmsService; import com.adobe.granite.translation.connector.bootstrap.core.BootstrapTranslationCloudConfig; +import com.adobe.granite.translation.connector.bootstrap.core.impl.config.BootstrapTranslationCloudConfigImpl; +import com.adobe.granite.translation.connector.bootstrap.core.impl.LiltApiClient; import com.adobe.granite.translation.core.TranslationCloudConfigUtil; +import org.apache.sling.api.resource.ResourceResolverFactory; +import org.apache.sling.api.resource.Resource; +import org.apache.sling.api.resource.ResourceResolver; +import org.apache.sling.api.resource.LoginException; @Component(service = TranslationServiceFactory.class, immediate = true, configurationPid = "com.adobe.granite.translation.connector.bootstrap.core.impl.BootstrapTranslationServiceFactoryImpl", property = { Constants.SERVICE_DESCRIPTION + "=Configurable settings for the Bootstrap Translation connector", @@ -61,6 +68,9 @@ public class BootstrapTranslationServiceFactoryImpl implements TranslationServic @Reference CryptoSupport cryptoSupport; + @Reference + private ResourceResolverFactory resolverFactory; + @Reference BootstrapTmsService bootstrapTmsService; @@ -68,13 +78,11 @@ public class BootstrapTranslationServiceFactoryImpl implements TranslationServic private BootstrapServiceConfiguration config; - public BootstrapTranslationServiceFactoryImpl() { log.trace("BootstrapTranslationServiceFactoryImpl."); supportedTranslationMethods = new ArrayList(); supportedTranslationMethods.add(TranslationMethod.HUMAN_TRANSLATION); - supportedTranslationMethods.add(TranslationMethod.MACHINE_TRANSLATION); } private static final Logger log = LoggerFactory.getLogger(BootstrapTranslationServiceFactoryImpl.class); @@ -84,26 +92,41 @@ public TranslationService createTranslationService(TranslationMethod translation throws TranslationException { log.trace("BootstrapTranslationServiceFactoryImpl.createTranslationService"); - BootstrapTranslationCloudConfig bootstrapCloudConfg = (BootstrapTranslationCloudConfig) cloudConfigUtil - .getCloudConfigObjectFromPath(BootstrapTranslationCloudConfig.class, cloudConfigPath); - String dummyConfigId = ""; - String dummyServerUrl = ""; + BootstrapTranslationCloudConfig bootstrapCloudConfg = null; + LiltApiClient liltApiClient = null; + + String liltConfigId = ""; + String liltServerUrl = ""; String previewPath = ""; + try { + Map param = new HashMap(); + param.put(ResourceResolverFactory.SUBSERVICE, "bootstrap-service"); + ResourceResolver resourceResolver = resolverFactory.getServiceResourceResolver(param); + Resource res = resourceResolver.getResource(cloudConfigPath); + bootstrapCloudConfg = (BootstrapTranslationCloudConfig) cloudConfigUtil + .getCloudConfigObjectFromPath(res, BootstrapTranslationCloudConfig.class, cloudConfigPath); + if (res != null) { + bootstrapCloudConfg = new BootstrapTranslationCloudConfigImpl(res); + } + } catch (LoginException e) { + log.error("Error while resolving config resource {}", e); + } + if (bootstrapCloudConfg != null) { - dummyConfigId = bootstrapCloudConfg.getDummyConfigId(); - dummyServerUrl = bootstrapCloudConfg.getDummyServerUrl(); + liltConfigId = bootstrapCloudConfg.getLiltConfigId(); + liltServerUrl = bootstrapCloudConfg.getLiltServerUrl(); previewPath = bootstrapCloudConfg.getPreviewPath(); - + liltApiClient = new LiltApiClient(liltServerUrl, liltConfigId); } if (cryptoSupport != null) { try { - if (cryptoSupport.isProtected(dummyConfigId)) { - dummyConfigId = cryptoSupport.unprotect(dummyConfigId); + if (cryptoSupport.isProtected(liltConfigId)) { + liltConfigId = cryptoSupport.unprotect(liltConfigId); } else { - log.trace("Dummy Config ID is not protected"); + log.trace("Lilt Config ID is not protected"); } } catch (CryptoException e) { log.error("Error while decrypting the client secret {}", e); @@ -113,8 +136,8 @@ public TranslationService createTranslationService(TranslationMethod translation Map availableLanguageMap = new HashMap(); Map availableCategoryMap = new HashMap(); return new BootstrapTranslationServiceImpl(availableLanguageMap, availableCategoryMap, factoryName, - isPreviewEnabled, isPseudoLocalizationDisabled, exportFormat, dummyConfigId, dummyServerUrl, - previewPath, translationConfig, bootstrapTmsService); + isPreviewEnabled, isPseudoLocalizationDisabled, exportFormat, liltConfigId, liltServerUrl, + previewPath, translationConfig, liltApiClient, cloudConfigPath); } @Override diff --git a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapTranslationServiceImpl.java b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapTranslationServiceImpl.java index d6d38f7..13f516f 100644 --- a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapTranslationServiceImpl.java +++ b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/BootstrapTranslationServiceImpl.java @@ -13,16 +13,21 @@ package com.adobe.granite.translation.connector.bootstrap.core.impl; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.Optional; import java.util.Random; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -46,10 +51,11 @@ import com.adobe.granite.translation.bootstrap.tms.core.BootstrapTmsConstants; import com.adobe.granite.translation.bootstrap.tms.core.BootstrapTmsService; import com.adobe.granite.translation.connector.bootstrap.core.impl.config.BootstrapTranslationCloudConfigImpl; +import com.adobe.granite.translation.connector.bootstrap.core.impl.LiltApiClient; +import com.adobe.granite.translation.connector.bootstrap.core.impl.LiltApiClient.SourceFile; import com.adobe.granite.translation.core.common.AbstractTranslationService; import com.adobe.granite.translation.core.common.TranslationResultImpl; - public class BootstrapTranslationServiceImpl extends AbstractTranslationService implements TranslationService { private static final Logger log = LoggerFactory.getLogger(BootstrapTranslationServiceImpl.class); @@ -58,15 +64,16 @@ public class BootstrapTranslationServiceImpl extends AbstractTranslationService private static final String ASSET_METADATA = "/asset-metadata"; private static final String I18NCOMPONENTSTRINGDICT = "/i18n-dictionary"; - private static final String SERVICE_LABEL = "bootstrap"; - private static final String SERVICE_ATTRIBUTION = "Translation By Bootstrap"; - private String dummyConfigId = ""; - private String dummyServerUrl = ""; + private static final String SERVICE_LABEL = "Lilt"; + private static final String SERVICE_ATTRIBUTION = "Translation By Lilt"; + private String liltConfigId = ""; + private String liltServerUrl = ""; private String previewPath = ""; private Boolean isPreviewEnabled = false; private Boolean isPseudoLocalizationDisabled = false; private String exportFormat = BootstrapConstants.EXPORT_FORMAT_XML; - private BootstrapTmsService bootstrapTmsService; + private String cloudConfigPath; + private LiltApiClient liltApiClient; private final static String BOOTSTRAP_SERVICE = "bootstrap-service"; @@ -120,25 +127,26 @@ public Map getFinalScope() { // Constructor public BootstrapTranslationServiceImpl(Map availableLanguageMap, - Map availableCategoryMap, String name, Boolean isPreviewEnabled, Boolean isPseudoLocalizationDisabled, String exportFormat, String dummyConfigId, String dummyServerUrl, String previewPath, - TranslationConfig translationConfig, BootstrapTmsService bootstrapTmsService) { + Map availableCategoryMap, String name, Boolean isPreviewEnabled, Boolean isPseudoLocalizationDisabled, String exportFormat, String liltConfigId, String liltServerUrl, String previewPath, + TranslationConfig translationConfig, LiltApiClient liltApiClient, String cloudConfigPath) { super(availableLanguageMap, availableCategoryMap, name, SERVICE_LABEL, SERVICE_ATTRIBUTION, BootstrapTranslationCloudConfigImpl.ROOT_PATH, TranslationMethod.MACHINE_TRANSLATION, translationConfig); log.trace("BootstrapTranslationServiceImpl."); - log.trace("dummyConfigId: {}",dummyConfigId); - log.trace("dummyServerUrl: {}",dummyServerUrl); + log.trace("liltConfigId: {}",liltConfigId); + log.trace("liltServerUrl: {}",liltServerUrl); log.trace("previewPath: {}",previewPath); log.trace("isPreviewEnabled: {}",isPreviewEnabled); log.trace("isPseudoLocalizationDisabled: {}", isPseudoLocalizationDisabled); log.trace("exportFormat: {}",exportFormat); - this.dummyConfigId = dummyConfigId; - this.dummyServerUrl = dummyServerUrl; + this.liltConfigId = liltConfigId; + this.liltServerUrl = liltServerUrl; this.previewPath = previewPath; - this.bootstrapTmsService = bootstrapTmsService; + this.liltApiClient = liltApiClient; this.isPseudoLocalizationDisabled = isPseudoLocalizationDisabled; this.isPreviewEnabled = isPreviewEnabled; - this.exportFormat=exportFormat; + this.exportFormat = exportFormat; + this.cloudConfigPath = cloudConfigPath; } @Override @@ -182,7 +190,7 @@ public TranslationResult translateString(String sourceString, String sourceLangu translatedString = String.format("%s_%s_%s", sourceLanguage, sourceString, targetLanguage); }else { // Using Pseudo translation here using accented characters - translatedString = bootstrapTmsService.getAccentedText(sourceString); + // translatedString = bootstrapTmsService.getAccentedText(sourceString); } return new TranslationResultImpl(translatedString, sourceLanguage, targetLanguage, contentType, contentCategory, sourceString, TranslationResultImpl.UNKNOWN_RATING, null); @@ -231,7 +239,17 @@ public String createTranslationJob(String name, String description, String strSo String strTargetLanguage, Date dueDate, TranslationState state, TranslationMetadata jobMetadata) throws TranslationException { log.trace("BootstrapTranslationServiceImpl.createTranslationJob"); - return bootstrapTmsService.createBootstrapTmsJob(name, strSourceLanguage, strTargetLanguage, dueDate); + String jobInfo = String.format("connector=aem,jobName=%s,srcLang=%s,trgLang=%s,config=%s", name, strSourceLanguage, strTargetLanguage, cloudConfigPath); + if (dueDate != null) { + String dueDateISO8601 = dueDate.toInstant().toString(); + jobInfo = String.format("%s,dueDate=%s", jobInfo, dueDateISO8601); + } + try { + SourceFile[] sourceFiles = liltApiClient.getFiles(null); + } catch (Exception e) { + log.warn("error during createTranslationJob {}", e); + } + return jobInfo; } @Override @@ -243,27 +261,48 @@ public TranslationScope getFinalScope(String strTranslationJobID) throws Transla @Override public TranslationStatus updateTranslationJobState(String strTranslationJobID, TranslationState state) - throws TranslationException { - if(strTranslationJobID=="dummy"){ - log.debug("Dummy Translation job detected"); + throws TranslationException { + if(strTranslationJobID=="lilt"){ + log.debug("Lilt Translation job detected"); } else if(strTranslationJobID == null) { log.debug("Job was never sent to TMS. Updated using Export/Import"); } else { - bootstrapTmsService.setTmsProperty(strTranslationJobID, BootstrapTmsConstants.BOOTSTRAP_TMS_STATUS, state.getStatus().toString()); - log.warn("JOB ID is {}",strTranslationJobID); + // bootstrapTmsService.setTmsProperty(strTranslationJobID, BootstrapTmsConstants.BOOTSTRAP_TMS_STATUS, state.getStatus().toString()); } if(state.getStatus() == TranslationStatus.COMMITTED_FOR_TRANSLATION) { log.trace("Uploaded all Translation Objects in job {}",strTranslationJobID); } - return state.getStatus(); + return state.getStatus(); } @Override public TranslationStatus getTranslationJobStatus(String strTranslationJobID) throws TranslationException { log.trace("BootstrapTranslationServiceImpl.getTranslationJobStatus"); - String status = bootstrapTmsService.getTmsJobStatus(strTranslationJobID); - log.debug("Status for Job {} is {}", strTranslationJobID, status); - return TranslationStatus.fromString(status); + try { + int imported = 0; + int translated = 0; + SourceFile[] files = liltApiClient.getFiles(strTranslationJobID); + // loop backwards through the list since the most recent files will be at the end. + for (SourceFile file : files) { + if (file.labels.contains("status=IMPORTED")) { + imported++; + } + if (file.labels.contains("status=TRANSLATED")) { + translated++; + } + } + boolean hasImported = imported > 0; + boolean hasTranslated = translated > 0; + if (hasImported && hasTranslated) { + return TranslationStatus.TRANSLATED; + } + if (hasImported) { + return TranslationStatus.TRANSLATION_IN_PROGRESS; + } + } catch (Exception e) { + log.warn("error during getTranslationJobStatus {}", e); + } + return TranslationStatus.COMMITTED_FOR_TRANSLATION; } @Override @@ -282,60 +321,129 @@ public void addTranslationJobComment(String strTranslationJobID, Comment comment @Override public InputStream getTranslatedObject(String strTranslationJobID, TranslationObject translationObj) - throws TranslationException { - log.trace("BootstrapTranslationServiceImpl.getTranslatedObject"); - return bootstrapTmsService.getTmsObjectTranslatedInputStream(strTranslationJobID, getObjectPath(translationObj)); + throws TranslationException { + log.trace("BootstrapTranslationServiceImpl.getTranslatedObject"); + String labels = String.format("%s,status=TRANSLATED", strTranslationJobID); + String objectPath = String.format("%s.%s", getObjectPath(translationObj), exportFormat); + try { + SourceFile[] files = liltApiClient.getFiles(labels); + // loop backwards through the list since the most recent files will be at the end. + for (int i = files.length - 1; i >= 0; i--) { + SourceFile file = files[i]; + if (Objects.equals(file.name, objectPath)) { + log.warn("Downloading the translated lilt file {}", file.id); + String translation = liltApiClient.downloadFile(file.id); + return new ByteArrayInputStream(translation.getBytes()); + } + } + } catch (Exception e) { + log.warn("error during getTranslatedObject {}", e); + } + log.info("No translations are available to download for {}", objectPath); + return null; + } + + public Optional getFileExtension(String filename) { + return Optional.ofNullable(filename) + .filter(f -> f.contains(".")) + .map(f -> f.substring(filename.lastIndexOf(".") + 1)); } @Override public String uploadTranslationObject(String strTranslationJobID, TranslationObject translationObject) - throws TranslationException { - - InputStream inputStream; - log.trace("Using {} InputStream", exportFormat); - if (exportFormat.equalsIgnoreCase(BootstrapConstants.EXPORT_FORMAT_XLIFF_1_2)) { - inputStream = translationObject.getTranslationObjectXLIFFInputStream("1.2"); - } else if (exportFormat.equalsIgnoreCase(BootstrapConstants.EXPORT_FORMAT_XLIFF_2_0)) { - inputStream = translationObject.getTranslationObjectXLIFFInputStream("2.0"); - } else { - inputStream = translationObject.getTranslationObjectXMLInputStream(); + throws TranslationException { + + InputStream inputStream; + log.trace("Using {} InputStream", exportFormat); + if (exportFormat.equalsIgnoreCase(BootstrapConstants.EXPORT_FORMAT_XLIFF_1_2)) { + inputStream = translationObject.getTranslationObjectXLIFFInputStream("1.2"); + } else if (exportFormat.equalsIgnoreCase(BootstrapConstants.EXPORT_FORMAT_XLIFF_2_0)) { + inputStream = translationObject.getTranslationObjectXLIFFInputStream("2.0"); + } else if (exportFormat.equalsIgnoreCase(BootstrapConstants.EXPORT_FORMAT_JSON)) { + inputStream = translationObject.getTranslationObjectJSONInputStream(); + } + else { + inputStream = translationObject.getTranslationObjectXMLInputStream(); + } + + String objectPath = getObjectPath(translationObject); + Optional maybeExt = getFileExtension(objectPath); + if (!maybeExt.isPresent()) { + objectPath = String.format("%s.%s", objectPath, exportFormat); + } + String labels = String.format("%s,status=READY", strTranslationJobID); + try { + liltApiClient.uploadFile(objectPath, labels, inputStream); + } catch (Exception e) { + log.warn("error during uploadTranslationObject {}", e); + } + + // Generate Preview + if(isPreviewEnabled) { + try { + ZipInputStream zipInputStream = translationObject.getTranslationObjectPreview(); + if (zipInputStream != null) { + unzipFileFromStream(zipInputStream, previewPath); + } else { + log.error("Got null for zipInputStream for " + getObjectPath(translationObject)); + } + } catch (FileNotFoundException e) { + log.error(e.getLocalizedMessage(), e); + } catch (IOException e) { + log.error(e.getLocalizedMessage(), e); } + } + log.trace("Preview Directory is: {}", previewPath); - String objectPath = bootstrapTmsService.uploadBootstrapTmsObject(strTranslationJobID, getObjectPath(translationObject), inputStream, translationObject.getMimeType(), exportFormat); - - // Generate Preview - if(isPreviewEnabled) { - try { - ZipInputStream zipInputStream = translationObject.getTranslationObjectPreview(); - if (zipInputStream != null) { - unzipFileFromStream(zipInputStream, previewPath); - } else { - log.error("Got null for zipInputStream for " + getObjectPath(translationObject)); - } - } catch (FileNotFoundException e) { - log.error(e.getLocalizedMessage(), e); - } catch (IOException e) { - log.error(e.getLocalizedMessage(), e); - } - } - log.trace("Preview Directory is: {}", previewPath); - - return objectPath; + return objectPath; } @Override public TranslationStatus updateTranslationObjectState(String strTranslationJobID, TranslationObject translationObject, TranslationState state) throws TranslationException { log.trace("BootstrapTranslationServiceImpl.updateTranslationObjectState"); - bootstrapTmsService.setTmsProperty(strTranslationJobID+getObjectPath(translationObject), BootstrapTmsConstants.BOOTSTRAP_TMS_STATUS, state.getStatus().toString()); - return state.getStatus(); + // bootstrapTmsService.setTmsProperty(strTranslationJobID+getObjectPath(translationObject), BootstrapTmsConstants.BOOTSTRAP_TMS_STATUS, state.getStatus().toString()); + return TranslationStatus.TRANSLATED; } @Override - public TranslationStatus getTranslationObjectStatus(String strTranslationJobID, - TranslationObject translationObject) throws TranslationException { - String status = bootstrapTmsService.getTmsObjectStatus(strTranslationJobID, getObjectPath(translationObject)); - return TranslationConstants.TranslationStatus.fromString(status); + public TranslationStatus getTranslationObjectStatus(String strTranslationJobID, TranslationObject translationObject) + throws TranslationException { + log.trace("BootstrapTranslationServiceImpl.getTranslationObjectStatus"); + try { + String objectPath = String.format("%s.%s", getObjectPath(translationObject), exportFormat); + int imported = 0; + int translated = 0; + SourceFile[] files = liltApiClient.getFiles(strTranslationJobID); + // loop backwards through the list since the most recent files will be at the end. + for (SourceFile file : files) { + if (!Objects.equals(file.name, objectPath)) { + continue; + } + if (file.labels.contains("status=IMPORTED")) { + imported++; + } + if (file.labels.contains("status=TRANSLATED")) { + translated++; + } + } + boolean hasImported = imported > 0; + boolean hasTranslated = translated > 0; + if (hasImported && hasTranslated) { + return TranslationStatus.TRANSLATED; + } + if (hasImported) { + return TranslationStatus.TRANSLATION_IN_PROGRESS; + } + // if the object has an extension then it is an image or some sort of asset. we should consider those translated. + Optional maybeExt = getFileExtension(objectPath); + if (maybeExt.isPresent()) { + return TranslationStatus.TRANSLATED; + } + } catch (Exception e) { + log.warn("error during getTranslationObjectStatus {}", e); + } + return TranslationStatus.COMMITTED_FOR_TRANSLATION; } @Override @@ -411,7 +519,7 @@ else if(translationObject.getTitle().equals("I18NCOMPONENTSTRINGDICT")){ public void updateDueDate(String strTranslationJobID, Date date) throws TranslationException { log.debug("NEW DUE DATE:{}",date); - bootstrapTmsService.setTmsJobDuedate(strTranslationJobID, date); + // bootstrapTmsService.setTmsJobDuedate(strTranslationJobID, date); } private static void unzipFileFromStream(ZipInputStream zipInputStream, String targetPath) throws IOException { diff --git a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/LiltApiClient.java b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/LiltApiClient.java new file mode 100644 index 0000000..2989a35 --- /dev/null +++ b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/LiltApiClient.java @@ -0,0 +1,103 @@ +package com.adobe.granite.translation.connector.bootstrap.core.impl; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.net.URISyntaxException; +import java.util.List; +import java.util.stream.Collectors; + +import com.google.gson.Gson; +import org.apache.http.entity.InputStreamEntity; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.ResponseHandler; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.apache.http.client.utils.URIBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LiltApiClient { + private static final Logger log = LoggerFactory.getLogger(LiltApiClient.class); + + String apiUrl; + String apiKey; + + public class SourceFile { + Integer id; + String name; + List labels; + } + + public LiltApiClient(String apiUrl, String apiKey) { + this.apiUrl = apiUrl; + this.apiKey = apiKey; + } + + public SourceFile[] getFiles(String labels) throws IOException, URISyntaxException { + try (CloseableHttpClient httpclient = HttpClients.createDefault()) { + String baseUrl = String.format("%s/files", apiUrl); + URIBuilder req = new URIBuilder(baseUrl); + req.setParameter("key", apiKey); + if (labels != null) { + req.setParameter("labels", labels); + } + HttpGet httpget = new HttpGet(req.build()); + log.warn("Executing request {}", httpget.getRequestLine()); + ResponseHandler responseHandler = response -> { + int status = response.getStatusLine().getStatusCode(); + if (status >= 200 && status < 300) { + HttpEntity entity = response.getEntity(); + return entity != null ? EntityUtils.toString(entity) : null; + } else { + throw new ClientProtocolException("Unexpected response status: " + status); + } + }; + Gson gson = new Gson(); + String response = httpclient.execute(httpget, responseHandler); + SourceFile[] sourceFiles = gson.fromJson(response, SourceFile[].class); + return sourceFiles; + } + } + + public void uploadFile(String name, String labels, InputStream body) throws IOException, URISyntaxException { + try (CloseableHttpClient httpclient = HttpClients.createDefault()) { + String baseUrl = String.format("%s/files", apiUrl); + URIBuilder req = new URIBuilder(baseUrl); + req.setParameter("key", apiKey); + req.setParameter("name", name); + req.setParameter("labels", labels); + HttpPost httppost = new HttpPost(req.build()); + log.warn("Executing request {}", httppost.getRequestLine()); + InputStreamEntity reqEntity = new InputStreamEntity(body); + reqEntity.setContentType("application/octet-stream"); + reqEntity.setChunked(true); + httppost.setEntity(reqEntity); + httpclient.execute(httppost); + } + } + + public String downloadFile(Integer fileId) throws IOException, URISyntaxException { + try (CloseableHttpClient httpclient = HttpClients.createDefault()) { + String baseUrl = String.format("%s/files/download", apiUrl); + URIBuilder req = new URIBuilder(baseUrl); + req.setParameter("key", apiKey); + req.setParameter("id", Integer.toString(fileId)); + HttpGet httpget = new HttpGet(req.build()); + log.warn("Executing request {}", httpget.getRequestLine()); + HttpResponse response = httpclient.execute(httpget); + HttpEntity entity = response.getEntity(); + InputStream content = entity.getContent(); + return new BufferedReader(new InputStreamReader(content, StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); + } + } +} diff --git a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/config/BootstrapTranslationAdapterFactory.java b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/config/BootstrapTranslationAdapterFactory.java index 8534795..371ce70 100644 --- a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/config/BootstrapTranslationAdapterFactory.java +++ b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/config/BootstrapTranslationAdapterFactory.java @@ -13,20 +13,21 @@ package com.adobe.granite.translation.connector.bootstrap.core.impl.config; +import com.adobe.granite.translation.api.TranslationException; +import com.adobe.granite.translation.connector.bootstrap.core.BootstrapTranslationCloudConfig; +import com.adobe.granite.translation.core.TranslationCloudConfigUtil; import javax.jcr.Node; - +import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.Property; +import org.apache.felix.scr.annotations.Reference; +import org.apache.felix.scr.annotations.Service; import org.apache.sling.api.adapter.AdapterFactory; import org.apache.sling.api.resource.Resource; -import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.adobe.granite.translation.api.TranslationException; -import com.adobe.granite.translation.connector.bootstrap.core.BootstrapTranslationCloudConfig; -import com.adobe.granite.translation.core.TranslationCloudConfigUtil; - -@Component(service = AdapterFactory.class) +@Component +@Service(value = AdapterFactory.class) public class BootstrapTranslationAdapterFactory implements AdapterFactory { @Reference @@ -34,9 +35,16 @@ public class BootstrapTranslationAdapterFactory implements AdapterFactory private final Logger log = LoggerFactory.getLogger(getClass()); + private static final Class RESOURCE_CLASS = Resource.class; + private static final Class NODE_CLASS = Node.class; private static final Class TRANSLATION_CLOUD_CONFIG_CLASS = - BootstrapTranslationCloudConfig.class; + BootstrapTranslationCloudConfig.class; + + @Property(name = "adapters") + protected static final String[] ADAPTER_CLASSES = {TRANSLATION_CLOUD_CONFIG_CLASS.getName()}; + @Property(name = "adaptables") + protected static final String[] ADAPTABLE_CLASSES = {RESOURCE_CLASS.getName(), NODE_CLASS.getName()}; // ---------- AdapterFactory ----------------------------------------------- diff --git a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/config/BootstrapTranslationCloudConfigImpl.java b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/config/BootstrapTranslationCloudConfigImpl.java index ceadba9..09df0b4 100644 --- a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/config/BootstrapTranslationCloudConfigImpl.java +++ b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/core/impl/config/BootstrapTranslationCloudConfigImpl.java @@ -25,8 +25,8 @@ public class BootstrapTranslationCloudConfigImpl implements BootstrapTranslationCloudConfig { private static final Logger log = LoggerFactory.getLogger(BootstrapTranslationCloudConfigImpl.class); - private String dummyServerUrl; - private String dummyConfigId; + private String liltServerUrl; + private String liltConfigId; private String previewPath; public BootstrapTranslationCloudConfigImpl(Resource translationConfigResource) throws TranslationException { @@ -42,14 +42,14 @@ public BootstrapTranslationCloudConfigImpl(Resource translationConfigResource) t if (configContent != null) { ValueMap properties = configContent.adaptTo(ValueMap.class); - this.dummyServerUrl = properties.get(PROPERTY_DUMMY_SERVER_URL, ""); - this.dummyConfigId = properties.get(PROPERTY_DUMMY_CONFIG_ID, ""); + this.liltServerUrl = properties.get(PROPERTY_LILT_SERVER_URL, ""); + this.liltConfigId = properties.get(PROPERTY_LILT_CONFIG_ID, ""); this.previewPath = properties.get(PROPERTY_PREVIEW_PATH, ""); if (log.isTraceEnabled()) { log.trace("Created Bootstrap Cloud Config with the following:"); - log.trace("dummyServerUrl: {}", dummyServerUrl); - log.trace("dummyConfigId: {}", dummyConfigId); + log.trace("liltServerUrl: {}", liltServerUrl); + log.trace("liltConfigId: {}", liltConfigId); log.trace("previewPath: {}", previewPath); } @@ -59,18 +59,18 @@ public BootstrapTranslationCloudConfigImpl(Resource translationConfigResource) t } } - public String getDummyServerUrl() { - log.trace("BootstrapTranslationCloudConfigImpl.getDummyServerUrl"); - return dummyServerUrl; + public String getLiltServerUrl() { + log.trace("BootstrapTranslationCloudConfigImpl.getLiltServerUrl"); + return liltServerUrl; } - public String getDummyConfigId() { - log.trace("BootstrapTranslationCloudConfigImpl.getDummyConfigId"); - return dummyConfigId; + public String getLiltConfigId() { + log.trace("BootstrapTranslationCloudConfigImpl.getLiltConfigId"); + return liltConfigId; } public String getPreviewPath(){ log.trace("BootstrapTranslationCloudConfigImpl.gePreviewPath"); return previewPath; } -} \ No newline at end of file +} diff --git a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/ui/models/BootStrapTranslationConnectorModel.java b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/ui/models/BootStrapTranslationConnectorModel.java index d6abf68..41a69a6 100755 --- a/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/ui/models/BootStrapTranslationConnectorModel.java +++ b/core/src/main/java/com/adobe/granite/translation/connector/bootstrap/ui/models/BootStrapTranslationConnectorModel.java @@ -55,11 +55,11 @@ public void postConstruct() throws Exception { * Get the server url for the configuration */ public String getServerUrl() { - return BootStrapModelUtils.getStringPropertyFromContent(bootStrapConfigResource, BootstrapTranslationCloudConfig.PROPERTY_DUMMY_SERVER_URL, logger); + return BootStrapModelUtils.getStringPropertyFromContent(bootStrapConfigResource, BootstrapTranslationCloudConfig.PROPERTY_LILT_SERVER_URL, logger); } public String getServiceId() { - return BootStrapModelUtils.getStringPropertyFromContent(bootStrapConfigResource, BootstrapTranslationCloudConfig.PROPERTY_DUMMY_CONFIG_ID, logger); + return BootStrapModelUtils.getStringPropertyFromContent(bootStrapConfigResource, BootstrapTranslationCloudConfig.PROPERTY_LILT_CONFIG_ID, logger); } public String getPreviewDirectory() { diff --git a/pom.xml b/pom.xml index 4c72e55..f5a7303 100644 --- a/pom.xml +++ b/pom.xml @@ -17,24 +17,34 @@ 4.0.0 com.adobe.granite.translation.connector - bootstrap-connector - Bootstrap Translation Connector + lilt-connector + Lilt Translation Connector pom - 2.0-SNAPSHOT - Bootstrap Translation Connector + 1.0.2 + Lilt Translation Connector core ui.apps + ui.content - scm:git:https://github.com/Adobe-Marketing-Cloud/aem-translation-framework-bootstrap-connector.git - scm:git:https://github.com/Adobe-Marketing-Cloud/aem-translation-framework-bootstrap-connector.git - https://github.com/Adobe-Marketing-Cloud/aem-translation-framework-bootstrap-connector + scm:git:https://github.com/lilt/aem-translation-framework-bootstrap-connector.git + scm:git:https://github.com/lilt/aem-translation-framework-bootstrap-connector.git + https://github.com/lilt/aem-translation-framework-bootstrap-connector HEAD + + + + project.local + project + file:///${project.basedir}/repository + + + localhost 4502 @@ -138,6 +148,24 @@ maven-clean-plugin 3.0.0 + + + org.apache.felix + maven-scr-plugin + + + generate-scr-scrdescriptor + + scr + + + + Adobe Systems Incorporated + + + + + org.apache.maven.plugins @@ -477,7 +505,14 @@ + + + org.apache.felix + org.apache.felix.scr.annotations + 1.9.6 + provided + org.osgi osgi.core @@ -506,9 +541,8 @@ com.adobe.aem - uber-jar - 6.3.0 - apis + aem-sdk-api + 2023.4.11835.20230414T234523Z-230200 provided @@ -539,7 +573,34 @@ 5.7.4 provided + + org.apache.httpcomponents + httpclient + 4.5 + provided + + + com.google.code.gson + gson + 2.8.5 + provided + + + + com.adobe.granite.translation + bootstrap-tms.core + 4.0 + provided + + + + github + GitHub OWNER Apache Maven Packages + https://maven.pkg.github.com/lilt/aem-translation-framework-bootstrap-connector + + + diff --git a/ui.apps/pom.xml b/ui.apps/pom.xml index cd853be..4d4679c 100644 --- a/ui.apps/pom.xml +++ b/ui.apps/pom.xml @@ -22,18 +22,18 @@ com.adobe.granite.translation.connector - bootstrap-connector - 2.0-SNAPSHOT + lilt-connector + 1.0.2 ../pom.xml - bootstrap-connector.ui.apps + lilt-connector.ui.apps content-package Bootstrap Translation Connector - UI apps - Bootstrap connector implementation for the Granite Translation API. This connector provides a reference implementation of the API. Please visit www.adobe.com for more details. + Lilt connector implementation for the Granite Translation API. + merge + com.adobe.granite.translation.connector - bootstrap-connector.core + lilt-connector.core + /apps/bootstrap-connector/install + + + com.adobe.granite.translation + bootstrap-tms.core /apps/bootstrap-connector/install + + + com.adobe.granite.translation.connector + lilt-connector.ui.content + [${project.version},) + + @@ -118,14 +135,13 @@ com.adobe.granite.translation.connector - bootstrap-connector.core - 2.0-SNAPSHOT + lilt-connector.core + ${project.version} com.adobe.aem - uber-jar - apis + aem-sdk-api @@ -142,5 +158,11 @@ com.day.cq.wcm cq-wcm-taglib + + + com.adobe.granite.translation + bootstrap-tms.core + provided + diff --git a/ui.apps/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.jar b/ui.apps/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.jar new file mode 100644 index 0000000..7d92f57 Binary files /dev/null and b/ui.apps/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.jar differ diff --git a/ui.apps/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.pom b/ui.apps/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.pom new file mode 100644 index 0000000..f6f57a3 --- /dev/null +++ b/ui.apps/repository/com/adobe/granite/translation/bootstrap-tms.core/4.0/bootstrap-tms.core-4.0.pom @@ -0,0 +1,9 @@ + + + 4.0.0 + com.adobe.granite.translation + bootstrap-tms.core + 4.0 + POM was created from install:install-file + diff --git a/ui.apps/repository/com/adobe/granite/translation/bootstrap-tms.core/maven-metadata-local.xml b/ui.apps/repository/com/adobe/granite/translation/bootstrap-tms.core/maven-metadata-local.xml new file mode 100644 index 0000000..3ee6949 --- /dev/null +++ b/ui.apps/repository/com/adobe/granite/translation/bootstrap-tms.core/maven-metadata-local.xml @@ -0,0 +1,12 @@ + + + com.adobe.granite.translation + bootstrap-tms.core + + 4.0 + + 4.0 + + 20200730102420 + + diff --git a/ui.apps/src/main/content/META-INF/vault/definition/thumbnail.png b/ui.apps/src/main/content/META-INF/vault/definition/thumbnail.png index f795136..7c7c8b7 100644 Binary files a/ui.apps/src/main/content/META-INF/vault/definition/thumbnail.png and b/ui.apps/src/main/content/META-INF/vault/definition/thumbnail.png differ diff --git a/ui.apps/src/main/content/META-INF/vault/filter.xml b/ui.apps/src/main/content/META-INF/vault/filter.xml index 192c8d4..aefc396 100644 --- a/ui.apps/src/main/content/META-INF/vault/filter.xml +++ b/ui.apps/src/main/content/META-INF/vault/filter.xml @@ -1,7 +1,7 @@ - - - + + + diff --git a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-bootstrap.xml b/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-bootstrap.xml index 2110ff5..af54772 100644 --- a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-bootstrap.xml +++ b/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-bootstrap.xml @@ -2,4 +2,4 @@ + user.mapping="[com.adobe.granite.translation.bootstrap-tms.core:bootstrap-service=bootstrap-service,com.adobe.granite.translation.connector.lilt-connector.core:bootstrap-service=bootstrap-service]"/> diff --git a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/bootstrap-connector-servicepage/.content.xml b/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/bootstrap-connector-servicepage/.content.xml index 6e7e035..639c6c9 100644 --- a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/bootstrap-connector-servicepage/.content.xml +++ b/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/bootstrap-connector-servicepage/.content.xml @@ -2,7 +2,7 @@
- To get a free trial account visit www.adobe.com/bootstrap.html -
\ No newline at end of file + To learn how to get an account visit https://lilt.com/ + diff --git a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/forms/editFormWithTabs.html b/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/forms/editFormWithTabs.html index 99bcaf6..98851fc 100755 --- a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/forms/editFormWithTabs.html +++ b/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/forms/editFormWithTabs.html @@ -24,12 +24,12 @@

${'Bootstrap Translation Connector Settings' @i18n, loca - - + + - - + + diff --git a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/forms/editform.html b/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/forms/editform.html index a056a30..16e57eb 100755 --- a/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/forms/editform.html +++ b/ui.apps/src/main/content/jcr_root/apps/bootstrap-connector/templates/forms/editform.html @@ -10,24 +10,24 @@ -

${'Bootstrap Translation Connector Settings' @i18n, locale=request.locale}

+

${'Lilt Connector Settings' @i18n, locale=request.locale}

- - + + - - + + - - - + + + - \ No newline at end of file + diff --git a/ui.apps/src/main/content/jcr_root/apps/settings/_rep_policy.xml b/ui.apps/src/main/content/jcr_root/apps/settings/_rep_policy.xml new file mode 100644 index 0000000..3ae4465 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/apps/settings/_rep_policy.xml @@ -0,0 +1,8 @@ + + + + diff --git a/ui.apps/src/main/content/jcr_root/conf/global/settings/cloudconfigs/.content.xml b/ui.apps/src/main/content/jcr_root/apps/settings/cloudconfigs/.content.xml similarity index 100% rename from ui.apps/src/main/content/jcr_root/conf/global/settings/cloudconfigs/.content.xml rename to ui.apps/src/main/content/jcr_root/apps/settings/cloudconfigs/.content.xml diff --git a/ui.apps/src/main/content/jcr_root/conf/global/settings/cloudconfigs/translation/.content.xml b/ui.apps/src/main/content/jcr_root/apps/settings/cloudconfigs/translation/.content.xml similarity index 100% rename from ui.apps/src/main/content/jcr_root/conf/global/settings/cloudconfigs/translation/.content.xml rename to ui.apps/src/main/content/jcr_root/apps/settings/cloudconfigs/translation/.content.xml diff --git a/ui.apps/src/main/content/jcr_root/conf/global/settings/cloudconfigs/translation/bootstrap-translation/.content.xml b/ui.apps/src/main/content/jcr_root/apps/settings/cloudconfigs/translation/lilt-translation/.content.xml similarity index 80% rename from ui.apps/src/main/content/jcr_root/conf/global/settings/cloudconfigs/translation/bootstrap-translation/.content.xml rename to ui.apps/src/main/content/jcr_root/apps/settings/cloudconfigs/translation/lilt-translation/.content.xml index 4c1eee0..3fc240e 100755 --- a/ui.apps/src/main/content/jcr_root/conf/global/settings/cloudconfigs/translation/bootstrap-translation/.content.xml +++ b/ui.apps/src/main/content/jcr_root/apps/settings/cloudconfigs/translation/lilt-translation/.content.xml @@ -5,21 +5,21 @@ cq:lastModified="{Date}2012-01-10T16:53:07.216+01:00" cq:lastModifiedBy="admin" cq:template="/apps/bootstrap-connector/templates/bootstrap-connector-servicepage" - jcr:description="Bootstrap translation connector desciption" + jcr:description="Translate with the Lilt Connector." jcr:primaryType="cq:PageContent" - jcr:title="Bootstrap Connector" + jcr:title="Lilt Connector" cq:configTemplate="/apps/bootstrap-connector/templates/bootstrap-connector-servicepage" editformPath="/apps/bootstrap-connector/templates/forms/editform.html" descriptionPath="/apps/bootstrap-connector/templates/forms/description.html" sling:resourceType="cq/cloudserviceconfigs/components/servicepage" - descriptionExtended="Bootstrap Connector description extended." - description="Translate with Bootstrap Connector." + descriptionExtended="Translate with the Lilt Connector." + description="Translate with the Lilt Connector." inclusionRank="{Long}202" mergeList="true" ranking="10" allowMultiple="{Boolean}true" serviceAdminUrl="http://www.adobe.com/bootstrap-connector/getting-started" serviceUrl="http://www.adobe.com/bootstrap-connector/learn-more" - serviceUrlLabel="Bootstrap Connector" + serviceUrlLabel="Lilt Connector" thumbnailPath="/apps/bootstrap-connector/templates/bootstrap-connector-servicepage/thumbnail.png"/> diff --git a/ui.apps/src/main/content/jcr_root/content/_rep_policy.xml b/ui.apps/src/main/content/jcr_root/content/_rep_policy.xml new file mode 100644 index 0000000..c860d94 --- /dev/null +++ b/ui.apps/src/main/content/jcr_root/content/_rep_policy.xml @@ -0,0 +1,8 @@ + + + + diff --git a/ui.content/pom.xml b/ui.content/pom.xml new file mode 100644 index 0000000..4b2292a --- /dev/null +++ b/ui.content/pom.xml @@ -0,0 +1,81 @@ + + + + 4.0.0 + + + + + + com.adobe.granite.translation.connector + lilt-connector + 1.0.2 + ../pom.xml + + + + + + lilt-connector.ui.content + + content-package + Bootstrap Translation Connector - UI contents + + + + + + + + + + + org.apache.jackrabbit + filevault-package-maven-plugin + true + + merge_preserve + com.adobe.granite.translation.connector + + + + com.day.jcr.vault + content-package-maven-plugin + true + + true + true + + + + + + + + + + + javax.jcr + jcr + + + + javax.servlet + servlet-api + + + diff --git a/ui.content/src/main/content/META-INF/vault/config.xml b/ui.content/src/main/content/META-INF/vault/config.xml new file mode 100644 index 0000000..941af6c --- /dev/null +++ b/ui.content/src/main/content/META-INF/vault/config.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ui.content/src/main/content/META-INF/vault/definition/.content.xml b/ui.content/src/main/content/META-INF/vault/definition/.content.xml new file mode 100644 index 0000000..c1025f1 --- /dev/null +++ b/ui.content/src/main/content/META-INF/vault/definition/.content.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/ui.content/src/main/content/META-INF/vault/filter.xml b/ui.content/src/main/content/META-INF/vault/filter.xml new file mode 100644 index 0000000..a6b97a3 --- /dev/null +++ b/ui.content/src/main/content/META-INF/vault/filter.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ui.content/src/main/content/META-INF/vault/settings.xml b/ui.content/src/main/content/META-INF/vault/settings.xml new file mode 100644 index 0000000..9dddd3f --- /dev/null +++ b/ui.content/src/main/content/META-INF/vault/settings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/ui.apps/src/main/content/jcr_root/home/users/system/bootstrap-service/.content.xml b/ui.content/src/main/content/jcr_root/home/users/system/bootstrap-service/.content.xml similarity index 100% rename from ui.apps/src/main/content/jcr_root/home/users/system/bootstrap-service/.content.xml rename to ui.content/src/main/content/jcr_root/home/users/system/bootstrap-service/.content.xml diff --git a/ui.content/src/main/content/jcr_root/home/users/system/bootstrap-service/_rep_policy.xml b/ui.content/src/main/content/jcr_root/home/users/system/bootstrap-service/_rep_policy.xml new file mode 100644 index 0000000..4ac39ba --- /dev/null +++ b/ui.content/src/main/content/jcr_root/home/users/system/bootstrap-service/_rep_policy.xml @@ -0,0 +1,8 @@ + + + + diff --git a/ui.apps/src/main/content/jcr_root/var/bootstrap-tms/.content.xml b/ui.content/src/main/content/jcr_root/var/bootstrap-tms/.content.xml similarity index 100% rename from ui.apps/src/main/content/jcr_root/var/bootstrap-tms/.content.xml rename to ui.content/src/main/content/jcr_root/var/bootstrap-tms/.content.xml