diff --git a/changes.xml b/changes.xml index ea9b42e5..4fa83b00 100644 --- a/changes.xml +++ b/changes.xml @@ -27,6 +27,9 @@ Update dependencies. + + Remove Site API options. + diff --git a/src/main/resources/META-INF/archetype-post-generate.groovy b/src/main/resources/META-INF/archetype-post-generate.groovy index 3366f036..6061d766 100644 --- a/src/main/resources/META-INF/archetype-post-generate.groovy +++ b/src/main/resources/META-INF/archetype-post-generate.groovy @@ -7,7 +7,6 @@ import groovy.util.XmlSlurper def rootDir = new File(request.getOutputDirectory() + "/" + request.getArtifactId()) def javaPackage = request.getProperties().get("package") -def javaPackagePath = javaPackage.replace('.','/') def optionAemVersion = request.getProperties().get("optionAemVersion") def optionAemServicePack = request.getProperties().get("optionAemServicePack") def optionAemServicePackAPI = request.getProperties().get("optionAemServicePackAPI") @@ -16,13 +15,10 @@ def optionEditableTemplates = request.getProperties().get("optionEditableTemplat def optionMultiBundleLayout = request.getProperties().get("optionMultiBundleLayout") def optionContextAwareConfig = request.getProperties().get("optionContextAwareConfig") def optionWcmioHandler = request.getProperties().get("optionWcmioHandler") -def optionWcmioSiteApi = request.getProperties().get("optionWcmioSiteApi") -def optionWcmioSiteApiGenericEdit = request.getProperties().get("optionWcmioSiteApiGenericEdit") def optionIntegrationTests = request.getProperties().get("optionIntegrationTests") def coreBundle = new File(rootDir, "bundles/core") def clientlibsBundle = new File(rootDir, "bundles/clientlibs") -def siteApiSpecBundle = new File(rootDir, "bundles/site-api-spec") def completeContentPackage = new File(rootDir, "content-packages/complete") def confContentPackage = new File(rootDir, "content-packages/conf-content") def sampleContentPackage = new File(rootDir, "content-packages/sample-content") @@ -32,7 +28,6 @@ def frontend = new File(rootDir, "frontend") def rootPom = new File(rootDir, "pom.xml") def parentPom = new File(rootDir, "parent/pom.xml") def tests = new File(rootDir, "tests") -def integrationTests = new File(rootDir, "tests/integration") // validate parameters - throw exceptions for invalid combinations if ((optionAemServicePack=="y" || optionAemServicePackAPI=="y") && optionAemVersion == "cloud") { @@ -50,15 +45,6 @@ if (optionWcmioHandler == "y" && optionContextAwareConfig == "n") { if (optionEditableTemplates == "n" && optionWcmioHandler == "n") { throw new RuntimeException("You have to specify either parameter optionEditableTemplates='y' or optionWcmioHandler='y'.") } -if (optionWcmioSiteApi == "y" && optionWcmioHandler == "n") { - throw new RuntimeException("Parameter optionSiteApi='y' is only supported with optionWcmioHandler='y'.") -} -if (optionWcmioSiteApiGenericEdit == "y" && optionWcmioSiteApi == "n") { - throw new RuntimeException("Parameter optionWcmioSiteApiGenericEdit='y' is only supported with optionWcmioSiteApi='y'.") -} -if (optionWcmioSiteApiGenericEdit == "y" && optionFrontend == "y") { - throw new RuntimeException("Parameter optionWcmioSiteApiGenericEdit='y' is not allowed together with optionFrontend='y'.") -} if (!(javaPackage ==~ /^[a-z0-9\.]+$/)) { throw new RuntimeException("Java package name is invalid: " + javaPackage) } @@ -94,26 +80,18 @@ else { // remove frontend module entry from root pom removeModule(rootPom, "frontend") } -if (optionWcmioSiteApiGenericEdit == "y") { - assert clientlibsBundle.deleteDir() - assert new File(uiAppsPackage, "jcr_root/apps/${projectName}/clientlibs").deleteDir() - // remove bundles/clientlibs module entry from root pom - removeModule(rootPom, "bundles/clientlibs") -} // remove files only relevant for wcm.io Handler projects if (optionWcmioHandler == "n") { - assert new File(coreBundle, "src/main/java/${javaPackagePath}/config").deleteDir() + assert new File(coreBundle, "src/main/java/" + javaPackage.replace('.','/') + "/config").deleteDir() assert new File(coreBundle, "src/main/webapp/app-root/templates/admin/redirect").deleteDir() assert new File(coreBundle, "src/main/webapp/app-root/templates/admin/redirect.json").delete() assert new File(coreBundle, "src/main/webapp/app-root/components/admin/page/redirect.json").delete() assert new File(coreBundle, "src/main/webapp/app-root/components/content/responsiveimage.json").delete() - if (optionWcmioSiteApiGenericEdit == "n") { - assert new File(clientlibsBundle, "src/main/webapp/clientlibs-root/${projectName}.app/css").deleteDir() - assert new File(uiAppsPackage, "jcr_root/apps/${projectName}/clientlibs/${projectName}.app/css").deleteDir() - } + assert new File(clientlibsBundle, "src/main/webapp/clientlibs-root/${projectName}.app/css").deleteDir() + assert new File(uiAppsPackage, "jcr_root/apps/${projectName}/clientlibs/${projectName}.app/css").deleteDir() if (optionFrontend == "y") { assert new File(frontend, "src/components/customcarousel/customcarousel.scss").delete() @@ -132,24 +110,8 @@ else { assert new File(uiAppsPackage, "jcr_root/apps/${projectName}/core/components/admin/page/structureElement/structureElement.html").delete() } -// remove empty component HTL files -[ - new File(coreBundle, "src/main/webapp/app-root/components"), - new File(uiAppsPackage, "jcr_root/apps/${projectName}/core/component") -].each { componentsFolder -> - if (componentsFolder.exists()) { - componentsFolder.eachFileRecurse(FileType.FILES) { file -> - if (file.name =~ /\.html$/) { - if (file.getText("UTF-8").empty) { - assert file.delete() - } - } - } - } -} - // refactor project layout when multi bundle layout is switched off -if (optionMultiBundleLayout == "n" && optionWcmioSiteApiGenericEdit == "n") { +if (optionMultiBundleLayout == "n") { // move .gitignore for clientlibs-root if (optionFrontend == "y") { assert new File(clientlibsBundle, ".gitignore").renameTo(new File(coreBundle, ".gitignore")) @@ -262,27 +224,10 @@ else { assert new File(configDefinition, "src/main/environments/cloud.yaml").delete() } -if (optionWcmioSiteApi == "n") { - assert new File(coreBundle, "src/main/java/${javaPackagePath}/reference").deleteDir() - assert new File(coreBundle, "src/test/java/${javaPackagePath}/reference").deleteDir() - removeModule(rootPom, "bundles/site-api-spec") - siteApiSpecBundle.deleteDir() -} - if (optionIntegrationTests == "n") { removeModule(rootPom, "tests/integration") tests.deleteDir() } -else if (optionWcmioSiteApi == "y") { - // remove non-Site API integration test code - assert new File(integrationTests, "src/main/java/${javaPackagePath}/it/components").deleteDir() - assert new File(integrationTests, "src/main/java/${javaPackagePath}/it/rules").deleteDir() - assert new File(integrationTests, "src/main/java/${javaPackagePath}/it/tests").deleteDir() -} -else { - // remove Site API integration test code - assert new File(integrationTests, "src/main/java/${javaPackagePath}/it/siteapi").deleteDir() -} // convert all line endings to unix-style diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml index d4e3c5d7..1ef7d39a 100644 --- a/src/main/resources/META-INF/maven/archetype-metadata.xml +++ b/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -123,16 +123,6 @@ n ^(y|n)$ - - - n - ^(y|n)$ - - - - n - ^(y|n)$ - n @@ -272,33 +262,6 @@ - - - - src/spec - - **/*.yaml - - - - src/test/java - - **/*.java - - - - - - index.html - package.json - README.md - webpack.config.js - src/index.js - - - - - @@ -443,7 +406,6 @@ README.md - run-integration-tests-locally.sh diff --git a/src/main/resources/archetype-resources/archetype.properties b/src/main/resources/archetype-resources/archetype.properties index 25ca9130..51fa13c2 100644 --- a/src/main/resources/archetype-resources/archetype.properties +++ b/src/main/resources/archetype-resources/archetype.properties @@ -23,6 +23,5 @@ optionContextAwareConfig=${optionContextAwareConfig} optionFrontend=${optionFrontend} optionNodeJsPlugin=${optionNodeJsPlugin} optionWcmioHandler=${optionWcmioHandler} -optionWcmioSiteApi=${optionWcmioSiteApi} optionAcsCommons=${optionAcsCommons} optionIntegrationTests=${optionIntegrationTests} diff --git a/src/main/resources/archetype-resources/bundles/core/pom.xml b/src/main/resources/archetype-resources/bundles/core/pom.xml index a4e6aeaa..7b053584 100644 --- a/src/main/resources/archetype-resources/bundles/core/pom.xml +++ b/src/main/resources/archetype-resources/bundles/core/pom.xml @@ -117,30 +117,6 @@ io.wcm.wcm.ui.clientlibs compile -#if ( $optionWcmioSiteApi == "y" ) - - io.wcm - io.wcm.site-api.processor - compile - - - io.wcm - io.wcm.site-api.handler - compile - -#end -#if ( $optionWcmioSiteApiGenericEdit == "y" ) - - io.wcm - io.wcm.site-api.generic-edit - compile - - - io.wcm - io.wcm.site-api.generic-edit.handler - compile - -#end #end @@ -204,37 +180,11 @@ io.wcm.testing.wcm-io-mock.wcm test -#if ( $optionWcmioSiteApi == "y" ) - - io.wcm - io.wcm.testing.wcm-io-mock.site-api.processor - test - -#end io.wcm io.wcm.testing.wcm-io-mock.handler test -#if ( $optionWcmioSiteApi == "y" ) - - io.wcm - io.wcm.testing.wcm-io-mock.site-api.handler - test - -#end -#if ( $optionWcmioSiteApiGenericEdit == "y" ) - - io.wcm - io.wcm.testing.wcm-io-mock.site-api.generic-edit - test - - - io.wcm - io.wcm.testing.wcm-io-mock.site-api.generic-edit.handler - test - -#end #end diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/java/config/impl/LinkHandlerConfigImpl.java b/src/main/resources/archetype-resources/bundles/core/src/main/java/config/impl/LinkHandlerConfigImpl.java index d106a668..77b02c2d 100644 --- a/src/main/resources/archetype-resources/bundles/core/src/main/java/config/impl/LinkHandlerConfigImpl.java +++ b/src/main/resources/archetype-resources/bundles/core/src/main/java/config/impl/LinkHandlerConfigImpl.java @@ -12,23 +12,12 @@ import com.day.cq.wcm.api.Page; -#if ( $optionWcmioSiteApi == "y" ) -import io.wcm.handler.link.markup.SimpleLinkMarkupBuilder; -#end import io.wcm.handler.link.spi.LinkHandlerConfig; -#if ( $optionWcmioSiteApi == "y" ) -import io.wcm.handler.link.spi.LinkMarkupBuilder; -import io.wcm.handler.link.spi.LinkProcessor; -#end import io.wcm.handler.link.spi.LinkType; import io.wcm.handler.link.type.ExternalLinkType; import io.wcm.handler.link.type.InternalCrossContextLinkType; import io.wcm.handler.link.type.InternalLinkType; import io.wcm.handler.link.type.MediaLinkType; -#if ( $optionWcmioSiteApi == "y" ) -import io.wcm.siteapi.handler.link.SiteApiLinkMarkupBuilder; -import io.wcm.siteapi.handler.link.SiteApiLinkPreProcessor; -#end import io.wcm.wcm.commons.util.Template; import ${package}.config.AppTemplate; @@ -45,35 +34,12 @@ public class LinkHandlerConfigImpl extends LinkHandlerConfig { ExternalLinkType.class, MediaLinkType.class); -#if ( $optionWcmioSiteApi == "y" ) - private static final List> PRE_PROCESSORS = List.of( - SiteApiLinkPreProcessor.class); - - private static final List> LINK_MARKUP_BUILDERS = List.of( - SiteApiLinkMarkupBuilder.class, - SimpleLinkMarkupBuilder.class); - -#end @Override @SuppressWarnings("squid:S2384") // returned list is immutable public @NotNull List> getLinkTypes() { return LINK_TYPES; } -#if ( $optionWcmioSiteApi == "y" ) - @Override - @SuppressWarnings("squid:S2384") // returned list is immutable - public @NotNull List> getPreProcessors() { - return PRE_PROCESSORS; - } - - @Override - @SuppressWarnings("squid:S2384") // returned list is immutable - public @NotNull List> getMarkupBuilders() { - return LINK_MARKUP_BUILDERS; - } - -#end @Override public boolean isValidLinkTarget(@NotNull Page page) { return !Template.is(page, AppTemplate.ADMIN_STRUCTURE_ELEMENT); diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/LinkReference.java b/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/LinkReference.java deleted file mode 100644 index a2e8cb82..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/LinkReference.java +++ /dev/null @@ -1,61 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}.reference; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import com.day.cq.wcm.api.Page; - -import io.wcm.handler.link.Link; - -/** - * Represents a link in Site API. - */ -public class LinkReference { - - private final Link link; - - /** - * @param link Valid link - */ - public LinkReference(Link link) { - this.link = link; - } - - /** - * @return Link type - */ - public @NotNull String getType() { - return link.getLinkType().getId(); - } - - /** - * @return Link URL - */ - public @NotNull String getUrl() { - return link.getUrl(); - } - - /** - * @return Link window target - */ - public @Nullable String getTarget() { - return link.getLinkRequest().getLinkArgs().getWindowTarget(); - } - - /** - * @return Page path (for internal links) - */ - public @Nullable String getPath() { - Page page = link.getTargetPage(); - if (page != null) { - return page.getPath(); - } - else { - return null; - } - } - -} diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/MediaReference.java b/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/MediaReference.java deleted file mode 100644 index 9c1186a7..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/MediaReference.java +++ /dev/null @@ -1,48 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}.reference; - -import java.util.Collection; - -import org.jetbrains.annotations.NotNull; - -import io.wcm.handler.media.Media; -import io.wcm.handler.media.Rendition; - -/** - * Represents a media reference in Site API. - */ -public class MediaReference { - - private final Media media; - - /** - * @param media Valid media - */ - public MediaReference(Media media) { - this.media = media; - } - - /** - * @return Main asset URL - */ - public @NotNull String getUrl() { - return media.getUrl(); - } - - /** - * @return Asset path - */ - public @NotNull String getPath() { - return media.getAsset().getPath(); - } - - /** - * @return Renditions - */ - public Collection getRenditions() { - return media.getRenditions(); - } - -} diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/impl/LinkReferenceDecorator.java b/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/impl/LinkReferenceDecorator.java deleted file mode 100644 index 77d519a1..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/impl/LinkReferenceDecorator.java +++ /dev/null @@ -1,26 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}.reference.impl; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.osgi.service.component.annotations.Component; - -import io.wcm.handler.link.Link; -import io.wcm.siteapi.handler.link.LinkDecorator; - -import ${package}.reference.LinkReference; - -/** - * Decorates link with project-specific {@link LinkReference}. - */ -@Component(service = LinkDecorator.class) -public class LinkReferenceDecorator implements LinkDecorator { - - @Override - public @Nullable LinkReference apply(@NotNull Link link) { - return new LinkReference(link); - } - -} diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/impl/MediaReferenceDecorator.java b/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/impl/MediaReferenceDecorator.java deleted file mode 100644 index 3ec02b26..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/java/reference/impl/MediaReferenceDecorator.java +++ /dev/null @@ -1,26 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -package ${package}.reference.impl; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.osgi.service.component.annotations.Component; - -import io.wcm.handler.media.Media; -import io.wcm.siteapi.handler.media.MediaDecorator; - -import ${package}.reference.MediaReference; - -/** - * Decorates media with project-specific {@link MediaReference}. - */ -@Component(service = MediaDecorator.class) -public class MediaReferenceDecorator implements MediaDecorator { - - @Override - public @Nullable MediaReference apply(@NotNull Media media) { - return new MediaReference(media); - } - -} diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/container/accordion/accordion.html b/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/container/accordion/accordion.html deleted file mode 100644 index 06279553..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/container/accordion/accordion.html +++ /dev/null @@ -1,3 +0,0 @@ -#if ( $optionWcmioSiteApiGenericEdit == "y" ) - -#end \ No newline at end of file diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/container/carousel/carousel.html b/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/container/carousel/carousel.html deleted file mode 100644 index 06279553..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/container/carousel/carousel.html +++ /dev/null @@ -1,3 +0,0 @@ -#if ( $optionWcmioSiteApiGenericEdit == "y" ) - -#end \ No newline at end of file diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/container/tabs/tabs.html b/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/container/tabs/tabs.html deleted file mode 100644 index 06279553..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/container/tabs/tabs.html +++ /dev/null @@ -1,3 +0,0 @@ -#if ( $optionWcmioSiteApiGenericEdit == "y" ) - -#end \ No newline at end of file diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/button/button.html b/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/button/button.html deleted file mode 100644 index 06279553..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/button/button.html +++ /dev/null @@ -1,3 +0,0 @@ -#if ( $optionWcmioSiteApiGenericEdit == "y" ) - -#end \ No newline at end of file diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/contentfragment/contentfragment.html b/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/contentfragment/contentfragment.html deleted file mode 100644 index 06279553..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/contentfragment/contentfragment.html +++ /dev/null @@ -1,3 +0,0 @@ -#if ( $optionWcmioSiteApiGenericEdit == "y" ) - -#end \ No newline at end of file diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/contentfragmentlist/contentfragmentlist.html b/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/contentfragmentlist/contentfragmentlist.html deleted file mode 100644 index 06279553..00000000 --- a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/contentfragmentlist/contentfragmentlist.html +++ /dev/null @@ -1,3 +0,0 @@ -#if ( $optionWcmioSiteApiGenericEdit == "y" ) - -#end \ No newline at end of file diff --git a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/customcarousel/customcarousel.html b/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/customcarousel/customcarousel.html index a6083fb6..5a28182d 100644 --- a/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/customcarousel/customcarousel.html +++ b/src/main/resources/archetype-resources/bundles/core/src/main/webapp/app-root/components/content/customcarousel/customcarousel.html @@ -1,9 +1,6 @@ #set( $symbol_pound = '#' ) #set( $symbol_dollar = '$' ) #set( $symbol_escape = '\' ) -#if ( $optionWcmioSiteApiGenericEdit == "y" ) - -#else