private String readContents(final URL resource) throws IOException { return IO.slurp(resource); }
private static boolean isEmpty(final InputStream stream) { try { final String content = IO.slurp(stream); return content.trim().length() == 0; } catch (final Exception e) { return false; } } }
public static String slurp(final URL url) throws IOException { return slurp(url.openStream()); }
public static String slurp(final URL url) throws IOException { return slurp(url.openStream()); }
private long getTimestampFromFile(File timestampFile) throws IOException { return Long.parseLong(IO.slurp(timestampFile).replace(System.getProperty("line.separator"), "")); }
public static String readAll(File file, Alerts alerts) { try { String text = IO.slurp(file); return text; } catch (Exception e) { alerts.addError("Unable to read " + file.getAbsolutePath()); return null; } }
private static String getDefaultProvider() { final Class<PersistenceBootstrap> clzz = PersistenceBootstrap.class; final String name = "/META-INF/" + clzz.getName() + ".provider"; try { final URL provider = clzz.getResource(name); if (provider != null) { final String trim = IO.slurp(provider).trim(); logger.info("Default JPA Provider changed to " + trim); return trim; } } catch (final Exception e) { logger.log(Level.WARNING, "Could not read " + name, e); } return "org.apache.openjpa.persistence.PersistenceProviderImpl"; }
public static String readAll(final File file, final Alerts alerts) { try { final String text = IO.slurp(file); return text; } catch (final Exception e) { alerts.addError("Unable to read " + file.getAbsolutePath()); return null; } }
public static String readEntry(JarFile jarFile, String name, Alerts alerts) { ZipEntry entry = jarFile.getEntry(name); if (entry == null) return null; try { String text = IO.slurp(jarFile.getInputStream(entry)); return text; } catch (Exception e) { alerts.addError("Unable to read " + name + " from " + jarFile.getName()); return null; } }
public static String slurp(final File file) throws IOException { try (final InputStream is = read(file)) { return slurp(is); } }
public static String slurp(final File file) throws IOException { return slurp(read(file)); }
public static String readEntry(final JarFile jarFile, final String name, final Alerts alerts) { final ZipEntry entry = jarFile.getEntry(name); if (entry == null) { return null; } try { final String text = IO.slurp(jarFile.getInputStream(entry)); return text; } catch (final Exception e) { alerts.addError("Unable to read " + name + " from " + jarFile.getName()); return null; } }
private static void deployFile(final Deployer deployer, final File file) throws IOException, OpenEJBException { if ("true".equalsIgnoreCase(System.getProperty(DeployerEjb.OPENEJB_USE_BINARIES, "false"))) { final Properties props = new Properties(); final byte[] slurpBinaries = IO.slurp(file).getBytes(); props.put(DeployerEjb.OPENEJB_VALUE_BINARIES, slurpBinaries); props.put(DeployerEjb.OPENEJB_PATH_BINARIES, file.getName()); deployer.deploy(file.getAbsolutePath(), props); } else { deployer.deploy(file.getAbsolutePath()); } }
private static void deployFile(final Deployer deployer, final File file) throws IOException, OpenEJBException { if ("true".equalsIgnoreCase(System.getProperty(DeployerEjb.OPENEJB_USE_BINARIES, "false"))) { final Properties props = new Properties(); final byte[] slurpBinaries = IO.slurp(file).getBytes(); props.put(DeployerEjb.OPENEJB_VALUE_BINARIES, slurpBinaries); props.put(DeployerEjb.OPENEJB_PATH_BINARIES, file.getName()); deployer.deploy(file.getAbsolutePath(), props); } else { deployer.deploy(file.getAbsolutePath()); } }
@ManagedOperation @Description("Slurp the WSDL") public String getWsdl() { try { return IO.slurp(new URL(wsdl)); } catch (final IOException e) { return e.getMessage(); } }
@ManagedOperation @Description("Slurp the WSDL") public String getWsdl() { try { return IO.slurp(new URL(wsdl)); } catch (final IOException e) { return e.getMessage(); } }
@ManagedOperation @Description("Slurp the WSDL") public String getWsdl() { try { return IO.slurp(new URL(wsdl)); } catch (final IOException e) { return e.getMessage(); } }
@ManagedOperation @Description("Slurp the WSDL") public String getWsdl() { try { return IO.slurp(new URL(wsdl)); } catch (final IOException e) { return e.getMessage(); } }
private static void updateBinFile(final File binDir, final String binFile, final String changes) throws IOException { final URL agent = getResource(changes); final File catalinaSh = file(binDir, binFile); String content = IO.slurp(catalinaSh); content = content.replace("# ----- Execute The Requested Command", IO.slurp(agent)); IO.copy(IO.read(content), catalinaSh); }
public static EjbJar readEjbJar(final InputStream is) throws OpenEJBException { try { final String content = IO.slurp(is); if (isEmptyEjbJar(new ByteArrayInputStream(content.getBytes()))) { final String id = getId(new ByteArrayInputStream(content.getBytes())); return new EjbJar(id); } return EjbJarXml.unmarshal(new ByteArrayInputStream(content.getBytes())); } catch (final SAXException e) { throw new OpenEJBException("Cannot parse the ejb-jar.xml", e); // file: " + url.toExternalForm(), e); } catch (final IOException e) { throw new OpenEJBException("Cannot read the ejb-jar.xml", e); // file: " + url.toExternalForm(), e); } catch (final Exception e) { throw new OpenEJBException("Encountered error parsing the ejb-jar.xml", e); // file: " + url.toExternalForm(), e); } }