protected Document parse(File artifact) throws Exception { return XmlUtils.parse(artifact, new ErrorHandler() { public void warning(SAXParseException exception) throws SAXException { } public void error(SAXParseException exception) throws SAXException { } public void fatalError(SAXParseException exception) throws SAXException { throw exception; } }); }
/** * Constructs threads with names <code><prefix>-<pool number>-thread-<thread number></code>. * @param prefix prefix to be used for thread names created by this {@link ThreadFactory} * @return */ public static ThreadFactory namedThreadFactory(String prefix) { return new NamedThreadFactory(prefix); }
/** * Short-hand builder configuration to use standard Karaf static KAR at current Karaf version * @return */ public Builder staticFramework() { return staticFramework(Version.karafVersion()); }
private void copyBinaryResourceToDir(String resource, File target, Map<String, URL> resources, boolean printOutput) throws IOException { File outFile = new File(target, resource); if( !outFile.exists() ) { logDebug("Creating file: %s", printOutput, outFile.getPath()); try ( InputStream is = getResourceStream(resource, resources); OutputStream os = new FileOutputStream(outFile) ) { StreamUtils.copy(is, os); } } }
public URL transform(URL artifact) throws Exception { try { String path = artifact.getPath(); String name = path.substring( path.lastIndexOf('/') + 1); String[] nv = DeployerUtils.extractNameVersionType( name ); return new URL("wrap", null, artifact.toExternalForm() + "$Bundle-SymbolicName=" + nv[0] + "&Bundle-Version=" + nv[1]); } catch (Exception e) { return new URL("wrap", null, artifact.toExternalForm()); } }
public AutoEncryptionSupport(Map<String, Object> properties) { running = true; encryptionSupport = new EncryptionSupport(properties); executor = Executors.newSingleThreadExecutor(ThreadUtils.namedThreadFactory("encryption")); executor.execute(this); }
public static Document parse(File f, ErrorHandler errorHandler) throws TransformerException, IOException, SAXException, ParserConfigurationException { DocumentBuilder db = documentBuilder(); db.setErrorHandler(errorHandler); try { return db.parse(f); } finally { db.reset(); } }
public static void transform(Source xmlSource, Result outputTarget) throws TransformerException { Transformer t = transformer(); try { t.transform(xmlSource, outputTarget); } finally { t.reset(); } }
private void copyBinaryResourceToDir(String resource, File target, Map<String, URL> resources, boolean printOutput) throws IOException { File outFile = new File(target, resource); if( !outFile.exists() ) { logDebug("Creating file: %s", printOutput, outFile.getPath()); try ( InputStream is = getResourceStream(resource, resources); OutputStream os = new FileOutputStream(outFile) ) { StreamUtils.copy(is, os); } } }
protected Document parse(File artifact) throws Exception { return XmlUtils.parse(artifact, new ErrorHandler() { public void warning(SAXParseException exception) throws SAXException { } public void error(SAXParseException exception) throws SAXException { } public void fatalError(SAXParseException exception) throws SAXException { throw exception; } }); }
public URL transform(URL artifact) throws Exception { try { String path = artifact.getPath(); String name = path.substring( path.lastIndexOf('/') + 1); String[] nv = DeployerUtils.extractNameVersionType( name ); return new URL("wrap", null, artifact.toExternalForm() + "$Bundle-SymbolicName=" + nv[0] + "&Bundle-Version=" + nv[1]); } catch (Exception e) { return new URL("wrap", null, artifact.toExternalForm()); } }
public AutoEncryptionSupport(Map<String, Object> properties) { running = true; encryptionSupport = new EncryptionSupport(properties); executor = Executors.newSingleThreadExecutor(ThreadUtils.namedThreadFactory("encryption")); executor.execute(this); }
/** * Short-hand builder configuration to use standard Karaf static KAR at current Karaf version * @return */ public Builder staticFramework() { return staticFramework(Version.karafVersion()); }
public static Document parse(InputStream stream) throws TransformerException, IOException, SAXException, ParserConfigurationException { DocumentBuilder db = documentBuilder(); try { return db.parse(stream); } finally { db.reset(); } }
public static void transform(Source xsltSource, Source xmlSource, Result outputTarget) throws TransformerException { Transformer t = transformer(xsltSource); try { t.transform(xmlSource, outputTarget); } finally { t.reset(); } }
protected static Document parse(URL url) throws Exception { try (InputStream is = url.openStream()) { return XmlUtils.parse(is); } }
public static Document parse(File f) throws TransformerException, IOException, SAXException, ParserConfigurationException { DocumentBuilder db = documentBuilder(); try { return db.parse(f); } finally { db.reset(); } }
protected static Document parse(URL url) throws Exception { try (InputStream is = url.openStream()) { return XmlUtils.parse(is); } }
public static Document parse(String uri) throws TransformerException, IOException, SAXException, ParserConfigurationException { DocumentBuilder db = documentBuilder(); try { return db.parse(uri); } finally { db.reset(); } }
protected static Document parse(URL url) throws Exception { try (InputStream is = url.openStream()) { return XmlUtils.parse(is); } }