Search in sources :

Example 6 with ControllableServerBehavior

use of org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior in project jbosstools-openshift by jbosstools.

the class AbstractCDKLaunchController method processTerminated.

private void processTerminated(IServer server, IProcess p, IDebugEventSetListener listener) {
    final ControllableServerBehavior beh = (ControllableServerBehavior) JBossServerBehaviorUtils.getControllableBehavior(server);
    new Thread() {

        @Override
        public void run() {
            handleProcessTerminated(p, beh);
        }
    }.start();
    if (listener != null) {
        DebugPlugin.getDefault().removeDebugEventListener(listener);
    }
}
Also used : ControllableServerBehavior(org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior) IControllableServerBehavior(org.jboss.ide.eclipse.as.wtp.core.server.behavior.IControllableServerBehavior)

Example 7 with ControllableServerBehavior

use of org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior in project jbosstools-openshift by jbosstools.

the class AbstractCDKShutdownController method processTerminated.

private void processTerminated(IServer server, IDebugEventSetListener listener) {
    final ControllableServerBehavior beh = (ControllableServerBehavior) JBossServerBehaviorUtils.getControllableBehavior(server);
    new Thread() {

        @Override
        public void run() {
            try {
                // sleep to allow vagrant to unlock queries.
                Thread.sleep(1000);
            } catch (InterruptedException ie) {
            }
            // Poll the server once more
            IStatus stat = getCDKPoller(server).getCurrentStateSynchronous(getServer());
            if (stat.getSeverity() == IStatus.ERROR) {
                beh.setServerStopped();
                beh.setRunMode("run");
                beh.putSharedData(CDKServerBehaviour.PROP_CACHED_PASSWORD, null);
                beh.putSharedData(CDKServerBehaviour.PROP_CACHED_USER, null);
            } else {
                // The shutdown failed. We'll set the server to started and indicate a requiresForce
                beh.setServerStarted();
                setNextStopRequiresForce(true);
            }
        }
    }.start();
    if (listener != null)
        DebugPlugin.getDefault().removeDebugEventListener(listener);
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) ControllableServerBehavior(org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior) PollThread(org.jboss.ide.eclipse.as.core.server.internal.PollThread)

Example 8 with ControllableServerBehavior

use of org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior in project jbosstools-openshift by jbosstools.

the class CDKLaunchController method handleOpenShiftUnavailable.

private void handleOpenShiftUnavailable(final IControllableServerBehavior beh, final OpenShiftNotReadyPollingException osnrpe) {
    // Log error?  Show dialog?
    ((ControllableServerBehavior) beh).setServerStarted();
    ((Server) beh.getServer()).setMode(ILaunchManager.RUN_MODE);
    new Job(osnrpe.getMessage()) {

        @Override
        protected IStatus run(IProgressMonitor monitor) {
            return CDKCoreActivator.statusFactory().errorStatus("Error contacting OpenShift", osnrpe);
        }
    }.schedule();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) CDKServer(org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDKServer) Server(org.eclipse.wst.server.core.internal.Server) IServer(org.eclipse.wst.server.core.IServer) ControllableServerBehavior(org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior) IControllableServerBehavior(org.jboss.ide.eclipse.as.wtp.core.server.behavior.IControllableServerBehavior) Job(org.eclipse.core.runtime.jobs.Job)

Example 9 with ControllableServerBehavior

use of org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior in project jbosstools-openshift by jbosstools.

the class AbstractCDKLaunchController method handleOpenShiftUnavailable.

private void handleOpenShiftUnavailable(final IControllableServerBehavior beh, final OpenShiftNotReadyPollingException osnrpe) {
    // Log error?  Show dialog?
    ((ControllableServerBehavior) beh).setServerStarted();
    ((Server) beh.getServer()).setMode("run");
    new Job(osnrpe.getMessage()) {

        @Override
        protected IStatus run(IProgressMonitor monitor) {
            return CDKCoreActivator.statusFactory().errorStatus("Error contacting OpenShift", osnrpe);
        }
    }.schedule();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) Server(org.eclipse.wst.server.core.internal.Server) IServer(org.eclipse.wst.server.core.IServer) ControllableServerBehavior(org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior) IControllableServerBehavior(org.jboss.ide.eclipse.as.wtp.core.server.behavior.IControllableServerBehavior) Job(org.eclipse.core.runtime.jobs.Job)

Aggregations

ControllableServerBehavior (org.jboss.ide.eclipse.as.wtp.core.server.behavior.ControllableServerBehavior)9 IStatus (org.eclipse.core.runtime.IStatus)7 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 IServer (org.eclipse.wst.server.core.IServer)5 Server (org.eclipse.wst.server.core.internal.Server)4 IControllableServerBehavior (org.jboss.ide.eclipse.as.wtp.core.server.behavior.IControllableServerBehavior)4 CoreException (org.eclipse.core.runtime.CoreException)3 Status (org.eclipse.core.runtime.Status)3 CDKServer (org.jboss.tools.openshift.cdk.server.core.internal.adapter.CDKServer)3 File (java.io.File)2 IOException (java.io.IOException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 Job (org.eclipse.core.runtime.jobs.Job)2 IDebugEventSetListener (org.eclipse.debug.core.IDebugEventSetListener)2 IProcess (org.eclipse.debug.core.model.IProcess)2 ICredentialDomain (org.jboss.tools.foundation.core.credentials.ICredentialDomain)2 URISyntaxException (java.net.URISyntaxException)1 StorageException (org.eclipse.equinox.security.storage.StorageException)1 PollThread (org.jboss.ide.eclipse.as.core.server.internal.PollThread)1 UsernameChangedException (org.jboss.tools.foundation.core.credentials.UsernameChangedException)1