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:
- Create a Maven project.
- 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>
- Add a dependency on the
oxygen-sdk
in the pom.xml file:
where you replace<dependency> <groupId>com.oxygenxml</groupId> <artifactId>oxygen-sdk</artifactId> <version>OXYGEN_VERSION</version> </dependency>
OXYGEN_VERSION
with the SDK version that corresponds to the version of Oxygen XML Web Author you are using. - 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 isro.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:
where you replace<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>
PATH_TO_FRAMEWORKS_FOLDER
with the path to your frameworks/ folder. - Build your Maven project
using:
mvn package
- Copy the resulting JAR found in the target/ folder to a location in your framework folder.
- Add a reference to that JAR file in the Classpath tab of the Document Type Configuration dialog box for your particular framework.