public String getBndInfo(String key, String defaultValue) { if (bndInfo == null) { bndInfo = new Properties(); try { InputStream in = Analyzer.class.getResourceAsStream("bnd.info"); if (in != null) { bndInfo.load(in); in.close(); } } catch (IOException ioe) { warning("Could not read bnd.info in " + Analyzer.class.getPackage() + ioe); } } return bndInfo.getProperty(key, defaultValue); }
public String getBndInfo(String key, String defaultValue) { if (bndInfo == null) { bndInfo = new Properties(); try { InputStream in = Analyzer.class.getResourceAsStream("bnd.info"); if (in != null) { bndInfo.load(in); in.close(); } } catch (IOException ioe) { warning("Could not read bnd.info in " + Analyzer.class.getPackage() + ioe); } } return bndInfo.getProperty(key, defaultValue); }
/** * Bnd is case sensitive for the instructions so we better check people are * not using an invalid case. We do allow this to set headers that should * not be processed by us but should be used by the framework. * * @param properties * Properties to verify. */ void verifyManifestHeadersCase(Properties properties) { for (Iterator<Object> i = properties.keySet().iterator(); i.hasNext();) { String header = (String) i.next(); for (int j = 0; j < headers.length; j++) { if (!headers[j].equals(header) && headers[j].equalsIgnoreCase(header)) { warning("Using a standard OSGi header with the wrong case (bnd is case sensitive!), using: " + header + " and expecting: " + headers[j]); break; } } } }
/** * Bnd is case sensitive for the instructions so we better check people are * not using an invalid case. We do allow this to set headers that should * not be processed by us but should be used by the framework. * * @param properties * Properties to verify. */ void verifyManifestHeadersCase(Properties properties) { for (Iterator<Object> i = properties.keySet().iterator(); i.hasNext();) { String header = (String) i.next(); for (int j = 0; j < headers.length; j++) { if (!headers[j].equals(header) && headers[j].equalsIgnoreCase(header)) { warning("Using a standard OSGi header with the wrong case (bnd is case sensitive!), using: " + header + " and expecting: " + headers[j]); break; } } } }
public void addClasspath(File cp) throws IOException { if (!cp.exists()) warning("File on classpath that does not exist: " + cp); Jar jar = new Jar(cp); addClose(jar); classpath.add(jar); }
public void addClasspath(File cp) throws IOException { if (!cp.exists()) warning("File on classpath that does not exist: " + cp); Jar jar = new Jar(cp); addClose(jar); classpath.add(jar); }
/** * * @param jar */ void checkManifest(Jar jar) { try { Manifest m = jar.getManifest(); if (m != null) { String exportHeader = m.getMainAttributes().getValue(EXPORT_PACKAGE); if (exportHeader != null) { Map<String, Map<String, String>> exported = parseHeader(exportHeader); if (exported != null) { for (Map.Entry<String, Map<String, String>> entry : exported.entrySet()) { if (!classpathExports.containsKey(entry.getKey())) { classpathExports.put(entry.getKey(), entry.getValue()); } } } } } } catch (Exception e) { warning("Erroneous Manifest for " + jar + " " + e); } }
public void addClasspath(Jar jar) { if (isPedantic() && jar.getResources().isEmpty()) warning("There is an empty jar or directory on the classpath: " + jar.getName()); classpath.add(jar); }
String findPath(String name, String[] args, boolean fullPathName) { if (args.length > 3) { warning("Invalid nr of arguments to " + name + " " + Arrays.asList(args) + ", syntax: ${" + name + " (; reg-expr (; replacement)? )? }"); return null;
public void addClasspath(Jar jar) { if (isPedantic() && jar.getResources().isEmpty()) warning("There is an empty jar or directory on the classpath: " + jar.getName()); classpath.add(jar); }
/** * * @param jar */ void checkManifest(Jar jar) { try { Manifest m = jar.getManifest(); if (m != null) { String exportHeader = m.getMainAttributes().getValue( EXPORT_PACKAGE); if (exportHeader != null) { Map<String, Map<String, String>> exported = parseHeader(exportHeader); if (exported != null) classpathExports.putAll(exported); } } } catch (Exception e) { warning("Erroneous Manifest for " + jar + " " + e); } }
String findPath(String name, String[] args, boolean fullPathName) { if (args.length > 3) { warning("Invalid nr of arguments to " + name + " " + Arrays.asList(args) + ", syntax: ${" + name + " (; reg-expr (; replacement)? )? }");
private void process(Analyzer analyzer, String path, Resource resource) { try { InputStream in = resource.openInputStream(); Set<String> set = analyze(in); in.close(); for (Iterator<String> r = set.iterator(); r.hasNext();) { String pack = r.next(); if (!QN.matcher(pack).matches()) analyzer .warning("Package does not seem a package in spring resource (" + path + "): " + pack); if (!analyzer.getReferred().containsKey(pack)) analyzer.getReferred().put(pack, new LinkedHashMap<String,String>()); } } catch (Exception e) { analyzer .error("Unexpected exception in processing spring resources(" + path + "): " + e); } }
@SuppressWarnings("unchecked") public boolean analyzeJar(Analyzer analyzer) throws Exception { Jar jar = analyzer.getJar(); Map dir = (Map) jar.getDirectories().get("META-INF/spring"); if ( dir == null || dir.isEmpty()) return false; for (Iterator i = dir.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); String path = (String) entry.getKey(); Resource resource = (Resource) entry.getValue(); if (SPRING_SOURCE.matcher(path).matches()) { try { InputStream in = resource.openInputStream(); Set set = analyze(in); in.close(); for (Iterator r = set.iterator(); r.hasNext();) { String pack = (String) r.next(); if ( !QN.matcher(pack).matches()) analyzer.warning("Package does not seem a package in spring resource ("+path+"): " + pack ); if (!analyzer.getReferred().containsKey(pack)) analyzer.getReferred().put(pack, new LinkedHashMap()); } } catch( Exception e ) { analyzer.error("Unexpected exception in processing spring resources("+path+"): " + e ); } } } return false; }
warning("Invalid header (starts with @ but does not seem to be for the Name section): %s", header);
warning( "Invalid header (starts with @ but does not seem to be for the Name section): %s", header);
void prepare(Analyzer analyzer) { for (ReferenceDef ref : references.values()) { ref.prepare(analyzer); if (ref.version.compareTo(version) > 0) version = ref.version; } if (implementation == null) analyzer.error("No Implementation defined for component " + name); else analyzer.referTo(implementation); name = implementation; if (service != null && service.length > 0) { for (String interfaceName : service) analyzer.referTo(interfaceName); } else if (servicefactory != null && servicefactory) analyzer.warning("The servicefactory:=true directive is set but no service is provided, ignoring it"); }
warning("The instruction %s in %s did not match any resources", instr.getKey(), NAMESECTION);
public List<Jar> getClasspath() { if (firstUse) { firstUse = false; String cp = getProperty(CLASSPATH); if (cp != null) for (String s : split(cp)) { Jar jar = getJarFromName(s, "getting classpath"); if (jar != null) addClasspath(jar); else warning("Cannot find entry on -classpath: %s", s); } } return classpath; }