public class TargetedPID
extends java.lang.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.
Modifier and Type | Field and Description |
---|---|
private short |
bindingLevel
The level of binding of this targeted PID:
0 -- this PID is not targeted at all
1 -- this PID is targeted by the symbolic name
2 -- this PID is targeted by the symbolic name and version
3 -- this PID is targeted by the symbolic name, version, and location
|
private java.lang.String |
location |
private java.lang.String |
rawPid |
private java.lang.String |
servicePid |
private java.lang.String |
symbolicName |
private java.lang.String |
version |
Constructor and Description |
---|
TargetedPID(java.lang.String rawPid) |
Modifier and Type | Method and Description |
---|---|
boolean |
bindsStronger(TargetedPID other)
|
boolean |
equals(java.lang.Object obj) |
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.
|
java.lang.String |
getRawPid()
Gets the raw PID with which this instance has been created.
|
java.lang.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.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.String |
toString() |
private final java.lang.String rawPid
private final java.lang.String servicePid
private final java.lang.String symbolicName
private final java.lang.String version
private final java.lang.String location
private final short bindingLevel
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 locationpublic static java.lang.String getBundleVersion(org.osgi.framework.Bundle bundle)
Version.emptyVersion
is
returned.bundle
- The bundle whose version is to be returned.public boolean matchesTarget(org.osgi.framework.Bundle serviceBundle)
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
.
serviceBundle
- Bundle
to the registered
servicetrue
if the referenced service matches the
target of this PID.public java.lang.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 java.lang.String getServicePid()
public boolean bindsStronger(TargetedPID other)
true
if this targeted PID binds stronger than
the other
TargetedPID
.
This method assumes both targeted PIDs have already been checked for suitability for the bundle encoded in the targetting.
other
- The targeted PID to check whether it is binding stronger
or not.true
if the other
targeted PID
is binding strong.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object