use of aQute.remote.util.JMXBundleDeployer in project bnd by bndtools.
the class RemoteProjectLauncherPlugin method tryJMXDeploy.
@SuppressWarnings("deprecation")
private void tryJMXDeploy(String jmx, String bsn) {
JMXBundleDeployer jmxBundleDeployer = null;
int port = -1;
try {
port = Integer.parseInt(jmx);
} catch (Exception e) {
// not an integer
}
try {
if (port > -1) {
jmxBundleDeployer = new JMXBundleDeployer(port);
} else {
jmxBundleDeployer = new JMXBundleDeployer();
}
} catch (Exception e) {
// ignore if we can't create bundle deployer (no remote osgi.core
// jmx avail)
}
if (jmxBundleDeployer != null) {
for (String path : this.getRunpath()) {
File file = new File(path);
try (Jar jar = new Jar(file)) {
if (bsn.equals(jar.getBsn())) {
long bundleId = jmxBundleDeployer.deploy(bsn, file);
trace("agent installed with bundleId=%s", bundleId);
break;
}
} catch (Exception e) {
//
}
}
}
}
use of aQute.remote.util.JMXBundleDeployer in project bnd by bndtools.
the class RemoteJMXTest method testJMXBundleDeployer.
public void testJMXBundleDeployer() throws Exception {
JMXBundleDeployer jmxBundleDeployer = new JMXBundleDeployer();
long bundleId = jmxBundleDeployer.deploy("biz.aQute.remote.agent", IO.getFile("generated/biz.aQute.remote.agent.jar"));
assertTrue(bundleId > 0);
BundleDTO agentBundle = null;
long state = -1;
for (BundleDTO bundle : jmxBundleDeployer.listBundles()) {
if (bundle.symbolicName.equals("biz.aQute.remote.agent")) {
agentBundle = bundle;
state = bundle.state;
}
}
assertNotNull(agentBundle);
assertEquals(Bundle.ACTIVE, state);
}
use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.
the class BladeServiceBuilderIntegrationTest method create.
@Deployment
public static JavaArchive create() throws Exception {
final File jarFile = new File(System.getProperty("jarFile"));
final File fooApiJar = new File(System.getProperty("fooApiJarFile"));
new JMXBundleDeployer().deploy(_fooApiJarBSN, fooApiJar);
return ShrinkWrap.createFromZipFile(JavaArchive.class, jarFile);
}
use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.
the class BladeSpringMVCPortletTest method cleanUp.
@AfterClass
public static void cleanUp() throws Exception {
new JMXBundleDeployer().uninstall(_fooApiJarBSN);
new JMXBundleDeployer().uninstall(_fooServiceJarBSN);
new JMXBundleDeployer().uninstall(_springmvcPortletWarBSN);
}
use of aQute.remote.util.JMXBundleDeployer in project liferay-blade-samples by liferay.
the class BladeSpringMVCPortletTest method create.
@Deployment
public static JavaArchive create() throws Exception {
final File jarFile = new File(System.getProperty("jarFile"));
final File fooApiJar = new File(System.getProperty("fooApiJarFile"));
final File fooServiceJar = new File(System.getProperty("fooServiceJarFile"));
final File springmvcPortletWar = new File(System.getProperty("springmvcPortletWarFile"));
new JMXBundleDeployer().deploy(_fooApiJarBSN, fooApiJar);
new JMXBundleDeployer().deploy(_fooServiceJarBSN, fooServiceJar);
String bundleID = BladeCLIUtil.installBundle(springmvcPortletWar);
BladeCLIUtil.startBundle(bundleID);
return ShrinkWrap.createFromZipFile(JavaArchive.class, jarFile);
}
Aggregations