use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.
the class DeployerEjb method reload.
private void reload(final AppInfo info) {
if (info.webAppAlone) {
final WebAppDeployer component = SystemInstance.get().getComponent(WebAppDeployer.class);
if (null != component) {
component.reload(info.path);
return;
}
}
try {
assembler.destroyApplication(info);
assembler.createApplication(info);
} catch (final Exception e) {
throw new OpenEJBRuntimeException(e);
}
}
use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.
the class OpenEJBDeployableContainer method setup.
@Override
public void setup(final OpenEJBConfiguration openEJBConfiguration) {
properties = new Properties();
configuration = openEJBConfiguration;
final ByteArrayInputStream bais = new ByteArrayInputStream(openEJBConfiguration.getProperties().getBytes());
try {
properties.load(bais);
} catch (final IOException e) {
throw new OpenEJBRuntimeException(e);
} finally {
IO.close(bais);
}
for (final Map.Entry<Object, Object> defaultKey : PROPERTIES.entrySet()) {
final String key = defaultKey.getKey().toString();
if (!properties.containsKey(key)) {
properties.setProperty(key, defaultKey.getValue().toString());
}
}
ArquillianUtil.preLoadClassesAsynchronously(openEJBConfiguration.getPreloadClasses());
}
use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.
the class EmbeddedTomEEConfiguration method toProperties.
private static Properties toProperties(final String value) {
if (value == null || value.isEmpty()) {
return null;
}
final Properties properties = new Properties();
final ByteArrayInputStream bais = new ByteArrayInputStream(value.getBytes());
try {
properties.load(bais);
} catch (final IOException e) {
throw new OpenEJBRuntimeException(e);
} finally {
try {
IO.close(bais);
} catch (final IOException ignored) {
// no-op
}
}
return properties;
}
use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.
the class OpenEJBArchiveProcessor method createEjbJar.
private static EjbJar createEjbJar(final String prefix, final Archive<?> webArchive) {
final EjbJar webEjbJar;
final Node webEjbJarXml = webArchive.get(prefix.concat(EJB_JAR_XML));
if (webEjbJarXml != null) {
try {
webEjbJar = ReadDescriptors.readEjbJar(webEjbJarXml.getAsset().openStream());
} catch (final OpenEJBException e) {
throw new OpenEJBRuntimeException(e);
}
} else {
webEjbJar = new EjbJar();
}
return webEjbJar;
}
use of org.apache.openejb.OpenEJBRuntimeException in project tomee by apache.
the class ConvertDataSourceDefinitions method rawDefinition.
private String rawDefinition(final DataSource d) {
try {
final Properties p = new Properties();
put(p, "transactional", d.getTransactional());
put(p, "initialPoolSize", d.getInitialPoolSize());
put(p, "isolationLevel", d.getIsolationLevel());
put(p, "loginTimeout", d.getLoginTimeout());
put(p, "maxIdleTime", d.getMaxIdleTime());
put(p, "maxPoolSize", d.getMaxPoolSize());
put(p, "maxStatements", d.getMaxStatements());
put(p, "minPoolSize", d.getMinPoolSize());
put(p, "portNumber", d.getPortNumber());
put(p, "databaseName", d.getDatabaseName());
put(p, "password", d.getPassword());
put(p, "serverName", d.getServerName());
put(p, "url", d.getUrl());
put(p, "user", d.getUser());
setProperties(d, p);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
p.store(out, "");
return new String(out.toByteArray());
} catch (final IOException e) {
throw new OpenEJBRuntimeException(String.format("Cannot canonicalize the @DataSourceDefinition %s as a properties string", d.getName()));
}
}
Aggregations