本文整理了Java中org.apache.openejb.loader.IO.write()
方法的一些代码示例,展示了IO.write()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IO.write()
方法的具体详情如下:
包路径:org.apache.openejb.loader.IO
类名称:IO
方法名:write
暂无
代码示例来源:origin: org.apache.openejb/openejb-loader
public static ZipOutputStream zip(final File file) throws IOException {
final OutputStream write = write(file);
return new ZipOutputStream(write);
}
代码示例来源:origin: org.apache.tomee/openejb-loader
public static ZipOutputStream zip(final File file) throws IOException {
final OutputStream write = write(file);
return new ZipOutputStream(write);
}
代码示例来源:origin: org.apache.openejb/openejb-core
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();
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
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();
}
}
代码示例来源:origin: org.apache.openejb/openejb-loader
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);
}
}
代码示例来源:origin: org.apache.tomee/openejb-loader
public static void copy(final InputStream from, final File to) throws IOException {
final OutputStream write = write(to);
try {
copy(from, write);
} finally {
close(write);
}
}
代码示例来源:origin: org.apache.openejb/openejb-loader
public static void copy(final InputStream from, final File to) throws IOException {
final OutputStream write = write(to);
try {
copy(from, write);
} finally {
close(write);
}
}
代码示例来源:origin: org.apache.openejb/openejb-core
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);
}
}
代码示例来源:origin: org.apache.tomee/openejb-loader
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);
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
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);
}
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-api-gateway-backbone
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)));
}
代码示例来源:origin: org.apache.tomee/openejb-core
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);
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
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);
}
}
代码示例来源:origin: org.apache.openejb/openejb-core
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
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
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
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
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
}
}
代码示例来源:origin: org.apache.openejb/openejb-core
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
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
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
}
}
代码示例来源:origin: org.apache.openejb/openejb-core
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
}
}
}
代码示例来源:origin: org.apache.tomee/openejb-core
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
}
}
}
内容来源于网络,如有侵权,请联系作者删除!