This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void start(BundleContext context) throws Exception { | |
System.out.println("start simple policy client"); | |
ServiceReference[] serviceReferences = context.getServiceReferences(PolicyService.class.getName(), "(Insurer=*)"); | |
if(serviceReferences != null && serviceReferences.length > 0){ | |
for(int i =0; i < serviceReferences.length; i++){ | |
PolicyService policyService = (PolicyService)context.getService(serviceReferences[i]); | |
System.out.println("Trying to find the services"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bundle-Name: policy.service.api | |
Bundle-Description: policy.service.api | |
Bundle-Version: 1.0.0 | |
Bundle-Activator: com.x.policy.Activator | |
Import-Package: org.osgi.framework | |
Export-Package: com.x.policy.service.api |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bundle-Name: policy.service.client | |
Bundle-SymbolicName: policy.service.client | |
Bundle-Description: Simple policy.service client | |
Bundle-Version: 1.0 | |
Bundle-Activator: com.x.policy.Activator | |
Import-Package: org.osgi.framework, com.x.policy.service.api;version="[1.0,2)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> | |
<groupId>com.x</groupId> | |
<artifactId>policy.service.api</artifactId> | |
<version>1.0.0</version> | |
<packaging>jar</packaging> | |
<name>policy.service.api</name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<groupId>com.x</groupId> | |
<artifactId>policy.client</artifactId> | |
<version>1.0.0</version> | |
<packaging>jar</packaging> | |
================================== | |
<dependency> | |
<groupId>com.x</groupId> | |
<artifactId>policy.service.api</artifactId> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bundle-Name: Policy.Service.A | |
Bundle-SymbolicName: Policy.Service.A | |
Bundle-Description: policy service for Insurer A | |
Bundle-Version: 1.0.0 | |
Bundle-Activator: com.x.policy.Activator | |
Import-Package: org.osgi.framework, com.x.policy.service.api;version="1.0.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- at the top , note packaging is changed from jar to bundle--> | |
<groupId>com.x</groupId> | |
<artifactId>policy.client</artifactId> | |
<version>3.0.0</version> | |
<packaging>bundle</packaging> | |
=================================== | |
<!-- inside dependencies --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- at top, note packaging type changed --> | |
<groupId>com.x</groupId> | |
<artifactId>policy.service.api</artifactId> | |
<version>3.0.0</version> | |
<packaging>bundle</packaging> | |
================================== | |
<!-- inside build tag, replace maven jar plugin with this --> | |
<plugin> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- at top --> | |
<groupId>com.x</groupId> | |
<artifactId>policy.service.a</artifactId> | |
<version>3.0.0</version> | |
<packaging>bundle</packaging> | |
<!-- in dependencies --> | |
<dependencies> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="policy.service.api" immediate="false"> | |
<service> | |
<provide interface="com.x.policy.service.api.PolicyService"/> | |
</service> | |
</scr:component> |