SDL WorldServer allows customers to expand WorldServer capabilities through pluggable components. There are several exit points in WorldServer through which custom code can be invoked to perform customer-specific operations.
Here are the types of pluggable components currently supported:
- AIS Triggers: AIS stands for Asset Interface System and is the framework WorldServer uses to access content whether that content is in a content management system, a file system, a database, etc. Through a customized AIS trigger, it is possible to execute customer-specific actions in response to specific AIS-related events.
- Automatic Actions: customized automatic actions to be executed within a WorldServer workflow.
- Authentication: can be used to override the default password validation strategy.
- Filters: allow the support of new types of assets within WorldServer.
- Notification Service: allow email messages to be customized.
- Servlets: customized WorldServer-aware servlets.
- TM Services: TM stands for Translation Memory. It is possible to provide alternative services to be used in place of the exposed TM services.
Developers use the SDL WorldServer Software Development Kit (SDK) to write these pluggable components. The implementation begins by extending an abstract class corresponding to the type of component you want to create. For example, the com.idiominc.wssdk.component.servlet.WSHttpServlet abstract class needs to be extended in order to implement a customized servlet.
The abstract classes provide us with a handle to the WSContext object, which provides us with access to the service managers.
I've implemented a very simple servlet for demonstration purposes. I'm using Maven in my project, so I first installed the wssdk-server jar file in my local repository using the following.
mvn install:install-file -Dfile=wssdk-server.jar -DgroupId=com.idiominc -DartifactId=wssdk-server -Dversion=11.1.0.3909 -Dpackaging=jar
There are only two dependencies in the pom.xml file.
<dependencies> <dependency> <groupId>com.idiominc</groupId> <artifactId>wssdk-server</artifactId> <version>11.1.0.3909</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> </dependencies>
The ProjectInfo servlet outputs project information from all projects available in the system (active and inactive). It demonstrates the use of the user and workflow managers for gathering information.
Deploying the custom servlet
- Creating a WorldServer component deployment descriptor
- Creating a component archive (zip file) containing the component classes and, if required, including all of the non-WorldServer library dependencies.
- Using the WorldServer UI to deploy the component.
The contents of my project's desc.xml is shown below.
<components> <servlet class="com.worldservertraining.ProjectInfo"/> </components>Create a zip file containing the XML descriptor file and your classes. Note that the desc.xml file must be at the base of the zip file. In addition, your Java classes must be placed in the zip file under the appropriate Java package structure. There cannot be any jar or zip files inside your deployment zip file. In order to use supporting libraries in your projects, you can either expand these supporting libraries in your zip package or have them added to WorldServer's classpath.
Once the zip package is ready, you can use WorldServer's UI to deploy your customizations. Your WorldServer user will need to have the right privilege to perform the following steps.
Login to WorldServer and click the Management option.