Blueprint Developer Manual / Version 2110
Table Of ContentsThe CAE can be extended with new capabilities by using the Blueprint extension mechanism or by just creating a new module with the required resources. In both cases the extension will be activated by adding a Maven dependency on the new module. This section describes how to add a new Blueprint module which contains an additional view template and a new view repository using this template.
Maven Configuration
First you have to create a new module which contains the required resources. The location of the
new module inside the workspace is not important to enable the new features provided by the
module. But to keep cohesion in the aggregation modules of the CoreMedia Blueprint workspace the new module
should be created next to other CAE functions. In this example the new module
sample-cae-extension will be created in the
apps/cae/modules/cae module.
First, add a new module entry named
sample-cae-extensionto the modules section of thecaepom.xmlfile:<modules> <module>cae-base-lib</module> <module>cae-base-component</module> <module>cae-live-webapp</module> <module>cae-preview-webapp</module> <module>contentbeans</module> <!-- add module --> <module>sample-cae-extension</module> </modules>After that create a new subdirectory
sample-cae-extensionand add thepom.xml.<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.coremedia.blueprint</groupId> <artifactId>cae</artifactId> <version>BLUEPRINT_VERSION</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>sample-cae-extension</artifactId> <packaging>jar</packaging> <dependencies> <dependency> <groupId>com.coremedia.cms</groupId> <artifactId>coremedia-spring</artifactId> <scope>runtime</scope> </dependency> </dependencies> </project>
Now the basic structure for the extension exists.
Enabling the Extension
To enable the extension the target component has to depend on the created extension module.
To enable the new capabilities in all CAEs add the following dependency to the
pom.xml of the cae-base-component module:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sample-cae-extension</artifactId>
<version>${project.version}</version>
</dependency>
Creating Source Files and Folders
The sample extension for the CAE provides a new view template for the content type
CMArticle to display external content and a new view repository
configuration which includes this view template.
Create the new view template
CMArticle.jspin the modulesample-cae-extensionin the directorysrc/main/resources/META-INF/resources/WEB-INF/templates/external-content-view-repository/com.coremedia.blueprint.common.contentbeans.To include the new view repository add a Spring boot auto configuration defining the following beans:
@Configuration(proxyBeanMethods = false) static class AddSampleViewRepositories { @Bean @Customize(value = "viewRepositories", mode = Customize.Mode.PREPEND) List<String> sampleViewRepositories() { // Add repository name, relative to /WEB-INF/templates/ return ImmutableList.of("sample-cae-extension"); } }


