Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The first step before writing your own connector is to visit Connectors and making sure there isn't a connector that already does what you need.

As with everything in the Aspire ecosystem, you'll need to develop the connector in Java, using Maven as the dependency and deploy manager, so make sure you already have everything set up.

What's next?

Children Display
alltrue


Create a Java Project Using the Connector Archetype

We have wrapped an example connector project into a Maven Archetype to make it easier for developers to start. It contains a basic FileSystem Connector implementation and lots of comments to guide you through your development.

Let's start!

1. Execute the archetype command

Open your command line terminal and execute:

Code Block
themeFadeToGrey
> mvn archetype:generate -DarchetypeGroupId=com.searchtechnologies.aspire -DarchetypeArtifactId=aspire-connector-archetype -DarchetypeVersion=3.1 -DrepositoryId=stPublic

 

You will be prompted to enter:

    • artifactId: This is the name for your connector. Typically we use the name of the repository you are trying to extract information from. All sub project names and classes will be base on this, and it is time consuming to change later, so you may wish to pause for a moment to think about it, the standard format is aspire-{repository}-source, so for example if you are writing a connector for Sharepoint, it would be "aspire-sharepoint-source"
    • groupId: This is the name of the organizational unit to which your connector belongs. It defaults to com.searchtechnologies.aspire
    • version: This will be the version number of Aspire that you wish this connector to compile against. All Aspire dependencies will be at this version and the connector will be created with this version.
    • repositoryType: This will be the prefix the Archetype will use to name the java classes

2. Import the project into Eclipse

From the previous step you now should be able to see a folder created with the "artifactId" you entered as its name.
Now let's import that project into eclipse:

    1. Open eclipse
    2. Go to File > Import
    3. Select Maven > Existing Maven Projects
    4. In the popup window browse and select your project in the "Root Directory" field, then Click on Finish

3. Look at the example code

Now open the source in eclipse and look though all of it. The principal class to look for is the RAP one , this is (the implementation of the RepositoryAccessProviderinterface RepositoryAccessProvider interface) which is the entry point from Aspire in order to crawl a repository. The code implemented there is a simply FileSystem Scanner which scans recursively from a start root folder.

4. Compile and Test

Now it is time to compile and see the connector working in Aspire

    1. Compile the code and run the unit tests by opening the Command Line into to your project folder and executing:

      Code Block
      themeFadeToGrey
      > mvn clean install
    2. Start Aspire
    3. Go to the Content Source Administration section in the UI
    4. Add a new Custom Content Source
    5. Enter the connector coordinates as groupId:artifactId:version
    6. Configure and save the content source
    7. Run a full and an incremental crawl

5. Modify as necessary

Now it is time for you to implement your connector logic, go ahead and visit General Scanning and General Metadata Population in order to know how to implement the RepositoryAccessProvider for scanning and populating metadata.

 

If your connector doesn't fit with the default behavior, visit Recipes for more example code for having your connector do whatever you need

.