Search in sources :

Example 1 with Parser

use of org.datanucleus.plugin.PluginParser.Parser in project datanucleus-core by datanucleus.

the class OSGiBundleParser method getRequireBundle.

/**
 * Accessor for the Bundle-Name from the manifest.mf file
 * @param mf the manifest
 * @return the Set with BundleDescription
 */
private static List<Bundle.BundleDescription> getRequireBundle(Dictionary<String, String> headers) {
    String str = headers.get("Require-Bundle");
    if (str == null || str.length() < 1) {
        return Collections.emptyList();
    }
    Parser p = new Parser(str);
    List<Bundle.BundleDescription> requiredBundle = new ArrayList<Bundle.BundleDescription>();
    String bundleSymbolicName = p.parseSymbolicName();
    while (bundleSymbolicName != null) {
        Bundle.BundleDescription bd = new Bundle.BundleDescription();
        bd.setBundleSymbolicName(bundleSymbolicName);
        bd.setParameters(p.parseParameters());
        bundleSymbolicName = p.parseSymbolicName();
        requiredBundle.add(bd);
    }
    return requiredBundle;
}
Also used : Bundle(org.datanucleus.plugin.Bundle) ArrayList(java.util.ArrayList) Parser(org.datanucleus.plugin.PluginParser.Parser)

Aggregations

ArrayList (java.util.ArrayList)1 Bundle (org.datanucleus.plugin.Bundle)1 Parser (org.datanucleus.plugin.PluginParser.Parser)1