当前位置: 首页>>代码示例>>Java>>正文


Java IServer.STATE_STARTED属性代码示例

本文整理汇总了Java中org.eclipse.wst.server.core.IServer.STATE_STARTED属性的典型用法代码示例。如果您正苦于以下问题:Java IServer.STATE_STARTED属性的具体用法?Java IServer.STATE_STARTED怎么用?Java IServer.STATE_STARTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.wst.server.core.IServer的用法示例。


在下文中一共展示了IServer.STATE_STARTED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serverChanged

@Override
public void serverChanged(ServerEvent event) {
  Preconditions.checkState(server == event.getServer());
  switch (event.getState()) {
    case IServer.STATE_STARTED:
      openBrowserPage(server);
      fireChangeEvent(DebugEvent.STATE);
      return;

    case IServer.STATE_STOPPED:
      server.removeServerListener(serverEventsListener);
      fireTerminateEvent();
      try {
        logger.fine("Server stopped; terminating launch"); //$NON-NLS-1$
        launch.terminate();
      } catch (DebugException ex) {
        logger.log(Level.WARNING, "Unable to terminate launch", ex); //$NON-NLS-1$
      }
      return;

    default:
      fireChangeEvent(DebugEvent.STATE);
      return;
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:25,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java

示例2: updateServerNameDisplay

private void updateServerNameDisplay(CloudFoundryApplicationModule application) {
	if (application.getApplication() == null) {
		serverNameText.setText(NLS.bind(Messages.ApplicationDetailsPart_TEXT_UPDATE_NOT_DEPLOYED,
				application.getDeployedApplicationName()));
		return;
	}
	int state = application.getState();

	switch (state) {
	case IServer.STATE_STARTED:
		String message = Messages.ApplicationDetailsPart_TEXT_UPDATE_STARTED;
		serverNameText.setText(NLS.bind("{0} {1}", application.getDeployedApplicationName(), message)); //$NON-NLS-1$
		break;
	case IServer.STATE_STOPPED:
		serverNameText.setText(NLS.bind(Messages.ApplicationDetailsPart_TEXT_UPDATE_STOPPED,
				application.getDeployedApplicationName()));
		break;
	default:
		serverNameText.setText(application.getDeployedApplicationName());
	}
}
 
开发者ID:eclipse,项目名称:cft,代码行数:21,代码来源:ApplicationDetailsPart.java

示例3: getCloudState

/**
 * @return One of the following state of the application on the Cloud
 * target: {@link IServer#STATE_STARTED}, {@link IServer#STATE_STOPPED},
 * {@link IServer#STATE_UNKNOWN}
 */
public static int getCloudState(CloudApplication cloudApp, ApplicationStats applicationStats) {
	// Fetch the running state of the first instance that is running.

	if (applicationStats != null) {
		List<InstanceStats> records = applicationStats.getRecords();

		if (records != null) {
			for (InstanceStats stats : records) {
				if (stats != null && stats.getState() == InstanceState.RUNNING) {
					return IServer.STATE_STARTED;
				}
			}
		}
	}

	// If the app desired state is stopped (so it may indicate that a
	// request to stop the app has been made)
	// consider the app to be stopped
	if (cloudApp != null && cloudApp.getState() == AppState.STOPPED) {
		return IServer.STATE_STOPPED;
	}

	return IServer.STATE_UNKNOWN;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:29,代码来源:CloudFoundryApplicationModule.java

示例4: canStop

@Override
public IStatus canStop() {
  int serverState = getServer().getServerState();
  if (serverState == IServer.STATE_STARTED) {
    return Status.OK_STATUS;
  }
  return StatusUtil.error(this, "Not started");
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:8,代码来源:LocalAppEngineServerBehaviour.java

示例5: launchesTerminated

@Override
public void launchesTerminated(ILaunch[] launches) {
  for (ILaunch terminated : launches) {
    if (terminated == launch) {
      if (server.getServerState() == IServer.STATE_STARTED) {
        logger.fine("Launch terminated; stopping server"); //$NON-NLS-1$
        server.stop(false);
      }
      return;
    }
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:12,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java

示例6: serverChanged

public void serverChanged(ServerEvent event) {
	if (CloudFoundryRsePlugin.doesServerBelongToHost(event.getServer(), getHost())) {
		if ((event.getKind() & ServerEvent.MODULE_CHANGE) != 0 && (event.getKind() & ServerEvent.STATE_CHANGE) != 0) {
			if (event.getState() == IServer.STATE_STARTED || event.getState() == IServer.STATE_STOPPED) {
				fireEventChangeChildren();
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:cft,代码行数:9,代码来源:ApplicationSubSystem.java

示例7: getActionsFromSelection

@Override
protected List<IAction> getActionsFromSelection(IServer server) {
	CloudFoundryServer cloudFoundryServer = (CloudFoundryServer) server.loadAdapter(CloudFoundryServer.class, null);
	if (cloudFoundryServer == null || server.getServerState() != IServer.STATE_STARTED) {
		return Collections.emptyList();
	}
	List<IAction> actions = new ArrayList<IAction>();

	return actions;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:10,代码来源:ServerMenuActionHandler.java

示例8: canRestartModule

@Override
public boolean canRestartModule(IModule[] modules) {
	try {
		CloudFoundryServer cloudServer = getCloudFoundryServer();
		IServer server = cloudServer.getServerOriginal();

		// If module is started, we should return true, regardless of the
		// publish state (this is for example an unlinked project that is
		// available and running, just not bound to any project in the
		// workspace)
		int moduleState = server.getModuleState(modules);
		if (moduleState == IServer.STATE_STARTED) {
			return true;
		}

		int publishState = server.getModulePublishState(modules);
		// If state is unknown, then inform module(s) can't be
		// restarted (which will disable push/start context menu operations)
		if (publishState == IServer.PUBLISH_STATE_UNKNOWN) {
			return false;
		}
	}
	catch (CoreException ce) {
		CloudFoundryPlugin.logError(ce);
	}

	return super.canRestartModule(modules);
}
 
开发者ID:eclipse,项目名称:cft,代码行数:28,代码来源:CloudFoundryServerBehaviour.java

示例9: getState

/**
 * 
 * @return {@link IServer} state
 */
public synchronized int getState() {
	if (application != null) {
		AppState state = application.getState();
		switch (state) {
		case STARTED:
			return IServer.STATE_STARTED;
		case UPDATING:
			return IServer.STATE_STARTING;
		case STOPPED:
			return IServer.STATE_STOPPED;
		}
	}
	return IServer.STATE_UNKNOWN;
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:18,代码来源:DockerFoundryApplicationModule.java

示例10: runAndWait

@Override
public T runAndWait(DockerClient client, SubMonitor monitor) throws CoreException {
	DockerFoundryServer cloudServer = getCloudServer();
	if (cloudServer.getDockerfile() == null || cloudServer.getDockerfile().length() == 0) {
		DockerFoundryPlugin.getCallback().getCredentials(cloudServer);
	}

	Server server = (Server) cloudServer.getServer();

	// Any Server request will require the server to be connected, so update
	// the server state
	if (server.getServerState() == IServer.STATE_STOPPED || server.getServerState() == IServer.STATE_STOPPING) {
		server.setServerState(IServer.STATE_STARTING);
	}

	try {
		T result = super.runAndWait(client, monitor);

		// No errors at this stage, therefore assume operation was completed
		// successfully, and update
		// server state accordingly
		if (server.getServerState() != IServer.STATE_STARTED) {
			server.setServerState(IServer.STATE_STARTED);
		}
		return result;

	}
	catch (CoreException ce) {
		// If the server state was starting and the error is related when
		// the operation was
		// attempted, but the operation failed
		// set the server state back to stopped.
		if (CloudErrorUtil.isConnectionError(ce) && server.getServerState() == IServer.STATE_STARTING) {
			server.setServerState(IServer.STATE_STOPPED);
		}
		// server.setServerPublishState(IServer.PUBLISH_STATE_NONE);
		throw ce;
	}

}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:40,代码来源:LocalServerRequest.java

示例11: getActionsFromSelection

@Override
protected List<IAction> getActionsFromSelection(IServer server) {
	DockerFoundryServer cloudFoundryServer = (DockerFoundryServer) server.loadAdapter(DockerFoundryServer.class, null);
	if (cloudFoundryServer == null || server.getServerState() != IServer.STATE_STARTED) {
		return Collections.emptyList();
	}
	List<IAction> actions = new ArrayList<IAction>();

	
	return actions;
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:11,代码来源:ServerMenuActionHandler.java

示例12: isRunning

private static boolean isRunning(IServer server) {
  return server.getServerState() == IServer.STATE_STARTED
      || server.getServerState() == IServer.STATE_STARTING;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:4,代码来源:LaunchHelper.java

示例13: restartServer

private void restartServer(IServer server, IProgressMonitor monitor) throws CoreException {
	monitor.subTask("Restarting server"); //$NON-NLS-1$

	final CountDownLatch eventLatch = new CountDownLatch(1);
	IServerListener serverListener = new IServerListener() {
		public void serverChanged(ServerEvent event) {
			if (event.getState() == IServer.STATE_STARTED) {
				eventLatch.countDown();
			}
		}
	};

	try {
		server.addServerListener(serverListener);

		if (server.getServerState() != IServer.STATE_STARTED) {
			server.start(ILaunchManager.DEBUG_MODE, monitor);
		}
		else if (server.getServerRestartState()) {
			server.restart(ILaunchManager.DEBUG_MODE, monitor);
		}
		else {
			return;
		}

		// wait 10 seconds
		monitor.subTask("Waiting for server to start"); //$NON-NLS-1$
		for (int i = 0; i < 50; i++) {
			try {
				if (eventLatch.await(200, TimeUnit.MILLISECONDS)) {
					break;
				}
			}
			catch (InterruptedException e) {
				throw new OperationCanceledException();
			}
			if (monitor != null && monitor.isCanceled()) {
				throw new OperationCanceledException();
			}
		}
	}
	finally {
		server.removeServerListener(serverListener);
	}
}
 
开发者ID:eclipse,项目名称:cft,代码行数:45,代码来源:ServerHandler.java

示例14: matchFound

public void matchFound(PatternMatchEvent event) {
	if (Logger.INFO) {
		Logger.println(Logger.INFO_LEVEL, this, "matchFound", "Application start detected: " + appName); //$NON-NLS-1$ //$NON-NLS-2$
	}
	appState = IServer.STATE_STARTED;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:6,代码来源:AbstractConsoleMonitorAppStateTracker.java

示例15: runAndWait

@Override
public T runAndWait(CloudFoundryOperations client, SubMonitor monitor) throws CoreException {
	CloudFoundryServer cloudServer = getCloudServer();
	
	if (!cloudServer.isSso()) {
		// The username/password should not be null in non-sso scenario.
		if (cloudServer.getUsername() == null || cloudServer.getUsername().length() == 0
				|| cloudServer.getPassword() == null || cloudServer.getPassword().length() == 0) {
			CloudFoundryPlugin.getCallback().getCredentials(cloudServer);
		}
	} else {
		if(cloudServer.getToken() == null) {
			CloudFoundryPlugin.getCallback().ssoLoginUserPrompt(cloudServer);
		}
	}
	
	Server server = (Server) cloudServer.getServer();

	// Any Server request will require the server to be connected, so update
	// the server state
	if (server.getServerState() == IServer.STATE_STOPPED || server.getServerState() == IServer.STATE_STOPPING) {
		server.setServerState(IServer.STATE_STARTING);
	}

	try {
		T result = super.runAndWait(client, monitor);

		// No errors at this stage, therefore assume operation was completed
		// successfully, and update
		// server state accordingly
		if (server.getServerState() != IServer.STATE_STARTED) {
			server.setServerState(IServer.STATE_STARTED);
		}
		return result;

	}
	catch (CoreException ce) {
		// If the server state was starting and the error is related when
		// the operation was
		// attempted, but the operation failed
		// set the server state back to stopped.
		if (CloudErrorUtil.isConnectionError(ce) && server.getServerState() == IServer.STATE_STARTING) {
			server.setServerState(IServer.STATE_STOPPED);
		}
		// server.setServerPublishState(IServer.PUBLISH_STATE_NONE);
		throw ce;
	}

}
 
开发者ID:eclipse,项目名称:cft,代码行数:49,代码来源:LocalServerRequest.java


注:本文中的org.eclipse.wst.server.core.IServer.STATE_STARTED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。