Edit online

Implementing Framework Extensions using Java

Some of the most advanced framework customizations can be implemented using Java extensions.

To create such a Java extension, follow these steps:

  1. Create a Maven project.
  2. Declare Oxygen's Maven repository in the pom.xml file:
    <repositories>
      <repository>
        <id>oxygenxml</id>
        <name>Oxygen XML SDK Maven Repository</name>
        <url>https://oxygenxml.com/maven/</url>
      </repository>
    </repositories>
  3. Add a dependency on the oxygen-sdk in the pom.xml file:
    <dependency>
      <groupId>com.oxygenxml</groupId>
      <artifactId>oxygen-sdk</artifactId>
      <version>OXYGEN_VERSION</version>
    </dependency>
    where you replace OXYGEN_VERSION with the SDK version that corresponds to the version of Oxygen XML Web Author you are using.
  4. Implement a Java class that extends ro.sync.ecss.extensions.api.ExtensionsBundle.
    Important: The built-in frameworks already have such an implementation. It is recommended to extend this class for your particular framework so that you get the benefits of all the built-in features. For example, the name of this class for the DITA framework is ro.sync.ecss.extensions.dita.DITAExtensionsBundle.
    To be able to compile your code, you should add the JAR files of the base framework to the Maven's classpath. For example:
    <dependency>
      <groupId>fake.group</groupId>
      <artifactId>dita-jar</artifactId>
      <version>1.0</version>
      <scope>system</scope>
      <systemPath>[PATH_TO_FRAMEWORKS_FOLDER]/dita/dita.jar</systemPath>
    </dependency>
    where you replace PATH_TO_FRAMEWORKS_FOLDER with the path to your frameworks/ folder.
  5. Build your Maven project using:
    mvn package
  6. Copy the resulting JAR found in the target/ folder to a location in your framework folder.
  7. Add a reference to that JAR file in the Classpath tab of the Document Type Configuration dialog box for your particular framework.