Skip to content
peacekeeper edited this page Dec 18, 2014 · 16 revisions

The XDI2 codebase supports a plugin mechanism, which makes it possible to extend its functionality in various ways.

Plugins can apply to any of the XDI2 components, for example:

  • A plugin for the xdi2-core component could provide a new [backend storage mechanism](Available backend storage for XDI graphs), a new serialization format, or a new parser.
  • A plugin for the xdi2-client component could provide a new way of sending XDI messages, e.g. via SMTP.
  • A plugin for the xdi2-transport component could provide new messaging targets, interceptors and contributors.

Plugins

A plugin is a single .jar file containing within itself any number of .jar files, all of which are added to the XDI2 library's classpath when the plugin is loaded.

The typical contents of a plugin .jar file look like this:

/
	xdi2-example-plugin-classes.jar
	/META-INF
	/dependency
		dependency-jar-1.jar
		dependency-jar-2.jar
		dependency-jar-3.jar

This is just an example however. The specific directory structure of a plugin is not mandated and in fact has no effect whatsoever on the loading or the execution of plugins.

Loading Plugins

To load plugins, the following call should be made before other XDI2 library code is used:

xdi2.core.plugins.PluginsLoader.loadPlugins("<path-to-plugins>");

If null is passed as a parameter, the default path is assumed, which is ./plugins.

When running the xdi2-transport-http-war or xdi2-webtools components, a servlet listener can be used in one's web.xml [configuration file](Configuration files) to load plugins from the default path:

<listener>
	<listener-class>xdi2.transport.impl.http.impl.servlet.PluginsLoaderListener</listener-class>
</listener>

List of plugins

Link Type Description
xdi2-mongodb Storage XDI Graph Storage in MongoDB
xdi2-redis Storage XDI Graph Storage in Redis
xdi2-connector-facebook Connector Facebook -> XDI Connector
xdi2-connector-personal Connector Personal.com -> XDI Connector
xdi2-connector-allfiled Connector Allfiled -> XDI Connector
xdi2-connector-google-calendar Connector Google Calendar -> XDI Connector

Future Work

The current plugin mechanism is very simple and light-weight. In the future, existing plugin frameworks such as JPF, JSPF, ServiceLoader or OSGi could be used.

Clone this wiki locally