Modifying an existing Module

You can modify the behavior of a default Module through inheritance.

In the following example, a number of custom keywords are added to the Component metadata.

package com.tridion.examples;

import com.tridion.deployer.Processor;
import com.tridion.deployer.ProcessingException;
import com.tridion.configuration.*;
import com.tridion.transport.transportpackage.*;

public class ExtendedComponentDeploy 
	extends com.tridion.deployer.modules.ComponentDeploy {

	public ExtendedComponentDeploy(Configuration config, Processor processor) 
		throws ConfigurationException {
		super(config, processor);
	}

	protected void processComponent(Component component) throws ProcessingException {
		Category category = component.getCategory("Custom");
		if (category == null) {
			// create a new Category if it does not exist yet
			category = new Category("Custom");
		}
		// Add a keyword
		category.addKeyWord("Custom Keyword");
		// Add or update the category
		component.addCategory(category);
		super.processComponent(component);
	}
}