public static ZipOutputStream zip(final File file) throws IOException { final OutputStream write = write(file); return new ZipOutputStream(write); }
public static ZipOutputStream zip(final File file) throws IOException { final OutputStream write = write(file); return new ZipOutputStream(write); }
public static void record() { try { final File file = new File("/tmp/trace.html"); final OutputStream write = IO.write(file); report(write); } catch (final FileNotFoundException e) { e.printStackTrace(); } }
public static void record() { try { final File file = new File("/tmp/trace.html"); final OutputStream write = IO.write(file); report(write); } catch (final FileNotFoundException e) { e.printStackTrace(); } }
public static void copy(final InputStream from, final File to, final boolean append) throws IOException { final OutputStream write = write(to, append); try { copy(from, write); } finally { close(write); } }
public static void copy(final InputStream from, final File to) throws IOException { final OutputStream write = write(to); try { copy(from, write); } finally { close(write); } }
public static void copy(final InputStream from, final File to) throws IOException { final OutputStream write = write(to); try { copy(from, write); } finally { close(write); } }
private void installLoggingPropertiesFile(final File loggingPropertiesFile) throws IOException { final String name = STANDALONE_PROPERTIES_FILE + LOGGING_PROPERTIES_FILE; final URL resource = Thread.currentThread().getContextClassLoader().getResource(name); if (resource == null) { System.err.println("FATAL ERROR WHILE CONFIGURING LOGGING!!!. MISSING RESOURCE " + name); return; } final Properties props = IO.readProperties(resource); preprocessProperties(props); final OutputStream out = IO.write(loggingPropertiesFile); try { props.store(out, "OpenEJB Default Log4j Configuration"); } finally { IO.close(out); } PropertyConfigurator.configure(props); } }
public static void copy(final InputStream from, final File to, final boolean append) throws IOException { final OutputStream write = write(to, append); try { copy(from, write); } finally { close(write); } }
private void installLoggingPropertiesFile(final File loggingPropertiesFile) throws IOException { final String name = STANDALONE_PROPERTIES_FILE + LOGGING_PROPERTIES_FILE; final URL resource = Thread.currentThread().getContextClassLoader().getResource(name); if (resource == null) { System.err.println("FATAL ERROR WHILE CONFIGURING LOGGING!!!. MISSING RESOURCE " + name); return; } final Properties props = IO.readProperties(resource); preprocessProperties(props); final OutputStream out = IO.write(loggingPropertiesFile); try { props.store(out, "OpenEJB Default Log4j Configuration"); } finally { IO.close(out); } PropertyConfigurator.configure(props); } }
private static void installResource(final File conf, final String file) throws IOException { final URL resource = getResource("/" + file); IO.copy(IO.read(resource), IO.write(new File(conf, file))); }
public void passivate(final Object primaryKey, final Object state) throws SystemException { try { final String filename = primaryKey.toString().replace(':', '='); final File sessionFile = new File(sessionDirectory, filename); if (!sessionFile.exists() && !sessionFile.createNewFile()) { throw new Exception("Failed to create passivation file: " + sessionFile.getAbsolutePath()); } logger.info("Passivating to file " + sessionFile); try (final OutputStream os = IO.write(sessionFile); final ObjectOutputStream oos = new ObjectOutputStream(os)) { oos.writeObject(state);// passivate just the bean instance } finally { sessionFile.deleteOnExit(); } } catch (final NotSerializableException nse) { logger.error("Passivation failed ", nse); throw (SystemException) new SystemException("The type " + nse.getMessage() + " is not serializable as mandated by the EJB specification.").initCause(nse); } catch (final Exception t) { logger.error("Passivation failed ", t); throw new SystemException(t); } }
public void passivate(final Object primaryKey, final Object state) throws SystemException { try { final String filename = primaryKey.toString().replace(':', '='); final File sessionFile = new File(sessionDirectory, filename); logger.info("Passivating to file " + sessionFile); try (final OutputStream os = IO.write(sessionFile); final ObjectOutputStream oos = new ObjectOutputStream(os)) { oos.writeObject(state);// passivate just the bean instance } finally { sessionFile.deleteOnExit(); } } catch (final NotSerializableException nse) { logger.error("Passivation failed ", nse); throw (SystemException) new SystemException("The type " + nse.getMessage() + " is not serializable as mandated by the EJB specification.").initCause(nse); } catch (final Exception t) { logger.error("Passivation failed ", t); throw new SystemException(t); } }
private void writeRaXml(final ConnectorModule connectorModule) { try { final Connector connector = connectorModule.getConnector(); final File tempFile = tempFile("ra-", connectorModule.getModuleId() + ".xml"); final OutputStream out = IO.write(tempFile); try { final JAXBContext ctx = JAXBContextFactory.newInstance(Connector.class); final Marshaller marshaller = ctx.createMarshaller(); marshaller.marshal(connector, out); logger.info("Dumping Generated ra.xml to: " + tempFile.getAbsolutePath()); } catch (final JAXBException e) { // no-op } finally { IO.close(out); } } catch (final IOException e) { // no-op } }
private void writeRaXml(final ConnectorModule connectorModule) { try { final Connector connector = connectorModule.getConnector(); final File tempFile = tempFile("ra-", connectorModule.getModuleId() + ".xml"); final OutputStream out = IO.write(tempFile); try { final JAXBContext ctx = JAXBContextFactory.newInstance(Connector.class); final Marshaller marshaller = ctx.createMarshaller(); marshaller.marshal(connector, out); logger.info("Dumping Generated ra.xml to: " + tempFile.getAbsolutePath()); } catch (final JAXBException e) { // no-op } finally { IO.close(out); } } catch (final IOException e) { // no-op } }
private void writeGeronimoOpenejb(final EjbModule ejbModule) { try { final GeronimoEjbJarType geronimoEjbJarType = (GeronimoEjbJarType) ejbModule.getAltDDs().get("geronimo-openejb.xml"); if (geronimoEjbJarType == null) { return; } final File tempFile = tempFile("geronimo-openejb-", ejbModule.getModuleId() + ".xml"); final OutputStream out = IO.write(tempFile); try { JaxbOpenejbJar2.marshal(GeronimoEjbJarType.class, geronimoEjbJarType, out); logger.info("Dumping Generated geronimo-openejb.xml to: " + tempFile.getAbsolutePath()); } catch (final JAXBException e) { // no-op } finally { IO.close(out); } } catch (final Exception e) { // no-op } }
private void writeOpenejbJar(final EjbModule ejbModule) { try { final OpenejbJar openejbJar = ejbModule.getOpenejbJar(); final File tempFile = tempFile("openejb-jar-", ejbModule.getModuleId() + ".xml"); final OutputStream out = IO.write(tempFile); try { JaxbOpenejbJar3.marshal(OpenejbJar.class, openejbJar, out); logger.info("Dumping Generated openejb-jar.xml to: " + tempFile.getAbsolutePath()); } catch (final JAXBException e) { // no-op } finally { IO.close(out); } } catch (final Exception e) { // no-op } }
private void writeOpenejbJar(final EjbModule ejbModule) { try { final OpenejbJar openejbJar = ejbModule.getOpenejbJar(); final File tempFile = tempFile("openejb-jar-", ejbModule.getModuleId() + ".xml"); final OutputStream out = IO.write(tempFile); try { JaxbOpenejbJar3.marshal(OpenejbJar.class, openejbJar, out); logger.info("Dumping Generated openejb-jar.xml to: " + tempFile.getAbsolutePath()); } catch (final JAXBException e) { // no-op } finally { IO.close(out); } } catch (final Exception e) { // no-op } }
private void writeEjbJar(final EjbModule ejbModule) { try { final EjbJar ejbJar = ejbModule.getEjbJar(); final File tempFile = tempFile("ejb-jar-", ejbModule.getModuleId() + ".xml"); final OutputStream out = IO.write(tempFile); try { EjbJarXml.marshal(ejbJar, out); logger.info("Dumping Generated ejb-jar.xml to: " + tempFile.getAbsolutePath()); } catch (final JAXBException e) { // no-op } finally { IO.close(out); } } catch (final Exception e) { // no-op } } }
private void writeEjbJar(final EjbModule ejbModule) { try { final EjbJar ejbJar = ejbModule.getEjbJar(); final File tempFile = tempFile("ejb-jar-", ejbModule.getModuleId() + ".xml"); final OutputStream out = IO.write(tempFile); try { EjbJarXml.marshal(ejbJar, out); logger.info("Dumping Generated ejb-jar.xml to: " + tempFile.getAbsolutePath()); } catch (final JAXBException e) { // no-op } finally { IO.close(out); } } catch (final Exception e) { // no-op } } }