use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project liferay-ide by liferay.
the class ServerCoreBase method setupRuntime.
@Before
public void setupRuntime() throws Exception {
if (shouldSkipBundleTests())
return;
assertNotNull("Expected System.getProperty(\"liferay.bundles.dir\") to not be null", System.getProperty("liferay.bundles.dir"));
assertNotNull("Expected liferayBundlesDir to not be null", liferayBundlesDir);
assertEquals("Expected liferayBundlesPath to exist: " + getLiferayBundlesPath().toOSString(), true, getLiferayBundlesPath().toFile().exists());
extractRuntime(getLiferayRuntimeZip(), getLiferayRuntimeDir());
final NullProgressMonitor npm = new NullProgressMonitor();
final String runtimeName = getRuntimeVersion();
runtime = ServerCore.findRuntime(runtimeName);
if (runtime == null) {
final IRuntimeWorkingCopy runtimeWC = ServerCore.findRuntimeType(getRuntimeId()).createRuntime(runtimeName, npm);
runtimeWC.setName(runtimeName);
runtimeWC.setLocation(getLiferayRuntimeDir());
runtime = runtimeWC.save(true, npm);
}
assertNotNull(runtime);
final ILiferayTomcatRuntime liferayRuntime = (ILiferayTomcatRuntime) ServerCore.findRuntime(runtimeName).loadAdapter(ILiferayTomcatRuntime.class, npm);
assertNotNull(liferayRuntime);
final IPath portalBundleFolder = runtime.getLocation().removeLastSegments(1);
final IPath deployPath = portalBundleFolder.append("deploy");
final File deployFolder = deployPath.toFile();
if (!deployFolder.exists()) {
deployFolder.mkdir();
}
assertEquals("Expected the deploy folder to exist:" + deployPath.toOSString(), true, deployFolder.exists());
}
use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project webtools.servertools by eclipse.
the class TomcatRuntimeWizardFragment method enter.
public void enter() {
if (comp != null) {
IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
comp.setRuntime(runtime);
}
}
use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project webtools.servertools by eclipse.
the class TomcatRuntimeWizardFragment method isComplete.
public boolean isComplete() {
IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
if (runtime == null)
return false;
IStatus status = runtime.validate(null);
return (status == null || status.getSeverity() != IStatus.ERROR);
}
use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project webtools.servertools by eclipse.
the class TomcatRuntimeLocator method getRuntimeFromDir.
protected static IRuntimeWorkingCopy getRuntimeFromDir(File dir, IProgressMonitor monitor) {
for (int i = 0; i < runtimeTypes.length; i++) {
try {
IRuntimeType runtimeType = ServerCore.findRuntimeType(runtimeTypes[i]);
String absolutePath = dir.getAbsolutePath();
String id = absolutePath.replace(File.separatorChar, '_').replace(':', '-');
IRuntimeWorkingCopy runtime = runtimeType.createRuntime(id, monitor);
runtime.setName(dir.getName());
runtime.setLocation(new Path(absolutePath));
ITomcatRuntimeWorkingCopy wc = (ITomcatRuntimeWorkingCopy) runtime.loadAdapter(ITomcatRuntimeWorkingCopy.class, null);
wc.setVMInstall(JavaRuntime.getDefaultVMInstall());
IStatus status = runtime.validate(monitor);
if (status == null || status.getSeverity() != IStatus.ERROR)
return runtime;
Trace.trace(Trace.FINER, "False runtime found at " + dir.getAbsolutePath() + ": " + status.getMessage());
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Could not find runtime", e);
}
}
return null;
}
use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project webtools.servertools by eclipse.
the class GetDelegateTestCase method createRuntime.
protected IRuntimeWorkingCopy createRuntime(String runtimeTypeId, String runtimeTypeLocation) throws CoreException {
if (runtimeTypeId == null)
throw new IllegalArgumentException();
IRuntimeWorkingCopy runtimeCopy = ServerCore.findRuntimeType(runtimeTypeId).createRuntime(runtimeTypeId, null);
runtimeCopy.setLocation(new Path(runtimeTypeLocation));
runtimeCopy.setReadOnly(false);
IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
ITomcatRuntimeWorkingCopy rwc = (ITomcatRuntimeWorkingCopy) runtimeCopy.loadAdapter(ITomcatRuntimeWorkingCopy.class, new NullProgressMonitor());
rwc.setVMInstall(vmInstall);
runtimeCopy.save(false, null);
return runtimeCopy;
}
Aggregations