26de38
From d7a2d969b55ab34a223ad1422b2e3ef7d95a347f Mon Sep 17 00:00:00 2001
26de38
From: Marian Koncek <mkoncek@redhat.com>
26de38
Date: Mon, 5 Nov 2018 09:59:04 +0100
26de38
Subject: [PATCH] Port to osgi-cmpn
26de38
26de38
---
26de38
 .../utils/repository/AggregateRepository.java | 20 +++++++++++++++++++
26de38
 .../utils/repository/BaseRepository.java      | 19 ++++++++++++++++++
26de38
 .../utils/properties/MockBundleContext.java   | 10 ++++++++++
26de38
 3 files changed, 49 insertions(+)
26de38
26de38
diff --git a/src/main/java/org/apache/felix/utils/repository/AggregateRepository.java b/src/main/java/org/apache/felix/utils/repository/AggregateRepository.java
26de38
index 50dceaf..4da3141 100644
26de38
--- a/src/main/java/org/apache/felix/utils/repository/AggregateRepository.java
26de38
+++ b/src/main/java/org/apache/felix/utils/repository/AggregateRepository.java
26de38
@@ -25,7 +25,12 @@ import java.util.Map;
26de38
 
26de38
 import org.osgi.resource.Capability;
26de38
 import org.osgi.resource.Requirement;
26de38
+import org.osgi.resource.Resource;
26de38
+import org.osgi.service.repository.ExpressionCombiner;
26de38
 import org.osgi.service.repository.Repository;
26de38
+import org.osgi.service.repository.RequirementBuilder;
26de38
+import org.osgi.service.repository.RequirementExpression;
26de38
+import org.osgi.util.promise.Promise;
26de38
 
26de38
 public class AggregateRepository implements Repository {
26de38
 
26de38
@@ -52,4 +57,19 @@ public class AggregateRepository implements Repository {
26de38
         }
26de38
         return result;
26de38
     }
26de38
+
26de38
+	@Override
26de38
+	public Promise<Collection<Resource>> findProviders(RequirementExpression expression) {
26de38
+		throw new UnsupportedOperationException();
26de38
+	}
26de38
+
26de38
+	@Override
26de38
+	public ExpressionCombiner getExpressionCombiner() {
26de38
+		throw new UnsupportedOperationException();
26de38
+	}
26de38
+
26de38
+	@Override
26de38
+	public RequirementBuilder newRequirementBuilder(String namespace) {
26de38
+		throw new UnsupportedOperationException();
26de38
+	}
26de38
 }
26de38
diff --git a/src/main/java/org/apache/felix/utils/repository/BaseRepository.java b/src/main/java/org/apache/felix/utils/repository/BaseRepository.java
26de38
index 95adadd..0998ab0 100644
26de38
--- a/src/main/java/org/apache/felix/utils/repository/BaseRepository.java
26de38
+++ b/src/main/java/org/apache/felix/utils/repository/BaseRepository.java
26de38
@@ -30,7 +30,11 @@ import org.osgi.framework.Constants;
26de38
 import org.osgi.resource.Capability;
26de38
 import org.osgi.resource.Requirement;
26de38
 import org.osgi.resource.Resource;
26de38
+import org.osgi.service.repository.ExpressionCombiner;
26de38
 import org.osgi.service.repository.Repository;
26de38
+import org.osgi.service.repository.RequirementBuilder;
26de38
+import org.osgi.service.repository.RequirementExpression;
26de38
+import org.osgi.util.promise.Promise;
26de38
 
26de38
 /**
26de38
  */
26de38
@@ -90,4 +94,19 @@ public class BaseRepository implements Repository {
26de38
         }
26de38
         return result;
26de38
     }
26de38
+
26de38
+	@Override
26de38
+	public Promise<Collection<Resource>> findProviders(RequirementExpression expression) {
26de38
+		throw new UnsupportedOperationException();
26de38
+	}
26de38
+
26de38
+	@Override
26de38
+	public ExpressionCombiner getExpressionCombiner() {
26de38
+		throw new UnsupportedOperationException();
26de38
+	}
26de38
+
26de38
+	@Override
26de38
+	public RequirementBuilder newRequirementBuilder(String namespace) {
26de38
+		throw new UnsupportedOperationException();
26de38
+	}
26de38
 }
26de38
diff --git a/src/test/java/org/apache/felix/utils/properties/MockBundleContext.java b/src/test/java/org/apache/felix/utils/properties/MockBundleContext.java
26de38
index 3eab444..df94a6c 100644
26de38
--- a/src/test/java/org/apache/felix/utils/properties/MockBundleContext.java
26de38
+++ b/src/test/java/org/apache/felix/utils/properties/MockBundleContext.java
26de38
@@ -25,7 +25,9 @@ import org.osgi.framework.BundleListener;
26de38
 import org.osgi.framework.Filter;
26de38
 import org.osgi.framework.FrameworkListener;
26de38
 import org.osgi.framework.InvalidSyntaxException;
26de38
+import org.osgi.framework.ServiceFactory;
26de38
 import org.osgi.framework.ServiceListener;
26de38
+import org.osgi.framework.ServiceObjects;
26de38
 import org.osgi.framework.ServiceReference;
26de38
 import org.osgi.framework.ServiceRegistration;
26de38
 
26de38
@@ -105,6 +107,10 @@ public class MockBundleContext implements BundleContext {
26de38
         throw new UnsupportedOperationException();
26de38
     }
26de38
 
26de38
+    public <S> ServiceRegistration<S> registerService(Class<S> clazz, ServiceFactory<S> factory, Dictionary<String, ?> properties) {
26de38
+        throw new UnsupportedOperationException();
26de38
+    }
26de38
+
26de38
     public ServiceReference[] getServiceReferences(String s, String s1) throws InvalidSyntaxException {
26de38
         throw new UnsupportedOperationException();
26de38
     }
26de38
@@ -125,6 +131,10 @@ public class MockBundleContext implements BundleContext {
26de38
         throw new UnsupportedOperationException();
26de38
     }
26de38
 
26de38
+	public <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> reference) {
26de38
+	    throw new UnsupportedOperationException();
26de38
+	}
26de38
+
26de38
     public File getDataFile(String s) {
26de38
         throw new UnsupportedOperationException();
26de38
     }
26de38
-- 
26de38
2.17.2
26de38