public Resource process(String source) { Map<Instruction,Map<String,String>> make = getMakeHeader(); builder.trace("make " + source); for (Map.Entry<Instruction,Map<String,String>> entry : make.entrySet()) { Instruction instr = entry.getKey(); Matcher m = instr.getMatcher(source); if (m.matches() || instr.isNegated()) { Map<String,String> arguments = replace(m, entry.getValue()); List<MakePlugin> plugins = builder.getPlugins(MakePlugin.class); for (MakePlugin plugin : plugins) { try { Resource resource = plugin.make(builder, source, arguments); if (resource != null) { builder.trace("Made " + source + " from args " + arguments + " with " + plugin); return resource; } } catch (Exception e) { builder.error("Plugin " + plugin + " generates error when use in making " + source + " with args " + arguments, e); } } } } return null; }
public Resource process(String source) { Map<Instruction,Map<String,String>> make = getMakeHeader(); builder.trace("make " + source); for (Map.Entry<Instruction,Map<String,String>> entry : make.entrySet()) { Instruction instr = entry.getKey(); Matcher m = instr.getMatcher(source); if (m.matches() || instr.isNegated()) { Map<String,String> arguments = replace(m, entry.getValue()); List<MakePlugin> plugins = builder.getPlugins(MakePlugin.class); for (MakePlugin plugin : plugins) { try { Resource resource = plugin.make(builder, source, arguments); if (resource != null) { builder.trace("Made " + source + " from args " + arguments + " with " + plugin); return resource; } } catch (Exception e) { builder.error("Plugin " + plugin + " generates error when use in making " + source + " with args " + arguments, e); } } } } return null; }
public Resource process(String source) { Map<Instruction,Map<String,String>> make = getMakeHeader(); builder.trace("make " + source); for (Map.Entry<Instruction,Map<String,String>> entry : make.entrySet()) { Instruction instr = entry.getKey(); Matcher m = instr.getMatcher(source); if (m.matches() || instr.isNegated()) { Map<String,String> arguments = replace(m, entry.getValue()); List<MakePlugin> plugins = builder.getPlugins(MakePlugin.class); for (MakePlugin plugin : plugins) { try { Resource resource = plugin.make(builder, source, arguments); if (resource != null) { builder.trace("Made " + source + " from args " + arguments + " with " + plugin); return resource; } } catch (Exception e) { builder.error("Plugin " + plugin + " generates error when use in making " + source + " with args " + arguments, e); } } } } return null; }
@Override public void write(OutputStream out) throws IOException, Exception { StringBuilder errors = new StringBuilder(); StringBuilder stdout = new StringBuilder(); domain.trace("executing command %s", command); Command cmd = new Command("sh"); cmd.setCwd(wd); cmd.inherit(); String oldpath = cmd.var("PATH"); String path = domain.getProperty("-PATH"); if (path != null) { path = path.replaceAll("\\s*,\\s*", File.pathSeparator); path = path.replaceAll("\\$\\{@\\}", oldpath); cmd.var("PATH", path); domain.trace("PATH: %s", path); } OutputStreamWriter osw = new OutputStreamWriter(out, "UTF-8"); int result = cmd.execute(command, stdout, errors); osw.append(stdout); osw.flush(); if (result != 0) { domain.error("Cmd '%s' failed in %s. %n %s%n %s", command, wd, errors, stdout); } }
@Override public void write(OutputStream out) throws IOException, Exception { StringBuilder errors = new StringBuilder(); StringBuilder stdout = new StringBuilder(); domain.trace("executing command %s", command); Command cmd = new Command("sh"); cmd.setCwd(wd); cmd.inherit(); String oldpath = cmd.var("PATH"); String path = domain.getProperty("-PATH"); if (path != null) { path = path.replaceAll("\\s*,\\s*", File.pathSeparator); path = path.replaceAll("\\$\\{@\\}", oldpath); cmd.var("PATH", path); domain.trace("PATH: %s", path); } OutputStreamWriter osw = new OutputStreamWriter(out, "UTF-8"); int result = cmd.execute(command, stdout, errors); osw.append(stdout); osw.flush(); if (result != 0) { domain.error("Cmd '%s' failed in %s. %n %s%n %s", command, wd, errors, stdout); } }
@Override public void write(OutputStream out) throws IOException, Exception { StringBuilder errors = new StringBuilder(); StringBuilder stdout = new StringBuilder(); try { domain.trace("executing command %s", command); Command cmd = new Command("sh"); cmd.setCwd(wd); cmd.inherit(); String oldpath = cmd.var("PATH"); String path = domain.getProperty("-PATH"); if (path != null) { path = path.replaceAll("\\s*,\\s*", File.pathSeparator); path = path.replaceAll("\\$\\{@\\}", oldpath); cmd.var("PATH", path); domain.trace("PATH: %s", path); } OutputStreamWriter osw = new OutputStreamWriter(out, "UTF-8"); int result = cmd.execute(command, stdout, errors); osw.append(stdout); osw.flush(); if (result != 0) { domain.error("executing command failed %s %s", command, stdout + "\n" + errors); } } catch (Exception e) { domain.error("executing command failed %s %s", command, e.getMessage()); } }
/** * Cop * * @param dest * @param srce * @param path * @param overwriteResource */ private void copy(Jar dest, Jar srce, String path, boolean overwrite) { trace("copy d=" + dest + " s=" + srce +" p="+ path); dest.copy(srce, path, overwrite); // bnd.info sources must be preprocessed String bndInfoPath = path + "/bnd.info"; Resource r = dest.getResource(bndInfoPath); if ( r != null && !(r instanceof PreprocessResource)) { trace("preprocessing bnd.info"); PreprocessResource pp = new PreprocessResource(this, r); dest.putResource(bndInfoPath, pp); } if (hasSources()) { String srcPath = "OSGI-OPT/src/" + path; Map<String,Resource> srcContents = srce.getDirectories().get(srcPath); if (srcContents != null) { dest.addDirectory(srcContents, overwrite); } } }
/** * Check if we need to calculate any checksums. * * @param dot * @throws Exception */ private void doDigests(Jar dot) throws Exception { Parameters ps = OSGiHeader.parseHeader(getProperty(DIGESTS)); if (ps.isEmpty()) return; trace("digests %s", ps); String[] digests = ps.keySet().toArray(new String[ps.size()]); dot.setDigestAlgorithms(digests); }
/** * Check if we need to calculate any checksums. * * @param dot * @throws Exception */ private void doDigests(Jar dot) throws Exception { Parameters ps = OSGiHeader.parseHeader(getProperty(DIGESTS)); if (ps.isEmpty()) return; trace("digests %s", ps); String[] digests = ps.keySet().toArray(new String[ps.size()]); dot.setDigestAlgorithms(digests); }
/** * Cop * * @param dest * @param srce * @param path * @param overwriteResource */ private void copy(Jar dest, Jar srce, String path, boolean overwrite) { trace("copy d=" + dest + " s=" + srce + " p=" + path); dest.copy(srce, path, overwrite); // bnd.info sources must be preprocessed String bndInfoPath = path + "/bnd.info"; Resource r = dest.getResource(bndInfoPath); if (r != null && !(r instanceof PreprocessResource)) { trace("preprocessing bnd.info"); PreprocessResource pp = new PreprocessResource(this, r); dest.putResource(bndInfoPath, pp); } if (hasSources()) { String srcPath = "OSGI-OPT/src/" + path; Map<String,Resource> srcContents = srce.getDirectories().get(srcPath); if (srcContents != null) { dest.addDirectory(srcContents, overwrite); } } }
/** * Cop * * @param dest * @param srce * @param path * @param overwriteResource */ private void copy(Jar dest, Jar srce, String path, boolean overwrite) { trace("copy d=" + dest + " s=" + srce + " p=" + path); dest.copy(srce, path, overwrite); // bnd.info sources must be preprocessed String bndInfoPath = path + "/bnd.info"; Resource r = dest.getResource(bndInfoPath); if (r != null && !(r instanceof PreprocessResource)) { trace("preprocessing bnd.info"); PreprocessResource pp = new PreprocessResource(this, r); dest.putResource(bndInfoPath, pp); } if (hasSources()) { String srcPath = "OSGI-OPT/src/" + path; Map<String,Resource> srcContents = srce.getDirectories().get(srcPath); if (srcContents != null) { dest.addDirectory(srcContents, overwrite); } } }
/** * Check if we need to calculate any checksums. * * @param dot * @throws Exception */ private void doDigests(Jar dot) throws Exception { Parameters ps = OSGiHeader.parseHeader(getProperty(DIGESTS)); if (ps.isEmpty()) return; trace("digests %s", ps); String[] digests = ps.keySet().toArray(new String[ps.size()]); dot.setDigestAlgorithms(digests); }
/** * Turn this normal bundle in a web and add any resources. * * @throws Exception */ private Jar doWab(Jar dot) throws Exception { String wab = getProperty(WAB); String wablib = getProperty(WABLIB); if (wab == null && wablib == null) return dot; trace("wab %s %s", wab, wablib); setBundleClasspath(append("WEB-INF/classes", getProperty(BUNDLE_CLASSPATH))); Set<String> paths = new HashSet<String>(dot.getResources().keySet()); for (String path : paths) { if (path.indexOf('/') > 0 && !Character.isUpperCase(path.charAt(0))) { trace("wab: moving: %s", path); dot.rename(path, "WEB-INF/classes/" + path); } } Parameters clauses = parseHeader(getProperty(WABLIB)); for (String key : clauses.keySet()) { File f = getFile(key); addWabLib(dot, f); } doIncludeResource(dot, wab); return dot; }
/** * Turn this normal bundle in a web and add any resources. * * @throws Exception */ private Jar doWab(Jar dot) throws Exception { String wab = getProperty(WAB); String wablib = getProperty(WABLIB); if (wab == null && wablib == null) return dot; trace("wab %s %s", wab, wablib); setBundleClasspath(append("WEB-INF/classes", getProperty(BUNDLE_CLASSPATH))); Set<String> paths = new HashSet<String>(dot.getResources().keySet()); for (String path : paths) { if (path.indexOf('/') > 0 && !Character.isUpperCase(path.charAt(0))) { trace("wab: moving: %s", path); dot.rename(path, "WEB-INF/classes/" + path); } } Parameters clauses = parseHeader(getProperty(WABLIB)); for (String key : clauses.keySet()) { File f = getFile(key); addWabLib(dot, f); } doIncludeResource(dot, wab); return dot; }
/** * Turn this normal bundle in a web and add any resources. * * @throws Exception */ private Jar doWab(Jar dot) throws Exception { String wab = getProperty(WAB); String wablib = getProperty(WABLIB); if (wab == null && wablib == null) return dot; trace("wab %s %s", wab, wablib); setBundleClasspath(append("WEB-INF/classes", getProperty(BUNDLE_CLASSPATH))); Set<String> paths = new HashSet<String>(dot.getResources().keySet()); for (String path : paths) { if (path.indexOf('/') > 0 && !Character.isUpperCase(path.charAt(0))) { trace("wab: moving: %s", path); dot.rename(path, "WEB-INF/classes/" + path); } } Parameters clauses = parseHeader(getProperty(WABLIB)); for (String key : clauses.keySet()) { File f = getFile(key); addWabLib(dot, f); } doIncludeResource(dot, wab); return dot; }
/** * Sign the jar file. -sign : <alias> [ ';' 'password:=' <password> ] [ ';' * 'keystore:=' <keystore> ] [ ';' 'sign-password:=' <pw> ] ( ',' ... )* * * @return */ void sign(@SuppressWarnings("unused") Jar jar) throws Exception { String signing = getProperty("-sign"); if (signing == null) return; trace("Signing %s, with %s", getBsn(), signing); List<SignerPlugin> signers = getPlugins(SignerPlugin.class); Parameters infos = parseHeader(signing); for (Entry<String,Attrs> entry : infos.entrySet()) { for (SignerPlugin signer : signers) { signer.sign(this, entry.getKey()); } } }
/** * Sign the jar file. -sign : <alias> [ ';' 'password:=' <password> ] [ ';' * 'keystore:=' <keystore> ] [ ';' 'sign-password:=' <pw> ] ( ',' ... )* * * @return */ void sign(@SuppressWarnings("unused") Jar jar) throws Exception { String signing = getProperty(SIGN); if (signing == null) return; trace("Signing %s, with %s", getBsn(), signing); List<SignerPlugin> signers = getPlugins(SignerPlugin.class); Parameters infos = parseHeader(signing); for (Entry<String,Attrs> entry : infos.entrySet()) { for (SignerPlugin signer : signers) { signer.sign(this, entry.getKey()); } } }
/** * Sign the jar file. -sign : <alias> [ ';' 'password:=' <password> ] [ ';' * 'keystore:=' <keystore> ] [ ';' 'sign-password:=' <pw> ] ( ',' ... )* * * @return */ void sign(@SuppressWarnings("unused") Jar jar) throws Exception { String signing = getProperty(SIGN); if (signing == null) return; trace("Signing %s, with %s", getBsn(), signing); List<SignerPlugin> signers = getPlugins(SignerPlugin.class); Parameters infos = parseHeader(signing); for (Entry<String,Attrs> entry : infos.entrySet()) { for (SignerPlugin signer : signers) { signer.sign(this, entry.getKey()); } } }