You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by tj...@apache.org on 2020/11/05 15:56:27 UTC
[felix-dev] 04/06: Add support for AnyService
This is an automated email from the ASF dual-hosted git repository.
tjwatson pushed a commit to branch scrR8
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
commit 5b25fb86601b8f30cec2b1d6c4a2bf5d862f8c57
Author: Thomas Watson <tj...@us.ibm.com>
AuthorDate: Wed Oct 28 16:33:27 2020 -0500
Add support for AnyService
---
.../felix/scr/impl/manager/DependencyManager.java | 94 +++++---
.../scr/integration/AnyServiceReferenceTest.java | 254 +++++++++++++++++++++
.../components/AnyServiceComponent.java | 108 +++++++++
.../components/AnyServiceComponentInvalid.java | 28 +++
.../components/AnyServiceComponentList.java | 30 +++
.../components/AnyServiceComponentMap.java | 30 +++
.../resources/integration_test_any_service.xml | 211 +++++++++++++++++
7 files changed, 723 insertions(+), 32 deletions(-)
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
index cddedda..b6473b7 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/DependencyManager.java
@@ -58,6 +58,9 @@ import org.osgi.service.component.ComponentException;
*/
public class DependencyManager<S, T> implements ReferenceManager<S, T>
{
+ public static final String ANY_SERVICE_CLASS = "org.osgi.service.component.AnyService";
+
+ public static final String NEVER_SATIFIED_FILTER = "(&(invalid.target.cannot.resolve=*)(!(invalid.target.cannot.resolve=*)))";
// the component to which this dependency belongs
private final AbstractComponentManager<S> m_componentManager;
@@ -2383,7 +2386,7 @@ public class DependencyManager<S, T> implements ReferenceManager<S, T>
getName(), target);
//create a filter that will never be satisfied
- target = "(&(invalid.target.cannot.resolve=*)(!(invalid.target.cannot.resolve=*)))";
+ target = DependencyManager.NEVER_SATIFIED_FILTER;
}
}
m_target = target;
@@ -2394,39 +2397,11 @@ public class DependencyManager<S, T> implements ReferenceManager<S, T>
// classFilter
// "(" + Constants.OBJECTCLASS + "=" + m_dependencyMetadata.getInterface() + ")"
- final StringBuilder classFilterSB = new StringBuilder();
- classFilterSB.append(OBJECTCLASS_CLAUSE);
- classFilterSB.append(m_dependencyMetadata.getInterface());
- classFilterSB.append(')');
- final String classFilterString = classFilterSB.toString();
+ final String classFilterString = getClassFilter();
// initialReferenceFilter
- final boolean multipleExpr = m_target != null
- || m_dependencyMetadata.getScope() == ReferenceScope.prototype_required;
- final StringBuilder initialReferenceFilterSB = new StringBuilder();
- if (multipleExpr)
- {
- initialReferenceFilterSB.append("(&");
- }
- initialReferenceFilterSB.append(classFilterString);
-
- // if reference scope is prototype_required, we simply add
- // (service.scope=prototype) to the filter
- if (m_dependencyMetadata.getScope() == ReferenceScope.prototype_required)
- {
- initialReferenceFilterSB.append(PROTOTYPE_SCOPE_CLAUSE);
- }
-
- // append target
- if (m_target != null)
- {
- initialReferenceFilterSB.append(m_target);
- }
- if (multipleExpr)
- {
- initialReferenceFilterSB.append(')');
- }
- String initialReferenceFilterString = initialReferenceFilterSB.toString();
+ final String initialReferenceFilterString = getInitialReferenceFilter(
+ classFilterString, target);
final ServiceTracker<T, RefPair<S, T>, ExtendedServiceEvent> oldTracker = m_tracker;
AtomicInteger trackingCount = new AtomicInteger();
@@ -2466,6 +2441,61 @@ public class DependencyManager<S, T> implements ReferenceManager<S, T>
null, getName());
}
+ private String getClassFilter()
+ {
+ String objectClass = m_dependencyMetadata.getInterface();
+ if (DependencyManager.ANY_SERVICE_CLASS.equals(objectClass))
+ {
+ objectClass = "*";
+ }
+ final StringBuilder classFilterSB = new StringBuilder();
+ classFilterSB.append(OBJECTCLASS_CLAUSE);
+ classFilterSB.append(objectClass);
+ classFilterSB.append(')');
+ return classFilterSB.toString();
+ }
+
+ private String getInitialReferenceFilter(String classFilterString, String target)
+ {
+ if (target == null)
+ {
+ if (DependencyManager.ANY_SERVICE_CLASS.equals(
+ m_dependencyMetadata.getInterface()))
+ {
+ m_componentManager.getLogger().log(Level.ERROR,
+ "The dependency reference {0} is an AnyService reference with no target specified.",
+ null, getName());
+ target = DependencyManager.NEVER_SATIFIED_FILTER;
+ }
+ }
+ final boolean multipleExpr = target != null
+ || m_dependencyMetadata.getScope() == ReferenceScope.prototype_required;
+ final StringBuilder initialReferenceFilterSB = new StringBuilder();
+ if (multipleExpr)
+ {
+ initialReferenceFilterSB.append("(&");
+ }
+ initialReferenceFilterSB.append(classFilterString);
+
+ // if reference scope is prototype_required, we simply add
+ // (service.scope=prototype) to the filter
+ if (m_dependencyMetadata.getScope() == ReferenceScope.prototype_required)
+ {
+ initialReferenceFilterSB.append(PROTOTYPE_SCOPE_CLAUSE);
+ }
+
+ // append target
+ if (target != null)
+ {
+ initialReferenceFilterSB.append(m_target);
+ }
+ if (multipleExpr)
+ {
+ initialReferenceFilterSB.append(')');
+ }
+ return initialReferenceFilterSB.toString();
+ }
+
@SuppressWarnings("unchecked")
private ServiceReference<T> getTrueConditionRef()
{
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/AnyServiceReferenceTest.java b/scr/src/test/java/org/apache/felix/scr/integration/AnyServiceReferenceTest.java
new file mode 100644
index 0000000..2354d0d
--- /dev/null
+++ b/scr/src/test/java/org/apache/felix/scr/integration/AnyServiceReferenceTest.java
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scr.integration;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.felix.scr.integration.components.AnyServiceComponent;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+import org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO;
+
+
+@RunWith(PaxExam.class)
+public class AnyServiceReferenceTest extends ComponentTestBase
+{
+ static
+ {
+ // uncomment to enable debugging of this test class
+ //paxRunnerVmOption = DEBUG_VM_OPTION;
+ descriptorFile = "/integration_test_any_service.xml";
+ }
+ static final String anyServiceObject = "anyServiceObject";
+
+ @Test
+ public void test_any_service_bind() throws Exception
+ {
+ final String componentName = "any.service.bind";
+ final String serviceProp = "bind";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertEquals("Should call bind method.", anyServiceObject,
+ anyServiceComponent.bindMethodInject);
+ }
+
+ @Test
+ public void test_any_service_bind_map() throws Exception
+ {
+ final String componentName = "any.service.bind.map";
+ final String serviceProp = "bind";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertNotNull("Should call bind method.",
+ anyServiceComponent.bindMethodInjectMap);
+ }
+
+ @Test
+ public void test_any_service_bind_invalid() throws Exception
+ {
+ final String componentName = "any.service.bind.invalid";
+ final String serviceProp = "bind";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertNull("Should not call invalid bind method.",
+ anyServiceComponent.bindMethodInject);
+ }
+
+ @Test
+ public void test_any_service_constructor_object() throws Exception
+ {
+ final String componentName = "any.service.constructor.object";
+ final String serviceProp = "constructor";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertEquals("Should call constructor", anyServiceObject,
+ anyServiceComponent.constructorInject);
+ }
+
+ @Test
+ public void test_any_service_constructor_map() throws Exception
+ {
+ final String componentName = "any.service.constructor.map";
+ final String serviceProp = "constructor";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertNotNull("Should call constructor",
+ anyServiceComponent.constructorInjectMap);
+ }
+
+ @Test
+ public void test_any_service_constructor_list() throws Exception
+ {
+ final String componentName = "any.service.constructor.list";
+ final String serviceProp = "constructor";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertNotNull("Should call constructor",
+ anyServiceComponent.constructorInjectList);
+ }
+
+ @Test
+ public void test_any_service_constructor_invalid() throws Exception
+ {
+ final String componentName = "any.service.constructor.invalid";
+ final String serviceProp = "constructor";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ findComponentConfigurationByName(componentName,
+ ComponentConfigurationDTO.FAILED_ACTIVATION);
+ }
+
+ @Test
+ public void test_any_service_field() throws Exception
+ {
+ final String componentName = "any.service.field";
+ final String serviceProp = "field";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertEquals("Should set field.", anyServiceObject,
+ anyServiceComponent.fieldInject);
+ }
+
+ @Test
+ public void test_any_service_field_map() throws Exception
+ {
+ final String componentName = "any.service.field.map";
+ final String serviceProp = "field";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertNotNull("Should call constructor", anyServiceComponent.fieldInjectMap);
+ }
+
+ @Test
+ public void test_any_service_field_List() throws Exception
+ {
+ final String componentName = "any.service.field.list";
+ final String serviceProp = "field";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertNotNull("Should call constructor", anyServiceComponent.fieldInjectList);
+ }
+
+ @Test
+ public void test_any_service_field_invalid() throws Exception
+ {
+ final String componentName = "any.service.field.invalid";
+ final String serviceProp = "field";
+
+ checkUnsatisfiedAnyReference(componentName, serviceProp);
+
+ registerAnyService(serviceProp);
+
+ AnyServiceComponent anyServiceComponent = checkSatisfiedAnyServiceComponent(
+ componentName);
+
+ assertNull("Should not set field.", anyServiceComponent.fieldInjectInvalid);
+ }
+
+ private void checkUnsatisfiedAnyReference(String componentName, String serviceProp)
+ throws InvocationTargetException, InterruptedException
+ {
+ ComponentConfigurationDTO configDTO = getDisabledConfigurationAndEnable(
+ componentName, ComponentConfigurationDTO.UNSATISFIED_REFERENCE);
+ UnsatisfiedReferenceDTO unsatisfiedDTO = configDTO.unsatisfiedReferences[0];
+ assertEquals("Wrong target.", "(test.any.service=" + serviceProp + ")",
+ unsatisfiedDTO.target);
+ }
+
+ private void registerAnyService(String serviceProp)
+ {
+ Dictionary<String, Object> serviceProps = new Hashtable<>(
+ Collections.singletonMap("test.any.service", (Object) serviceProp));
+ bundleContext.registerService(String.class, anyServiceObject, serviceProps);
+ }
+
+ private AnyServiceComponent checkSatisfiedAnyServiceComponent(String componentName)
+ {
+ ComponentConfigurationDTO configDTO = findComponentConfigurationByName(
+ componentName, ComponentConfigurationDTO.ACTIVE);
+
+ return getServiceFromConfiguration(configDTO, AnyServiceComponent.class);
+ }
+}
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponent.java b/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponent.java
new file mode 100644
index 0000000..bbeb1d9
--- /dev/null
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponent.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scr.integration.components;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class AnyServiceComponent
+{
+ public final Object constructorInject;
+ public volatile Object activateInject = null;
+ public volatile Object bindMethodInject = null;
+ public volatile Object fieldInject = null;
+
+ public final List<Object> constructorInjectList;
+ public volatile List<Object> activateInjectList = null;
+ public final List<Object> fieldInjectList = new ArrayList<>();
+
+ public final Map<String, Object> constructorInjectMap;
+ public volatile Map<String, Object> activateInjectMap = null;
+ public volatile Map<String, Object> bindMethodInjectMap = null;
+ public volatile Map<String, Object> fieldInjectMap = null;
+
+ public volatile String fieldInjectInvalid = null;
+
+ public AnyServiceComponent()
+ {
+ this(null);
+ }
+
+ public AnyServiceComponent(Object anyService)
+ {
+ this(anyService, null, null);
+ }
+
+ protected AnyServiceComponent(Object anyService, List<Object> anyServices, Map<String, Object> anyServiceMap)
+ {
+ constructorInject = anyService;
+ constructorInjectList = anyServices;
+ constructorInjectMap = anyServiceMap;
+ }
+
+ void simpleActivate()
+ {
+ }
+
+ void injectAnyServiceActivate(Object anyService)
+ {
+ this.activateInject = anyService;
+ }
+
+ void setAnyService(Object anyService)
+ {
+ this.bindMethodInject = anyService;
+ }
+
+ void unsetAnyService(Object anyService)
+ {
+ if (this.bindMethodInject == anyService)
+ {
+ this.bindMethodInject = null;
+ }
+ }
+
+ void setAnyServiceInvalid(String anyService)
+ {
+ this.bindMethodInject = anyService;
+ }
+
+ void unsetAnyServiceInvalid(String anyService)
+ {
+ if (this.bindMethodInject == anyService)
+ {
+ this.bindMethodInject = null;
+ }
+ }
+
+ void setAnyServiceMap(Map<String, Object> anyService)
+ {
+ this.bindMethodInjectMap = anyService;
+ }
+
+ void unsetAnyServiceMap(Map<String, Object> anyService)
+ {
+ if (this.bindMethodInjectMap == anyService)
+ {
+ this.bindMethodInjectMap = null;
+ }
+ }
+}
+
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponentInvalid.java b/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponentInvalid.java
new file mode 100644
index 0000000..0a5f4d8
--- /dev/null
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponentInvalid.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scr.integration.components;
+
+public class AnyServiceComponentInvalid extends AnyServiceComponent
+{
+ public AnyServiceComponentInvalid(String anyService)
+ {
+ super(anyService);
+ }
+}
+
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponentList.java b/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponentList.java
new file mode 100644
index 0000000..676f0fc
--- /dev/null
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponentList.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scr.integration.components;
+
+import java.util.List;
+
+public class AnyServiceComponentList extends AnyServiceComponent
+{
+ public AnyServiceComponentList(List<Object> anyServiceList)
+ {
+ super(null, anyServiceList, null);
+ }
+}
+
diff --git a/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponentMap.java b/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponentMap.java
new file mode 100644
index 0000000..d7cff1b
--- /dev/null
+++ b/scr/src/test/java/org/apache/felix/scr/integration/components/AnyServiceComponentMap.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.scr.integration.components;
+
+import java.util.Map;
+
+public class AnyServiceComponentMap extends AnyServiceComponent
+{
+ public AnyServiceComponentMap(Map<String, Object> anyServiceMap)
+ {
+ super(null, null, anyServiceMap);
+ }
+}
+
diff --git a/scr/src/test/resources/integration_test_any_service.xml b/scr/src/test/resources/integration_test_any_service.xml
new file mode 100644
index 0000000..9c6c00c
--- /dev/null
+++ b/scr/src/test/resources/integration_test_any_service.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0">
+
+ <!--
+ Components used in this test use the any service reference
+ -->
+
+ <!-- valid bind target -->
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.bind"
+ immediate="true"
+ enabled="false">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponent"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="bind.ref"
+ target="(test.any.service=bind)"
+ interface="org.osgi.service.component.AnyService"
+ bind="setAnyService"
+ unbind="unsetAnyService"
+ />
+ </scr:component>
+
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.bind.map"
+ immediate="true"
+ enabled="false">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponent"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="bind.ref"
+ target="(test.any.service=bind)"
+ interface="org.osgi.service.component.AnyService"
+ bind="setAnyServiceMap"
+ unbind="unsetAnyServiceMap"
+ />
+ </scr:component>
+
+ <!-- invalid bind target -->
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.bind.invalid"
+ immediate="true"
+ enabled="false">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponent"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="bind.ref"
+ target="(test.any.service=bind)"
+ interface="org.osgi.service.component.AnyService"
+ bind="setAnyServiceInvalid"
+ unbind="unsetAnyServiceInvalid"
+ />
+ </scr:component>
+
+ <!-- constructor target object -->
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.constructor.object"
+ immediate="true"
+ enabled="false"
+ init="1">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponent"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="constructor.ref"
+ target="(test.any.service=constructor)"
+ interface="org.osgi.service.component.AnyService"
+ parameter="0"
+ />
+ </scr:component>
+
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.constructor.map"
+ immediate="true"
+ enabled="false"
+ init="1">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponentMap"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="constructor.ref"
+ target="(test.any.service=constructor)"
+ interface="org.osgi.service.component.AnyService"
+ parameter="0"
+ />
+ </scr:component>
+
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.constructor.list"
+ immediate="true"
+ enabled="false"
+ init="1">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponentList"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="constructor.ref"
+ target="(test.any.service=constructor)"
+ interface="org.osgi.service.component.AnyService"
+ parameter="0"
+ cardinality="1..n"
+ />
+ </scr:component>
+
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.constructor.invalid"
+ immediate="true"
+ enabled="false"
+ init="1">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponentInvalid"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="constructor.ref"
+ target="(test.any.service=constructor)"
+ interface="org.osgi.service.component.AnyService"
+ parameter="0"
+ />
+ </scr:component>
+
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.field"
+ immediate="true"
+ enabled="false">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponent"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="field.ref"
+ target="(test.any.service=field)"
+ interface="org.osgi.service.component.AnyService"
+ field="fieldInject"
+ />
+ </scr:component>
+
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.field.map"
+ immediate="true"
+ enabled="false">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponent"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="field.ref"
+ target="(test.any.service=field)"
+ interface="org.osgi.service.component.AnyService"
+ field="fieldInjectMap"
+ />
+ </scr:component>
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.field.list"
+ immediate="true"
+ enabled="false">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponent"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="field.ref"
+ target="(test.any.service=field)"
+ interface="org.osgi.service.component.AnyService"
+ field="fieldInjectList"
+ cardinality="1..n"
+ />
+ </scr:component>
+ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.5.0"
+ name="any.service.field.invalid"
+ immediate="true"
+ enabled="false">
+ <implementation class="org.apache.felix.scr.integration.components.AnyServiceComponent"/>
+ <service>
+ <provide interface='org.apache.felix.scr.integration.components.AnyServiceComponent' />
+ </service>
+ <reference
+ name="field.ref"
+ target="(test.any.service=field)"
+ interface="org.osgi.service.component.AnyService"
+ field="fieldInjectInvalid"
+ />
+ </scr:component>
+</components>