Search in sources :

Example 11 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project webtools.servertools by eclipse.

the class ServerPerformanceTestCase 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);
    runtimeCopy.save(false, null);
    return runtimeCopy;
}
Also used : Path(org.eclipse.core.runtime.Path) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 12 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project mdw-designer by CenturyLinkCloud.

the class ServiceMixRuntimeWizardFragment method isComplete.

@Override
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);
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 13 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project eclipse-integration-commons by spring-projects.

the class ServerHandler method createRuntime.

private IRuntime createRuntime(IServerType st, IPath path, IProgressMonitor monitor, IOverwriteQuery query) throws CoreException {
    IRuntime runtime = ServerCore.findRuntime(runtimeName);
    if (runtime != null) {
        if (!query(query, NLS.bind("A runtime with the name ''{0}'' already exists. Replace the existing runtime?", runtimeName))) {
            monitor.worked(1);
            return runtime;
        } else {
            runtime.delete();
        }
    }
    IRuntimeWorkingCopy wc = st.getRuntimeType().createRuntime(runtimeName, new SubProgressMonitor(monitor, 1));
    wc.setName(runtimeName);
    if (path != null) {
        wc.setLocation(path);
    }
    IStatus validationResult = wc.validate(monitor);
    if (!validationResult.isOK()) {
        throw new CoreException(validationResult);
    }
    runtime = wc.save(true, new SubProgressMonitor(monitor, 1));
    return runtime;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor) IRuntime(org.eclipse.wst.server.core.IRuntime)

Example 14 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project webtools.servertools by eclipse.

the class HttpRuntimeWizardFragment method enter.

/*
	 * @see org.eclipse.wst.server.ui.wizard.WizardFragment#enter()
	 */
public void enter() {
    if (comp != null) {
        IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
        comp.setRuntime(runtime);
    }
}
Also used : IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 15 with IRuntimeWorkingCopy

use of org.eclipse.wst.server.core.IRuntimeWorkingCopy in project webtools.servertools by eclipse.

the class HttpRuntimeLocator method getRuntimeFromDir.

protected static IRuntimeWorkingCopy getRuntimeFromDir(File dir, IProgressMonitor monitor) {
    for (String rt : runtimeTypes) {
        try {
            IRuntimeType runtimeType = ServerCore.findRuntimeType(rt);
            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).append("htdocs"));
            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;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IStatus(org.eclipse.core.runtime.IStatus) IRuntimeType(org.eclipse.wst.server.core.IRuntimeType) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Aggregations

IRuntimeWorkingCopy (org.eclipse.wst.server.core.IRuntimeWorkingCopy)41 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)16 IRuntime (org.eclipse.wst.server.core.IRuntime)13 IRuntimeType (org.eclipse.wst.server.core.IRuntimeType)12 CoreException (org.eclipse.core.runtime.CoreException)9 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)9 IServerType (org.eclipse.wst.server.core.IServerType)8 IPath (org.eclipse.core.runtime.IPath)6 IStatus (org.eclipse.core.runtime.IStatus)6 Path (org.eclipse.core.runtime.Path)6 Test (org.junit.Test)6 PortalRuntime (com.liferay.ide.server.core.portal.PortalRuntime)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 NewModuleFragmentOp (com.liferay.ide.project.core.modules.fragment.NewModuleFragmentOp)2 OverrideFilePath (com.liferay.ide.project.core.modules.fragment.OverrideFilePath)2 HashMap (java.util.HashMap)2 IFile (org.eclipse.core.resources.IFile)2 IProject (org.eclipse.core.resources.IProject)2 GenericServerRuntime (org.eclipse.jst.server.generic.core.internal.GenericServerRuntime)2 ITomcatRuntimeWorkingCopy (org.eclipse.jst.server.tomcat.core.internal.ITomcatRuntimeWorkingCopy)2