Class Util
java.lang.Object
org.eclipse.jetty.osgi.boot.utils.Util
Various useful functions utility methods for OSGi wide use.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.osgi.framework.FiltercreateFilter(org.osgi.framework.BundleContext bundleContext, String classname, String managedServerName) Create an osgi filter for the given classname and server name.fileNamesAsURLs(String val, String delims) Treating the string as a separated list of filenames, convert and return the list of urls.static StringgetManifestHeaderValue(String name, String altName, Dictionary<String, String> manifest) Get the value of a manifest header.static StringgetManifestHeaderValue(String name, Dictionary<String, String> manifest) Get the value of a manifest header.static StringresolvePropertyValue(String value) recursively substitute the${sysprop}by their actual system property.static voidsetProperty(Dictionary<String, Object> properties, String key, Object value)
-
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- theBundleContextinstance to useclassname- the class to match on the filtermanagedServerName- 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 headeraltName- an alternative name for the header (useful for deprecated names)manifest- the dictionary- Returns:
- the value from the manifest
-
getManifestHeaderValue
Get the value of a manifest header.- Parameters:
name- the name of the headermanifest- the dictionary- Returns:
- the value from the manifest
-
fileNamesAsURLs
Treating the string as a separated list of filenames, convert and return the list of urls.- Parameters:
val- the separated list of filenamesdelims- 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
-
resolvePropertyValue
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
-