Skip to content

Processing Definitions

mweikard edited this page Nov 5, 2018 · 7 revisions

Processing Definitions

A Processing Definition wraps a specific configuration of the service. It consists of

  • The base definition.yml.
  • A CaaS schema definition for the CoreMedia document type model either handcrafted or as input configuration for the Schema Generator. The schema definition is translated to a GraphQL schema by the Spring-Boot application.
  • A set of GraphQL queries executed on the defined schema and backed by the UAPI content objects and services (see Queries).
  • A configuration for transforming CoreMedia Richtext (see Richtext).

Processing Definition layout with schema:

.
├── definition.yml
|
├── query
|   ├── article.graphql
|   ├── navigation.graphql
|   └── ...
|
├── richtext
|   ├── include
|   |   └── ...
|   ├── detail.yml
|   ├── plain.yml
|   ├── teaser.yml
|   └── ...
|
└── schema
    ├── CMArticle.yml
    ├── CMArticleImpl.yml
    └── ...

Processing Definition layout with configuration for the Schema Generator:

.
├── definition.yml
|
├── config
|   ├── types
|   |   ├── customizers
|   |   |   └── ...
|   |   └── static
|   |       └── ...
|   └── schema.yml
|
├── query
|   ├── article.graphql
|   ├── navigation.graphql
|   └── ...
|
└── richtext
    ├── includes
    |   └── ...
    ├── detail.yml
    ├── plain.yml
    ├── teaser.yml
    └── ...

The base definition

The base definition file contains the mapping for the Link Builders, the default Richtext Formatter to use if not specified by the schema or query and an optional description.

description: "The sample schema used by the CaaS React fragments"
defaultRichtextFormat: detail
linkBuilders:
  default: !LinkBuilder "simpleLinkBuilder"

Static Configuration

A static configuration is added to the Spring-Boot application at build time and loaded upon application start from the classpath.

Add the Maven dependency plugin to the pom.xml of the headless-server-app module and configure the Processing Definitions to be added to the application. See the following example for adding the supplied sample definition.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>
  <executions>
    <execution>
      <id>unpack</id>
      <phase>compile</phase>
      <goals>
        <goal>unpack</goal>
      </goals>
      <configuration>
        <artifactItems>
          <artifactItem>
            <groupId>${project.groupId}</groupId>
            <artifactId>headless-pd-sample</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <overWrite>true</overWrite>
            <excludes>META-INF/**</excludes>
            <outputDirectory>${project.build.directory}/classes/pd/static/default</outputDirectory>
          </artifactItem>
        </artifactItems>
      </configuration>
    </execution>
  </executions>
</plugin>

All configurations below /pd/static/ are detected automaticlly based on their marker file definitions.yml. A configuration's name is defined by the name of it's output directory - default in this example.

Dynamic Configuration

Processing Definitions can be deployed (and changed) at runtime by uploading the built JAR file to the content repository.

Use a document type with a blob property named data, e.g. CMDownload if you don't have a custom type for resources, create a new document of that type, upload the JAR and link the document to the localSettings of a site.

site configuration

Multiple definitions can be uploaded per site, so the service can be customized per client application.

Clone this wiki locally