Class TargetedPID
- java.lang.Object
-
- org.apache.felix.scr.impl.metadata.TargetedPID
-
public class TargetedPID extends java.lang.ObjectCopied with modifications from felix configadmin. TheTargetedPIDclass represents a targeted PID as read from a configuration object.For a factory configuration the
TargetedPIDrepresents the factory PID of the configuration. Otherwise it represents the PID itself of the configuration.
-
-
Field Summary
Fields Modifier and Type Field Description private shortbindingLevelThe level of binding of this targeted PID:0-- this PID is not targeted at all1-- this PID is targeted by the symbolic name2-- this PID is targeted by the symbolic name and version3-- this PID is targeted by the symbolic name, version, and locationprivate java.lang.Stringlocationprivate java.lang.StringrawPidprivate java.lang.StringservicePidprivate java.lang.StringsymbolicNameprivate java.lang.Stringversion
-
Constructor Summary
Constructors Constructor Description TargetedPID(java.lang.String rawPid)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanbindsStronger(TargetedPID other)booleanequals(java.lang.Object obj)static java.lang.StringgetBundleVersion(org.osgi.framework.Bundle bundle)Returns the bundle's version as required for targeted PIDs: If the bundle has a version the string representation of the version string converted to a Version object is returned.java.lang.StringgetRawPid()Gets the raw PID with which this instance has been created.java.lang.StringgetServicePid()Returns the service PID of this targeted PID which basically is the targeted PID without the targeting information.inthashCode()booleanmatchesTarget(org.osgi.framework.Bundle serviceBundle)Returns true if the target of this PID (bundle symbolic name, version, and location) match the bundle registering the referenced service.java.lang.StringtoString()
-
-
-
Field Detail
-
rawPid
private final java.lang.String rawPid
-
servicePid
private final java.lang.String servicePid
-
symbolicName
private final java.lang.String symbolicName
-
version
private final java.lang.String version
-
location
private final java.lang.String location
-
bindingLevel
private final short bindingLevel
The level of binding of this targeted PID:0-- this PID is not targeted at all1-- this PID is targeted by the symbolic name2-- this PID is targeted by the symbolic name and version3-- this PID is targeted by the symbolic name, version, and location
-
-
Method Detail
-
getBundleVersion
public static java.lang.String getBundleVersion(org.osgi.framework.Bundle bundle)
Returns the bundle's version as required for targeted PIDs: If the bundle has a version the string representation of the version string converted to a Version object is returned. Otherwise the string representation ofVersion.emptyVersionis returned.- Parameters:
bundle- The bundle whose version is to be returned.
-
matchesTarget
public boolean matchesTarget(org.osgi.framework.Bundle serviceBundle)
Returns true if the target of this PID (bundle symbolic name, version, and location) match the bundle registering the referenced service.This method just checks the target not the PID value itself, so this method returning
truedoes not indicate whether the service actually is registered with a service PID equal to the raw PID of this targeted PID.This method also returns
falseif the service has concurrently been unregistered and the registering bundle is nownull.- Parameters:
serviceBundle-Bundleto the registered service- Returns:
trueif the referenced service matches the target of this PID.
-
getRawPid
public java.lang.String getRawPid()
Gets the raw PID with which this instance has been created.If an actual service PID contains pipe symbols that PID might be considered being targeted PID without it actually being one. This method provides access to the raw PID to allow for such services to be configured.
-
getServicePid
public java.lang.String getServicePid()
Returns the service PID of this targeted PID which basically is the targeted PID without the targeting information.
-
bindsStronger
public boolean bindsStronger(TargetedPID other)
Returnstrueif this targeted PID binds stronger than theotherTargetedPID.This method assumes both targeted PIDs have already been checked for suitability for the bundle encoded in the targetting.
- Parameters:
other- The targeted PID to check whether it is binding stronger or not.- Returns:
trueif theothertargeted PID is binding strong.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-