Skip to main content

Developing MEP Connectors - Part IV

Posted by spericas on October 17, 2008 at 6:11 AM PDT

In this installment of the Developing MEP Connectors series we focus on the development cycle of a MEP connector, including source code generation from a template, compilation and deployment. The recommended tools for developing MEP connectors are NetBeans 6.1 (or later) and Maven 2.0.8 (or later), although developing under other IDEs should be straightforward given that Maven is the primary tool that we use.

The first step is to download and install the FCS version of MEP which is available here. The installation process will set up Glassfish first and MEP second. In what follows, we'll assume that MEP is installed under $AS_HOME/domains/mep, the default location.

In order to build a new connector, we start by installing a dependency in our local Maven repository. We can do that by cding into $AS_HOME/domains/mep/lib and using the mvn command as shown below.

>> cd $AS_HOME/domains/mep/lib
>> mvn install:install-file -DgroupId=com.synchronica.mep
   -DartifactId=ds-jcr-connector -Dversion=3.1.31 -Dpackaging=jar
   -Dfile=ds-jcr-connector-3.1.31.jar

With that dependency installed, we can now start NetBeans and verify that we have the Maven plugin installed by going to Tools -> Plugins -> Installed and looking for a plugin named "Maven". If it isn't installed, search for it under Available Plugins and install it.

The next step is the generation of our MEP connector template. This step uses a Maven archetype available from Java.net. To create the project go to File -> New Project -> Maven -> Maven Project and click "Next". From the list of Maven archetypes, open the "Archetypes from remote Maven Repositories" entry and select "MEP Connector Archetype (JAR)", the first archetype listed for MEP.




mep-archetype.jpg


After clicking "Next", simply name your project and click "Finish". The first time you generate a project, it will take a few minutes for Maven to warm up your local repository cache. Subsequent operations that use Maven will be much faster. Once the operation is completed, you should be able to browse the generated source code under "Source Packages" and build your project under the IDE (naturally, the connector generated by the archetype is just a template and does not implement any business logic). The resulting jar file, generated as part of the building process and available in the target directory, can be simply copied to $AS_HOME/domains/mep/lib. For more information on how to configure a connector, the reader is referred to the MEP Administration Guide. Happy synching!

Related Topics >>