You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2016/11/14 16:25:49 UTC

[27/38] incubator-unomi git commit: UNOMI-60 inject blueprint bundle context into PrivacyServiceImpl so we can get and return current version of UNOMI instead of hardcoded value

UNOMI-60 inject blueprint bundle context into PrivacyServiceImpl so we can get and return current version of UNOMI instead of hardcoded value


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/d8c63f58
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/d8c63f58
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/d8c63f58

Branch: refs/heads/UNOMI-28-ES-2-X-UPGRADE
Commit: d8c63f58fe4c6ed6423dd3ba835431506006c945
Parents: ac31af9
Author: dgaillard <dg...@jahia.com>
Authored: Thu Oct 20 17:51:12 2016 +0200
Committer: dgaillard <dg...@jahia.com>
Committed: Thu Oct 20 17:51:12 2016 +0200

----------------------------------------------------------------------
 extensions/privacy-extension/services/pom.xml                | 5 +++++
 .../apache/unomi/privacy/internal/PrivacyServiceImpl.java    | 8 +++++++-
 .../src/main/resources/OSGI-INF/blueprint/blueprint.xml      | 1 +
 3 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d8c63f58/extensions/privacy-extension/services/pom.xml
----------------------------------------------------------------------
diff --git a/extensions/privacy-extension/services/pom.xml b/extensions/privacy-extension/services/pom.xml
index d13fe92..4afcde8 100644
--- a/extensions/privacy-extension/services/pom.xml
+++ b/extensions/privacy-extension/services/pom.xml
@@ -48,6 +48,11 @@
             <artifactId>cxf-rt-rs-security-cors</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d8c63f58/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java
----------------------------------------------------------------------
diff --git a/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java b/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java
index ce97f52..87604ba 100644
--- a/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java
+++ b/extensions/privacy-extension/services/src/main/java/org/apache/unomi/privacy/internal/PrivacyServiceImpl.java
@@ -23,6 +23,7 @@ import org.apache.unomi.api.services.PrivacyService;
 import org.apache.unomi.api.services.ProfileService;
 import org.apache.unomi.persistence.spi.PersistenceService;
 import org.apache.unomi.persistence.spi.aggregate.TermsAggregate;
+import org.osgi.framework.BundleContext;
 
 import java.util.*;
 
@@ -35,6 +36,7 @@ public class PrivacyServiceImpl implements PrivacyService {
     private ProfileService profileService;
     private EventService eventService;
     private List<String> defaultDeniedProperties;
+    private BundleContext bundleContext;
 
     public void setPersistenceService(PersistenceService persistenceService) {
         this.persistenceService = persistenceService;
@@ -56,11 +58,15 @@ public class PrivacyServiceImpl implements PrivacyService {
         this.defaultDeniedProperties = Arrays.asList(defaultDeniedProperties.split(","));
     }
 
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
     @Override
     public ServerInfo getServerInfo() {
         ServerInfo serverInfo = new ServerInfo();
         serverInfo.setServerIdentifier("Apache Unomi");
-        serverInfo.setServerVersion("2.0.0.incubating-SNAPSHOT");
+        serverInfo.setServerVersion(bundleContext.getBundle().getVersion().toString());
 
         // let's retrieve all the event types the server has seen.
         Map<String,Long> eventTypeCounts = persistenceService.aggregateQuery(null, new TermsAggregate("eventType"), Event.ITEM_TYPE);

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/d8c63f58/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
index ea4df97..2755772 100644
--- a/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ b/extensions/privacy-extension/services/src/main/resources/OSGI-INF/blueprint/blueprint.xml
@@ -43,6 +43,7 @@
         <property name="eventService" ref="eventService" />
         <property name="profileService" ref="profileService" />
         <property name="defaultDeniedProperties" value="${defaultDeniedProperties}" />
+        <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
     <service id="privacyService" ref="privacyServiceImpl" auto-export="interfaces"/>
 </blueprint>