Metamerge logo
Search

Advanced Search
*
*
*
* HOME DOCUMENTS & RESOURCES DOWNLOADS EARLY TECH ACCESS SUPPORT FAQ KNOWN ISSUES OLD VERSIONS
*

 

Writing a new Raw Connector

There 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 Connector

Read 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 Connector

Learning 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 Connector

Remember 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-libraries

If 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 It

Follow 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

(This is the Windows Command when Metamerge was installed in the metamergeHome directory.  Unix uses ':' instead of ';' as separator.)

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:

Keyword Value/Description
label The text shown in the form
default The default value for the parameter
description Descriptive text for the parameter. This text will appear when the user hovers over the label 
syntax
string One line text
textarea Multi line text
droplist Dropdown list with values
dropedit Dropdown list with value and edit box for user defined value
boolean Checkbox using "true" or "false" as value
password Allows a password to be input
static Text that cannot be changed
script A special function to use in the admin tool when the user selects this parameter. The only interesting value is selectFile, which allows the user to browse through the filesystem and select a filepath.
scriptlabel The label on the button which evokes the optional script 

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.

 

*
  Metamerge Integrator version 4.6 ©Copyright Metamerge AS 2000-2002 Last edited 2002-06-10 contact us