use of com.liferay.ide.server.core.gogo.GogoBundleDeployer in project liferay-ide by liferay.
the class PortalServerBehavior method startOrStopModules.
private void startOrStopModules(IModule[] modules, String action, IProgressMonitor monitor) {
for (IModule module : modules) {
IProject project = module.getProject();
if (project == null) {
continue;
}
final IBundleProject bundleProject = LiferayCore.create(IBundleProject.class, project);
if (bundleProject != null) {
try {
final String symbolicName = bundleProject.getSymbolicName();
GogoBundleDeployer helper = new GogoBundleDeployer();
long bundleId = helper.getBundleId(symbolicName);
if (bundleId > 0) {
if (action.equals("start")) {
String error = helper.start(bundleId);
if (error == null) {
setModuleState(new IModule[] { module }, IServer.STATE_STARTED);
} else {
LiferayServerCore.logError("Unable to start this bundle");
}
} else if (action.equals("stop")) {
String error = helper.stop(bundleId);
if (error == null) {
setModuleState(new IModule[] { module }, IServer.STATE_STOPPED);
} else {
LiferayServerCore.logError("Unable to stop this bundle");
}
}
}
} catch (Exception e) {
LiferayServerCore.logError("Unable to " + action + " module", e);
}
}
}
}
use of com.liferay.ide.server.core.gogo.GogoBundleDeployer in project liferay-ide by liferay.
the class BundlePublishFullAdd method remoteDeploy.
private IStatus remoteDeploy(String bsn, IPath output) {
IStatus retval = null;
if (FileUtil.exists(output)) {
GogoBundleDeployer bundleDeployer = null;
try {
bundleDeployer = createBundleDeployer();
BundleDTO deployed = bundleDeployer.deploy(bsn, output.toFile(), getBundleUrl(output.toFile(), bsn));
if (deployed instanceof BundleDTOWithStatus) {
BundleDTOWithStatus withStatus = (BundleDTOWithStatus) deployed;
retval = LiferayServerCore.error("Problem with deploying bundle: " + withStatus._status);
} else {
retval = new Status(IStatus.OK, LiferayServerCore.PLUGIN_ID, (int) deployed.id, null, null);
}
} catch (Exception e) {
retval = LiferayServerCore.error("Unable to deploy bundle remotely " + output.toPortableString(), e);
}
} else {
retval = LiferayServerCore.error("Unable to deploy bundle remotely " + output.toPortableString());
}
return retval;
}
use of com.liferay.ide.server.core.gogo.GogoBundleDeployer in project liferay-ide by liferay.
the class ServiceCommand method execute.
public ServiceContainer execute() throws Exception {
GogoBundleDeployer bundleDeployer = null;
ServiceContainer result;
if (_server == null) {
return _getServiceFromTargetPlatform();
}
PortalServerBehavior serverBehavior = (PortalServerBehavior) _server.loadAdapter(PortalServerBehavior.class, null);
bundleDeployer = serverBehavior.createBundleDeployer();
if (bundleDeployer == null) {
return _getServiceFromTargetPlatform();
}
if (_serviceName == null) {
String[] services = _getServices(bundleDeployer);
result = new ServiceContainer(Arrays.asList(services));
} else {
String[] serviceBundle = _getServiceBundle(_serviceName, bundleDeployer);
result = new ServiceContainer(serviceBundle[0], serviceBundle[1], serviceBundle[2]);
}
return result;
}
use of com.liferay.ide.server.core.gogo.GogoBundleDeployer in project liferay-ide by liferay.
the class BundlePublishFullRemove method remoteUninstall.
private IStatus remoteUninstall(IBundleProject bundleProject, String symbolicName, IProgressMonitor monitor) throws CoreException {
// TODO we should get bsn first and try use the bsn to uninstall
IStatus retval = null;
IPath outputJar = bundleProject.getOutputBundlePath();
GogoBundleDeployer bundleDeployer = null;
try {
bundleDeployer = createBundleDeployer();
String error = bundleDeployer.uninstall(bundleProject, outputJar);
if (error == null) {
retval = Status.OK_STATUS;
} else {
retval = LiferayServerCore.error("Unable to uninstall bundle " + error);
}
} catch (Exception e) {
retval = LiferayServerCore.error("Unable to uninstall bundle " + symbolicName, e);
}
if (retval == null) {
retval = Status.OK_STATUS;
}
return retval;
}
Aggregations