Custom Component Modules
- AIS Triggers – allow user-defined actions to be executed in response to specific AIS-related events
- Automatic Actions – allow user-defined actions to be executed within a WorldServer workflow
- Authentication – allow customers 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 modified
- Servlets – allow the creation of custom WorldServer-aware servlets
- TM Services – allow alternate implementations to be used in place of the exposed TM services
In the pluggable component model, you create new component classes by extending the abstract class that corresponds to the type of component you want to develop. (For example, the WSFilter class supports creating custom filters, and the WSProjectAutomaticAction supports creating new custom project-level automatic actions.)
As with the WSRunnable interface, the abstract classes provide you a handle to the WSContext (or derived context) object, which is required to gain access to the various supported service managers. Consider the following code snippet that illustrates a simple WSHttpServlet example.
/**
* SDK Sample implementation of a Custom Servlet.
<p>
* Simple Custom servlet that prints out a list of
* WorldServer users.
*/
public class UserList extends WSHttpServlet
{
public boolean handle(WSContext context,
HttpServletRequest request,
HttpServletResponse response)
{
try {
// Get users
WSUser[] users = context.getUserManager().getUsers();
// List them
PrintWriter out = response.getWriter();
out.print("<table cellpadding=5 border=1>");
out.print("<tr><td colspan=2>WorldServer User List</td></tr>");
for(int i=0; i<users.length; i++) {
out.print("<tr>");
out.print("<td align=center>");
if(users[i].getId() == 1) {
out.print("<img src=ws_ext?resource=images/admin.jpg>");
} else {
out.print("<img src=ws_ext?resource=images/user.jpg>");
}
out.print("</td>");
out.print("<td>");
out.print(users[i].getFullName());
out.print("</td></tr>");
}
out.print("</table>");
} catch (Exception ex) {
throw new WSRuntimeException(ex);
}
return true;
}
When you create an SDK servlet, you must extend the WSHttpServlet class, which requires you to implement the handle method. The handle method is how the SDK execution framework provides you with a handle to an initialized WorldServer context object. Each of the supported pluggable components has its own SDK abstract class that exposes a method that you implement in order to gain access to the WorldServer context.