public void putAll(Map<String, String> additional, boolean force) { for (Iterator<Map.Entry<String, String>> i = additional.entrySet().iterator(); i.hasNext();) { Map.Entry<String, String> entry = i.next(); if (force || getProperties().get(entry.getKey()) == null) setProperty((String) entry.getKey(), (String) entry.getValue()); } }
public void putAll(Map<String, String> additional, boolean force) { for (Iterator<Map.Entry<String, String>> i = additional.entrySet() .iterator(); i.hasNext();) { Map.Entry<String, String> entry = i.next(); if (force || getProperties().get(entry.getKey()) == null) setProperty((String) entry.getKey(), (String) entry.getValue()); } }
/** * Provide any macro substitutions and versions for exported packages. */ void augmentExports() { for (String packageName : exports.keySet()) { setProperty(CURRENT_PACKAGE, packageName); try { Map<String, String> attributes = exports.get(packageName); Map<String, String> exporterAttributes = classpathExports.get(packageName); if (exporterAttributes == null) continue; for (Map.Entry<String, String> entry : exporterAttributes.entrySet()) { String key = entry.getKey(); if (key.equalsIgnoreCase(SPECIFICATION_VERSION)) key = VERSION_ATTRIBUTE; if (!key.endsWith(":") && !attributes.containsKey(key)) { attributes.put(key, entry.getValue()); } } fixupAttributes(attributes); removeAttributes(attributes); } finally { unsetProperty(CURRENT_PACKAGE); } } }
/** * Check if manadatory properties are present, otherwise generate default. * * @param analyzer bnd analyzer * @param jar bnd jar * @param symbolicName bundle symbolic name */ private static void checkMandatoryProperties( final Analyzer analyzer, final Jar jar, final String symbolicName ) { final String importPackage = analyzer.getProperty( Analyzer.IMPORT_PACKAGE ); if( importPackage == null || importPackage.trim().length() == 0 ) { analyzer.setProperty( Analyzer.IMPORT_PACKAGE, "*;resolution:=optional" ); } final String exportPackage = analyzer.getProperty( Analyzer.EXPORT_PACKAGE ); if( exportPackage == null || exportPackage.trim().length() == 0 ) { analyzer.setProperty( Analyzer.EXPORT_PACKAGE, analyzer.calculateExportsFromContents( jar ) ); } final String localSymbolicName = analyzer.getProperty( Analyzer.BUNDLE_SYMBOLICNAME, symbolicName ); analyzer.setProperty( Analyzer.BUNDLE_SYMBOLICNAME, generateSymbolicName( localSymbolicName ) ); }
/** * Calculate a version from a version policy. * * @param version * The actual exported version * @param impl * true for implementations and false for clients */ String calculateVersionRange(String version, boolean impl) { setProperty("@", version); try { return getVersionPolicy(impl); } finally { unsetProperty("@"); } }
/** * Add the uses clauses. This method iterates over the exports and cal * * @param exports * @param uses * @throws MojoExecutionException */ void doUses(Map<String, Map<String, String>> exports, Map<String, Set<String>> uses, Map<String, Map<String, String>> imports) { if ("true".equalsIgnoreCase(getProperty(NOUSES))) return; for (Iterator<String> i = exports.keySet().iterator(); i.hasNext();) { String packageName = i.next(); setProperty(CURRENT_PACKAGE, packageName); try { doUses(packageName, exports, uses, imports); } finally { unsetProperty(CURRENT_PACKAGE); } } }
/** * Merge the existing manifest with the instructions. * * @param manifest * The manifest to merge with * @throws IOException */ public void mergeManifest(Manifest manifest) throws IOException { if (manifest != null) { Attributes attributes = manifest.getMainAttributes(); for (Iterator<Object> i = attributes.keySet().iterator(); i.hasNext();) { Name name = (Name) i.next(); String key = name.toString(); // Dont want instructions if (key.startsWith("-")) continue; if (getProperty(key) == null) setProperty(key, (String) attributes.get(name)); } } }
/** * Check if manadatory properties are present, otherwise generate default. * * @param analyzer bnd analyzer * @param jar bnd jar * @param symbolicName bundle symbolic name */ private static void checkMandatoryProperties( final Analyzer analyzer, final Jar jar, final String symbolicName ) { final String importPackage = analyzer.getProperty( Analyzer.IMPORT_PACKAGE ); if( importPackage == null || importPackage.trim().length() == 0 ) { analyzer.setProperty( Analyzer.IMPORT_PACKAGE, "*;resolution:=optional" ); } final String exportPackage = analyzer.getProperty( Analyzer.EXPORT_PACKAGE ); if( exportPackage == null || exportPackage.trim().length() == 0 ) { analyzer.setProperty( Analyzer.EXPORT_PACKAGE, analyzer.calculateExportsFromContents( jar ) ); } final String localSymbolicName = analyzer.getProperty( Analyzer.BUNDLE_SYMBOLICNAME, symbolicName ); analyzer.setProperty( Analyzer.BUNDLE_SYMBOLICNAME, generateSymbolicName( localSymbolicName ) ); }
setProperty(CURRENT_USES, sb.toString()); override = getReplacer().process(override); unsetProperty(CURRENT_USES);
setProperty(CURRENT_PACKAGE, packageName); try { Map<String, String> clause = exports.get(packageName); setProperty(CURRENT_USES, sb.toString()); override = getReplacer().process(override); unsetProperty(CURRENT_USES);
/** * Merge the existing manifest with the instructions. * * @param manifest * The manifest to merge with * @throws IOException */ public void mergeManifest(Manifest manifest) throws IOException { if (manifest != null) { Attributes attributes = manifest.getMainAttributes(); for (Iterator<Object> i = attributes.keySet().iterator(); i .hasNext();) { Name name = (Name) i.next(); String key = name.toString(); // Dont want instructions if (key.startsWith("-")) continue; if (getProperty(key) == null) setProperty(key, (String) attributes.get(name)); } } }
/** * Find some more information about imports in manifest and other places. */ void augmentImports() { for (String packageName : imports.keySet()) { setProperty(CURRENT_PACKAGE, packageName); try { Map<String, String> importAttributes = imports.get(packageName); Map<String, String> exporterAttributes = classpathExports.get(packageName); if (exporterAttributes == null) exporterAttributes = exports.get(packageName); if (exporterAttributes != null) { augmentVersion(importAttributes, exporterAttributes); augmentMandatory(importAttributes, exporterAttributes); if (exporterAttributes.containsKey(IMPORT_DIRECTIVE)) importAttributes.put(IMPORT_DIRECTIVE, exporterAttributes.get(IMPORT_DIRECTIVE)); } fixupAttributes(importAttributes); removeAttributes(importAttributes); } finally { unsetProperty(CURRENT_PACKAGE); } } }
setProperty(CURRENT_PACKAGE, packageName); try { Map<String, String> importAttributes = imports.get(packageName);
public boolean analyzeJar(Analyzer analyzer) throws Exception { ComponentMaker m = new ComponentMaker(analyzer); Map<String, Map<String, String>> l = m.doServiceComponent(); if (!l.isEmpty()) analyzer.setProperty(Constants.SERVICE_COMPONENT, Processor .printClauses(l, "")); analyzer.getInfo(m, "Service Component"); m.close(); return false; }
analyzer.setProperty(Constants.SERVICE_COMPONENT, sc); return false;
setProperty("@", exportVersion);
public boolean analyzeJar(Analyzer analyzer) throws Exception { ComponentMaker m = new ComponentMaker(analyzer); Map<String, Map<String, String>> l = m.doServiceComponent(); analyzer.setProperty(Constants.SERVICE_COMPONENT, Processor.printClauses(l)); analyzer.getInfo(m, "Service-Component: "); m.close(); return false; }
setProperty("@", next.getKey()); try { String processed = getReplacer().process(property.getValue());
boolean impl = isTrue(currentAttributes.get(PROVIDE_DIRECTIVE)); try { setProperty("@", exportVersion);
analyzer.setProperty(Analyzer.IMPORT_PACKAGE, "*;resolution:=optional"); error("Can not calculate name of output bundle, rename jar or use -properties"); analyzer.setProperty(Analyzer.BUNDLE_SYMBOLICNAME, base); analyzer.setProperty(Analyzer.EXPORT_PACKAGE, export); if (version != null) { version = Builder.cleanupVersion(version); analyzer.setProperty(Analyzer.BUNDLE_VERSION, version);