use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class CreationTestCase method test02CreateServer.
public void test02CreateServer() throws Exception {
// Find the v6 runtime that can be started (not stub).
IRuntimeType runtimeType = ServerCore.findRuntimeType("com.ibm.etools.publishing.static.server.runtime");
assertTrue("V6 runtime type is not found", runtimeType != null);
// Create the server.
IServerType serverType = ServerCore.findServerType("com.ibm.etools.publishing.static.server");
assertTrue("No Static server type has be defined.", serverType != null);
IServerWorkingCopy serverWc = null;
serverWc = serverType.createServer("Static Server", null, new NullProgressMonitor());
server = serverWc.save(true, null);
assertNotNull("The created server cannot be found.", server);
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class CreationTestCase method test00CreateServer.
public void test00CreateServer() throws Exception {
// Find the v6 runtime that can be started (not stub).
IRuntimeType runtimeType = ServerCore.findRuntimeType("com.ibm.etools.publishing.server.runtime");
assertTrue("V6 runtime type is not found", runtimeType != null);
// Find the V6 runtime location.
// String userWasV6RuntimeLocation = System.getProperty("was.runtime.v6");
// IPath runtimeLocation = userWasV6RuntimeLocation == null ?
// WASRuntimeLocator.getRuntimeLocation(WASRuntimeLocator.BASE_V6) : new
// Path(userWasV6RuntimeLocation);
// assertTrue("Cannot find the runtime location", runtimeLocation !=
// null);
// Create the runtime
// IRuntimeWorkingCopy curRuntimeWc = runtimeType.createRuntime(null);
// ServerUtil.setRuntimeDefaultName(curRuntimeWc);
// //curRuntimeWc.setLocation(runtimeLocation);
// curRuntimeWc.save(null);
// Get the created runtime.
// IRuntime curRuntime = curRuntimeWc.getOriginal();
// assertTrue("No created runtime is found.", curRuntime != null);
//
// Create the server.
IServerType serverType = ServerCore.findServerType(HttpServer.ID);
assertTrue(serverType != null);
IServerWorkingCopy serverWc = null;
serverWc = serverType.createServer("HTTP Server", null, new NullProgressMonitor());
server = serverWc.save(true, null);
assertNotNull(server);
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class ServerPropertyPage method createContents.
/**
* Create the body of the page.
*
* @param parent org.eclipse.swt.widgets.Composite
* @return org.eclipse.swt.widgets.Control
*/
protected Control createContents(Composite parent) {
try {
IAdaptable element = getElement();
server = (IServer) element.getAdapter(IServer.class);
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 3;
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
whs.setHelp(composite, ContextIds.SERVER_PROPERTY_PAGE);
// name
Label label = new Label(composite, SWT.NONE);
label.setText(Messages.propServerInfoName);
label = new Label(composite, SWT.NONE);
label.setText(server.getName());
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
label.setLayoutData(data);
// type
label = new Label(composite, SWT.NONE);
label.setText(Messages.propServerInfoType);
IServerType serverType = server.getServerType();
label = new Label(composite, SWT.NONE);
if (serverType != null)
label.setText(serverType.getName());
else
label.setText(Messages.elementUnknownName);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
label.setLayoutData(data);
// vendor
label = new Label(composite, SWT.NONE);
label.setText(Messages.propServerInfoVendor);
IRuntimeType runtimeType = null;
if (serverType != null)
runtimeType = serverType.getRuntimeType();
label = new Label(composite, SWT.NONE);
if (runtimeType != null)
label.setText(runtimeType.getVendor());
else
label.setText(Messages.elementUnknownName);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
label.setLayoutData(data);
// location
label = new Label(composite, SWT.NONE);
label.setText(Messages.switchServerLocation);
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));
final Label serverLocation = new Label(composite, SWT.NONE);
final Server svr = (Server) server;
if (svr.getFile() != null)
serverLocation.setText(svr.getFile().getFullPath().toPortableString());
else
serverLocation.setText(Messages.switchServerLocationMetadata);
serverLocation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
Button switchLocation = new Button(composite, SWT.PUSH);
switchLocation.setText(Messages.actionSwitchServerLocation);
switchLocation.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
switchLocation.setEnabled(!server.isReadOnly());
switchLocation.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
try {
Server.switchLocation(svr, null);
} catch (CoreException ce) {
if (Trace.SEVERE) {
Trace.trace(Trace.STRING_SEVERE, "Error switching server location", ce);
}
}
if (svr.getFile() != null)
serverLocation.setText(svr.getFile().getFullPath().toPortableString());
else
serverLocation.setText(Messages.switchServerLocationMetadata);
}
});
Dialog.applyDialogFont(composite);
return composite;
} catch (Exception e) {
if (Trace.SEVERE) {
Trace.trace(Trace.STRING_SEVERE, "Error creating property page", e);
}
return null;
}
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class RuntimeBridge method initialize.
private static void initialize() {
// add runtime mappings
IRuntimeType[] runtimeTypes = ServerCore.getRuntimeTypes();
int size = runtimeTypes.length;
for (int i = 0; i < size; i++) {
RuntimeType rt = (RuntimeType) runtimeTypes[i];
String component = rt.getFacetRuntimeComponent();
String version = rt.getFacetRuntimeVersion();
if (component != null && !"".equals(component) && version != null && !"".equals(version))
addMapping(rt.getId(), component, version);
}
// add extension mappings
RuntimeFacetMapping[] rfms = FacetMappingUtil.getRuntimeFacetMapping();
size = rfms.length;
for (int i = 0; i < size; i++) addMapping(rfms[i].getRuntimeTypeId(), rfms[i].getRuntimeComponent(), rfms[i].getVersion());
// generic runtimes
addMapping("org.eclipse.jst.server.generic.runtime.jboss323", "org.eclipse.jst.server.generic.runtime.jboss", "3.2.3");
addMapping("org.eclipse.jst.server.generic.runtime.jonas4", "org.eclipse.jst.server.generic.runtime.jonas", "4.0");
addMapping("org.eclipse.jst.server.generic.runtime.oracle1013", "org.eclipse.jst.server.generic.runtime.oracle", "10.1.3");
}
use of org.eclipse.wst.server.core.IRuntimeType in project webtools.servertools by eclipse.
the class RuntimeTreeContentProvider method fillTree.
public void fillTree() {
clean();
List<TreeElement> list = new ArrayList<TreeElement>();
IRuntime[] runtimes = ServerCore.getRuntimes();
if (runtimes != null) {
int size = runtimes.length;
for (int i = 0; i < size; i++) {
IRuntimeType runtimeType = runtimes[i].getRuntimeType();
try {
TreeElement ele = getOrCreate(list, runtimeType.getVendor());
ele.contents.add(runtimes[i]);
elementToParentMap.put(runtimes[i], ele);
} catch (Exception e) {
if (Trace.WARNING) {
Trace.trace(Trace.STRING_WARNING, "Error in runtime content provider", e);
}
}
}
}
elements = list.toArray();
}
Aggregations