Hi,

I am trying to set up a scenario similar to "Using the Restlet servlet
within a webapp" (http://camel.apache.org/restlet.html).
However, my WAR is deployed inside an Apache Karaf container using
Aries/Blueprint instead of Spring/Spring DM.

How can I provide the Blueprint-defined Restlet-Component to the
Restlet-Servlet?

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:camel="http://camel.apache.org/schema/blueprint";
       xsi:schemaLocation="
            http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
            http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd";>

    <!-- Restlet set-up -->
    <bean id="restletComponent"
          class="org.restlet.Component"/>

    <bean id="camelRestletComponent"
class="org.apache.camel.component.restlet.RestletComponent">
        <argument index="0" type="org.restlet.Component"
ref="restletComponent"/>
    </bean>

    <!-- ... -->

    <camel:camelContext id="camelContext">

        <camel:route>
            <camel:from uri="restlet:/doSomething"/>
            <camel:to uri="direct:wasteBin"/>
        </camel:route>

        <!-- ... -->
    </camel:camelContext>

</blueprint>

The only thing I can think of, is to expose the restletComponent as an
OSGi-service, e.g.,

    <service id="restletComponentService"
             interface="org.restlet.Component"
             ref="restletComponent"/>

and provide a BlueprintServerServlet similar to SpringServerServlet that
performs a JNDI lookup for "osgi:service/org.restlet.Component".

Yet, even if that would work, it just doesn't feel "right" to expose the
component as a service. Are there any alternatives?

-- 
Janko Heilgeist
Softwareingenieur @ QAware GmbH

Reply via email to