Class Util

java.lang.Object
org.eclipse.jetty.osgi.boot.utils.Util

public class Util extends Object
Various useful functions utility methods for OSGi wide use.
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • createFilter

      public static org.osgi.framework.Filter createFilter(org.osgi.framework.BundleContext bundleContext, String classname, String managedServerName) throws org.osgi.framework.InvalidSyntaxException
      Create an osgi filter for the given classname and server name.
      Parameters:
      bundleContext - the BundleContext instance to use
      classname - the class to match on the filter
      managedServerName - the name of the jetty server instance
      Returns:
      a new filter
      Throws:
      org.osgi.framework.InvalidSyntaxException - If the filter contains an invalid string that cannot be parsed.
    • getManifestHeaderValue

      public static String getManifestHeaderValue(String name, String altName, Dictionary<String,String> manifest)
      Get the value of a manifest header.
      Parameters:
      name - the name of the header
      altName - an alternative name for the header (useful for deprecated names)
      manifest - the dictionary
      Returns:
      the value from the manifest
    • getManifestHeaderValue

      public static String getManifestHeaderValue(String name, Dictionary<String,String> manifest)
      Get the value of a manifest header.
      Parameters:
      name - the name of the header
      manifest - the dictionary
      Returns:
      the value from the manifest
    • fileNamesAsURLs

      public static List<URL> fileNamesAsURLs(String val, String delims) throws Exception
      Treating the string as a separated list of filenames, convert and return the list of urls.
      Parameters:
      val - the separated list of filenames
      delims - the separators (default is ,;)
      Returns:
      the list of URLs found in the input list
      Throws:
      Exception - if unable to convert entry to a URL
    • setProperty

      public static void setProperty(Dictionary<String,Object> properties, String key, Object value)
    • resolvePropertyValue

      public static String resolvePropertyValue(String value)
      recursively substitute the ${sysprop} by their actual system property. ${sysprop,defaultvalue} will use 'defaultvalue' as the value if no sysprop is defined. Not the most efficient code but we are shooting for simplicity and speed of development here.
      Parameters:
      value - the input string
      Returns:
      the string with replaced properties