Extend ConnectorBase

To create a new connector you must create a class that extends the Autonomy.Connector.ConnectorBase class. For example:

using System;
using Autonomy.Connector;

namespace MyConnectorNamespace
{
	public class MyConnector : ConnectorBase
	{
		public MyConnector(IConfig config, ILog log) :
		    base("My Connector" )
		{
		}
		
		public override void Synchronize(ISynchronizeTask task)
		{
			string target = task.TaskConfig.Read("Target", "World");
			task.Log.WriteLine(LogLevel.Normal, "Hello " + target);
		}
	}
}

NOTE: As shown in the example above, any connector implementation must extend ConnectorBase and have a constructor that takes two arguments (an IConfig and an ILog).

OpenText recommends that the IConfig instance provided to the constructor is used only from within the constructor and that a reference to this object is not kept. This configuration is generally only useful for global settings that change how the connector behaves as a whole. Configuration for tasks should be accessed using the configuration objects provided to each task implementation.

The instance of ILog provided to the constructor can be used outside of the constructor, and writes to the connector's application log stream. It should not be used for logging that is specific to a task (such as Synchronize).

The implementation of Synchronize uses task.TaskConfig and task.Log which provide access to the configuration and log for the task.

The constructor of ConnectorBase is passed the string "My Connector". This is the name of the connector as it should be displayed to the user, and can be any string.

A Visual Studio solution with this sample code is provided in the SDK (HelloWorldConnector.sln).

This very basic connector implements only the synchronize fetch action. Your class does not have to implement the synchronize action, and it could implement other actions such as collect, view, update, and delete.

The body of the synchronize method reads a configuration value and writes a log message. It reads the value of the Target configuration parameter (which has a default value of "World") and then writes it to the synchronize log at the normal log level.

You now have the shell of a connector that you can compile and run. To run the connector, see Run the Connector.