Précédent: Diving
In |
Haut: Diving In |
Suivant: TDD With
Plexus |
The contents of this document are a work in progress
If you browse through the sources generated by the Plexus component archetype used for preparing and setting up our project, you will see that we have:
public interface WebsiteMonitor {
/**
* Role used to register component implementations with the container.
*/
String ROLE = WebsiteMonitor.class.getName ();
/**
* Monitor the specified website.
*
* @param website
* Website URL to monitor
* @throws Exception
* error encountered while performing the monitoring request.
*/
public void monitor(String website) throws Exception;
}
public class DefaultWebsiteMonitor implements WebsiteMonitor {
/*
* (non-Javadoc)
*
* @see org.codehaus.plexus.tutorial.WebsiteMonitor#monitor(java.lang.String)
*/
public void monitor(String website) throws Exception {
// TODO implement
}
}
Locate the component descriptor for our component provider under project-root/src/main/resources/META-INF/plexus/component.xml. Edit its content to reflect as below:
<component-set>
<components>
<component>
<role>org.codehaus.plexus.tutorial.WebsiteMonitor</role>
<implementation>
org.codehaus.plexus.tutorial.DefaultWebsiteMonitor
</implementation>
<configuration/>
</component>
</components>
</component-set>
Before we implement the the provider, we need to update our project dependencies and include Jakarta Commons HttpClient library. To do this, locate pom.xml under project-root and edit it to reflect the dependencies section of our pom.xml as below:
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>1.0-alpha-9</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
Update Eclipse project dependencies for new library that we added above, to do this:
mvn eclipse:clean eclipse:eclipse
Précédent: Diving
In |
Haut: Diving In |
Suivant: TDD With
Plexus |