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


Java IServer.STATE_UNKNOWN属性代码示例

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


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

示例1: 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

示例2: isDeployed

/**
 * 
 * @return true if application exists in the Cloud server AND running state
 * is known (stopped, started, starting)
 */
public synchronized boolean isDeployed() {
	// WARNING: if refactoring, beware to retain this behaviour as deployed
	// means existing in CF AND having a KNOWN app state
	// Many components rely on the application to be in KNOWN app state in
	// addition to existing in CF therefore take care
	// when modifying this implementation
	return exists() && getState() != IServer.STATE_UNKNOWN;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:13,代码来源:CloudFoundryApplicationModule.java

示例3: 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

示例4: 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);

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

示例5: startAndTrackApplication

protected void startAndTrackApplication(CloudFoundryApplicationModule appModule, SubMonitor monitor)
		throws CoreException {

	final String deploymentName = appModule.getDeployedApplicationName();

	final String startLabel = Messages.RestartOperation_STARTING_APP + " - " + deploymentName; //$NON-NLS-1$
	Server server = (Server) getBehaviour().getServer();

	getBehaviour().printlnToConsole(appModule, startLabel);

	CloudFoundryPlugin.getCallback().startApplicationConsole(getBehaviour().getCloudFoundryServer(), appModule, 0,
			monitor.newChild(20));

	CloudFoundryPlugin.trace("Application " + deploymentName + " starting"); //$NON-NLS-1$ //$NON-NLS-2$

	if (monitor.isCanceled()) {
		throw new OperationCanceledException(Messages.bind(Messages.OPERATION_CANCELED, startLabel));
	}

	// Get the old state first in case it needs to be restored due to
	// tracking or restart failure
	int updatedState = appModule.getState();

	// IMPORTANT: this sets the module state in the server to STARTING. Be
	// sure to update the module state to another state
	// after the restart and tracking is completed, even on exception, to
	// avoid the state to be stuck in STARTING even if restarting
	// or tracking failed, or operation was canceled.
	try {

		// Set the state of the module to Starting
		server.setModuleState(getModules(), IServer.STATE_STARTING);
		
		// IMPORTANT: Notify that module state has been changed
		getBehaviour().operations().updateModule(getFirstModule()).run(monitor);

		// Perform the actual restarting in the client
		StartingInfo info = getBehaviour().getRequestFactory().restartApplication(deploymentName, startLabel)
				.run(monitor.newChild(20));

		appModule.setStartingInfo(info);

		updatedState = trackApplicationRunningState(appModule, startLabel, monitor);
	}
	catch (OperationCanceledException oce) {
		updatedState = IServer.STATE_UNKNOWN;
		throw oce;
	}
	catch (CoreException ce) {
		updatedState = IServer.STATE_UNKNOWN;
		throw ce;
	}
	finally {
		// Always update the module state in the server
		server.setModuleState(getModules(), updatedState);

		// This may also update the module state in the server indirectly,
		// but in case an error occurs during the module update, the module
		// state is still explicitly set above to avoid apps to be stuck in
		// "Starting"
		getBehaviour().updateModuleWithAllCloudInfo(deploymentName, monitor);
	}
}
 
开发者ID:eclipse,项目名称:cft,代码行数:63,代码来源:RestartOperation.java

示例6: isDeployed

/**
 * 
 * @return true if the application is published to the Cloud Foundry server.
 * False otherwise.
 */
public synchronized boolean isDeployed() {
	return getApplication() != null && getState() != IServer.STATE_UNKNOWN;
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:8,代码来源:DockerFoundryApplicationModule.java


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