Registering a Custom Connector

You can implement configuration data.

You can implement configuration data by any means you want, but the following provides a scheme that allows users to set configuration parameters in a way that is consistent with the other Connectors.

The process provided in the example code is as follows:

  • A Java Server Page is implemented (as a service path), together with a small number of web app files (JavaScript code and CSS data), to provide a Form for the user to enter configuration values
  • A second “service” path is used to save configuration values and return a generated “results” page
  • The configuration values are stored to an XML file, and read back, using the JAXB system, with the result that there is a JAVA class available for reading/writing the configuration values
  • The Connector implementation code then simply uses the access methods of this class to get the values of the configuration parameters.

The classes / files that you need to modify to implement your own Connector Configuration page, with the names changed for your own connector, are:

src/FileSysConnectorConfig.java
This defines the XML elements, i.e. your configuration parameters. It also defines the file that will store the user settings, and locking capabilities on that file. Important: If you use the path shown in the example code, then the configuration file will automatically be copied to a new release of the Connectors during the upgrade process. You should add additional “set” and “get” methods for your parameters.
src/FileSysConfigApplication.java
This defines the “Application” for the configuration services, and the class that provides the service implementations.
src/FileSysResource.java
This is the service implementation class. It provides the method called when the Form is submitted, and the method called when the request is made for the form itself.
src/HtmlForm.java
This is the implementation of the JSP for generating the Form for the configuration parameters. We recommend you follow the structure shown in the example, to be consistent, but this is not required. Note that this makes use of the “String Manager” (see implementation details below) to allow forms to be generated in an appropriate language for the user.
This file also contains the implementation for the JSP for the result of saving the configuration data. The other Connectors’ configuration panels display a “result page” after the user saves changes, rather than just refreshing the page. This example follows that structure, but you can decide whether that is appropriate to your own needs.
src/Html.java
This contains utility functions for HtmlForm.java. Note that the example uses JSP calls that generate very basic Html 1.0 style pages. You might want to implement a more ‘modern’ JavaScript-based approach.
webapp/scmfilesys/scmfilesys.js
This file contains JavaScript functions used by the form. For example, if you want to “validate” entered values before they are submitted, you would add functions here to do that and reference those from the code generated in the HtmlForm.java class.
webapp/scmfilesys/scmfilesys.css
This defines CSS for the form. You can use the one provided, which is consistent with the other Connectors and the main adapter panel, or you can use your own.
webapp/scmfilesys/assets/doc/FileSysConnector.htm
This is a “Help” page shown when the Help button is pressed on the Form. We recommend you use a similar approach to provide your users with help information.