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; }
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; }
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); }
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 setProperties(Map<String, String> map) { String repoString = map.get("repositories"); if (repoString != null) { String[] repos = repoString.split("\\s*,\\s*"); repositories = new URI[repos.length]; int n = 0; for (String repo : repos) { try { URI uri = new URI(repo); if ( !uri.isAbsolute()) uri = IO.getFile( new File(""),repo).toURI(); repositories[n++] = uri; } catch (Exception e) { if (reporter != null) reporter.error("Invalid repository %s for maven plugin, %s", repo, e); } } } }
public synchronized void setProperties(Map<String, String> map) { if (map.containsKey(PROP_NAME)) name = map.get(PROP_NAME); if (map.containsKey(PROP_RESOLUTION_MODE)) { supportedModes = EnumSet.noneOf(OBRResolutionMode.class); StringTokenizer tokenizer = new StringTokenizer(map.get(PROP_RESOLUTION_MODE), ","); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken().trim(); if (PROP_RESOLUTION_MODE_ANY.equalsIgnoreCase(token)) supportedModes = EnumSet.allOf(OBRResolutionMode.class); else { try { supportedModes.add(OBRResolutionMode.valueOf(token)); } catch (Exception e) { if (reporter != null) reporter.error("Unknown OBR resolution mode: " + token); } } } } }
public List<String> list(String regex) throws Exception { init(); Instruction pattern = null; if (regex != null) pattern = Instruction.getPattern(regex); List<String> result = new ArrayList<String>(); if (root == null) { if (reporter != null) reporter.error("FileRepo root directory is not set."); } else { File[] list = root.listFiles(); if (list != null) { for (File f : list) { if (!f.isDirectory()) continue; // ignore non-directories String fileName = f.getName(); if (fileName.charAt(0) == '.') continue; // ignore hidden files if (pattern == null || pattern.matches(fileName)) result.add(fileName); } } else if (reporter != null) reporter.error("FileRepo root directory (%s) does not exist", root); } return result; }
reporter.error("Failed to load %s", configFileName); } finally { if (stream != null) IO.close(stream);
public boolean processReferral(String fromUrl, Referral referral, int maxDepth, int currentDepth) { try { URL indexLocation = new URL(referral.getUrl()); try { CachingURLResourceHandle indexHandle = new CachingURLResourceHandle(indexLocation.toExternalForm(), null, getCacheDirectory(), connector, CachingMode.PreferRemote); indexHandle.setReporter(reporter); return readIndex(indexLocation.toString(), new FileInputStream(indexHandle.request()), this); } catch (Exception e) { reporter.error("Unable to read referral index at URL '%s' from parent index '%s': %s", indexLocation, fromUrl, e); } } catch (MalformedURLException e) { reporter.error("Invalid referral URL '%s' from parent index '%s': %s", referral.getUrl(), fromUrl, e); } return false; } };
void filterResourcesByResolverMode(Collection<Resource> resources, ResolverMode mode) { assert mode != null; Properties modeCapability = new Properties(); modeCapability.setProperty(CapabilityType.MODE.getTypeName(), mode.name()); for (Iterator<Resource> iter = resources.iterator(); iter.hasNext(); ) { Resource resource = iter.next(); Require modeRequire = resource.findRequire(CapabilityType.MODE.getTypeName()); if (modeRequire == null) continue; else if (modeRequire.getFilter() == null) iter.remove(); else { try { Filter filter = new Filter(modeRequire.getFilter()); if (!filter.match(modeCapability)) iter.remove(); } catch (IllegalArgumentException e) { synchronized (this) { if (reporter != null) reporter.error("Error parsing mode filter requirement on resource %s: %s", resource.getUrl(), modeRequire.getFilter()); } iter.remove(); } } } }
reporter.error("Maven dependency version not set for %s - %s", groupId, artifactId); return null;
public static Map<String, String> parseProperties(String input, Reporter logger) { if (input == null || input.trim().length() == 0) return Create.map(); Map<String, String> result = Create.map(); QuotedTokenizer qt = new QuotedTokenizer(input, "=,"); char del = ','; while (del == ',') { String key = qt.nextToken(",="); String value = ""; del = qt.getSeparator(); if (del == '=') { value = qt.nextToken(",="); del = qt.getSeparator(); } result.put(key, value); } if (del != 0) if ( logger == null ) throw new IllegalArgumentException( "Invalid syntax for properties: " + input); else logger.error("Invalid syntax for properties: " + input); return result; }
readIndex(indexLocation.toExternalForm(), new FileInputStream(indexFile), listener); } catch (Exception e) { reporter.error("Unable to read index at URL '%s': %s", indexLocation, e);
reporter.error( "Activate method for %s does not have an acceptable prototype, only Map, ComponentContext, or BundleContext is allowed. Found: %s", className, methodDescriptor); reporter.error( "Deactivate method for %s does not have an acceptable prototype, only Map, ComponentContext, or BundleContext is allowed. Found: %s", className, methodDescriptor); reporter.error( "In component %s, Multiple references with the same name: %s. Previous def: %s, this def: %s", name, map.get(name), service, "");