|
|
Writing a new Raw ConnectorThere are generally two ways of writing new Connectors. The first way is to write a script that implements a set of functions using your favourite scripting language. The second way is to write the Raw Connector using Java. Script based ConnectorRead the documentation for the Script Connector and also take a look at the sample Outlook Connector. Both will give you the necessary information to roll your own Connector. Java based ConnectorLearning by example is probably the best way to learn new things. The source code for the HTTP Client Connector is freely available for download here and should give you a firm understanding as to how the Java based Connectors are implemented. Note: from version 4.6 you need to implement a public String getVersion() method. Also note that the HTTP Client2 Connector is the preferred Connector, we here use the HTTP Client Connector because it is a better example. Building and Installing a Java based ConnectorRemember that the Metamerge Integrator will wrap the AssemblyLine Connector around your Raw Connector, so you only need to write the Raw Connector. A comment about Java-librariesIf you use the same libraries as the Integrator does (see Distributed Components ) you should make sure that you use the same version as Integrator does. If not, you can run into compatibility problems because the loader gets confused. Doing ItFollow these steps to get your Raw Connector built and activated. The build instructions assumes you have installed the Java2 SDK and that those binaries are in your PATH. 1. In order to compile your code you must include miserver.jar from the Metamerge distribution in your classpath. (Of course, you need to include other jars as needed, the HTTP Client Connector referred to above needs the mailapi.jar) javac -classpath 'metamergeHome/jars/miserver.jar;metamergeHome/jars/mailapi.jar' com\myname\httpconnector.java 2. Make a file named metamerge.inf with the following content: [connectors MyConnector] connectorConfig { connectorType:com.myname.HTTPConnector } description:My HTTPConnector [end] [form com.myname.HTTPConnector] title:The title parameterlist [ myparam1 myparam2 ] parameter { myparam1 { label:URL syntax:string default:http://localhost } myparam2 { label:Port syntax:droplist values [ 80 8080 ] default:80 } } [end] The connectors section of this file tells the Admin Tool that this is a connector, and also gives both the name this connector is known under in the Admin Tool (MyConnector), and the java class name (com.myname.HTTPConnector). The form section tells the Admin Tool which parameters you connector needs.The parameterlist section lists the order in which the parameters are presented. The parameter section contains a subsection for each parameter and has the following keywords:
3. Add your metamerge.inf and class files to a jar file ( myconnector.jar ) jar cvfM myconnector.jar metamerge.inf com\myname\HTTPConnector.class 4. Copy the jar file to a suitable directory, such as metamerge/jars/myjars . It has to be in a subdirectory of metamerge/jars, it should not use the system directories connectors/, eventhandlers/ or parsers/. 5. Your connector is now available as MyConnector.
|
|
|