Skip to main content
Skip table of contents

Configure the wrapper

[]

Target groups

  • Developer (Web)

Context

The SIS model uses freemarker to render HTML and freemarker uses java-models to access data objects and content structures.

The SIS module provides freemarker models for the standard-information-structure assets and xml elements, making their data structures available in freemarker and for the templating framework.

Prerequisites

  • Administrator rights
  • censhare-Client (java)
  • OC version 2019.1 or higher
  • utilize UpdatingSatellite

Introduction

In customized projects new asset types may be derived from existing ones to express a different semantic meaning. The derived information units keep the data- and information-structure of the original object. For example think of variations of topic. or keyword. asset types.

Also xml content elements may by introduced duplicating and renaming existing structures to express a different meaning or even to restrict usage.

In this cases it's possible to configure the freemarker model for asset type foo. or element <foo> to be also used on the derived asset type bar. or element <bar>.
But the reuse of freemarker-models requires the data-structure of the derived object to be compatible to the original one.

Since 2019.2.2 it is also possible to disable the provided standard models, e.g. to gain performance.

A wrapper is used to apply a freemarker model to assets and xml elements before they are available to the freemarker skin engine. These wrappers are designed as OSGi services. By adding a xml configuration to a satellite group it is possible to configure the wrapper to wrap assets or elements of formerly unknown types or names into his product - the model.
With version 2019.2.2 the SIS-standard-models are registered using java method register(BundleContext, Consumer<ServiceRegistration<?>>, Consumer<ServiceRegistration<?>>) enabling them to register/deregister for specific sites.

Step-by-step

  • Create an asset of type Modul/Satellite/Satellite-OSGI/Satellite-OSGI-Configuration (or clone existing)
  • Edit new configuration and set content to example below.
    • adapt <pid> to java wrapper class
    • adapt collection assetTypes to the types to wrap (xml elements use collection with <key>nodeNames</key>)
    • @since 2019.2.2: adapt/delete collection sites to register wrapper on specified instances (omit sites property to enable global, use empty collection for sites to deregister from any site)
  • Add configuration to satellite configuration group as described here

Example configuration:

XML
<?xml version="1.0" encoding="UTF-8"?>
<dictionary>
  <pid>com.censhare.wrapper.SomeModelWrapper</pid>
  <property>
    <key>assetTypes</key>
    <collection>
     <String>new.type.towrap.</String>
     <String>more.type.other.</String>
    </collection>
  </property>
  <property>
    <key>sites</key>
    <collection>
     <String>customer-site-foo</String>
     <String>customer-site-bar</String>
    </collection>
  </property>
</dictionary>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.