camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > tutorial-osgi-camel-part2c
Date Thu, 01 Apr 2010 13:57:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CAMEL/tutorial-osgi-camel-part2c">tutorial-osgi-camel-part2c</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~cmoulliard">charles Moulliard</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="tutorial-osgi-camel-part2c-ApacheWicketwebsite"></a>Apache Wicket - web site</h2>

<p>The tutorial is almost finished. We have to design the web page that we will use to consult the incidents published in the database. The web framework that we will use is <a href="http://wicket.apache.org/" rel="nofollow">Apache Wicket</a>. </p>

<h2><a name="tutorial-osgi-camel-part2c-Step1%3AWebpages"></a>Step 1 : Web pages</h2>

<p>To display the incidents in a web page, we will create the file <tt>HomePage.html</tt> in the directory <tt>src/main/java/org/apache/camel/example/reportincident</tt>. This file contain html tags with some wicket tags. One of the benefit of Apache Wicket compare to other web frameworks is that it try to keep the html page as clean as possible to facilitate the work of the web designer and integration with code made by the developers. It is a component framework like JSF but not based on programmable page like JSP, ...</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-html">
<span class="code-tag">&lt;html&gt;</span>
<span class="code-tag">&lt;head&gt;</span>
	<span class="code-tag">&lt;title&gt;</span>Report Incident HomePage<span class="code-tag">&lt;/title&gt;</span>
	<span class="code-tag">&lt;link rel=<span class="code-quote">"stylesheet"</span> type=<span class="code-quote">"text/css"</span> href=<span class="code-quote">"style.css"</span>/&gt;</span>
<span class="code-tag">&lt;/head&gt;</span>
<span class="code-tag">&lt;body&gt;</span>
	<span class="code-tag">&lt;strong&gt;</span>Report Incident HomePage<span class="code-tag">&lt;/strong&gt;</span>
	<span class="code-tag">&lt;br/&gt;</span>
	<span class="code-tag">&lt;p/&gt;</span>
	<span class="code-tag">&lt;span wicket:id=<span class="code-quote">"message"</span>&gt;</span>message will be here<span class="code-tag">&lt;/span&gt;</span> (1)
	<span class="code-tag">&lt;p/&gt;</span>
	
	<span class="code-tag">&lt;table cellspacing=<span class="code-quote">"0"</span> class=<span class="code-quote">"dataview"</span>&gt;</span>
    	<span class="code-tag">&lt;tr&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Id<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Incident Date<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Incident Ref<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>First Name<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Last Name<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Summary<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Details<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Email<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Phone<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Origin<span class="code-tag">&lt;/th&gt;</span>
        	<span class="code-tag">&lt;th&gt;</span>Creation date<span class="code-tag">&lt;/th&gt;</span>
    	<span class="code-tag">&lt;/tr&gt;</span>
    	<span class="code-tag">&lt;tr&gt;</span>
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"incidentId"</span>&gt;</span>[incidentId]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>  (2)
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"incidentDate"</span>&gt;</span>[incidentDate]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"incidentRef"</span>&gt;</span>[incidentRef]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"givenName"</span>&gt;</span>[givenName]<span class="code-tag">&lt;/span&gt;</span> <span class="code-tag">&lt;/td&gt;</span>
       	 	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"familyName"</span>&gt;</span>[familyName]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"summary"</span>&gt;</span>[summary]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"details"</span>&gt;</span>[details]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"email"</span>&gt;</span>[email]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"phone"</span>&gt;</span>[phone]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"creationUser"</span>&gt;</span>[creationUser]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>
        	<span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span wicket:id=<span class="code-quote">"creationDate"</span>&gt;</span>[creationDate]<span class="code-tag">&lt;/span&gt;</span><span class="code-tag">&lt;/td&gt;</span>
    	<span class="code-tag">&lt;/tr&gt;</span>
	<span class="code-tag">&lt;/table&gt;</span>

<span class="code-tag">&lt;/body&gt;</span>
<span class="code-tag">&lt;/html&gt;</span>
</pre>
</div></div>

<p>Remarks :<br/>
(1) - The tag wicket:id="message" is used to display top of the screen a message<br/>
(2) - The tags &lt;td&gt; are enriched with parameter wicket:id="" to allow to the wicket code page to replace this property with the property field of the <tt>Incident</tt> class.</p>


<h2><a name="tutorial-osgi-camel-part2c-Step2%3AWebpagecode"></a>Step 2 : Web page code</h2>

<h3><a name="tutorial-osgi-camel-part2c-HomePage.java"></a>HomePage.java</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">package</span> org.apache.camel.example.reportincident;

<span class="code-keyword">import</span> java.util.Iterator;
<span class="code-keyword">import</span> org.apache.camel.example.reportincident.model.Incident;
<span class="code-keyword">import</span> org.apache.camel.example.reportincident.service.IncidentService;
<span class="code-keyword">import</span> org.apache.commons.logging.Log;
<span class="code-keyword">import</span> org.apache.commons.logging.LogFactory;
<span class="code-keyword">import</span> org.apache.wicket.AttributeModifier;
<span class="code-keyword">import</span> org.apache.wicket.PageParameters;
<span class="code-keyword">import</span> org.apache.wicket.markup.html.basic.Label;
<span class="code-keyword">import</span> org.apache.wicket.markup.html.WebPage;
<span class="code-keyword">import</span> org.apache.wicket.markup.repeater.Item;
<span class="code-keyword">import</span> org.apache.wicket.markup.repeater.data.DataView;
<span class="code-keyword">import</span> org.apache.wicket.markup.repeater.data.IDataProvider;
<span class="code-keyword">import</span> org.apache.wicket.model.AbstractReadOnlyModel;
<span class="code-keyword">import</span> org.apache.wicket.model.IModel;
<span class="code-keyword">import</span> org.apache.wicket.model.LoadableDetachableModel;
<span class="code-keyword">import</span> org.apache.wicket.model.Model;
<span class="code-keyword">import</span> org.apache.wicket.spring.injection.annot.SpringBean;

/**
 * Homepage
 */
<span class="code-keyword">public</span> class HomePage <span class="code-keyword">extends</span> WebPage {

	<span class="code-keyword">private</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> <span class="code-object">long</span> serialVersionUID = 1L;

	<span class="code-keyword">private</span> <span class="code-keyword">static</span> <span class="code-keyword">final</span> <span class="code-keyword">transient</span> Log LOG = LogFactory.getLog(HomePage.class);

	@SpringBean (1)
	<span class="code-keyword">private</span> IncidentService incidentService;

	/**
	 * Constructor that is invoked when page is invoked without a session.
	 * 
	 * @param parameters
	 *            Page parameters
	 */
	<span class="code-keyword">public</span> HomePage(<span class="code-keyword">final</span> PageParameters parameters) {

		LOG.debug(<span class="code-quote">"Spring service : "</span> + incidentService.toString());

		<span class="code-comment">// Add the simplest type of label
</span>		add(<span class="code-keyword">new</span> Label(<span class="code-quote">"message"</span>, <span class="code-quote">"List of incidents coming from web services or file : "</span>)); (2)

		DataView dataView = <span class="code-keyword">new</span> DataView(<span class="code-quote">"pageable"</span>, <span class="code-keyword">new</span> IncidentProvider()) { (3)

			@Override
			<span class="code-keyword">protected</span> void populateItem(<span class="code-keyword">final</span> Item item) { (5) 
				Incident incident = (Incident) item.getModelObject();
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"incidentId"</span>, <span class="code-object">String</span>.valueOf(incident
						.getIncidentId())));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"incidentDate"</span>, <span class="code-object">String</span>.valueOf(incident
						.getIncidentDate())));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"incidentRef"</span>, incident.getIncidentRef()));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"givenName"</span>, incident.getGivenName()));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"familyName"</span>, incident.getFamilyName()));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"summary"</span>, incident.getSummary()));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"details"</span>, incident.getDetails()));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"email"</span>, incident.getEmail()));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"phone"</span>, incident.getPhone()));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"creationUser"</span>, incident.getCreationUser()));
				item.add(<span class="code-keyword">new</span> Label(<span class="code-quote">"creationDate"</span>, <span class="code-object">String</span>.valueOf(incident
						.getCreationDate())));

				item.add(<span class="code-keyword">new</span> AttributeModifier(<span class="code-quote">"class"</span>, <span class="code-keyword">true</span>,
						<span class="code-keyword">new</span> AbstractReadOnlyModel() {
							@Override
							<span class="code-keyword">public</span> <span class="code-object">Object</span> getObject() {
								<span class="code-keyword">return</span> (item.getIndex() % 2 == 1) ? <span class="code-quote">"even"</span>
										: <span class="code-quote">"odd"</span>;
							}
						}));
			}
		};
		
        add(dataView);


	}

	<span class="code-keyword">private</span> class IncidentProvider <span class="code-keyword">implements</span> IDataProvider { (4)

		<span class="code-keyword">public</span> Iterator iterator(<span class="code-object">int</span> first, <span class="code-object">int</span> count) {
			<span class="code-keyword">return</span> incidentService.findIncident().iterator();
		}

		<span class="code-keyword">public</span> <span class="code-object">int</span> size() {
			<span class="code-keyword">return</span> incidentService.findIncident().size();
		}

		<span class="code-keyword">public</span> IModel model(<span class="code-object">Object</span> object) {
			<span class="code-keyword">return</span> <span class="code-keyword">new</span> Model((Incident) object);
		}

		<span class="code-keyword">public</span> void detach() {
			<span class="code-comment">// TODO Auto-generated method stub
</span>
		}
	}

	<span class="code-keyword">private</span> class IncidentDetachModel <span class="code-keyword">extends</span> LoadableDetachableModel {

		<span class="code-keyword">private</span> <span class="code-object">long</span> id;

		@Override
		<span class="code-keyword">protected</span> <span class="code-object">Object</span> load() {
			<span class="code-keyword">return</span> incidentService.findIncident(<span class="code-object">String</span>.valueOf(id));
		}

		/**
		 * @param c
		 */
		<span class="code-keyword">public</span> IncidentDetachModel(Incident i) {
			<span class="code-keyword">this</span>(i.getIncidentId());
		}

		<span class="code-keyword">public</span> IncidentDetachModel(<span class="code-object">long</span> id) {

			<span class="code-keyword">if</span> (id == 0) {
				<span class="code-keyword">throw</span> <span class="code-keyword">new</span> IllegalArgumentException();
			}
			<span class="code-keyword">this</span>.id = id;
		}

	}

}

</pre>
</div></div>

<p>Remarks :<br/>
(1) - The @SpringBean annotation is used to inject our spring IncidentService service <br/>
(2) - To set the message label of the HomePage.html, we call the method add(new Label()) and set the property "message" with the information that we want to display on the screen 'List of incidents coming from web services or file'<br/>
(3) - To populate the table of the web page, we will use a DataView object. The DataView class requires as a parameter a IncidentDataProvider which is in fact an inner class implementing the interface IDataProvider. <br/>
(4) - The class IncidentDataProvider will call our IncidentSaver service to retrieve from the database the list of Incidents reported.<br/>
(5) - The populateItem method of the DataView will map the content of our incident objects with the attributes (= items) of the web page</p>

<h3><a name="tutorial-osgi-camel-part2c-WicketApplication.java"></a>WicketApplication.java</h3>

<p>To tell to the Apache Wicket framework that our application contains the page HomePage.html and class HomePage (1), we will create the class <tt>WebApplication</tt> in the directory <tt>src/main/java/org/apache/camel/example/reportincident</tt>) like this.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
<span class="code-keyword">package</span> org.apache.camel.example.reportincident;

<span class="code-keyword">import</span> org.apache.wicket.protocol.http.WebApplication;
<span class="code-keyword">import</span> org.apache.wicket.spring.injection.annot.SpringComponentInjector;

/**
 * Application object <span class="code-keyword">for</span> your web application. If you want to run <span class="code-keyword">this</span> application without deploying, run the Start class.
 * 
 * @see org.apache.wicket.example.Start#main(<span class="code-object">String</span>[])
 */
<span class="code-keyword">public</span> class WicketApplication <span class="code-keyword">extends</span> WebApplication
{    
	
	/**
	 * Init
	 */
    <span class="code-keyword">public</span> void init() {
        <span class="code-keyword">super</span>.init();
        addComponentInstantiationListener(<span class="code-keyword">new</span> SpringComponentInjector(<span class="code-keyword">this</span>)); (2)
    }

	
    /**
     * Constructor
     */
	<span class="code-keyword">public</span> WicketApplication()
	{
	}
	
	/**
	 * @see org.apache.wicket.Application#getHomePage()
	 */
	<span class="code-keyword">public</span> <span class="code-object">Class</span>&lt;HomePage&gt; getHomePage() (1)
	{
		<span class="code-keyword">return</span> HomePage.class;
	}

}
</pre>
</div></div>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><p>To inject Spring into Wicket, we have used the approach described on the following web site of <a href="http://cwiki.apache.org/WICKET/spring.html" rel="nofollow">Apache Wicki documentation</a> and added the line <tt>addComponentInstantiationListener(new SpringComponentInjector(this));</tt> into the class (2)</p></td></tr></table></div>

<h2><a name="tutorial-osgi-camel-part2c-Step3%3Aweb.xmlconfiguration"></a>Step 3 : web.xml configuration</h2>

<p>Now that the code/web pages are ready, we have to create the <tt>web.xml</tt> file in the directory <tt>src/main/webapp/WEB-INF</tt></p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span> encoding=<span class="code-quote">"ISO-8859-1"</span>?&gt;</span>
&lt;web-app xmlns=<span class="code-quote">"http://java.sun.com/xml/ns/j2ee"</span> <span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
	xsi:schemaLocation=<span class="code-quote">"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"</span>
	version=<span class="code-quote">"2.4"</span>&gt;

	<span class="code-tag">&lt;display-name&gt;</span>reportincident.web<span class="code-tag">&lt;/display-name&gt;</span>

	<span class="code-tag">&lt;context-param&gt;</span>
		<span class="code-tag">&lt;param-name&gt;</span>contextClass<span class="code-tag">&lt;/param-name&gt;</span>
		<span class="code-tag">&lt;param-value&gt;</span>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext<span class="code-tag">&lt;/param-value&gt;</span> (2)
	<span class="code-tag">&lt;/context-param&gt;</span>

	<span class="code-tag">&lt;listener&gt;</span>
		<span class="code-tag">&lt;listener-class&gt;</span>org.springframework.web.context.ContextLoaderListener<span class="code-tag">&lt;/listener-class&gt;</span> (1) 
	<span class="code-tag">&lt;/listener&gt;</span>

	<span class="code-tag">&lt;filter&gt;</span>
		<span class="code-tag">&lt;filter-name&gt;</span>camel.example.reportincident.web<span class="code-tag">&lt;/filter-name&gt;</span>
		<span class="code-tag">&lt;filter-class&gt;</span>org.apache.wicket.protocol.http.WicketFilter<span class="code-tag">&lt;/filter-class&gt;</span>
		<span class="code-tag">&lt;init-param&gt;</span>
		    <span class="code-tag">&lt;param-name&gt;</span>applicationClassName<span class="code-tag">&lt;/param-name&gt;</span>
		    <span class="code-tag">&lt;param-value&gt;</span>org.apache.camel.example.reportincident.WicketApplication<span class="code-tag">&lt;/param-value&gt;</span>
		    <span class="code-tag">&lt;param-name&gt;</span>applicationFactoryClassName<span class="code-tag">&lt;/param-name&gt;</span>
		    <span class="code-tag">&lt;param-value&gt;</span>org.apache.wicket.spring.SpringWebApplicationFactory<span class="code-tag">&lt;/param-value&gt;</span> (1)
    	<span class="code-tag">&lt;/init-param&gt;</span>
	<span class="code-tag">&lt;/filter&gt;</span>
	<span class="code-tag">&lt;filter-mapping&gt;</span>
		<span class="code-tag">&lt;filter-name&gt;</span>camel.example.reportincident.web<span class="code-tag">&lt;/filter-name&gt;</span>
		<span class="code-tag">&lt;url-pattern&gt;</span>/*<span class="code-tag">&lt;/url-pattern&gt;</span>
	<span class="code-tag">&lt;/filter-mapping&gt;</span>


<span class="code-tag">&lt;/web-app&gt;</span>
</pre>
</div></div>

<p>Remarks :</p>

<p>(1) - Wicket applications have a global application object which is a subclass of Application. This global application object is only created once per application and is never serialized (since it contains no user-specific data and thus remains the same across all nodes in the cluster). These qualities make it a good candidate to act as a service locator for the rest of the application. Wicket allows you to provide a custom factory for creating this object, the wicket-contrib-spring project provides such a factory (SpringWebApplicationFactory) that, instead of creating an instance, pulls it out of the spring application context. Wicket keeps the instance of the application object in a threadlocal variable and provides various helper methods in components to get to it, so it is easy to retrieve dependencies in wicket components. <br/>
(2) - Spring DM provides a dedicated, OSGi-aware, web application context (called OsgiBundleXmlWebApplicationContext) that offers the same functionality and behaviour to its Spring-MVC brethren, XmlWebApplicationContext. The application context is aware of the web application BundleContext  and thus is able to load resources from the OSGi space, import and export OSGi services and support the BundleContextAware and component scanning across the bundles included in the classpath.</p>

<h2><a name="tutorial-osgi-camel-part2c-Step4%3AAddspringstuffs"></a>Step 4 : Add spring stuffs</h2>

<p>To allow our web bundle to have access to the osgi (1) service <tt>org.apache.camel.example.reportincident.service.IncidentService</tt>, we have to add the following line in the file called <tt>applicationContext</tt> that we create in the directory <tt>src/main/webapp/WEB-INF</tt>.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span>?&gt;</span>
&lt;beans xmlns=<span class="code-quote">"http://www.springframework.org/schema/beans"</span>
<span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
<span class="code-keyword">xmlns:osgi</span>=<span class="code-quote">"http://www.springframework.org/schema/osgi"</span>
xsi:schemaLocation="http://www.springframework.org/schema/beans
                    http://www.springframework.org/schema/beans/spring-beans.xsd
                    http://www.springframework.org/schema/osgi
                    http://www.springframework.org/schema/osgi/spring-osgi.xsd"&gt;
                    
 <span class="code-tag">&lt;osgi:reference id=<span class="code-quote">"incidentService"</span> interface=<span class="code-quote">"org.apache.camel.example.reportincident.service.IncidentService"</span>/&gt;</span> (1)
 
<span class="code-tag">&lt;/beans&gt;</span>
</pre>
</div></div>

<h2><a name="tutorial-osgi-camel-part2c-Step4%3AAdaptthepom.xmlfile"></a>Step 4 : Adapt the pom.xml file</h2>

<p>The pom of this project is different from the bundles projects because :<br/>
(1) - the packaging here is <b>war</b> and not <b>bundle</b>,<br/>
(2) - The MANIFEST.MF file generated must be copied in the WAR<br/>
(3) - we must tell to maven that the plugin in charge to generate the MANIFEST.MF file must be called during the goal/phase : process-classes<br/>
(4) - we want to define the web application context &lt;Webapp-Context&gt; who will be published by <a href="http://wiki.ops4j.org/display/paxweb/Pax+Web" rel="nofollow">PAX Web</a> </p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span> encoding=<span class="code-quote">"UTF-8"</span>?&gt;</span>
&lt;project xmlns=<span class="code-quote">"http://maven.apache.org/POM/4.0.0"</span> <span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
	xsi:schemaLocation=<span class="code-quote">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"</span>&gt;
	<span class="code-tag">&lt;modelVersion&gt;</span>4.0.0<span class="code-tag">&lt;/modelVersion&gt;</span>
	<span class="code-tag">&lt;groupId&gt;</span>org.apache.camel.example<span class="code-tag">&lt;/groupId&gt;</span>
	<span class="code-tag">&lt;artifactId&gt;</span>reportincident.web<span class="code-tag">&lt;/artifactId&gt;</span>
	<span class="code-tag">&lt;packaging&gt;</span>war<span class="code-tag">&lt;/packaging&gt;</span> (1)
	<span class="code-tag">&lt;version&gt;</span>1.0-SNAPSHOT<span class="code-tag">&lt;/version&gt;</span>
	<span class="code-tag">&lt;name&gt;</span>Report Incident Web Bundle<span class="code-tag">&lt;/name&gt;</span>

	<span class="code-tag">&lt;parent&gt;</span>
		<span class="code-tag">&lt;groupId&gt;</span>org.apache.camel.example<span class="code-tag">&lt;/groupId&gt;</span>
	    <span class="code-tag">&lt;artifactId&gt;</span>reportincident.parent<span class="code-tag">&lt;/artifactId&gt;</span>
	    <span class="code-tag">&lt;version&gt;</span>1.0-SNAPSHOT<span class="code-tag">&lt;/version&gt;</span>
	<span class="code-tag">&lt;/parent&gt;</span>

	<span class="code-tag">&lt;dependencies&gt;</span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.apache.camel.example<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>reportincident.service<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>1.0-SNAPSHOT<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
		
		<span class="code-tag"><span class="code-comment">&lt;!-- SPRING DEPENDENCIES --&gt;</span></span>
	    <span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.springframework<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>spring-core<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${spring-version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
	    <span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.springframework<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>spring-beans<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${spring-version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
		&lt;!-- 
	    <span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.springframework<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>spring-webmvc<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${spring-version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
		 --&gt;
		<span class="code-tag"><span class="code-comment">&lt;!--  WICKET DEPENDENCIES --&gt;</span></span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.apache.wicket<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>wicket<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${wicket.version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.apache.wicket<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>wicket-spring<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${wicket.version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.apache.wicket<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>wicket-ioc<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${wicket.version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
                <span class="code-tag">&lt;dependency&gt;</span>
                        <span class="code-tag">&lt;groupId&gt;</span>org.apache.wicket<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>wicket-extensions<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${wicket.version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>

		<span class="code-tag"><span class="code-comment">&lt;!-- LOGGING DEPENDENCIES - LOG4J --&gt;</span></span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.slf4j<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>slf4j-log4j12<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>1.4.2<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>test<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>log4j<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>log4j<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>1.2.14<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>test<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>

		<span class="code-tag"><span class="code-comment">&lt;!--  JUNIT DEPENDENCY FOR TESTING --&gt;</span></span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>junit<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>junit<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>3.8.2<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>test<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>

		<span class="code-tag"><span class="code-comment">&lt;!--  JETTY DEPENDENCIES FOR TESTING  --&gt;</span></span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.mortbay.jetty<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>jetty<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${jetty.version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.mortbay.jetty<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>jetty-util<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${jetty.version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
		<span class="code-tag">&lt;dependency&gt;</span>
			<span class="code-tag">&lt;groupId&gt;</span>org.mortbay.jetty<span class="code-tag">&lt;/groupId&gt;</span>
			<span class="code-tag">&lt;artifactId&gt;</span>jetty-management<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;version&gt;</span>${jetty.version}<span class="code-tag">&lt;/version&gt;</span>
			<span class="code-tag">&lt;scope&gt;</span>provided<span class="code-tag">&lt;/scope&gt;</span>
		<span class="code-tag">&lt;/dependency&gt;</span>
	<span class="code-tag">&lt;/dependencies&gt;</span>
	<span class="code-tag">&lt;build&gt;</span>
		<span class="code-tag">&lt;resources&gt;</span>
			<span class="code-tag">&lt;resource&gt;</span>
				<span class="code-tag">&lt;filtering&gt;</span>false<span class="code-tag">&lt;/filtering&gt;</span>
				<span class="code-tag">&lt;directory&gt;</span>src/main/resources<span class="code-tag">&lt;/directory&gt;</span>
			<span class="code-tag">&lt;/resource&gt;</span>
			<span class="code-tag">&lt;resource&gt;</span>
				<span class="code-tag">&lt;filtering&gt;</span>false<span class="code-tag">&lt;/filtering&gt;</span>
				<span class="code-tag">&lt;directory&gt;</span>src/main/java<span class="code-tag">&lt;/directory&gt;</span>
				<span class="code-tag">&lt;includes&gt;</span>
					<span class="code-tag">&lt;include&gt;</span>**<span class="code-tag">&lt;/include&gt;</span>
				<span class="code-tag">&lt;/includes&gt;</span>
				<span class="code-tag">&lt;excludes&gt;</span>
					<span class="code-tag">&lt;exclude&gt;</span>**/*.java<span class="code-tag">&lt;/exclude&gt;</span>
				<span class="code-tag">&lt;/excludes&gt;</span>
			<span class="code-tag">&lt;/resource&gt;</span>
		<span class="code-tag">&lt;/resources&gt;</span>
		<span class="code-tag">&lt;testResources&gt;</span>
			<span class="code-tag">&lt;testResource&gt;</span>
				<span class="code-tag">&lt;filtering&gt;</span>false<span class="code-tag">&lt;/filtering&gt;</span>
				<span class="code-tag">&lt;directory&gt;</span>src/test/java<span class="code-tag">&lt;/directory&gt;</span>
				<span class="code-tag">&lt;includes&gt;</span>
					<span class="code-tag">&lt;include&gt;</span>**<span class="code-tag">&lt;/include&gt;</span>
				<span class="code-tag">&lt;/includes&gt;</span>
				<span class="code-tag">&lt;excludes&gt;</span>
					<span class="code-tag">&lt;exclude&gt;</span>**/*.java<span class="code-tag">&lt;/exclude&gt;</span>
				<span class="code-tag">&lt;/excludes&gt;</span>
			<span class="code-tag">&lt;/testResource&gt;</span>
		<span class="code-tag">&lt;/testResources&gt;</span>
		<span class="code-tag">&lt;plugins&gt;</span>

			<span class="code-tag">&lt;plugin&gt;</span>
				<span class="code-tag">&lt;inherited&gt;</span>true<span class="code-tag">&lt;/inherited&gt;</span>
				<span class="code-tag">&lt;groupId&gt;</span>org.apache.maven.plugins<span class="code-tag">&lt;/groupId&gt;</span>
				<span class="code-tag">&lt;artifactId&gt;</span>maven-compiler-plugin<span class="code-tag">&lt;/artifactId&gt;</span>
				<span class="code-tag">&lt;configuration&gt;</span>
					<span class="code-tag">&lt;source&gt;</span>1.5<span class="code-tag">&lt;/source&gt;</span>
					<span class="code-tag">&lt;target&gt;</span>1.5<span class="code-tag">&lt;/target&gt;</span>
					<span class="code-tag">&lt;optimise&gt;</span>true<span class="code-tag">&lt;/optimise&gt;</span>
					<span class="code-tag">&lt;debug&gt;</span>true<span class="code-tag">&lt;/debug&gt;</span>
				<span class="code-tag">&lt;/configuration&gt;</span>
			<span class="code-tag">&lt;/plugin&gt;</span>

			<span class="code-tag">&lt;plugin&gt;</span>
				<span class="code-tag">&lt;groupId&gt;</span>org.mortbay.jetty<span class="code-tag">&lt;/groupId&gt;</span>
				<span class="code-tag">&lt;artifactId&gt;</span>maven-jetty-plugin<span class="code-tag">&lt;/artifactId&gt;</span>
			<span class="code-tag">&lt;/plugin&gt;</span>


			<span class="code-tag">&lt;plugin&gt;</span>
				<span class="code-tag">&lt;groupId&gt;</span>org.apache.maven.plugins<span class="code-tag">&lt;/groupId&gt;</span>
				<span class="code-tag">&lt;artifactId&gt;</span>maven-war-plugin<span class="code-tag">&lt;/artifactId&gt;</span>
				<span class="code-tag">&lt;version&gt;</span>2.1-alpha-2<span class="code-tag">&lt;/version&gt;</span>
				<span class="code-tag">&lt;configuration&gt;</span>
					<span class="code-tag">&lt;archive&gt;</span>
						<span class="code-tag"><span class="code-comment">&lt;!-- add the generated manifest to the war --&gt;</span></span> (2)
						<span class="code-tag">&lt;manifestFile&gt;</span>${project.build.outputDirectory}/META-INF/MANIFEST.MF<span class="code-tag">&lt;/manifestFile&gt;</span>
					<span class="code-tag">&lt;/archive&gt;</span>
					&lt;!-- 
					<span class="code-tag">&lt;webResources&gt;</span>
						<span class="code-tag">&lt;resource&gt;</span>
							<span class="code-tag">&lt;directory&gt;</span>src/main/resources/META-INF/spring<span class="code-tag">&lt;/directory&gt;</span>
							<span class="code-tag">&lt;targetPath&gt;</span>META-INF/spring<span class="code-tag">&lt;/targetPath&gt;</span>
						<span class="code-tag">&lt;/resource&gt;</span>
					<span class="code-tag">&lt;/webResources&gt;</span>
					 --&gt;
				<span class="code-tag">&lt;/configuration&gt;</span>

			<span class="code-tag">&lt;/plugin&gt;</span>


			<span class="code-tag"><span class="code-comment">&lt;!-- to generate the MANIFEST-FILE required by the bundle --&gt;</span></span>
			<span class="code-tag">&lt;plugin&gt;</span>
				<span class="code-tag">&lt;groupId&gt;</span>org.apache.felix<span class="code-tag">&lt;/groupId&gt;</span>
				<span class="code-tag">&lt;artifactId&gt;</span>maven-bundle-plugin<span class="code-tag">&lt;/artifactId&gt;</span>
				<span class="code-tag">&lt;version&gt;</span>${felix-version}<span class="code-tag">&lt;/version&gt;</span>
				<span class="code-tag">&lt;extensions&gt;</span>true<span class="code-tag">&lt;/extensions&gt;</span>
				<span class="code-tag">&lt;executions&gt;</span> (3)
					<span class="code-tag">&lt;execution&gt;</span>
						<span class="code-tag">&lt;id&gt;</span>bundle-manifest<span class="code-tag">&lt;/id&gt;</span>
						<span class="code-tag">&lt;phase&gt;</span>process-classes<span class="code-tag">&lt;/phase&gt;</span>
						<span class="code-tag">&lt;goals&gt;</span>
							<span class="code-tag">&lt;goal&gt;</span>manifest<span class="code-tag">&lt;/goal&gt;</span>
						<span class="code-tag">&lt;/goals&gt;</span>
					<span class="code-tag">&lt;/execution&gt;</span>
				<span class="code-tag">&lt;/executions&gt;</span>
				<span class="code-tag">&lt;configuration&gt;</span>
					<span class="code-tag">&lt;supportedProjectTypes&gt;</span>
						<span class="code-tag">&lt;supportedProjectType&gt;</span>bundle<span class="code-tag">&lt;/supportedProjectType&gt;</span> (3)
						<span class="code-tag">&lt;supportedProjectType&gt;</span>war<span class="code-tag">&lt;/supportedProjectType&gt;</span>
					<span class="code-tag">&lt;/supportedProjectTypes&gt;</span>
					<span class="code-tag">&lt;instructions&gt;</span>
						<span class="code-tag">&lt;Bundle-SymbolicName&gt;</span>${pom.artifactId}<span class="code-tag">&lt;/Bundle-SymbolicName&gt;</span>
						<span class="code-tag">&lt;Bundle-ClassPath&gt;</span>
							.,
							WEB-INF/classes,
						<span class="code-tag">&lt;/Bundle-ClassPath&gt;</span>
						<span class="code-tag">&lt;Import-Package&gt;</span>
							javax.servlet;version=<span class="code-quote">"[2.5.0, 3.0.0)"</span>,
							javax.servlet.http;version=<span class="code-quote">"[2.5.0, 3.0.0)"</span>,
							javax.servlet.resources;version=<span class="code-quote">"[2.5.0, 3.0.0)"</span>,
							org.apache.camel.example.reportincident.service,
							org.springframework.web.context;version=<span class="code-quote">"[2.5.6, 3.0.0)"</span>,
							org.springframework.web.context.support;version=<span class="code-quote">"[2.5.6, 3.0.0)"</span>,
							org.springframework.osgi.web.context.support,
							org.xml.sax;resolution:=optional,
							org.w3c.dom;resolution:=optional,
							*
						<span class="code-tag">&lt;/Import-Package&gt;</span>
						<span class="code-tag">&lt;Private-Package&gt;</span>org.apache.camel.example.reportincident<span class="code-tag">&lt;/Private-Package&gt;</span>
						<span class="code-tag">&lt;Export-Package&gt;</span><span class="code-tag">&lt;/Export-Package&gt;</span>
						<span class="code-tag">&lt;Webapp-Context&gt;</span>reportincidentweb<span class="code-tag">&lt;/Webapp-Context&gt;</span> (4)
						<span class="code-tag">&lt;_failok&gt;</span>true<span class="code-tag">&lt;/_failok&gt;</span>
					<span class="code-tag">&lt;/instructions&gt;</span>
				<span class="code-tag">&lt;/configuration&gt;</span>

			<span class="code-tag">&lt;/plugin&gt;</span>
		<span class="code-tag">&lt;/plugins&gt;</span>
	<span class="code-tag">&lt;/build&gt;</span>
<span class="code-tag">&lt;/project&gt;</span>
</pre>
</div></div>

<p>Remark : To deploy the war in your maven repository, execute the following maven command <div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">mvn clean install</pre>
</div></div></p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>One big advantage of the approach followed here is that the web application will not be packages with the jar required in the lib directory but only with the classes/pages/... which are part of the application. The jar required by the Web Application must be deployed separately on the OSGI server. Another positive aspect is the clear separation between the front layer from the service/persistence layers. Our application uses OSGI services which are injected in the configuration. So you are no more dependent of a big WAR/EAR file as it was the case with monolithic J2EE applications <img class="emoticon" src="/confluence/images/icons/emoticons/wink.gif" height="20" width="20" align="absmiddle" alt="" border="0"/> </td></tr></table></div>

<h2><a name="tutorial-osgi-camel-part2c-BuildandPackagetheapplication"></a>Build and Package the application</h2>

<h3><a name="tutorial-osgi-camel-part2c-Build"></a>Build</h3>

<p>To build the project, you must execute the following maven command in the root of the installation directory :</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
mvn clean install -Dtest=<span class="code-keyword">false</span>  -DfailIfNoTests=<span class="code-keyword">false</span>
</pre>
</div></div>


<h3><a name="tutorial-osgi-camel-part2c-Package"></a>Package</h3>

<p>To simplify our deployment procedure, we will use the provisioning mechanism of Apache Felix Karaf called 'Feature'. In a feature xml file, we will define the bundles that we will package and their dependencies. The bundles can be linked to a feature and features can be linked together. This file will be packaged in a jar.</p>

<p>The advantage of the feature is that you avoid to deploy manually your bundles in your OSGI server and they can be versioned as you will see in the file. Moreover, the feature can be seen as a contract between your development and the deployment team. Different versions can be created according to the environment where the code will be deployed (development, acceptance and production).  </p>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><p>If you prefer to generate automatically the file based on the dependencies of yours pom, then you can use the maven plugin maven-features-plugin </p></td></tr></table></div>

<p>Create the file <tt>reportincident.features-1.0-SNAPSHOT-features.xml</tt> in the directory <tt>src/main</tt> of the project <tt>reportincident.features</tt></p>

<p>Remarks :<br/>
(1) - The reportincident feature has the number version 1.0<br/>
(2) - Each feature is a collection of bundles or bundles/features. The bundle tag contains the URI syntax used by <a href="http://wiki.ops4j.org/display/paxurl/Documentation" rel="nofollow">PAX URI</a> to install the JAR or the resource on the OSGI server. We us the mvn protocol to download the jar from Maven repository but other protocols exist (see OPS4J for more info)<br/>
(3) - The camel feature include a list of camel-xx features.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span> encoding=<span class="code-quote">"UTF-8"</span>?&gt;</span>
&lt;!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the <span class="code-quote">"License"</span>); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an <span class="code-quote">"AS IS"</span> BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
--&gt;
<span class="code-tag">&lt;features&gt;</span>
	
   <span class="code-tag">&lt;feature name=<span class="code-quote">"reportincident"</span> version=<span class="code-quote">"1.0-SNAPSHOT"</span>&gt;</span>
	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.camel.example/reportincident.activemq/1.0-SNAPSHOT<span class="code-tag">&lt;/bundle&gt;</span>
	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.camel.example/reportincident.queueservice/1.0-SNAPSHOT<span class="code-tag">&lt;/bundle&gt;</span>
	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.camel.example/reportincident.model/1.0-SNAPSHOT<span class="code-tag">&lt;/bundle&gt;</span>
	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.camel.example/reportincident.persistence/1.0-SNAPSHOT<span class="code-tag">&lt;/bundle&gt;</span>
	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.camel.example/reportincident.service/1.0-SNAPSHOT<span class="code-tag">&lt;/bundle&gt;</span>
	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.camel.example/reportincident.webservice/1.0-SNAPSHOT<span class="code-tag">&lt;/bundle&gt;</span>
	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.camel.example/reportincident.routing/1.0-SNAPSHOT<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.camel.example/reportincident.web/1.0-SNAPSHOT/war<span class="code-tag">&lt;/bundle&gt;</span>
    <span class="code-tag">&lt;/feature&gt;</span>
	
    <span class="code-tag">&lt;feature name=<span class="code-quote">"transaction"</span> version=<span class="code-quote">"1.0.0"</span>&gt;</span>
	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/2.0.0<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.howl/1.0.1-1_1<span class="code-tag">&lt;/bundle&gt;</span>
   	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.geronimo.components/geronimo-transaction/2.2-r634076<span class="code-tag">&lt;/bundle&gt;</span>
  	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.servicemix.transaction/org.apache.servicemix.transaction/1.0.0<span class="code-tag">&lt;/bundle&gt;</span> 
    <span class="code-tag">&lt;/feature&gt;</span>

    <span class="code-tag">&lt;feature name=<span class="code-quote">"connector"</span> version=<span class="code-quote">"4.0.0"</span>&gt;</span>
        <span class="code-tag">&lt;feature version=<span class="code-quote">"1.0.0"</span>&gt;</span>transaction<span class="code-tag">&lt;/feature&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/2.0.0<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.geronimo.components/geronimo-connector/2.1.3<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.geronimo.specs/geronimo-servlet_2.5_spec/1.1.2<span class="code-tag">&lt;/bundle&gt;</span> 
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.springframework/spring-tx/2.5.6.SEC01<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.jencks/jencks/2.2<span class="code-tag">&lt;/bundle&gt;</span>
    <span class="code-tag">&lt;/feature&gt;</span>
		
   <span class="code-tag">&lt;feature name=<span class="code-quote">"activemq"</span> version=<span class="code-quote">"5.3.0"</span>&gt;</span>
        <span class="code-tag">&lt;feature version=<span class="code-quote">"4.0.0"</span>&gt;</span>connector<span class="code-tag">&lt;/feature&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.geronimo.specs/geronimo-j2ee-management_1.1_spec/1.0.1<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:commons-pool/commons-pool/1.4<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.xbean/xbean-spring/3.5<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.activemq/kahadb/5.3.0<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.activemq/activemq-core/5.3.0<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.activemq/activemq-ra/5.3.0<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.activemq/activemq-console/5.3.0<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.activemq/activemq-pool/5.3.0<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag"><span class="code-comment">&lt;!-- &lt;bundle&gt;</span>mvn:org.apache.servicemix.activemq/org.apache.servicemix.activemq.commands/4.0.0<span class="code-tag">&lt;/bundle&gt;</span> --&gt;</span>
    <span class="code-tag">&lt;/feature&gt;</span>
	
    <span class="code-tag">&lt;feature name=<span class="code-quote">"activemq-camel"</span> version=<span class="code-quote">"5.3.0"</span>&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.activemq/activemq-camel/5.3.0<span class="code-tag">&lt;/bundle&gt;</span>
    <span class="code-tag">&lt;/feature&gt;</span>
	
    <span class="code-tag">&lt;feature name=<span class="code-quote">"spring-web"</span>&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.springframework/spring-web/2.5.6.SEC01<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.springframework.osgi/spring-osgi-web/1.2.0<span class="code-tag">&lt;/bundle&gt;</span> 
    <span class="code-tag">&lt;/feature&gt;</span>
   
    <span class="code-tag">&lt;feature name=<span class="code-quote">"hibernate"</span>&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.springframework/spring-orm/2.5.6.SEC01<span class="code-tag">&lt;/bundle&gt;</span>
        <span class="code-tag">&lt;bundle&gt;</span>mvn:org.springframework/spring-jdbc/2.5.6.SEC01<span class="code-tag">&lt;/bundle&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j/1.6.1_2<span class="code-tag">&lt;/bundle&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.antlr/com.springsource.antlr/2.7.7<span class="code-tag">&lt;/bundle&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.jgroups/com.springsource.org.jgroups/2.5.1<span class="code-tag">&lt;/bundle&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.jboss.javassist/com.springsource.javassist/3.3.0.ga<span class="code-tag">&lt;/bundle&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.hibernate/com.springsource.org.hibernate/3.3.1.GA<span class="code-tag">&lt;/bundle&gt;</span>
    <span class="code-tag">&lt;/feature&gt;</span>
    
    <span class="code-tag">&lt;feature name=<span class="code-quote">"jdbc-driver"</span>&gt;</span>
	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp/1.2.2_3<span class="code-tag">&lt;/bundle&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:com.mysql.jdbc/com.springsource.com.mysql.jdbc/5.1.8<span class="code-tag">&lt;/bundle&gt;</span>
    <span class="code-tag">&lt;/feature&gt;</span>
    
    <span class="code-tag">&lt;feature name=<span class="code-quote">"wicket"</span> version=<span class="code-quote">"1.4.7"</span>&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.wicket/wicket/1.4.7<span class="code-tag">&lt;/bundle&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.wicket/wicket-ioc/1.4.7<span class="code-tag">&lt;/bundle&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.wicket/wicket-spring/1.4.7<span class="code-tag">&lt;/bundle&gt;</span>
    	<span class="code-tag"><span class="code-comment">&lt;!-- &lt;bundle&gt;</span>mvn:org.apache.wicket/wicket-spring-annot/1.4.7<span class="code-tag">&lt;/bundle&gt;</span> --&gt;</span>
    	<span class="code-tag">&lt;bundle&gt;</span>mvn:org.apache.wicket/wicket-extensions/1.4.7<span class="code-tag">&lt;/bundle&gt;</span>
    <span class="code-tag">&lt;/feature&gt;</span> 
     
<span class="code-tag">&lt;/features&gt;</span>
</pre>
</div></div>

<p>To generate the jar file containing the feature xml file, adapt the pom.xml like this :</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;project xmlns=<span class="code-quote">"http://maven.apache.org/POM/4.0.0"</span> <span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
	xsi:schemaLocation=<span class="code-quote">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"</span>&gt;
	<span class="code-tag">&lt;modelVersion&gt;</span>4.0.0<span class="code-tag">&lt;/modelVersion&gt;</span>
	<span class="code-tag">&lt;groupId&gt;</span>org.apache.camel.example<span class="code-tag">&lt;/groupId&gt;</span>
	<span class="code-tag">&lt;artifactId&gt;</span>reportincident.features<span class="code-tag">&lt;/artifactId&gt;</span>
	<span class="code-tag">&lt;packaging&gt;</span>jar<span class="code-tag">&lt;/packaging&gt;</span>
	<span class="code-tag">&lt;version&gt;</span>1.0-SNAPSHOT<span class="code-tag">&lt;/version&gt;</span>
	<span class="code-tag">&lt;name&gt;</span>Reportincident :: Project Features<span class="code-tag">&lt;/name&gt;</span>
	
	<span class="code-tag">&lt;parent&gt;</span>
		<span class="code-tag">&lt;groupId&gt;</span>org.apache.camel.example<span class="code-tag">&lt;/groupId&gt;</span>
	    <span class="code-tag">&lt;artifactId&gt;</span>reportincident.parent<span class="code-tag">&lt;/artifactId&gt;</span>
	    <span class="code-tag">&lt;version&gt;</span>1.0-SNAPSHOT<span class="code-tag">&lt;/version&gt;</span>
	<span class="code-tag">&lt;/parent&gt;</span>

	<span class="code-tag">&lt;build&gt;</span>
		<span class="code-tag">&lt;resources&gt;</span>
			<span class="code-tag"><span class="code-comment">&lt;!-- standard Maven folder --&gt;</span></span>
			<span class="code-tag">&lt;resource&gt;</span>
				<span class="code-tag">&lt;directory&gt;</span>src/main/resources<span class="code-tag">&lt;/directory&gt;</span>
			<span class="code-tag">&lt;/resource&gt;</span>
		<span class="code-tag">&lt;/resources&gt;</span>

		<span class="code-tag">&lt;plugins&gt;</span>
			<span class="code-tag">&lt;plugin&gt;</span>
				<span class="code-tag">&lt;groupId&gt;</span>org.apache.maven.plugins<span class="code-tag">&lt;/groupId&gt;</span>
				<span class="code-tag">&lt;artifactId&gt;</span>maven-resources-plugin<span class="code-tag">&lt;/artifactId&gt;</span>
				<span class="code-tag">&lt;version&gt;</span>2.3<span class="code-tag">&lt;/version&gt;</span>
				<span class="code-tag">&lt;executions&gt;</span>
					<span class="code-tag">&lt;execution&gt;</span>
						<span class="code-tag">&lt;phase&gt;</span>copy-resources<span class="code-tag">&lt;/phase&gt;</span>
						<span class="code-tag">&lt;goals&gt;</span>
							<span class="code-tag">&lt;goal&gt;</span>resources<span class="code-tag">&lt;/goal&gt;</span>
						<span class="code-tag">&lt;/goals&gt;</span>
					<span class="code-tag">&lt;/execution&gt;</span>
				<span class="code-tag">&lt;/executions&gt;</span>
			<span class="code-tag">&lt;/plugin&gt;</span>
		<span class="code-tag">&lt;/plugins&gt;</span>
	<span class="code-tag">&lt;/build&gt;</span>

<span class="code-tag">&lt;/project&gt;</span>
</pre>
</div></div>

<p>During the execution of the following maven command :</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
mvn clean install
</pre>
</div></div>

<p>maven will put the file <tt>reportincident.features-1.0-SNAPSHOT-features.xml</tt> in the jar and the jar will be installed in your Maven local repository under the directory {{<em>localMavenRepository</em>/org/apache/camel/example/reportincident.features/1.0-SNAPSHOT</p>

<h2><a name="tutorial-osgi-camel-part2c-Deploy"></a>Deploy</h2>

<p>The deployment process is very simple and two steps will be necessary :</p>

<h3><a name="tutorial-osgi-camel-part2c-Step1%3ACopypropertiesfilesinetcdirectory"></a>Step 1 : Copy properties files in etc directory</h3>

<p>Copy the files containing your properties file <tt>org.apache.camel.example.reportincident.datasource.cfg, ...</tt> in the <tt>etc</tt> directory of Apache Felix Karaf and customize them if required</p>

<h3><a name="tutorial-osgi-camel-part2c-Step2%3AEditthefileorg.apache.felix.karaf.features.cfg"></a>Step 2 : Edit the file org.apache.felix.karaf.features.cfg</h3>

<p>To use the feature file created in the previous section, we must adapt the file <tt>org.apache.felix.karaf.features.cfg</tt> that you find in the <tt>etc</tt> directory </p>

<p>Replace the current featureRepositories line with the following :</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
featuresRepositories=mvn:org.apache.felix.karaf/apache-felix-karaf/1.4.0/xml/features,mvn:org.apache.camel.karaf/apache-camel/2.2.0/xml/features,jar:mvn:org.apache.camel.example/reportincident.features/1.0-SNAPSHOT!/reportincident.features-1.0-SNAPSHOT-features.xml
</pre>
</div></div>

<p>This line will be processed by PAX Url who will pickup the <tt>reportincident.features-1.0-SNAPSHOT-features.xml</tt> file from the jar located in the maven repository <tt><em>localMavenRepo</em>/org.apache.camel.example/reportincident.features/1.0-SNAPSHOT</tt></p>

<p>and </p>

<p>replace the existing line containing the featuresBoot parameter</p>

<p>by</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
featuresBoot=spring,spring-dm,camel,camel-bindy,camel-jms,activemq,activemq-camel,http,war,spring-web,camel-cxf,hibernate,jdbc-driver,wicket,reportincident
</pre>
</div></div>

<p>By adding these two lines, we will configure our Apache Felix Karaf server to install bundles from features defined in the order appearing at the line of featuresBoot</p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The deployment order of the bundle is critical in an OSGI environement. This is why for the purposes of this project/tutorial we have organised in consequence. If you plan to change something in the application, be aware of that</td></tr></table></div>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><p>The /etc/system.property file must be modified to define the environment variable servicemix.base used by activemq bundle<br/>
Add the following line<br/>
servicemix.base=root</p>
</td></tr></table></div>

<h2><a name="tutorial-osgi-camel-part2c-Testit"></a>Test it</h2>

<h3><a name="tutorial-osgi-camel-part2c-Step1%3Alaunchapplication"></a>Step 1 : launch application</h3>

<p>It is time to launch the karaf server and to test if our application works well. If this is not yet done, <a href="http://felix.apache.org/site/downloads.cgi" rel="nofollow">download Apache Felix Karaf 1.4.0</a> server and install it. Launch the server by executing the command in the <tt>bin</tt> folder:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
c:\apache-felix-karaf-1.4.0\bin&gt;karaf
</pre>
</div></div>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><p>If this is the first time that Karaf is started, then you will see that a new <tt>data</tt> folder is created. This directory will contain subfolders :</p>
<ul class="alternate" type="square">
	<li>cache : containing the bundlles deployed</li>
	<li>log : where the log file is updated by the application</li>
</ul>
</td></tr></table></div>

<h3><a name="tutorial-osgi-camel-part2c-Step2%3ACheckosgilist"></a>Step 2 : Check osgi list</h3>

<p>When the following prompt appears on the screen :</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
c:\apache-felix-karaf-1.0.0\bin&gt;karaf
        __ __                  ____
       / <span class="code-comment">//_/____ __________ _/ __/
</span>      / ,&lt;  / __ `/ ___/ __ `/ /_
     / /| |/ /_/ / /  / /_/ / __/
    /_/ |_|\__,_/_/   \__,_/_/

  Apache Felix Karaf (1.4.0)

Hit '&lt;tab&gt;' <span class="code-keyword">for</span> a list of available commands
and '[cmd] --help' <span class="code-keyword">for</span> help on a specific command.

karaf@root&gt;
</pre>
</div></div>

<p>execute the command :</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root:/&gt; osgi:list
</pre>
</div></div>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>During the first launch of Karaf, it will install all the bundles defined in the features (one by one) in the order defined. 134 bundles must be deployed, so be patient because it can take time depending of your internet connection, cpu, processor of your machine.</td></tr></table></div> 

<p>but after a few minutes, you must see the following list</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; osgi:list
START LEVEL 100
   ID   State         Blueprint      Spring    Level  Name
[   0] [Active     ] [            ] [       ] [    0] <span class="code-object">System</span> Bundle (2.0.4)
[   1] [Active     ] [            ] [       ] [    5] OPS4J Pax Url - mvn: (1.1.2)
[   2] [Active     ] [            ] [       ] [    5] OPS4J Pax Url - wrap: (1.1.2)
[   3] [Active     ] [            ] [       ] [    8] OPS4J Pax Logging - API (1.4)
[   4] [Active     ] [            ] [       ] [    8] OPS4J Pax Logging - Service (1.4)
[   5] [Active     ] [            ] [       ] [   10] Apache Felix Configuration Admin Service (1.2.4)
[   6] [Active     ] [            ] [       ] [   10] Apache Felix Preferences Service (1.0.4)
[   7] [Active     ] [            ] [       ] [   11] Apache Felix File Install (2.0.8)
[   8] [Active     ] [Created     ] [       ] [   20] Apache Geronimo Blueprint Bundle (1.0.0)
[   9] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Features Management (1.4.0)
[  10] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Spring Deployer (1.4.0)
[  11] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Features Deployer (1.4.0)
[  12] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell Various Commands (1.4.0)
[  13] [Active     ] [            ] [       ] [   30] Apache Mina SSHD :: Core (0.3.0)
[  14] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell Development Commands (1.4.0)
[  15] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Features Core (1.4.0)
[  16] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell ConfigAdmin Commands (1.4.0)
[  17] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell PackageAdmin Commands (1.4.0)
[  18] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Blueprint Deployer (1.4.0)
[  19] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: JAAS Modules (1.4.0)
[  20] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Admin Management (1.4.0)
[  21] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell OSGi Commands (1.4.0)
[  22] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: JAAS Config (1.4.0)
[  23] [Active     ] [            ] [       ] [   30] org.osgi.impl.bundle.jmx (4.2.0.200907080519)
[  24] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Features Command (1.4.0)
[  25] [Active     ] [            ] [       ] [   30] Apache Felix Gogo Shell <span class="code-object">Runtime</span> (0.2.2)
[  26] [Active     ] [            ] [       ] [   30] Apache MINA Core (2.0.0.RC1)
[  27] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell Console (1.4.0)
[  28] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Admin Core (1.4.0)
[  29] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Management (1.4.0)
[  30] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Admin Command (1.4.0)
[  31] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell Log Commands (1.4.0)
[  32] [Active     ] [Created     ] [       ] [   30] Apache Felix Karaf :: Shell SSH (1.4.0)
[  33] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: aopalliance-1.0 (1.0.0.3)
[  34] [Active     ] [            ] [       ] [   60] Spring Core (2.5.6.SEC01)
[  35] [Active     ] [            ] [       ] [   60] Spring Beans (2.5.6.SEC01)
[  36] [Active     ] [            ] [       ] [   60] Spring AOP (2.5.6.SEC01)
[  37] [Active     ] [            ] [       ] [   60] Spring Context (2.5.6.SEC01)
[  38] [Active     ] [            ] [       ] [   60] Spring Context Support (2.5.6.SEC01)
[  39] [Active     ] [            ] [       ] [   60] Apache ServiceMix Specs :: ACTIVATION API 1.4 (1.4.0)
[  40] [Active     ] [            ] [       ] [   60] Apache ServiceMix Specs :: JAXB API 2.1 (1.4.0)
[  41] [Active     ] [            ] [       ] [   60] Apache ServiceMix Specs :: STAX API 1.0 (1.4.0)
[  42] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jaxb-impl-2.1.12 (2.1.12.1)
[  43] [Active     ] [            ] [       ] [   60] Commons Management (1.0)
[  44] [Active     ] [            ] [       ] [   60] camel-core (2.2.0)
[  45] [Active     ] [            ] [       ] [   60] Spring Transaction (2.5.6.SEC01)
[  46] [Active     ] [            ] [       ] [   60] geronimo-jta_1.1_spec (1.1.1)
[  47] [Active     ] [            ] [       ] [   60] Commons Pool (1.5.4)
[  48] [Active     ] [            ] [       ] [   60] geronimo-jms_1.1_spec (1.1.1)
[  49] [Active     ] [            ] [       ] [   60] Spring JMS (2.5.6.SEC01)
[  50] [Active     ] [            ] [       ] [   60] camel-jms (2.2.0)
[  51] [Active     ] [            ] [       ] [   60] geronimo-servlet_2.5_spec (1.1.2)
[  52] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jetty-6.1.22 (6.1.22.1)
[  53] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - API (0.7.2)
[  54] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Service SPI (0.7.2)
[  55] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - <span class="code-object">Runtime</span> (0.7.2)
[  56] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Jetty (0.7.2)
[  57] [Active     ] [            ] [       ] [   60] camel-bindy (2.2.0)
[  58] [Active     ] [            ] [       ] [   60] activemq-camel (5.3.0)
[  59] [Active     ] [            ] [Started] [   60] Reportincident :: ActiveMQ Queuing Engine (1.0.0.SNAPSHOT)
[  60] [Active     ] [            ] [Started] [   60] Reportincident :: Camel Queuing Service (1.0.0.SNAPSHOT)
[  61] [Active     ] [            ] [       ] [   60] Reportincident :: Model Bundle (1.0.0.SNAPSHOT)
[  62] [Active     ] [            ] [Started] [   60] Reportincident :: Persistence Bundle (1.0.0.SNAPSHOT)
[  63] [Active     ] [            ] [Started] [   60] Reportincident :: Service Bundle (1.0.0.SNAPSHOT)
[  64] [Active     ] [            ] [       ] [   60] Reportincident :: Webservice Bundle (1.0.0.SNAPSHOT)
[  65] [Active     ] [            ] [Started] [   60] Reportincident :: Routing Bundle (1.0.0.SNAPSHOT)
[  66] [Active     ] [            ] [       ] [   60] Reportincident :: Web Bundle (1.0.0.SNAPSHOT)
[  67] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: commons-dbcp-1.2.2 (1.2.2.3)
[  68] [Active     ] [            ] [       ] [   60] MySQL AB's JDBC Driver <span class="code-keyword">for</span> MySQL (5.1.6)
[  69] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: cglib-2.1_3 (2.1.0.3_4)
[  70] [Active     ] [            ] [       ] [   60] spring-osgi-io (1.2.0)
[  71] [Active     ] [            ] [       ] [   60] spring-osgi-core (1.2.0)
[  72] [Active     ] [            ] [       ] [   60] spring-osgi-extender (1.2.0)
[  73] [Active     ] [            ] [       ] [   60] spring-osgi-annotation (1.2.0)
[  74] [Active     ] [Created     ] [       ] [   60] Apache Felix Karaf :: Spring Deployer (1.2.0)
[  75] [Active     ] [            ] [       ] [   60] camel-spring-osgi (2.2.0)
[  76] [Active     ] [            ] [       ] [   60] Spring Web (2.5.6.SEC01)
[  77] [Active     ] [            ] [       ] [   60] spring-osgi-web (1.2.0)
[  78] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jetty-6.1.14 (6.1.14.1)
[  79] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - API (0.7.1)
[  80] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Service SPI (0.7.1)
[  81] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - <span class="code-object">Runtime</span> (0.7.1)
[  82] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Jetty (0.7.1)
[  83] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: asm-2.2.3 (2.2.3.3)
[  84] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jetty-6.1.19 (6.1.19.2)
[  85] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: commons-codec-1.3 (1.3.0.2)
[  86] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: jdom-1.1 (1.1.0.2)
[  87] [Active     ] [            ] [       ] [   60] jettison (1.2)
[  88] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: ant-1.7.0 (1.7.0.3)
[  89] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: bcel-5.2 (5.2.0.2)
[  90] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xalan-2.7.1 (2.7.1.2)
[  91] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xercesImpl-2.9.1 (2.9.1.3)
[  92] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xmlbeans-2.4.0 (2.4.0.3)
[  93] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xmlsec-1.4.3 (1.4.3.2)
[  94] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: xmlresolver-1.2 (1.2.0.2)
[  95] [Active     ] [            ] [       ] [   60] Woodstox XML-processor (4.0.7)
[  96] [Active     ] [            ] [       ] [   60] Stax2 API (3.0.1)
[  97] [Active     ] [            ] [       ] [   60] XmlSchema (1.4.5)
[  98] [Active     ] [            ] [       ] [   60] Commons Lang (2.4)
[  99] [Active     ] [            ] [       ] [   60] Commons Collections (3.2.1)
[ 100] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: antlr-2.7.7 (2.7.7.2)
[ 101] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: oro-2.0.8 (2.0.8.3)
[ 102] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: velocity-1.6.2 (1.6.2.3)
[ 103] [Active     ] [            ] [       ] [   60] Axiom API (1.2.8)
[ 104] [Active     ] [            ] [       ] [   60] Axiom API (1.2.8)
[ 105] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: mail-1.4.1 (1.4.1.2)
[ 106] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: neethi-2.0.4 (2.0.4.2)
[ 107] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: abdera-0.4.0-incubating (0.4.0.incubating_3)
[ 108] [Active     ] [            ] [       ] [   60] geronimo-jaxws_2.1_spec (1.0)
[ 109] [Active     ] [            ] [       ] [   60] geronimo-annotation_1.0_spec (1.1.1)
[ 110] [Active     ] [            ] [       ] [   60] Apache ServiceMix Specs :: SAAJ API 1.3 (1.4.0)
[ 111] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: wsdl4j-1.6.2 (1.6.2.2)
[ 112] [Active     ] [            ] [       ] [   60] Apache ServiceMix Specs :: JSR311 API 1.0 (1.4.0)
[ 113] [Active     ] [            ] [       ] [   60] geronimo-ws-metadata_2.0_spec (1.1.2)
[ 114] [Active     ] [            ] [Started] [   60] Apache CXF Bundle Jar (2.2.6)
[ 115] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: commons-io-1.3.2 (1.3.2.3)
[ 116] [Active     ] [            ] [       ] [   60] camel-cxf (2.2.0)
[ 117] [Active     ] [            ] [       ] [   60] geronimo-j2ee-connector_1.5_spec (2.0.0)
[ 118] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: howl-1.0.1-1 (1.0.1.1_1)
[ 119] [Active     ] [            ] [       ] [   60] Geronimo TxManager :: Transaction (2.2.0.r634076)
[ 120] [Active     ] [            ] [Started] [   60] Apache ServiceMix Transaction (1.0.0)
[ 121] [Active     ] [            ] [       ] [   60] Geronimo TxManager :: Connector (2.1.3)
[ 122] [Active     ] [            ] [       ] [   60] Jencks (2.2)
[ 123] [Active     ] [            ] [       ] [   60] geronimo-j2ee-management_1.1_spec (1.0.1)
[ 124] [Active     ] [            ] [       ] [   60] Apache Commons Pool Bundle (1.4)
[ 125] [Active     ] [            ] [       ] [   60] xbean-spring (3.5)
[ 126] [Active     ] [            ] [       ] [   60] kahadb (5.3.0)
[ 127] [Active     ] [            ] [       ] [   60] activemq-core (5.3.0)
[ 128] [Active     ] [            ] [       ] [   60] activemq-ra (5.3.0)
[ 129] [Active     ] [            ] [       ] [   60] activemq-console (5.3.0)
[ 130] [Active     ] [            ] [       ] [   60] activemq-pool (5.3.0)
[ 131] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Jsp Support (0.7.2)
[ 132] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Extender - WAR (0.7.2)
[ 133] [Active     ] [            ] [       ] [   60] OPS4J Pax Web - Extender - Whiteboard (0.7.2)
[ 134] [Active     ] [            ] [       ] [   60] OPS4J Pax Url - war:, war-i: (1.1.2)
[ 135] [Active     ] [Created     ] [       ] [   60] Apache Felix Karaf :: WAR Deployer (1.4.0)
[ 136] [Active     ] [            ] [       ] [   60] Wicket (1.4.7)
[ 137] [Active     ] [            ] [       ] [   60] Wicket IoC common code (1.4.7)
[ 138] [Active     ] [            ] [       ] [   60] Wicket Spring Integration (1.4.7)
[ 139] [Active     ] [            ] [       ] [   60] Wicket Extensions (1.4.7)
[ 140] [Active     ] [            ] [       ] [   60] Spring ORM (2.5.6.SEC01)
[ 141] [Active     ] [            ] [       ] [   60] Spring JDBC (2.5.6.SEC01)
[ 142] [Active     ] [            ] [       ] [   60] Apache ServiceMix Bundles: dom4j-1.6.1 (1.6.1.2)
[ 143] [Active     ] [            ] [       ] [   60] ANTLR (2.7.7)
[ 144] [Active     ] [            ] [       ] [   60] JGroups Toolkit (2.5.1)
[ 145] [Active     ] [            ] [       ] [   60] Javassist Java Programming Assistant (3.3.0.ga)
[ 146] [Active     ] [            ] [       ] [   60] JBoss Hibernate <span class="code-object">Object</span>-Relational Mapper (3.3.1.GA)
</pre>
</div></div>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/confluence/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><p>If errors happen during installation of the bundles, the list could be not completed. In this is the case, the feature provisioning system has stopped the installation. You have to check the log file of karaf and depending of the error reported, correction made, the  installation can be relaunched in the menu 'feature' using the command :</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; features:list
  State          Version       Name
[uninstalled]  [      0.0.0] hibernate

karaf@root&gt; features:install hibernate
</pre>
</div></div>

<p>If a problem occurs with a bundle, you can by example recompile the code, regenerate the jar and update the bundle using the command </p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; osgi:update xxx
</pre>
</div></div>
<p>where xxx corresponds to the bundle to be updated</p></td></tr></table></div>

<p>The features list can also be very helpfull to see which features has been installed</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
karaf@root&gt; features:list

State         Version        Name                     Repository
[installed  ] [2.2.0       ] camel                    repo-0
[installed  ] [2.2.0       ] camel-core               repo-0
[installed  ] [2.2.0       ] camel-spring-osgi        repo-0
[uninstalled] [2.2.0       ] camel-spring             repo-0
[uninstalled] [2.2.0       ] camel-osgi               repo-0
[uninstalled] [2.2.0       ] camel-test               repo-0
[installed  ] [2.2.0       ] camel-cxf                repo-0
[uninstalled] [2.2.0       ] camel-cache              repo-0
[uninstalled] [2.2.0       ] camel-castor             repo-0
[uninstalled] [2.2.0       ] camel-dozer              repo-0
[uninstalled] [2.2.0       ] camel-http               repo-0
[uninstalled] [2.2.0       ] camel-mina               repo-0
[uninstalled] [2.2.0       ] camel-jetty              repo-0
[uninstalled] [2.2.0       ] camel-servlet            repo-0
[installed  ] [2.2.0       ] camel-jms                repo-0
[uninstalled] [2.2.0       ] camel-amqp               repo-0
[uninstalled] [2.2.0       ] camel-atom               repo-0
[uninstalled] [2.2.0       ] camel-bam                repo-0
[installed  ] [2.2.0       ] camel-bindy              repo-0
[uninstalled] [2.2.0       ] camel-cometd             repo-0
[uninstalled] [2.2.0       ] camel-csv                repo-0
[uninstalled] [2.2.0       ] camel-flatpack           repo-0
[uninstalled] [2.2.0       ] camel-freemarker         repo-0
[uninstalled] [2.2.0       ] camel-ftp                repo-0
[uninstalled] [2.2.0       ] camel-guice              repo-0
[uninstalled] [2.2.0       ] camel-groovy             repo-0
[uninstalled] [2.2.0       ] camel-hl7                repo-0
[uninstalled] [2.2.0       ] camel-ibatis             repo-0
[uninstalled] [2.2.0       ] camel-irc                repo-0
[uninstalled] [2.2.0       ] camel-jaxb               repo-0
[uninstalled] [2.2.0       ] camel-jcr                repo-0
[uninstalled] [2.2.0       ] camel-jing               repo-0
[uninstalled] [2.2.0       ] camel-jdbc               repo-0
[uninstalled] [2.2.0       ] camel-josql              repo-0
[uninstalled] [2.2.0       ] camel-jpa                repo-0
[uninstalled] [2.2.0       ] camel-jxpath             repo-0
[uninstalled] [2.2.0       ] camel-juel               repo-0
[uninstalled] [2.2.0       ] camel-ldap               repo-0
[uninstalled] [2.2.0       ] camel-mail               repo-0
[uninstalled] [2.2.0       ] camel-msv                repo-0
[uninstalled] [2.2.0       ] camel-mvel               repo-0
[uninstalled] [2.2.0       ] camel-ognl               repo-0
[uninstalled] [2.2.0       ] camel-printer            repo-0
[uninstalled] [2.2.0       ] camel-protobuf           repo-0
[uninstalled] [2.2.0       ] camel-quartz             repo-0
[uninstalled] [2.2.0       ] camel-restlet            repo-0
[uninstalled] [2.2.0       ] camel-rmi                repo-0
[uninstalled] [2.2.0       ] camel-rss                repo-0
[uninstalled] [2.2.0       ] camel-saxon              repo-0
[uninstalled] [2.2.0       ] camel-scala              repo-0
[uninstalled] [2.2.0       ] camel-script             repo-0
[uninstalled] [2.2.0       ] camel-smpp               repo-0
[uninstalled] [2.2.0       ] camel-snmp               repo-0
[uninstalled] [2.2.0       ] camel-spring-integration repo-0
[uninstalled] [2.2.0       ] camel-sql                repo-0
[uninstalled] [2.2.0       ] camel-stream             repo-0
[uninstalled] [2.2.0       ] camel-string-template    repo-0
[uninstalled] [2.2.0       ] camel-tagsoup            repo-0
[uninstalled] [2.2.0       ] camel-velocity           repo-0
[uninstalled] [2.2.0       ] camel-xmlbeans           repo-0
[uninstalled] [2.2.0       ] camel-xmlsecurity        repo-0
[uninstalled] [2.2.0       ] camel-xmpp               repo-0
[uninstalled] [2.2.0       ] camel-xstream            repo-0
[installed  ] [2.5.6.SEC01 ] spring                   karaf-1.4.0
[installed  ] [1.2.0       ] spring-dm                karaf-1.4.0
[uninstalled] [1.4.0       ] wrapper                  karaf-1.4.0
[uninstalled] [1.4.0       ] obr                      karaf-1.4.0
[installed  ] [1.4.0       ] http                     karaf-1.4.0
[installed  ] [1.4.0       ] war                      karaf-1.4.0
[uninstalled] [1.4.0       ] webconsole               karaf-1.4.0
[installed  ] [1.4.0       ] ssh                      karaf-1.4.0
[installed  ] [1.4.0       ] management               karaf-1.4.0
[installed  ] [1.0-SNAPSHOT] reportincident           repo-0
[installed  ] [1.0.0       ] transaction              repo-0
[installed  ] [4.0.0       ] connector                repo-0
[installed  ] [5.3.0       ] activemq                 repo-0
[installed  ] [5.3.0       ] activemq-camel           repo-0
[installed  ] [0.0.0       ] spring-web               repo-0
[installed  ] [0.0.0       ] hibernate                repo-0
[installed  ] [0.0.0       ] jdbc-driver              repo-0
[installed  ] [1.4.7       ] wicket                   repo-0
[uninstalled] [0.0.0       ] http-reportingincident   repo-0
</pre>
</div></div>

<h3><a name="tutorial-osgi-camel-part2c-Step3%3AIncidentfile"></a>Step 3 : Incident file</h3>

<p>To test the Camel routing, we have to produce an incident file report and put it in the file defined in the from uri of your inittial route. Create a file containing csv lines :</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
001,29-04-2009,Claus,Ibsen,incident camel-001,<span class="code-keyword">this</span> is a report incident <span class="code-keyword">for</span> camel-001,cibsen@gmail.com,+111 10 20 300
002,29-04-2009,Charles,Moulliard,incident smx-002,<span class="code-keyword">this</span> is a report incident <span class="code-keyword">for</span> smx-002,cmoulliard@gmail.com,+222 10 20 300
003,28-04-2009,Guillaume,Nodet,incident camel-123,<span class="code-keyword">this</span> is a report incident <span class="code-keyword">for</span> camel-123,gnodet@gmail.com,+333 10 20 300
004,25-04-2009,Gert,Vanthienen,incident camel-454,<span class="code-keyword">this</span> is a report incident <span class="code-keyword">for</span> camel-454,gvanthienen@gmail.com,+444 10 20 300
005,24-04-2009,James,Anstey,incident smx-023,<span class="code-keyword">this</span> is a report incident <span class="code-keyword">for</span> smx-023,janstey@gmail.com,+555 10 20 300
007,01-04-2009,Willem,Jiang,incident smx-456,<span class="code-keyword">this</span> is a report incident <span class="code-keyword">for</span> smx-456,wjiang@gmail.com,+666 10 20 300
008,27-04-2009,Matt,Raibble,incident appfuse-123,<span class="code-keyword">this</span> is a report incident <span class="code-keyword">for</span> appfuse-123,mraibble@gmail.com,+777 10 20 300
009,12-04-2009,Jean-Baptiste,Onofré,incident smx3-088,<span class="code-keyword">this</span> is a report incident <span class="code-keyword">for</span> smx3-088,cjbonofre@gmail.com,+888 10 20 300
010,17-04-2009,Hadrian,Zbarcea,incident camel-005,<span class="code-keyword">this</span> is a report incident <span class="code-keyword">for</span> camel-005,hzbarcea@gmail.com,+999 10 20 300
</pre>
</div></div>

<p>Save your file and copy it in the folder</p>

<p>Check the log of SMX and you must see something like this </p>

<p><a href="/confluence/download/attachments/116430/log_file_servicemix.txt?version=1">log_file_servicemix.txt</a></p>

<p>Next, open the web page of your application : <a href="http://localhost:8080/reportincidentweb/" rel="nofollow">http://localhost:8080/reportincidentweb/</a></p>

<p><a class="confluence-thumbnail-link 1400x1020" href='http://cwiki.apache.org/confluence/download/attachments/116430/reportincident_file.GIF'><img src="/confluence/download/thumbnails/116430/reportincident_file.GIF" align="absmiddle" border="0" /></a></p>

<h3><a name="tutorial-osgi-camel-part2c-Step4%3ACallawebservice"></a>Step 4 : Call a webservice</h3>

<p>You can use the tool <a href="/confluence/pages/createpage.action?spaceKey=CAMEL&amp;title=www.soapui.org&amp;linkCreation=true&amp;fromPageId=116430" class="createlink">Soapui</a> to call the web service of the application.</p>

<p>Use the following url from Soapui, to generate the client interface to communicate with the web service : <a href="http://localhost:8080/cxf/camel-example/incident?wsdl" rel="nofollow">http://localhost:8080/cxf/camel-example/incident?wsdl</a>.</p>

<p>Call the web service with the request : <a href="http://localhost:8080/cxf/camel-example/incident" rel="nofollow">http://localhost:8080/cxf/camel-example/incident</a> <br/>
and the following SOAP message request by example :</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;soapenv:Envelope <span class="code-keyword">xmlns:soapenv</span>=<span class="code-quote">"http://schemas.xmlsoap.org/soap/envelope/"</span> <span class="code-keyword">xmlns:rep</span>=<span class="code-quote">"http://reportincident.example.camel.apache.org"</span>&gt;</span>
   <span class="code-tag">&lt;soapenv:Header/&gt;</span>
   <span class="code-tag">&lt;soapenv:Body&gt;</span>
      <span class="code-tag">&lt;rep:inputReportIncident&gt;</span>
         <span class="code-tag">&lt;incidentId&gt;</span>000<span class="code-tag">&lt;/incidentId&gt;</span>
         <span class="code-tag">&lt;incidentDate&gt;</span>29-04-2009<span class="code-tag">&lt;/incidentDate&gt;</span>
         <span class="code-tag">&lt;givenName&gt;</span>Charles<span class="code-tag">&lt;/givenName&gt;</span>
         <span class="code-tag">&lt;familyName&gt;</span>Moulliard<span class="code-tag">&lt;/familyName&gt;</span>
         <span class="code-tag">&lt;summary&gt;</span>This is an web service report incident<span class="code-tag">&lt;/summary&gt;</span>
         <span class="code-tag">&lt;details&gt;</span>This is an web service report incident,This is an web service report incident.<span class="code-tag">&lt;/details&gt;</span>
         <span class="code-tag">&lt;email&gt;</span>cmoulliard@gmail.com<span class="code-tag">&lt;/email&gt;</span>
         <span class="code-tag">&lt;phone&gt;</span>+222 10 20 30 40<span class="code-tag">&lt;/phone&gt;</span>
      <span class="code-tag">&lt;/rep:inputReportIncident&gt;</span>
   <span class="code-tag">&lt;/soapenv:Body&gt;</span>
<span class="code-tag">&lt;/soapenv:Envelope&gt;</span>
</pre>
</div></div> 

<p>Check the Karaf log :</p>

<p><a href="/confluence/download/attachments/116430/log_file_servicemix2.txt?version=1">log_file_servicemix2.txt</a></p>

<p>and web screen result : <a href="http://localhost:8080/reportincidentweb/" rel="nofollow">http://localhost:8080/reportincidentweb/</a></p>

<p><a class="confluence-thumbnail-link 1400x1020" href='http://cwiki.apache.org/confluence/download/attachments/116430/reportincident_ws.GIF'><img src="/confluence/download/thumbnails/116430/reportincident_ws.GIF" align="absmiddle" border="0" /></a></p>

<h2><a name="tutorial-osgi-camel-part2c-Conclusion"></a>Conclusion</h2>

<p>Well, this tutorial was a little bit long but we have tried to provide you all the required information to design a real application using Apache Camel, Felix Karaf, OSGI, CXF and Apache Wicket frameworks. We hope that we have reached the goals defined in the introduction and will continue to improve its content based on Apache frameworks evolution. A part which is not covered but we plan to add it in the future concerns the testing/debugging of the application and transactional aspects. </p>

<h2><a name="tutorial-osgi-camel-part2c-Links"></a>Links</h2>

<ul class="alternate" type="square">
	<li><a href="/confluence/display/CAMEL/tutorial-osgi-camel-part2" title="tutorial-osgi-camel-part2">Part 2 : real example, architecture, project setup, database creation</a></li>
	<li><a href="/confluence/display/CAMEL/tutorial-osgi-camel-part2a" title="tutorial-osgi-camel-part2a">Part 2a : transform projects in bundles</a></li>
	<li><a href="/confluence/display/CAMEL/tutorial-osgi-camel-part2b" title="tutorial-osgi-camel-part2b">Part 2b : add infrastructure and routing</a></li>
	<li>Part 2c : web and deployment</li>
</ul>


<h2><a name="tutorial-osgi-camel-part2c-%23Resources"></a><a href="#tutorial-osgi-camel-part2c-Resources">Resources</a></h2>

<ul>
	<li>
    
    

            <div class="greybox">
        There are currently no attachments on this page.
        </div>
    
    </li>
</ul>

     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action" class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CAMEL/tutorial-osgi-camel-part2c">View Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=116430&revisedVersion=35&originalVersion=34">View Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/tutorial-osgi-camel-part2c?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message