Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.util
Class OsgiFilterUtils

    java.lang.Object
      org.eclipse.gemini.blueprint.util.OsgiFilterUtils

    public abstract class OsgiFilterUtils

extends Object

Utility class for creating OSGi filters. This class allows filter creation and concatenation from common parameters such as class names.

Author:
  Costin Leau

Constructor Summary
`OsgiFilterUtils()`

Method Summary
`static org.osgi.framework.Filter` | `createFilter(String filter)` Creates an OSGi `Filter` from the given String.
`static String` | `getFilter(org.osgi.framework.ServiceReference reference)` Creates a filter (as String) that matches the properties (expect the service id) of service reference.
`static boolean` | `isValidFilter(String filter)` Validates the given String as a OSGi filter.
`static String` | `unifyFilter(Class<?>[] classes, String filter)` Adds the given classes to the given filter.
`static String` | `unifyFilter(Class<?> clazz, String filter)` Adds the given class to the given filter.
`static String` | `unifyFilter(String[] classes, String filter)` Adds the given classes as an 'and'(&) `Constants.OBJECTCLASS` constraint to the given filter.
`static String` | `unifyFilter(String clazz, String filter)` Adds the given class as an 'and'(&) `Constants.OBJECTCLASS` constraint to the given filter.
`static String` | `unifyFilter(String key, String[] items, String filter)` Concatenates the given strings with an 'and'(&) constraint under the given key to the given filter.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OsgiFilterUtils

    public OsgiFilterUtils()

Method Detail

### unifyFilter

    public static String unifyFilter(String clazz,
                                     String filter)

  Adds the given class as an 'and'(&) `Constants.OBJECTCLASS` constraint to the given filter. At least one parameter must be valid (non-`null`).

  Parameters:
    `clazz` - class name (can be `null`)
    `filter` - valid OSGi filter (can be `null`)
  Returns:
    OSGi filter containing the `Constants.OBJECTCLASS` constraint and the given filter

### unifyFilter

    public static String unifyFilter(Class<?> clazz,
                                     String filter)

  Adds the given class to the given filter. At least one parameter must be valid (non-`null`).

  Parameters:
    `clazz` - fully qualified class name (can be `null`)
    `filter` - valid OSGi filter (can be `null`)
  Returns:
    an OSGi filter concatenating the given parameters
  See Also:
    `unifyFilter(String, String)`

### unifyFilter

    public static String unifyFilter(Class<?>[] classes,
                                     String filter)

  Adds the given classes to the given filter. At least one parameter must be valid (non-`null`).

  Parameters:
    `classes` - array of fully qualified class names (can be `null`/empty)
    `filter` - valid OSGi filter (can be `null`)
  Returns:
    an OSGi filter concatenating the given parameters
  See Also:
    `unifyFilter(String[], String)`

### unifyFilter

    public static String unifyFilter(String[] classes,
                                     String filter)

  Adds the given classes as an 'and'(&) `Constants.OBJECTCLASS` constraint to the given filter. At least one parameter must be valid (non-`null`).

  Parameters:
    `classes` - array of fully qualified class names (can be `null`/empty)
    `filter` - valid OSGi filter (can be `null`)
  Returns:
    an OSGi filter concatenating the given parameters

### unifyFilter

    public static String unifyFilter(String key,
                                     String[] items,
                                     String filter)

  Concatenates the given strings with an 'and'(&) constraint under the given key to the given filter. At least one of the items/filter parameters must be valid (non-`null`).

  Parameters:
    `key` - the key under which the items are being concatenated (required)
    `items` - an array of strings concatenated to the existing filter
    `filter` - valid OSGi filter (can be `null`)
  Returns:
    an OSGi filter concatenating the given parameters

### isValidFilter

    public static boolean isValidFilter(String filter)

  Validates the given String as a OSGi filter.

  Parameters:
    `filter` - OSGi filter
  Returns:
    true if the filter is valid, false otherwise

### createFilter

    public static org.osgi.framework.Filter createFilter(String filter)

  Creates an OSGi `Filter` from the given String. Translates the `InvalidSyntaxException` checked exception into an unchecked `IllegalArgumentException`.

  Parameters:
    `filter` - OSGi filter given as a String
  Returns:
    OSGi filter (as `Filter`)

### getFilter

    public static String getFilter(org.osgi.framework.ServiceReference reference)

  Creates a filter (as String) that matches the properties (expect the service id) of service reference.

  Parameters:
    `reference` -
  Returns:

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2012. All Rights Reserved.