private File replaceVar(String path) { if ((options & DO_VARIABLES) == 0) return null; Matcher m = PATH.matcher(path); if (m.matches()) { String var = m.group(1); String remainder = m.group(2); String base = (String) properties.get(var); if (base != null) { File b = new File(base); File f = new File(b, remainder.replace('/', File.separatorChar)); return f; } else reporter.error("Can't find replacement variable for: " + path); } else reporter.error("Cant split variable path: " + path); return null; }
protected boolean report(Reporter reporter) { if (reporter.getWarnings().size() > 0) { System.err.println("Warnings"); for (Iterator<String> e = reporter.getWarnings().iterator(); e.hasNext();) { System.err.println(" " + e.next()); } } if (reporter.getErrors().size() > 0) { System.err.println( reporter.getErrors().size() + " Errors"); for (Iterator<String> e = reporter.getErrors().iterator(); e.hasNext();) { System.err.println(" " + e.next()); } return true; } return false; }
public List<Version> versions(String bsn) { String path = bsn.replace('.', '/'); File base = Processor.getFile(root, path); if (!base.isDirectory()) { reporter.warning("Expected a directory %s", base); return null; } List<Version> result = new ArrayList<Version>(); String[] versions = base.list(); for (String v : versions) { v = Analyzer.cleanupVersion(v); if (Verifier.VERSION.matcher(v).matches()) { result.add(new Version(v)); } else { if (reporter.isPedantic()) { reporter .warning( "Invalid version in maven base directory: %s", base); } } } return result; }
if (logger != null && logger.isPedantic()) { logger .warning("Empty clause, usually caused by repeating a comma without any name field or by having spaces after the backslash of a property file: " + value); if (logger != null) { logger .error("Header contains name field after attribute or directive: " + adname + " from " String advalue = qt.nextToken(); if (clause.containsKey(adname)) { if (logger != null && logger.isPedantic()) logger .warning("Duplicate attribute/directive name " + adname + " in " if (logger != null) logger .error("No value after '=' sign for attribute " + adname); advalue = ""; if (logger != null && logger.isPedantic()) logger .warning("Duplicate name " + clauseName
File file = new File(dir, fName); reporter.trace("Updating " + file.getAbsolutePath()); if (!file.exists() || file.lastModified() < jar.lastModified()) { jar.write(file); reporter.progress("Updated " + file.getAbsolutePath()); fireBundleAdded(jar, file); } else { reporter.progress("Did not update " + jar + " because repo has a newer version"); reporter.trace("NOT Updating " + fName + " (repo is newer)");
public void run() { try { int c = in.read(); while (c >= 0) { if (trace) System.out.print((char) c); sb.append((char) c); c = in.read(); } } catch (Exception e) { try { sb.append("\n**************************************\n"); sb.append(e.toString()); sb.append("\n**************************************\n"); } catch (IOException e1) { } if (reporter != null) { reporter.trace("cmd exec: %s", e); } } } }
protected void fireBundleAdded(Jar jar, File file) { if (registry == null) return; List<RepositoryListenerPlugin> listeners = registry .getPlugins(RepositoryListenerPlugin.class); for (RepositoryListenerPlugin listener : listeners) { try { listener.bundleAdded(this, jar, file); } catch (Exception e) { if (reporter != null) reporter.warning("Repository listener threw an unexpected exception: %s", e); } } }
reporter.progress("Did not update " + jar + " because repo has a newer version"); System.out.println("NOT Updating " + fName + " (repo is newer)");
if (reporter != null) reporter.warning("Download of remote resource %s failed, using local cache %s.", url, cachedFile); return cachedFile; } else {
private File replaceVar(String path) { if ((options & DO_VARIABLES) == 0) return null; Matcher m = PATH.matcher(path); if (m.matches()) { String var = m.group(1); String remainder = m.group(2); String base = (String) properties.get(var); if (base != null) { File b = new File(base); File f = new File(b, remainder.replace('/', File.separatorChar)); return f; } else reporter.error("Can't find replacement variable for: " + path); } else reporter.error("Cant split variable path: " + path); return null; }
protected boolean report(Reporter reporter) { if (reporter.getWarnings().size() > 0) { System.err.println("Warnings"); for (Iterator<String> e = reporter.getWarnings().iterator(); e.hasNext();) { System.err.println(e.next()); } } if (reporter.getErrors().size() > 0) { System.err.println("Errors"); for (Iterator<String> e = reporter.getErrors().iterator(); e.hasNext();) { System.err.println(e.next()); } return true; } return false; }
public File[] get(String bsn, String version) throws Exception { VersionRange range = new VersionRange("0"); if (version != null) range = new VersionRange(version); List<BsnToMavenPath> plugins = ((Processor) reporter).getPlugins(BsnToMavenPath.class); if ( plugins.isEmpty()) plugins.add(this); for (BsnToMavenPath cvr : plugins) { String[] paths = cvr.getGroupAndArtifact(bsn); if (paths != null) { File[] files = find(paths[0], paths[1], range); if (files != null) return files; } } reporter.trace("Cannot find in maven: %s-%s", bsn, version); return null; }
public void setProperties(Map<String, String> map) { String root = map.get("root"); if (root == null) { String home = System.getProperty("user.home"); root = home + "/.m2/repository"; } this.root = Processor.getFile(new File(""), root).getAbsoluteFile(); if (!this.root.isDirectory()) { reporter .error( "Maven repository did not get a proper URL to the repository %s", root); } name = (String) map.get(NAME); }
protected void assertOk(Reporter reporter) { try { assertEquals(0, reporter.getErrors().size()); assertEquals(0, reporter.getWarnings().size()); } catch (AssertionFailedError t) { print("Errors", reporter.getErrors()); print("Warnings", reporter.getWarnings()); throw t; } }
public File[] get(String bsn, String version) throws Exception { VersionRange range = new VersionRange("0"); if (version != null) range = new VersionRange(version); List<BsnToMavenPath> plugins = ((Processor) reporter) .getPlugins(BsnToMavenPath.class); for (BsnToMavenPath cvr : plugins) { String[] paths = cvr.getGroupAndArtifact(bsn); if (paths != null) { File[] files = find(paths[0], paths[1], range); if (files != null) return files; } } reporter.trace("Cannot find in maven: %s-%s", bsn, version); return null; }
reader.parse(new InputSource(new FileInputStream(localIndex))); } catch (Exception e) { reporter.warning("Existing local index is invalid or missing, overwriting (%s).", localIndex.getAbsolutePath());
public void setProperties(Map<String, String> map) { File home = new File(""); String root = map.get("root"); if (root == null) { home = new File( System.getProperty("user.home") ); this.root = Processor.getFile(home , ".m2/repository").getAbsoluteFile(); } else this.root = Processor.getFile(home, root).getAbsoluteFile(); if (!this.root.isDirectory()) { reporter.error("Maven repository did not get a proper URL to the repository %s", root); } name = (String) map.get(NAME); }
public void finish() { set(COMPONENT_MULTIPLE, multiple); set(COMPONENT_DYNAMIC, dynamic); set(COMPONENT_OPTIONAL, optional); set(COMPONENT_IMPLEMENTATION, clazz.getFQN(), "<>"); set(COMPONENT_PROPERTIES, properties); if (version != null) { set(COMPONENT_VERSION, version, "<>"); reporter.trace("Component %s is v1.1", map); } set(COMPONENT_DESCRIPTORS, descriptors); }