Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2516,7 +2516,7 @@ private ServiceReference<T> getTrueConditionRef()
{
return null;
}
if (ReferenceMetadata.REFERENCE_NAME_SATISFYING_CONDITION.equals(
if (ComponentConstants.REFERENCE_NAME_SATISFYING_CONDITION.equals(
m_dependencyMetadata.getName()) == false)
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataReader;
import org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataWriter;
import org.osgi.service.component.ComponentConstants;

/**
* Information associated to a dependency
Expand Down Expand Up @@ -101,13 +102,6 @@ public enum ReferenceScope {bundle, prototype, prototype_required}

public static final String CONDITION_TRUE_FILTER = "(osgi.condition.id=true)";

/**
* The reference name for the implicit satisfying condition as defined in the
* OSGi R8 Declarative Services specification (see https://github.com/osgi/osgi/pull/875).
* This reference is automatically added to components when a true condition service is available.
*/
public static final String REFERENCE_NAME_SATISFYING_CONDITION = "osgi.ds.satisfying.condition";

// Name for the reference (required)
private String m_name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.felix.scr.impl.metadata.ServiceMetadata;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.ComponentConstants;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
Expand Down Expand Up @@ -493,7 +494,7 @@ else if ( localName.equals( XmlConstants.EL_FACTORY_PROPERTY ) && m_pendingFacto
boolean missingSatisfyingConditionRef = true;
for (ReferenceMetadata ref : m_currentComponent.getDependencies())
{
if (ReferenceMetadata.REFERENCE_NAME_SATISFYING_CONDITION.equals(
if (ComponentConstants.REFERENCE_NAME_SATISFYING_CONDITION.equals(
ref.getName()))
{
missingSatisfyingConditionRef = false;
Expand All @@ -504,7 +505,7 @@ else if ( localName.equals( XmlConstants.EL_FACTORY_PROPERTY ) && m_pendingFacto
{
ReferenceMetadata trueReference = new ReferenceMetadata();
trueReference.setName(
ReferenceMetadata.REFERENCE_NAME_SATISFYING_CONDITION);
ComponentConstants.REFERENCE_NAME_SATISFYING_CONDITION);
trueReference.setTarget(ReferenceMetadata.CONDITION_TRUE_FILTER);
trueReference.setInterface(ReferenceMetadata.CONDITION_SERVICE_CLASS);
trueReference.setPolicy(ReferenceMetadata.POLICY_DYNAMIC);
Expand All @@ -515,7 +516,7 @@ else if ( localName.equals( XmlConstants.EL_FACTORY_PROPERTY ) && m_pendingFacto
// condition targets via the osgi.ds.satisfying.condition.target property.
PropertyMetadata prop = new PropertyMetadata(true);
prop.setName(
ReferenceMetadata.REFERENCE_NAME_SATISFYING_CONDITION + ".target");
ComponentConstants.REFERENCE_NAME_SATISFYING_CONDITION + ".target");
prop.setValue(ReferenceMetadata.CONDITION_TRUE_FILTER);
m_currentComponent.addProperty(prop);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.felix.scr.integration.components;

import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
import org.osgi.service.component.ComponentConstants;
import org.osgi.service.component.ComponentContext;

public class SatisfyingConditionComponentClass
Expand All @@ -27,7 +27,7 @@ public class SatisfyingConditionComponentClass
void activate(ComponentContext cc)
{
Object trueCondition = cc.locateService(
ReferenceMetadata.REFERENCE_NAME_SATISFYING_CONDITION);
ComponentConstants.REFERENCE_NAME_SATISFYING_CONDITION);
System.out.println("Found condition: " + trueCondition);
}

Expand Down