use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.
the class ServerNameChangeTests method setupRuntime.
private String setupRuntime(IPath runtimeZipPath, IPath runitmeDirPath, String runtimeName, IPath runtimUnzipDir, String runtimeId) throws Exception {
assertEquals("Expected liferayBundlesPath to exist: " + runtimeZipPath.toOSString(), true, runtimeZipPath.toFile().exists());
extractLiferayRuntime(runtimeZipPath, runtimUnzipDir);
final NullProgressMonitor npm = new NullProgressMonitor();
IRuntime findRuntime = ServerCore.findRuntime(runtimeName);
if (findRuntime == null) {
final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(runtimeId).createRuntime(runtimeName, npm);
runtimeWC.setName(runtimeName);
runtimeWC.setLocation(runitmeDirPath);
findRuntime = runtimeWC.save(true, npm);
}
assertNotNull(findRuntime);
final PortalRuntime liferayRuntime = (PortalRuntime) ServerCore.findRuntime(runtimeName).loadAdapter(PortalRuntime.class, npm);
assertNotNull(liferayRuntime);
return findRuntime.getId();
}
use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.
the class ServerNameChangeTests method setup62Runtime.
private String setup62Runtime(IPath runtimeZipPath, IPath runitmeDirPath, String runtimeName, IPath runtimUnzipDir, String runtimeId) throws Exception {
assertEquals("Expected liferayBundlesPath to exist: " + runtimeZipPath.toOSString(), true, runtimeZipPath.toFile().exists());
extractLiferayRuntime(runtimeZipPath, runtimUnzipDir);
final NullProgressMonitor npm = new NullProgressMonitor();
IRuntime findRuntime = ServerCore.findRuntime(runtimeName);
if (findRuntime == null) {
final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(runtimeId).createRuntime(runtimeName, npm);
runtimeWC.setName(runtimeName);
runtimeWC.setLocation(runitmeDirPath);
findRuntime = runtimeWC.save(true, npm);
}
assertNotNull(findRuntime);
final LiferayTomcatRuntime liferayRuntime = (LiferayTomcatRuntime) ServerCore.findRuntime(runtimeName).loadAdapter(LiferayTomcatRuntime.class, npm);
assertNotNull(liferayRuntime);
return findRuntime.getId();
}
use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.
the class ServerUtil method getRuntime.
public static IRuntimeWorkingCopy getRuntime(String runtimeTypeId, IPath location) {
IRuntimeType runtimeType = ServerCore.findRuntimeType(runtimeTypeId);
try {
// $NON-NLS-1$
IRuntime runtime = runtimeType.createRuntime("runtime", null);
IRuntimeWorkingCopy runtimeWC = runtime.createWorkingCopy();
// $NON-NLS-1$
runtimeWC.setName("Runtime");
runtimeWC.setLocation(location);
return runtimeWC;
} catch (CoreException e) {
e.printStackTrace();
}
return null;
}
use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.
the class LiferayTomcatUtil method validateRuntimeStubLocation.
public static IStatus validateRuntimeStubLocation(String runtimeTypeId, IPath runtimeStubLocation) {
try {
IRuntimeWorkingCopy runtimeStub = ServerCore.findRuntimeType(runtimeTypeId).createRuntime(null, null);
runtimeStub.setLocation(runtimeStubLocation);
runtimeStub.setStub(true);
return runtimeStub.validate(null);
} catch (Exception e) {
return LiferayTomcatPlugin.createErrorStatus(e);
}
}
use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.
the class PortalRuntimeWizard method exit.
public void exit() {
IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
IPath path = runtime.getLocation();
if (runtime.validate(null).getSeverity() != IStatus.ERROR) {
LiferayServerCore.setPreference("location." + runtime.getRuntimeType().getId(), path.toPortableString());
}
}
Aggregations