public class TargetedPID extends Object
TargetedPID
class represents a targeted PID as read
from a configuration object.
For a factory configuration the TargetedPID
represents
the factory PID of the configuration. Otherwise it represents the
PID itself of the configuration.
Constructor and Description |
---|
TargetedPID(String rawPid) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static 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.
|
String |
getRawPid()
Gets the raw PID with which this instance has been created.
|
String |
getServicePid()
Returns the service PID of this targeted PID which basically is
the targeted PID without the targeting information.
|
int |
hashCode() |
boolean |
matchesTarget(org.osgi.framework.ServiceReference<?> reference)
Returns true if the target of this PID (bundle symbolic name,
version, and location) match the bundle registering the referenced
service.
|
String |
toString() |
public TargetedPID(String rawPid)
public static String getBundleVersion(org.osgi.framework.Bundle bundle)
Version.emptyVersion
is
returned.
To remain compatible with pre-R4.2 (Framework API < 1.5) we cannot
use the Bundle.getVersion()
method.
bundle
- The bundle whose version is to be returned.public boolean matchesTarget(org.osgi.framework.ServiceReference<?> reference)
This method just checks the target not the PID value itself, so
this method returning true
does 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 false
if the service has
concurrently been unregistered and the registering bundle is now
null
.
reference
- ServiceReference
to the registered
servicetrue
if the referenced service matches the
target of this PID.public String getRawPid()
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.
public String getServicePid()
Copyright © 2006–2017 The Apache Software Foundation. All rights reserved.