Search in sources :

Example 11 with ServerWorkingCopy

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

the class SetServerStopTimeoutCommand method execute.

/**
 * Execute the command.
 */
public void execute() {
    ServerWorkingCopy swc = (ServerWorkingCopy) server;
    oldTime = swc.getStopTimeout();
    swc.setStopTimeout(time);
}
Also used : ServerWorkingCopy(org.eclipse.wst.server.core.internal.ServerWorkingCopy) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy)

Example 12 with ServerWorkingCopy

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

the class NewRuntimeWizardFragment method createChildFragments.

protected void createChildFragments(List<WizardFragment> list) {
    if (getTaskModel() == null)
        return;
    Object runtime = getTaskModel().getObject(TaskModel.TASK_RUNTIME);
    if (runtime == null)
        return;
    WizardFragment sub = null;
    if (runtime instanceof IRuntimeWorkingCopy)
        sub = getWizardFragment(((RuntimeWorkingCopy) runtime).getRuntimeType().getId());
    else if (runtime instanceof RuntimeTypeWithServerProxy)
        sub = getWizardFragment(((RuntimeTypeWithServerProxy) runtime).getId());
    if (sub != null)
        list.add(sub);
    Object serverObj = getTaskModel().getObject(TaskModel.TASK_SERVER);
    if (serverObj != null && serverObj instanceof IServerWorkingCopy) {
        IServerWorkingCopy server = (IServerWorkingCopy) serverObj;
        if (server.getServerType().hasServerConfiguration() && server instanceof ServerWorkingCopy) {
            ServerWorkingCopy swc = (ServerWorkingCopy) server;
            try {
                if (runtime instanceof IRuntimeWorkingCopy) {
                    RuntimeWorkingCopy runtimeWorkingCopy = (RuntimeWorkingCopy) runtime;
                    if (runtimeWorkingCopy.getLocation() != null && !runtimeWorkingCopy.getLocation().isEmpty())
                        swc.importRuntimeConfiguration(runtimeWorkingCopy, null);
                }
            } catch (CoreException ce) {
            // ignore
            }
        }
        list.add(new WizardFragment() {

            public void enter() {
                IRuntimeWorkingCopy runtime2 = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
                IServerWorkingCopy server2 = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
                server2.setRuntime(runtime2);
            }
        });
        sub = getWizardFragment(server.getServerType().getId());
        if (sub != null)
            list.add(sub);
        list.add(WizardTaskUtil.SaveServerFragment);
    }
}
Also used : RuntimeTypeWithServerProxy(org.eclipse.wst.server.core.internal.RuntimeTypeWithServerProxy) ServerWorkingCopy(org.eclipse.wst.server.core.internal.ServerWorkingCopy) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) WizardFragment(org.eclipse.wst.server.ui.wizard.WizardFragment) CoreException(org.eclipse.core.runtime.CoreException) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) RuntimeWorkingCopy(org.eclipse.wst.server.core.internal.RuntimeWorkingCopy) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy) IRuntimeWorkingCopy(org.eclipse.wst.server.core.IRuntimeWorkingCopy)

Example 13 with ServerWorkingCopy

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

the class PasteAction method run.

/**
 * Implementation of method defined on <code>IAction</code>.
 */
public void run() {
    ServerTransfer serverTransfer = ServerTransfer.getInstance();
    IServer[] servers = (IServer[]) clipboard.getContents(serverTransfer);
    if (servers == null)
        return;
    int size = servers.length;
    for (int i = 0; i < size; i++) {
        try {
            IServerWorkingCopy wc = servers[i].createWorkingCopy();
            ((ServerWorkingCopy) wc).disassociate();
            // sets the name from the current one so that the
            wc.setName("Temp");
            // default name generation will work
            ServerUtil.setServerDefaultName(wc);
            wc.save(false, null);
        } catch (CoreException ce) {
            if (Trace.SEVERE) {
                Trace.trace(Trace.STRING_SEVERE, "Failure to copy server", ce);
            }
        }
    }
}
Also used : ServerWorkingCopy(org.eclipse.wst.server.core.internal.ServerWorkingCopy) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) IServer(org.eclipse.wst.server.core.IServer) CoreException(org.eclipse.core.runtime.CoreException) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy)

Example 14 with ServerWorkingCopy

use of org.eclipse.wst.server.core.internal.ServerWorkingCopy in project liferay-ide by liferay.

the class ServerNameChangeTests method testPortalServiceDelegate62Name.

@Test
public void testPortalServiceDelegate62Name() throws Exception {
    if (shouldSkipBundleTests())
        return;
    IServerType portalServer62Type = ServerCore.findServerType("com.liferay.ide.eclipse.server.tomcat.7062");
    assertNotNull(portalServer62Type);
    IProgressMonitor monitor = new NullProgressMonitor();
    IServerWorkingCopy newServer = portalServer62Type.createServer(null, null, monitor);
    assertNotNull(newServer);
    newServer.setRuntime(ServerUtil.getRuntime(getTomcat62RuntimeName()));
    ((ServerWorkingCopy) newServer).setDefaults(null);
    assertEquals("Liferay CE Tomcat62 at localhost", newServer.getName());
    newServer.setRuntime(ServerUtil.getRuntime(getTomcat62DumyRuntimeName()));
    ((ServerWorkingCopy) newServer).setDefaults(null);
    assertEquals("Liferay CE Tomcat62 Dumy at localhost", newServer.getName());
}
Also used : ServerWorkingCopy(org.eclipse.wst.server.core.internal.ServerWorkingCopy) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IServerType(org.eclipse.wst.server.core.IServerType) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) Test(org.junit.Test)

Example 15 with ServerWorkingCopy

use of org.eclipse.wst.server.core.internal.ServerWorkingCopy in project liferay-ide by liferay.

the class ServerNameChangeTests method testPortalServiceDelegateName.

@Test
public void testPortalServiceDelegateName() throws Exception {
    if (shouldSkipBundleTests())
        return;
    IServerType portalServerType = ServerCore.findServerType(PortalServer.ID);
    assertNotNull(portalServerType);
    IProgressMonitor monitor = new NullProgressMonitor();
    IServerWorkingCopy newServer = portalServerType.createServer(null, null, monitor);
    assertNotNull(newServer);
    newServer.setRuntime(ServerUtil.getRuntime(getTomcatRuntimeName()));
    ((ServerWorkingCopy) newServer).setDefaults(null);
    assertEquals("Liferay CE GA5 Tomcat at localhost", newServer.getName());
    newServer.setRuntime(ServerUtil.getRuntime(getWildflyRuntimeName()));
    ((ServerWorkingCopy) newServer).setDefaults(null);
    assertEquals("Liferay CE GA5 Wildfly at localhost", newServer.getName());
}
Also used : ServerWorkingCopy(org.eclipse.wst.server.core.internal.ServerWorkingCopy) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IServerType(org.eclipse.wst.server.core.IServerType) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) Test(org.junit.Test)

Aggregations

ServerWorkingCopy (org.eclipse.wst.server.core.internal.ServerWorkingCopy)15 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)14 CoreException (org.eclipse.core.runtime.CoreException)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 IServerType (org.eclipse.wst.server.core.IServerType)2 WizardFragment (org.eclipse.wst.server.ui.wizard.WizardFragment)2 Test (org.junit.Test)2 IRuntimeWorkingCopy (org.eclipse.wst.server.core.IRuntimeWorkingCopy)1 IServer (org.eclipse.wst.server.core.IServer)1 RuntimeTypeWithServerProxy (org.eclipse.wst.server.core.internal.RuntimeTypeWithServerProxy)1 RuntimeWorkingCopy (org.eclipse.wst.server.core.internal.RuntimeWorkingCopy)1