Class TargetedPID

java.lang.Object
org.apache.felix.cm.impl.helper.TargetedPID

public class TargetedPID extends Object
The 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.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final short
    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 symoblic name, version, and location
    private final String
     
    private final String
     
    private final String
     
    private final String
     
    private final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) boolean
    Returns true if this targeted PID binds stronger than the other TargetedPID.
    boolean
     
    Gets the raw PID with which this instance has been created.
    Returns the service PID of this targeted PID which basically is the targeted PID without the targeting information.
    int
     
    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.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • rawPid

      private final String rawPid
    • servicePid

      private final String servicePid
    • symbolicName

      private final String symbolicName
    • version

      private final String version
    • location

      private final String location
    • bindingLevel

      private final 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 symoblic name, version, and location
  • Constructor Details

    • TargetedPID

      public TargetedPID(String rawPid)
  • Method Details

    • matchesTarget

      public 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.

      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.

      Parameters:
      reference - ServiceReference to the registered service
      Returns:
      true if the referenced service matches the target of this PID.
    • getRawPid

      public 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 String getServicePid()
      Returns the service PID of this targeted PID which basically is the targeted PID without the targeting information.
    • bindsStronger

      boolean bindsStronger(TargetedPID other)
      Returns 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.

      Parameters:
      other - The targeted PID to check whether it is binding stronger or not.
      Returns:
      true if the other targeted PID is binding strong.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object