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.a" immediate="true"> | |
<service> | |
<provide interface="com.x.policy.service.api.PolicyService"/> | |
</service> | |
<implementation class="com.x.policy.service.impl.PolicyServiceImpl"/> | |
</scr:component> |
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.client" immediate="true"> | |
<implementation class="com.x.policy.client.PolicyServiceClient"/> | |
<reference | |
interface="com.x.policy.service.api.PolicyService" | |
bind="addPolicyService" | |
unbind="removePolicyService" | |
cardinality="1..n" | |
policy="dynamic" |
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
/** | |
* Policy client class. | |
* @author Dileep Hareendran | |
* | |
*/ | |
public class PolicyServiceClient { | |
private Set<PolicyService> services = new HashSet<PolicyService>(); | |
/** | |
* Hook method called on activation of this service client. |
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.service.a</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
<groupId>com.y</groupId> | |
<artifactId>non-osgi-dep-depth1</artifactId> | |
<version>1.0.0</version> | |
<packaging>jar</packaging> | |
<name>non-osgi-dep-depth1</name> | |
<url>http://maven.apache.org</url> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
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.y</groupId> | |
<artifactId>non-osgi-dep-depth2</artifactId> | |
<version>1.0.0</version> | |
<packaging>jar</packaging> | |
<name>non-osgi-dep-depth2</name> | |
<url>http://maven.apache.org</url> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
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.y</groupId> | |
<artifactId>non-osgi-dep-depth3</artifactId> | |
<version>1.0.0</version> | |
<packaging>jar</packaging> | |
<name>non-osgi-dep-depth3</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
package com.y.d1; | |
import com.y.d2.Depth2; | |
public class Depth1 { | |
public String call(String x){ | |
Depth2 d2 = new Depth2(); | |
return "data service " + d2.call(x); | |
} |
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
//Modify getName() method as follows | |
public String getName(){ | |
Depth1 d1 = new Depth1(); | |
return "policywithdep-1.0" + d1.call(" deep call "); | |
} | |
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
/** | |
* Hook method called on activation of this service client. | |
* @param context BundleContext | |
*/ | |
public void activate(ComponentContext context){ | |
System.out.println(" >>> " + context.getProperties().get("cmp.name")); | |
} | |
/** |