本文整理汇总了Java中org.eclipse.wst.server.core.IServer.STATE_STOPPED属性的典型用法代码示例。如果您正苦于以下问题:Java IServer.STATE_STOPPED属性的具体用法?Java IServer.STATE_STOPPED怎么用?Java IServer.STATE_STOPPED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.wst.server.core.IServer
的用法示例。
在下文中一共展示了IServer.STATE_STOPPED属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: updateName
/**
* Update the shown name with the server stop/stopping state.
*/
private void updateName(int serverState) {
final String computedName;
if (serverState == IServer.STATE_STARTING) {
computedName = Messages.getString("SERVER_STARTING_TEMPLATE", unprefixedName);
} else if (serverState == IServer.STATE_STOPPING) {
computedName = Messages.getString("SERVER_STOPPING_TEMPLATE", unprefixedName);
} else if (serverState == IServer.STATE_STOPPED) {
computedName = Messages.getString("SERVER_STOPPED_TEMPLATE", unprefixedName);
} else {
computedName = unprefixedName;
}
UIJob nameUpdateJob = new UIJob("Update server name") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
LocalAppEngineConsole.this.setName(computedName);
return Status.OK_STATUS;
}
};
nameUpdateJob.setSystem(true);
nameUpdateJob.schedule();
}
示例3: 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());
}
}
示例4: 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;
}
示例5: stop
@Override
public void stop(boolean force) {
int serverState = getServer().getServerState();
if (serverState == IServer.STATE_STOPPED) {
return;
}
// If the server seems to be running, and we haven't already tried to stop it,
// then try to shut it down nicely
if (devServer != null && (!force || serverState != IServer.STATE_STOPPING)) {
setServerState(IServer.STATE_STOPPING);
DefaultStopConfiguration stopConfig = new DefaultStopConfiguration();
if (isDevAppServer1()) {
stopConfig.setAdminPort(serverPort);
} else {
stopConfig.setAdminPort(adminPort);
}
try {
devServer.stop(stopConfig);
} catch (AppEngineException ex) {
logger.log(Level.WARNING, "Error terminating server: " + ex.getMessage(), ex); //$NON-NLS-1$
}
} else {
// we've already given it a chance
logger.info("forced stop: destroying associated processes"); //$NON-NLS-1$
if (devProcess != null) {
devProcess.destroy();
devProcess = null;
}
devServer = null;
setServerState(IServer.STATE_STOPPED);
}
}
示例6: terminate
@Override
public void terminate() throws DebugException {
int state = server.getServerState();
if (state != IServer.STATE_STOPPED) {
serverBehaviour.stop(state == IServer.STATE_STOPPING);
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:7,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java
示例7: 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();
}
}
}
}
示例8: 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;
}
示例9: 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;
}
}
示例10: isTerminated
@Override
public boolean isTerminated() {
int state = server.getServerState();
return state == IServer.STATE_STOPPED;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:5,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java
示例11: update
private void update(int serverState) {
if (serverState == IServer.STATE_STOPPED) {
disengage(); // we should no longer update
}
updateName(serverState);
}
示例12: refreshDeploymentButtons
protected void refreshDeploymentButtons(CloudFoundryApplicationModule appModule) {
if (topButtonRow == null || lowerButtonRow == null || lowerButtonRow.isDisposed()
|| topButtonRow.isDisposed()) {
return;
}
int state = appModule.getStateInServer();
// Don't refresh if the restart buttons were selected
if (skipButtonRefreshOnRestart) {
skipButtonRefreshOnRestart = false;
return;
}
// Show/hide action buttons based on server state
// [487916] - Enable Stop button at all times except when app is stopped
if (state == IServer.STATE_STOPPED) {
stopAppButton.setEnabled(false);
startAppButton.setText(Messages.ApplicationDetailsPart_TEXT_START);
startAppButton.setImage(ImageResource.getImage(ImageResource.IMG_CLCL_START));
startAppButton.setToolTipText(Messages.ApplicationDetailsPart_TEXT_START_TOOLTIP);
}
// Otherwise assume app is not running
else {
stopAppButton.setEnabled(true);
startAppButton.setText(Messages.ApplicationDetailsPart_TEXT_RESTART);
startAppButton.setImage(CloudFoundryImages.getImage(CloudFoundryImages.RESTART));
startAppButton.setToolTipText(Messages.ApplicationDetailsPart_TEXT_RESTART_TOOLTIP);
}
// Push can be enabled either when app is stopped or started, as the
// Push operation automatically stops an app if it is running
// before it push
if (CloudFoundryProperties.isModuleProjectAccessible.testProperty(new IModule[] { module }, cloudServer)) {
pushAppButton.setEnabled(true);
}
else {
pushAppButton.setEnabled(false);
}
// handle the update and restart button separately.
// Do not show the update button if there is not accessible
// module project in the workspace, as no source update would be
// possible within Eclipse
if (state == IServer.STATE_STOPPED || state == IServer.STATE_UNKNOWN
|| !CloudFoundryProperties.isModuleProjectAccessible.testProperty(new IModule[] { module },
cloudServer)) {
updateRestartAppButton.setEnabled(false);
}
else {
updateRestartAppButton.setEnabled(true);
}
refreshDebugControls(appModule);
topButtonRow.getParent().layout(true);
lowerButtonRow.getParent().layout(true);
}
示例13: 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;
}
}
示例14: promptCredentialsAndRun
public T promptCredentialsAndRun(IProgressMonitor 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 {
CFClient client = getClient(monitor);
if (client == null) {
throw CloudErrorUtil.toCoreException(NLS.bind(Messages.ERROR_NO_CLIENT, requestLabel));
}
httpTrace(client);
T result = checkClientConnectionAndRun(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;
}
}