Java classes for gateway plug-ins retrieve the parameters that were set in the user interface, as diplayed by the JSP file, then they save these parameters in eDirectory as printer agent object attribute values. The GatewayTemplate.java file included with the CompanyXYZ plug-in provides an excellent example of how to do this, and we recommend that you use this file as a starting point for creating your own gateway plug-ins. This file illustrates the following points concerning gateway plug-ins:
They must extend the com.novell.emframe.dev.Task class and implement the execute method defined in that class.
They must import the com.novell.service.ndps package, as shown in the following example:
import com.novell.service.ndps.*;
They should contain the following code, which retrieves the printer agent object that was stored in the session:
Hashtable sessionCache = context.getSessionCache(); PrinterAgent newPa = (PrinterAgent)sessionCache.get("NDPS.newPrinterAgent");
The PrinterAgent.modifyAttrs method is used to set the attributes in the Managed Object Database (MOD):
BasicAttributes attrSet; attrSet = new BasicAttributes(); attrSet.put(Oid.NDPS_ATT_PDS_EXEC_AND_PARAMS.getString(), "NDPSGW IPP URL=" + printerURL); newPa.modifyAttrs(DirContext.REPLACE_ATTRIBUTE, attrSet);
For further information about plug-in Java classes, see Section 3.2, Creating a Task: An Example and Section 3.3, Tips for Creating Task Java Classes.