I don't understand how can I make a ""common" project containing just the
service interface. "

For me this is a good answer, what more ?

Thank you for your answer

that is my provider : 
ProviderActivator.java 
******************************
package com.bw.osgi.provider;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import com.bw.osgi.provider.able.messageService;
import com.bw.osgi.provider.impl.MessageServiceImpl;

public class ProviderActivator implements BundleActivator {
    private ServiceRegistration registration;

    @Override
    public void start(BundleContext bundleContext) throws Exception {
        registration = bundleContext.registerService(
                messageService.class.getName(),
                new MessageServiceImpl(),
                null);
    }

    @Override
    public void stop(BundleContext bundleContext) throws Exception {
        registration.unregister();
    }
}

MessageServiceImpl.java
**********************************
package com.bw.osgi.provider.impl;
import com.bw.osgi.provider.able.messageService;
public class MessageServiceImpl  implements messageService  {
        public String message(String message) { 
             return "mon message : " + message; 
           } 
}
messageService.java
*********************
package com.bw.osgi.provider.able;
public interface messageService {
           public String message(String message); 
}



-----
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>net.lr.tutorial.karaf.cxf.personservice</groupId>
    <artifactId>personservice-parent</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>
  <artifactId>personservice-message</artifactId>
  <version>1.0</version>
  <packaging>bundle</packaging>
    
      <dependencies>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
    
       <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                       
<Bundle-SymbolicName>personservice-message</Bundle-SymbolicName>
                       
<Export-Package>com.bw.osgi.provider.able</Export-Package>
                       
<Bundle-Activator>com.bw.osgi.provider.ProviderActivator</Bundle-Activator>
                        <Bundle-Vendor>parker</Bundle-Vendor>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build> 
    
    
    
</project>



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Karaf-Tutorial-Part-4-CXF-Services-in-OSGi-How-to-use-a-new-service-tp4033785p4033813.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to