SPI messaging and code clean

6.19.x
Gennady Azarenkov 2017-05-25 21:12:11 +03:00
parent c6822e08da
commit 8ad21b4638
72 changed files with 252 additions and 436 deletions

View File

@ -123,7 +123,7 @@ public abstract class AbstractAgentLauncher implements AgentLauncher {
process.start(lineConsumer);
} catch (ConflictException | MachineException e) {
try {
machine.getLogger().writeLine(format("[ERROR] %s", e.getMessage()));
machine.getLogger().writeLine(format("[FAILED] %s", e.getMessage()));
} catch (IOException ignored) {
}
}

View File

@ -49,7 +49,7 @@ public class DefaultAgentLauncher implements AgentLauncher {
// //process.start(lineConsumer);
// } catch (Throwable e) {
// try {
// machine.getLogger().writeLine(format("[ERROR] %s", e.getMessage()));
// machine.getLogger().writeLine(format("[FAILED] %s", e.getMessage()));
// } catch (IOException ignored) {
// }
// } finally {

View File

@ -117,6 +117,12 @@ public class WsMasterModule extends AbstractModule {
bind(org.eclipse.che.everrest.ETagResponseFilter.class);
bind(org.eclipse.che.api.agent.server.AgentRegistryService.class);
// temporary solution
bind(org.eclipse.che.api.workspace.server.event.RuntimeStatusJsonRpcMessenger.class).asEagerSingleton();
bind(org.eclipse.che.api.workspace.server.event.MachineStatusJsonRpcMessenger.class).asEagerSingleton();
bind(org.eclipse.che.api.workspace.server.event.ServerStatusJsonRpcMessenger.class).asEagerSingleton();
//
bind(org.eclipse.che.security.oauth.OAuthAuthenticatorProvider.class)
.to(org.eclipse.che.security.oauth.OAuthAuthenticatorProviderImpl.class);
bind(org.eclipse.che.security.oauth.shared.OAuthTokenProvider.class)

View File

@ -1,21 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012-2017 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.core.model.machine;
/**
* Describes machine limits such as RAM size.
*
* @author Alexander Garagatyi
*/
public interface MachineLimits {
/** Get memory size (in megabytes) that is allocated for starting machine. */
int getRam();
}

View File

@ -45,7 +45,7 @@ export class Project {
this.workspaceDTO = workspaceDTO;
// search the workspace agent link
let servers : Map<string, org.eclipse.che.api.machine.shared.dto.ServerDto> = this.workspaceDTO.getRuntime().getDevMachine().getRuntime().getServers();
let servers : Map<string, org.eclipse.che.api.workspace.shared.dto.ServerDto> = this.workspaceDTO.getRuntime().getDevMachine().getRuntime().getServers();
var hrefWsAgent;
for (let server of servers.values()) {

View File

@ -104,7 +104,7 @@ export class WorkspaceSshAction {
return ssh.getPair("workspace", foundWorkspaceDTO.getId());
}).then((sshPairDto : org.eclipse.che.api.ssh.shared.dto.SshPairDto) => {
let machines : Array<org.eclipse.che.api.machine.shared.dto.MachineDto> = foundWorkspaceDTO.getRuntime().getMachines();
let machines : Array<org.eclipse.che.api.workspace.shared.dto.MachineDto> = foundWorkspaceDTO.getRuntime().getMachines();
let runtime: org.eclipse.che.api.machine.shared.dto.MachineRuntimeInfoDto = this.getSelectedMachine(machines).getRuntime();
let user : string = runtime.getProperties().get("config.user");
if (user === "") {
@ -135,7 +135,7 @@ export class WorkspaceSshAction {
});
}
private getSelectedMachine(machines : Array<org.eclipse.che.api.machine.shared.dto.MachineDto>) : org.eclipse.che.api.machine.shared.dto.MachineDto {
private getSelectedMachine(machines : Array<org.eclipse.che.api.workspace.shared.dto.MachineDto>) : org.eclipse.che.api.workspace.shared.dto.MachineDto {
for(let i : number=0; i<machines.length; i++) {
if (machines[i].getConfig().getName() === this.machineName) {
return machines[i];

View File

@ -13,7 +13,7 @@ package org.eclipse.che.ide.api.machine.events;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import org.eclipse.che.api.machine.shared.dto.event.MachineStatusEvent;
import org.eclipse.che.api.workspace.shared.dto.event.MachineStatusEvent;
/**
* Event that describes the fact that dev machine state has been changed.
@ -43,7 +43,7 @@ public class DevMachineStateEvent extends GwtEvent<DevMachineStateEvent.Handler>
/** Type class used to register this event. */
public static Type<DevMachineStateEvent.Handler> TYPE = new Type<>();
private final MachineStatusEvent.EventType status;
private final String machineId;
//private final String machineId;
private final String workspaceId;
private final String machineName;
private final String error;
@ -56,8 +56,8 @@ public class DevMachineStateEvent extends GwtEvent<DevMachineStateEvent.Handler>
*/
public DevMachineStateEvent(MachineStatusEvent event) {
this.status = event.getEventType();
this.machineId = event.getMachineId();
this.workspaceId = event.getWorkspaceId();
//this.machineId = event.getMachineId();
this.workspaceId = event.getIdentity().getWorkspaceId();
this.machineName = event.getMachineName();
this.error = event.getError();
}
@ -72,9 +72,9 @@ public class DevMachineStateEvent extends GwtEvent<DevMachineStateEvent.Handler>
return status;
}
public String getMachineId() {
return machineId;
}
// public String getMachineId() {
// return machineId;
// }
public String getWorkspaceId() {
return workspaceId;
@ -94,9 +94,9 @@ public class DevMachineStateEvent extends GwtEvent<DevMachineStateEvent.Handler>
case RUNNING:
handler.onDevMachineStarted(this);
break;
case DESTROYED:
handler.onDevMachineDestroyed(this);
break;
// case DESTROYED:
// handler.onDevMachineDestroyed(this);
// break;
}
}

View File

@ -59,7 +59,7 @@ import static org.eclipse.che.ide.ui.menu.PositionController.VerticalAlign.BOTTO
public class OutputConsoleViewImpl extends Composite implements OutputConsoleView, ScrollHandler {
private final List<Pair<RegExp, String>> output2Color = newArrayList(new Pair<>(compile("\\[\\s*(DOCKER)\\s*\\]"), "#4EABFF"),
new Pair<>(compile("\\[\\s*(ERROR)\\s*\\]"), "#FF2727"),
new Pair<>(compile("\\[\\s*(FAILED)\\s*\\]"), "#FF2727"),
new Pair<>(compile("\\[\\s*(WARN)\\s*\\]"), "#F5A623"),
new Pair<>(compile("\\[\\s*(STDOUT)\\s*\\]"), "#8ED72B"),
new Pair<>(compile("\\[\\s*(STDERR)\\s*\\]"), "#FF4343"));

View File

@ -15,7 +15,7 @@ import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;
import org.eclipse.che.api.core.jsonrpc.commons.RequestTransmitter;
import org.eclipse.che.api.machine.shared.dto.event.MachineStatusEvent;
import org.eclipse.che.api.workspace.shared.dto.event.MachineStatusEvent;
import org.eclipse.che.api.workspace.shared.dto.RuntimeDto;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.machine.ActiveRuntime;
@ -60,8 +60,8 @@ public class EnvironmentStatusHandler {
}
public void handleEnvironmentStatusChanged(MachineStatusEvent event) {
final String machineId = event.getMachineId();
final String workspaceId = event.getWorkspaceId();
final String machineId = event.getMachineName();
final String workspaceId = event.getIdentity().getWorkspaceId();
workspaceServiceClient.getWorkspace(workspaceId).then(workspace -> {
RuntimeDto workspaceRuntime = workspace.getRuntime();
@ -72,13 +72,13 @@ public class EnvironmentStatusHandler {
((AppContextImpl)appContext).setWorkspace(workspace);
switch (event.getEventType()) {
case CREATING:
case STARTING:
handleMachineCreating(machineId);
break;
case RUNNING:
handleMachineRunning(machineId);
break;
case ERROR:
case FAILED:
handleMachineError(event);
break;
}

View File

@ -26,7 +26,7 @@ import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.config.MachineConfig;
import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.api.core.model.workspace.runtime.Server;
import org.eclipse.che.api.machine.shared.dto.MachineDto;
import org.eclipse.che.api.workspace.shared.dto.MachineDto;
import org.eclipse.che.api.machine.shared.dto.execagent.GetProcessLogsResponseDto;
import org.eclipse.che.api.machine.shared.dto.execagent.GetProcessesResponseDto;
import org.eclipse.che.api.promises.client.Operation;

View File

@ -15,7 +15,7 @@ import com.google.inject.Provider;
import com.google.inject.Singleton;
import org.eclipse.che.api.core.jsonrpc.commons.RequestHandlerConfigurator;
import org.eclipse.che.api.machine.shared.dto.event.MachineStatusEvent;
import org.eclipse.che.api.workspace.shared.dto.event.MachineStatusEvent;
import org.eclipse.che.ide.machine.EnvironmentStatusHandler;
import org.eclipse.che.ide.util.loging.Log;

View File

@ -12,7 +12,7 @@ package org.eclipse.che.ide.command.palette;
import org.eclipse.che.api.core.model.machine.Machine;
import org.eclipse.che.api.core.model.workspace.Workspace;
import org.eclipse.che.api.machine.shared.dto.MachineDto;
import org.eclipse.che.api.workspace.shared.dto.MachineDto;
import org.eclipse.che.api.promises.client.Operation;
import org.eclipse.che.api.promises.client.Promise;
import org.eclipse.che.api.workspace.shared.dto.WorkspaceRuntimeDto;

View File

@ -11,7 +11,7 @@
package org.eclipse.che.ide.command.toolbar.previews;
import org.eclipse.che.api.machine.shared.dto.MachineRuntimeInfoDto;
import org.eclipse.che.api.machine.shared.dto.ServerDto;
import org.eclipse.che.api.workspace.shared.dto.ServerDto;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.machine.DevMachine;
import org.junit.Before;

View File

@ -12,8 +12,8 @@ package org.eclipse.che.workspace.infrastructure.docker;
import org.eclipse.che.api.agent.server.exception.AgentException;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.workspace.infrastructure.docker.model.DockerEnvironment;
import javax.inject.Inject;

View File

@ -17,13 +17,13 @@ import org.eclipse.che.api.agent.server.impl.AgentSorter;
import org.eclipse.che.api.core.ValidationException;
import org.eclipse.che.api.core.model.machine.MachineSource;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.workspace.server.URLRewriter;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.InternalInfrastructureException;
import org.eclipse.che.api.workspace.server.spi.InternalMachineConfig;
import org.eclipse.che.api.workspace.server.spi.InternalRuntime;
import org.eclipse.che.api.workspace.server.spi.RuntimeContext;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.api.workspace.shared.Utils;
import org.eclipse.che.plugin.docker.client.MessageProcessor;
import org.eclipse.che.workspace.infrastructure.docker.exception.SourceNotFoundException;
@ -83,7 +83,7 @@ public class DockerRuntimeContext extends RuntimeContext {
AgentRegistry agentRegistry,
ContextsStorage contextsStorage)
throws ValidationException, InfrastructureException {
super(environment, identity, infrastructure, agentSorter, agentRegistry, null);
super(environment, identity, infrastructure, agentSorter, agentRegistry);
this.devMachineName = Utils.getDevMachineName(environment);
this.dockerEnvironment = dockerEnvironment;
this.dockerNetworkLifecycle = dockerNetworkLifecycle;

View File

@ -14,9 +14,10 @@ import com.google.inject.Inject;
import org.eclipse.che.api.core.ValidationException;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.api.workspace.server.spi.RuntimeInfrastructure;
import org.eclipse.che.workspace.infrastructure.docker.environment.DockerConfigSourceSpecificEnvironmentParser;
import org.eclipse.che.workspace.infrastructure.docker.environment.EnvironmentNormalizer;
@ -49,8 +50,9 @@ public class DockerRuntimeInfrastructure extends RuntimeInfrastructure {
InfrastructureProvisioner infrastructureProvisioner,
EnvironmentNormalizer environmentNormalizer,
Map<String, DockerConfigSourceSpecificEnvironmentParser> environmentParsers,
RuntimeFactory runtimeFactory) {
super("docker", environmentParsers.keySet());
RuntimeFactory runtimeFactory,
EventService eventService) {
super("docker", environmentParsers.keySet(), eventService);
this.dockerEnvironmentValidator = dockerEnvironmentValidator;
this.dockerEnvironmentParser = dockerEnvironmentParser;
this.startStrategy = startStrategy;

View File

@ -11,8 +11,8 @@
package org.eclipse.che.workspace.infrastructure.docker;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.workspace.infrastructure.docker.model.DockerEnvironment;
/**

View File

@ -16,12 +16,12 @@ import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import org.eclipse.che.api.core.model.workspace.config.ServerConfig;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.core.util.FileCleaner;
import org.eclipse.che.api.core.util.SystemInfo;
import org.eclipse.che.api.workspace.server.model.impl.MachineSourceImpl;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.InternalInfrastructureException;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.commons.annotation.Nullable;
import org.eclipse.che.commons.env.EnvironmentContext;
import org.eclipse.che.commons.lang.os.WindowsPathEscaper;
@ -41,12 +41,10 @@ import org.eclipse.che.plugin.docker.client.json.network.ConnectContainer;
import org.eclipse.che.plugin.docker.client.json.network.EndpointConfig;
import org.eclipse.che.plugin.docker.client.params.BuildImageParams;
import org.eclipse.che.plugin.docker.client.params.CreateContainerParams;
import org.eclipse.che.plugin.docker.client.params.GetContainerLogsParams;
import org.eclipse.che.plugin.docker.client.params.ListImagesParams;
import org.eclipse.che.plugin.docker.client.params.PullParams;
import org.eclipse.che.plugin.docker.client.params.RemoveContainerParams;
import org.eclipse.che.plugin.docker.client.params.RemoveImageParams;
import org.eclipse.che.plugin.docker.client.params.network.RemoveNetworkParams;
import org.eclipse.che.plugin.docker.client.params.StartContainerParams;
import org.eclipse.che.plugin.docker.client.params.TagParams;
import org.eclipse.che.plugin.docker.client.params.network.ConnectContainerToNetworkParams;

View File

@ -14,8 +14,8 @@ import com.google.inject.assistedinject.Assisted;
import org.eclipse.che.api.core.ValidationException;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.workspace.infrastructure.docker.model.DockerEnvironment;
import java.util.List;

View File

@ -12,13 +12,13 @@ package org.eclipse.che.workspace.infrastructure.docker.environment;
import org.eclipse.che.api.core.ServerException;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.workspace.server.RecipeDownloader;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.commons.lang.NameGenerator;
import org.eclipse.che.workspace.infrastructure.docker.ContainerNameGenerator;
import org.eclipse.che.workspace.infrastructure.docker.model.DockerEnvironment;
import org.eclipse.che.workspace.infrastructure.docker.model.DockerContainerConfig;
import org.eclipse.che.workspace.infrastructure.docker.model.DockerEnvironment;
import javax.inject.Inject;
import javax.inject.Named;

View File

@ -13,9 +13,9 @@ package org.eclipse.che.workspace.infrastructure.docker.local;
import com.google.common.base.Strings;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.core.util.SystemInfo;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.commons.annotation.Nullable;
import org.eclipse.che.commons.lang.os.WindowsPathEscaper;
import org.eclipse.che.inject.CheBootstrap;

View File

@ -651,7 +651,7 @@ public class CheEnvironmentEngineTest {
// // then
// for (Instance instance : instances) {
// verify(eventService).publish(newDto(MachineStatusEvent.class)
// .withEventType(MachineStatusEvent.EventType.CREATING)
// .withEventType(MachineStatusEvent.EventType.STARTING)
// .withDev(instance.getConfig().isDev())
// .withMachineName(instance.getConfig().getName())
// .withMachineId(instance.getId())
@ -841,7 +841,7 @@ public class CheEnvironmentEngineTest {
//
// // then
// verify(eventService).publish(newDto(MachineStatusEvent.class)
// .withEventType(MachineStatusEvent.EventType.CREATING)
// .withEventType(MachineStatusEvent.EventType.STARTING)
// .withDev(config.isDev())
// .withMachineName(config.getName())
// .withMachineId("newMachineId")
@ -918,7 +918,7 @@ public class CheEnvironmentEngineTest {
//
// // then
// verify(eventService).publish(newDto(MachineStatusEvent.class)
// .withEventType(MachineStatusEvent.EventType.CREATING)
// .withEventType(MachineStatusEvent.EventType.STARTING)
// .withDev(instance.getConfig().isDev())
// .withMachineName(instance.getConfig().getName())
// .withMachineId(instance.getId())

View File

@ -151,7 +151,7 @@ public class ExtensionsRegistry {
// if (value != null) {
// IContentType contentType= fContentTypeManager.getContentType(value);
// if (contentType == null) {
// log(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, NLSUtility
// log(new Status(IStatus.FAILED, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, NLSUtility
// .format(FileBuffersMessages.ExtensionsRegistry_error_contentTypeDoesNotExist, value), null));
// return;
// }
@ -188,7 +188,7 @@ public class ExtensionsRegistry {
//
// IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(FileBuffersPlugin.PLUGIN_ID, extensionPointName);
// if (extensionPoint == null) {
// log(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, 0, NLSUtility
// log(new Status(IStatus.FAILED, FileBuffersPlugin.PLUGIN_ID, 0, NLSUtility
// .format(FileBuffersMessages.ExtensionsRegistry_error_extensionPointNotFound, extensionPointName), null));
// return;
// }

View File

@ -128,7 +128,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
//
// fileBuffer= createFileBuffer(fileStore);
// if (fileBuffer == null)
// throw new CoreException(new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IFileBufferStatusCodes.CREATION_FAILED, FileBuffersMessages.FileBufferManager_error_canNotCreateFilebuffer, null));
// throw new CoreException(new Status(IStatus.FAILED, FileBuffersPlugin.PLUGIN_ID, IFileBufferStatusCodes.CREATION_FAILED, FileBuffersMessages.FileBufferManager_error_canNotCreateFilebuffer, null));
//
// fileBuffer.create(fileStore, monitor);
//
@ -487,7 +487,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
// }
// }
// public void handleException(Throwable t) {
// IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentSetupFailed, t);
// IStatus status= new Status(IStatus.FAILED, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentSetupFailed, t);
// FileBuffersPlugin.getDefault().log(status);
// }
// };
@ -517,7 +517,7 @@ public class TextFileBufferManager implements ITextFileBufferManager {
// runnableResult[0]= factory.createDocument();
// }
// public void handleException(Throwable t) {
// IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentFactoryFailed, t);
// IStatus status= new Status(IStatus.FAILED, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, FileBuffersMessages.TextFileBufferManager_error_documentFactoryFailed, t);
// FileBuffersPlugin.getDefault().log(status);
// }
// };

View File

@ -1465,7 +1465,7 @@ public interface IWorkspace extends IAdaptable {
* be filtered out by its parent resource filters once it exists in the workspace.
* </p>
* <p>
* This method will return a status with severity <code>IStatus.ERROR</code>
* This method will return a status with severity <code>IStatus.FAILED</code>
* if the resource will be filtered out - removed - out of the workspace by
* its parent resource filters.
* </p>
@ -1476,7 +1476,7 @@ public interface IWorkspace extends IAdaptable {
* @param resource the resource to validate the location for
* @return a status object with code <code>IStatus.OK</code> if the given
* resource is not filtered by its parent resource filters, otherwise a status
* object with severity <code>IStatus.ERROR</code> indicating that it will
* object with severity <code>IStatus.FAILED</code> indicating that it will
* @see IStatus#OK
* @since 3.6
*/
@ -1507,7 +1507,7 @@ public interface IWorkspace extends IAdaptable {
* </ul>
* </p>
* <p>
* This method will return a status with severity <code>IStatus.ERROR</code>
* This method will return a status with severity <code>IStatus.FAILED</code>
* if the location does not obey the above rules. Also, this method will
* return a status with severity <code>IStatus.WARNING</code> if the
* location overlaps the location of any existing resource in the workspace.
@ -1521,7 +1521,7 @@ public interface IWorkspace extends IAdaptable {
* @return a status object with code <code>IStatus.OK</code> if the given
* location is valid as the linked resource location, otherwise a status
* object with severity <code>IStatus.WARNING</code> or
* <code>IStatus.ERROR</code> indicating what is wrong with the location
* <code>IStatus.FAILED</code> indicating what is wrong with the location
* @see IStatus#OK
* @see ResourcesPlugin#PREF_DISABLE_LINKING
* @since 2.1
@ -1551,7 +1551,7 @@ public interface IWorkspace extends IAdaptable {
* </ul>
* </p>
* <p>
* This method will return a status with severity <code>IStatus.ERROR</code>
* This method will return a status with severity <code>IStatus.FAILED</code>
* if the location does not obey the above rules. Also, this method will
* return a status with severity <code>IStatus.WARNING</code> if the
* location overlaps the location of any existing resource in the workspace.
@ -1565,7 +1565,7 @@ public interface IWorkspace extends IAdaptable {
* @return a status object with code <code>IStatus.OK</code> if the given
* location is valid as the linked resource location, otherwise a status
* object with severity <code>IStatus.WARNING</code> or
* <code>IStatus.ERROR</code> indicating what is wrong with the location
* <code>IStatus.FAILED</code> indicating what is wrong with the location
* @see IStatus#OK
* @see ResourcesPlugin#PREF_DISABLE_LINKING
* @since 3.2

View File

@ -131,7 +131,7 @@ public abstract class TeamHook extends InternalTeamHook {
* @param location a file system path where the file should be linked
* @return a status object with code <code>IStatus.OK</code>
* if linking is allowed, otherwise a status object with severity
* <code>IStatus.ERROR</code> indicating why the creation is not allowed.
* <code>IStatus.FAILED</code> indicating why the creation is not allowed.
* @see org.eclipse.core.resources.IResource#ALLOW_MISSING_LOCAL
*/
public IStatus validateCreateLink(IFile file, int updateFlags, IPath location) {
@ -161,7 +161,7 @@ public abstract class TeamHook extends InternalTeamHook {
* @param location a file system URI where the file should be linked
* @return a status object with code <code>IStatus.OK</code>
* if linking is allowed, otherwise a status object with severity
* <code>IStatus.ERROR</code> indicating why the creation is not allowed.
* <code>IStatus.FAILED</code> indicating why the creation is not allowed.
* @see org.eclipse.core.resources.IResource#ALLOW_MISSING_LOCAL
* @since 3.2
*/
@ -195,7 +195,7 @@ public abstract class TeamHook extends InternalTeamHook {
* @param location a file system path where the folder should be linked
* @return a status object with code <code>IStatus.OK</code>
* if linking is allowed, otherwise a status object with severity
* <code>IStatus.ERROR</code> indicating why the creation is not allowed.
* <code>IStatus.FAILED</code> indicating why the creation is not allowed.
* @see org.eclipse.core.resources.IResource#ALLOW_MISSING_LOCAL
*/
public IStatus validateCreateLink(IFolder folder, int updateFlags, IPath location) {
@ -225,7 +225,7 @@ public abstract class TeamHook extends InternalTeamHook {
* @param location a file system path where the folder should be linked
* @return a status object with code <code>IStatus.OK</code>
* if linking is allowed, otherwise a status object with severity
* <code>IStatus.ERROR</code> indicating why the creation is not allowed.
* <code>IStatus.FAILED</code> indicating why the creation is not allowed.
* @see org.eclipse.core.resources.IResource#ALLOW_MISSING_LOCAL
* @since 3.2
*/

View File

@ -755,7 +755,7 @@ public final class JavaConventions {
}
} else {
// compliance is not valid
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.invalidCompilerOption", compliance==null?"":compliance, JavaCore.COMPILER_COMPLIANCE))); //$NON-NLS-1$ //$NON-NLS-2$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.invalidCompilerOption", compliance==null?"":compliance, JavaCore.COMPILER_COMPLIANCE))); //$NON-NLS-1$ //$NON-NLS-2$
}
// Verify source value and set default for target if necessary
@ -775,7 +775,7 @@ public final class JavaConventions {
sourceLevel = ClassFileConstants.JDK1_3;
} else {
// source is not valid
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.invalidCompilerOption", source==null?"":source, JavaCore.COMPILER_SOURCE))); //$NON-NLS-1$ //$NON-NLS-2$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.invalidCompilerOption", source==null?"":source, JavaCore.COMPILER_SOURCE))); //$NON-NLS-1$ //$NON-NLS-2$
}
// Verify target value
@ -783,7 +783,7 @@ public final class JavaConventions {
targetLevel = CompilerOptions.versionToJdkLevel(target);
if (targetLevel == 0) {
// target is not valid
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.invalidCompilerOption", target==null?"":target, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM))); //$NON-NLS-1$ //$NON-NLS-2$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.invalidCompilerOption", target==null?"":target, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM))); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@ -791,24 +791,24 @@ public final class JavaConventions {
if (complianceLevel != 0 && sourceLevel != 0 && targetLevel != 0) {
// target must be 1.5 if source is 1.5
if (sourceLevel >= ClassFileConstants.JDK1_5 && targetLevel < ClassFileConstants.JDK1_5) {
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleTargetForSource", target, JavaCore.VERSION_1_5))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleTargetForSource", target, JavaCore.VERSION_1_5))); //$NON-NLS-1$
}
else
// target must be 1.4 if source is 1.4
if (sourceLevel >= ClassFileConstants.JDK1_4 && targetLevel < ClassFileConstants.JDK1_4) {
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleTargetForSource", target, JavaCore.VERSION_1_4))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleTargetForSource", target, JavaCore.VERSION_1_4))); //$NON-NLS-1$
}
// target cannot be greater than compliance level
if (complianceLevel < targetLevel){
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleComplianceForTarget", compliance, JavaCore.VERSION_1_4))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleComplianceForTarget", compliance, JavaCore.VERSION_1_4))); //$NON-NLS-1$
}
// compliance must be 1.5 if source is 1.5
if (source.equals(JavaCore.VERSION_1_5) && complianceLevel < ClassFileConstants.JDK1_5) {
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleComplianceForSource", compliance, JavaCore.VERSION_1_5))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleComplianceForSource", compliance, JavaCore.VERSION_1_5))); //$NON-NLS-1$
} else
// compliance must be 1.4 if source is 1.4
if (source.equals(JavaCore.VERSION_1_4) && complianceLevel < ClassFileConstants.JDK1_4) {
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleComplianceForSource", compliance, JavaCore.VERSION_1_4))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleComplianceForSource", compliance, JavaCore.VERSION_1_4))); //$NON-NLS-1$
}
}

View File

@ -274,7 +274,7 @@ public class JavaDocLocations {
}
// private static JavaUIException createException(Throwable t, String message) {
// return new JavaUIException(JavaUIStatus.createError(IStatus.ERROR, message, t));
// return new JavaUIException(JavaUIStatus.createError(IStatus.FAILED, message, t));
// }
// private static Map<IPath, String> loadOldForCompatibility() {

View File

@ -754,7 +754,7 @@ public final class JavaConventions {
}
} else {
// compliance is not valid
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.invalidCompilerOption", compliance==null?"":compliance, JavaCore.COMPILER_COMPLIANCE))); //$NON-NLS-1$ //$NON-NLS-2$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.invalidCompilerOption", compliance==null?"":compliance, JavaCore.COMPILER_COMPLIANCE))); //$NON-NLS-1$ //$NON-NLS-2$
}
// Verify source value and set default for target if necessary
@ -774,7 +774,7 @@ public final class JavaConventions {
sourceLevel = ClassFileConstants.JDK1_3;
} else {
// source is not valid
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.invalidCompilerOption", source==null?"":source, JavaCore.COMPILER_SOURCE))); //$NON-NLS-1$ //$NON-NLS-2$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.invalidCompilerOption", source==null?"":source, JavaCore.COMPILER_SOURCE))); //$NON-NLS-1$ //$NON-NLS-2$
}
// Verify target value
@ -782,7 +782,7 @@ public final class JavaConventions {
targetLevel = CompilerOptions.versionToJdkLevel(target);
if (targetLevel == 0) {
// target is not valid
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.invalidCompilerOption", target==null?"":target, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM))); //$NON-NLS-1$ //$NON-NLS-2$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.invalidCompilerOption", target==null?"":target, JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM))); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@ -790,24 +790,24 @@ public final class JavaConventions {
if (complianceLevel != 0 && sourceLevel != 0 && targetLevel != 0) {
// target must be 1.5 if source is 1.5
if (sourceLevel >= ClassFileConstants.JDK1_5 && targetLevel < ClassFileConstants.JDK1_5) {
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleTargetForSource", target, JavaCore.VERSION_1_5))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleTargetForSource", target, JavaCore.VERSION_1_5))); //$NON-NLS-1$
}
else
// target must be 1.4 if source is 1.4
if (sourceLevel >= ClassFileConstants.JDK1_4 && targetLevel < ClassFileConstants.JDK1_4) {
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleTargetForSource", target, JavaCore.VERSION_1_4))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleTargetForSource", target, JavaCore.VERSION_1_4))); //$NON-NLS-1$
}
// target cannot be greater than compliance level
if (complianceLevel < targetLevel){
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleComplianceForTarget", compliance, JavaCore.VERSION_1_4))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleComplianceForTarget", compliance, JavaCore.VERSION_1_4))); //$NON-NLS-1$
}
// compliance must be 1.5 if source is 1.5
if (source.equals(JavaCore.VERSION_1_5) && complianceLevel < ClassFileConstants.JDK1_5) {
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleComplianceForSource", compliance, JavaCore.VERSION_1_5))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleComplianceForSource", compliance, JavaCore.VERSION_1_5))); //$NON-NLS-1$
} else
// compliance must be 1.4 if source is 1.4
if (source.equals(JavaCore.VERSION_1_4) && complianceLevel < ClassFileConstants.JDK1_4) {
errors.add(new JavaModelStatus(IStatus.ERROR, Util.bind("convention.compiler.incompatibleComplianceForSource", compliance, JavaCore.VERSION_1_4))); //$NON-NLS-1$
errors.add(new JavaModelStatus(IStatus.FAILED, Util.bind("convention.compiler.incompatibleComplianceForSource", compliance, JavaCore.VERSION_1_4))); //$NON-NLS-1$
}
}

View File

@ -1894,8 +1894,8 @@ tag if no children*/);
// && !JavaCore.IGNORE.equals(option)) {
// boolean opStartsWithProject = projectName.equals(otherEntry.getPath().segment(0));
// String otherPathMsg = opStartsWithProject ? otherEntry.getPath().removeFirstSegments(1).toString() : otherEntry.getPath().makeRelative().toString();
// if (JavaCore.ERROR.equals(option)) {
// return new JavaModelStatus(IStatus.ERROR, IJavaModelStatusConstants.OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE,
// if (JavaCore.FAILED.equals(option)) {
// return new JavaModelStatus(IStatus.FAILED, IJavaModelStatusConstants.OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE,
// Messages.bind(Messages.classpath_cannotUseDistinctSourceFolderAsOutput, new String[] {
// entryPathMsg, otherPathMsg, projectName }));
// }
@ -1923,7 +1923,7 @@ tag if no children*/);
// }
//
// // NOTE: The above code that checks for IJavaModelStatusConstants.OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE, can be configured to return
// // a WARNING status and hence should be at the end of this validation method. Any other code that might return a more severe ERROR should be
// // a WARNING status and hence should be at the end of this validation method. Any other code that might return a more severe FAILED should be
// // inserted before the mentioned code.
// if (cachedStatus != null) return cachedStatus;

View File

@ -1548,7 +1548,7 @@ public class JavaModelManager {
}
// backward compatibility
// if (isDeprecatedOption(optionName)) {
// return JavaCore.ERROR;
// return JavaCore.FAILED;
// }
int optionLevel = getOptionLevel(optionName);
if (optionLevel != UNKNOWN_OPTION) {

View File

@ -2299,7 +2299,7 @@ public class Util {
// try {
// URI locationURI = file.getLocationURI();
// if (locationURI == null)
// throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Messages
// throw new CoreException(new Status(IStatus.FAILED, JavaCore.PLUGIN_ID, Messages
// .bind(Messages.file_notFound, file.getFullPath().toString())));
// length = EFS.getStore(locationURI).fetchInfo().getLength();
// } catch (CoreException e) {

View File

@ -739,7 +739,7 @@ public class Checks {
* Checks whether it is possible to modify the given <code>IJavaElement</code>.
* The <code>IJavaElement</code> must exist and be non read-only to be modifiable.
* Moreover, if it is a <code>IMember</code> it must not be binary.
* The returned <code>RefactoringStatus</code> has <code>ERROR</code> severity if
* The returned <code>RefactoringStatus</code> has <code>FAILED</code> severity if
* it is not possible to modify the element.
* @param javaElement
* @return the status

View File

@ -35,8 +35,8 @@ public class StatusInfo implements IStatus {
/**
* Creates a status .
* @param severity The status severity: ERROR, WARNING, INFO and OK.
* @param message The message of the status. Applies only for ERROR,
* @param severity The status severity: FAILED, WARNING, INFO and OK.
* @param message The message of the status. Applies only for FAILED,
* WARNING and INFO.
*/
public StatusInfo(int severity, String message) {
@ -66,7 +66,7 @@ public class StatusInfo implements IStatus {
}
/**
* Returns if the status' severity is ERROR.
* Returns if the status' severity is FAILED.
*/
public boolean isError() {
return fSeverity == IStatus.ERROR;
@ -80,7 +80,7 @@ public class StatusInfo implements IStatus {
}
/**
* Sets the status to ERROR.
* Sets the status to FAILED.
* @param errorMessage The error message (can be empty, but not null)
*/
public void setError(String errorMessage) {

View File

@ -70,7 +70,7 @@ public final class ContributedProcessorDescriptor {
// IConfigurationElement[] children= fConfigurationElement.getChildren(ExpressionTagNames.ENABLEMENT);
// if (children.length > 1) {
// String id= fConfigurationElement.getAttribute(ID);
// return new StatusInfo(IStatus.ERROR, "Only one < enablement > element allowed. Disabling " + id); //$NON-NLS-1$
// return new StatusInfo(IStatus.FAILED, "Only one < enablement > element allowed. Disabling " + id); //$NON-NLS-1$
// }
return new StatusInfo(IStatus.OK, "Syntactically correct quick assist/fix processor"); //$NON-NLS-1$
}
@ -118,7 +118,7 @@ public final class ContributedProcessorDescriptor {
// } else {
// String message= "Invalid extension to " + fConfigurationElement.getName() //$NON-NLS-1$
// + ". Must extends '" + expectedType.getName() + "'." + fConfigurationElement.getContributor().getName(); //$NON-NLS-1$ //$NON-NLS-2$
// JavaPlugin.log(new Status(IStatus.ERROR, JavaPlugin.ID_PLUGIN, message));
// JavaPlugin.log(new Status(IStatus.FAILED, JavaPlugin.ID_PLUGIN, message));
// fStatus= Boolean.FALSE;
// return null;
// }

View File

@ -145,7 +145,7 @@ public class GetterSetterCorrectionSubProcessor {
// if (fNoDialog) {
// IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
// final RefactoringExecutionHelper helper =
// new RefactoringExecutionHelper(refactoring, RefactoringStatus.ERROR, RefactoringSaveHelper.SAVE_REFACTORING,
// new RefactoringExecutionHelper(refactoring, RefactoringStatus.FAILED, RefactoringSaveHelper.SAVE_REFACTORING,
// JavaPlugin.getActiveWorkbenchShell(), window);
// if (Display.getCurrent() != null) {
// try {

View File

@ -702,7 +702,7 @@ public class UnresolvedElementsSubProcessor {
// file.create(new BufferedInputStream(new FileInputStream(bundleFile)), false, pm);
// return new DeleteResourceChange(file.getFullPath(), false);
// } catch (FileNotFoundException e) {
// throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), e.getMessage()));
// throw new CoreException(new Status(IStatus.FAILED, JavaPlugin.getPluginId(), e.getMessage()));
// }
// }
// @Override

View File

@ -63,8 +63,8 @@ public class FixCorrectionProposal extends LinkedCorrectionProposal implements I
// ImageImageDescriptor image = new ImageImageDescriptor(super.getImage());
//
// int flag = JavaElementImageDescriptor.WARNING;
// if (status.getSeverity() == IStatus.ERROR) {
// flag = JavaElementImageDescriptor.ERROR;
// if (status.getSeverity() == IStatus.FAILED) {
// flag = JavaElementImageDescriptor.FAILED;
// }
//
// ImageDescriptor composite =
@ -200,7 +200,7 @@ public class FixCorrectionProposal extends LinkedCorrectionProposal implements I
// if (cause instanceof CoreException) {
// throw (CoreException)cause;
// } else {
// throw new CoreException(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, cause.getLocalizedMessage(), cause));
// throw new CoreException(new Status(IStatus.FAILED, JavaUI.ID_PLUGIN, cause.getLocalizedMessage(), cause));
// }
// }
// }

View File

@ -218,7 +218,7 @@ public class LinkedCorrectionProposal extends ASTRewriteCorrectionProposal imple
// }
}
// } catch (BadLocationException e) {
// throw new CoreException(JavaUIStatus.createError(IStatus.ERROR, e));
// throw new CoreException(JavaUIStatus.createError(IStatus.FAILED, e));
// }
}

View File

@ -442,7 +442,7 @@ public class TemplateProposal implements IJavaCompletionProposal, ICompletionPro
} catch (BadLocationException e) {
// handleException(
// JavaPlugin.getActiveWorkbenchShell(), new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, "", e))); //$NON-NLS-1$
// JavaPlugin.getActiveWorkbenchShell(), new CoreException(new Status(IStatus.FAILED, JavaPlugin.getPluginId(), IStatus.OK, "", e))); //$NON-NLS-1$
JavaPlugin.log(e);
return null;
}

View File

@ -329,7 +329,7 @@ public class JavaElementImageDescriptor extends ImageDescriptor {
//
// private void drawBottomLeft() {
// Point pos= new Point(0, getSize().y);
// if ((fFlags & ERROR) != 0) {
// if ((fFlags & FAILED) != 0) {
// addBottomLeftImage(JavaPluginImages.DESC_OVR_ERROR, pos);
// }
// if ((fFlags & BUILDPATH_ERROR) != 0) {

View File

@ -27,7 +27,7 @@ import org.eclipse.core.runtime.IStatus;
* <p>
* Additionally a problem severity is managed. Severities are ordered as follows:
* <code>OK</code> &lt; <code>INFO</code> &lt; <code>WARNING</code> &lt; <code>
* ERROR</code> &lt; <code>FATAL</code>. The status's problem severity is the maximum
* FAILED</code> &lt; <code>FATAL</code>. The status's problem severity is the maximum
* of the severities of all entries. If the status doesn't have any entry the status's
* severity is <code>OK</code>.
* </p>
@ -199,7 +199,7 @@ public class RefactoringStatus {
* entry matches.
*
* @param severity the severity to search for. Must be one of <code>FATAL
* </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
* </code>, <code>FAILED</code>, <code>WARNING</code> or <code>INFO</code>
* @return the entry that matches the search criteria
*/
public RefactoringStatusEntry getEntryMatchingSeverity(int severity) {
@ -242,7 +242,7 @@ public class RefactoringStatus {
* the first one is returned. Returns <code>null</code> if no entry matches.
*
* @param severity the severity to search for. Must be one of <code>FATAL
* </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
* </code>, <code>FAILED</code>, <code>WARNING</code> or <code>INFO</code>
* @return the message of the entry that matches the search criteria
*/
public String getMessageMatchingSeverity(int severity) {
@ -330,7 +330,7 @@ public class RefactoringStatus {
}
/**
* Creates a new <code>RefactoringStatus</code> with one <code>ERROR</code> entry
* Creates a new <code>RefactoringStatus</code> with one <code>FAILED</code> entry
* filled with the given message.
*
* @param msg the message of the error entry
@ -343,7 +343,7 @@ public class RefactoringStatus {
}
/**
* Creates a <code>RefactoringStatus</code> with one <code>ERROR</code> entry
* Creates a <code>RefactoringStatus</code> with one <code>FAILED</code> entry
* fill with the given message and context.
*
* @param msg the message of the error entry
@ -500,9 +500,9 @@ public class RefactoringStatus {
}
/**
* Adds an <code>ERROR</code> entry filled with the given message to this status.
* Adds an <code>FAILED</code> entry filled with the given message to this status.
* If the current severity is <code>OK</code>, <code>INFO</code> or <code>WARNING
* </code> it will be changed to <code>ERROR</code>. It will remain unchanged
* </code> it will be changed to <code>FAILED</code>. It will remain unchanged
* otherwise.
*
* @param msg the message of the error entry
@ -514,9 +514,9 @@ public class RefactoringStatus {
}
/**
* Adds an <code>ERROR</code> entry filled with the given message and context to
* Adds an <code>FAILED</code> entry filled with the given message and context to
* this status. If the current severity is <code>OK</code>, <code>INFO</code> or
* <code>WARNING</code> it will be changed to <code>ERROR</code>. It will remain
* <code>WARNING</code> it will be changed to <code>FAILED</code>. It will remain
* unchanged otherwise.
*
* @param msg the message of the error entry
@ -628,10 +628,10 @@ public class RefactoringStatus {
/**
* Returns <code>true</code> if the current severity is <code>
* FATAL</code> or <code>ERROR</code>.
* FATAL</code> or <code>FAILED</code>.
*
* @return <code>true</code> if the current severity is <code>
* FATAL</code> or <code>ERROR</code>; otherwise <code>false
* FATAL</code> or <code>FAILED</code>; otherwise <code>false
* </code> is returned
*/
public boolean hasError() {
@ -640,10 +640,10 @@ public class RefactoringStatus {
/**
* Returns <code>true</code> if the current severity is <code>
* FATAL</code>, <code>ERROR</code> or <code>WARNING</code>.
* FATAL</code>, <code>FAILED</code> or <code>WARNING</code>.
*
* @return <code>true</code> if the current severity is <code>
* FATAL</code>, <code>ERROR</code> or <code>WARNING</code>;
* FATAL</code>, <code>FAILED</code> or <code>WARNING</code>;
* otherwise <code>false</code> is returned
*/
public boolean hasWarning() {
@ -652,11 +652,11 @@ public class RefactoringStatus {
/**
* Returns <code>true</code> if the current severity is <code>
* FATAL</code>, <code>ERROR</code>, <code>WARNING</code> or
* FATAL</code>, <code>FAILED</code>, <code>WARNING</code> or
* <code>INFO</code>.
*
* @return <code>true</code> if the current severity is <code>
* FATAL</code>, <code>ERROR</code>, <code>WARNING</code> or
* FATAL</code>, <code>FAILED</code>, <code>WARNING</code> or
* <code>INFO</code>; otherwise <code>false</code> is returned
*/
public boolean hasInfo() {

View File

@ -201,7 +201,7 @@ public class RefactoringStatusEntry {
/**
* Returns whether the entry represents an error or not.
*
* @return <code>true</code> if (severity ==<code>RefactoringStatus.ERROR</code>).
* @return <code>true</code> if (severity ==<code>RefactoringStatus.FAILED</code>).
*/
public boolean isError() {
return fSeverity == RefactoringStatus.ERROR;

View File

@ -51,16 +51,16 @@ public class ParticipantDescriptor {
public IStatus checkSyntax() {
// if (fConfigurationElement.getAttribute(ID) == null) {
// return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR,
// return new Status(IStatus.FAILED, RefactoringCorePlugin.getPluginId(), IStatus.FAILED,
// RefactoringCoreMessages.ParticipantDescriptor_error_id_missing, null);
// }
// if (fConfigurationElement.getAttribute(NAME) == null) {
// return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR,
// return new Status(IStatus.FAILED, RefactoringCorePlugin.getPluginId(), IStatus.FAILED,
// Messages.format( RefactoringCoreMessages.ParticipantDescriptor_error_name_missing, getId()),
// null);
// }
// if (fConfigurationElement.getAttribute(CLASS) == null) {
// return new Status(IStatus.ERROR, RefactoringCorePlugin.getPluginId(), IStatus.ERROR,
// return new Status(IStatus.FAILED, RefactoringCorePlugin.getPluginId(), IStatus.FAILED,
// Messages.format( RefactoringCoreMessages.ParticipantDescriptor_error_class_missing, getId()),
// null);
// }

View File

@ -67,7 +67,7 @@ public class NewSearchUI {
// if (status != null) {
// if (!status.isOK())
// SearchPlugin.log(status);
// if (status.getSeverity() == IStatus.ERROR) {
// if (status.getSeverity() == IStatus.FAILED) {
// ErrorDialog.openError(SearchPlugin.getActiveWorkbenchShell(), SearchMessages.NewSearchUI_error_title, SearchMessages
// .NewSearchUI_error_label, status);
// }

View File

@ -275,7 +275,7 @@ final class MoveViewImpl extends Window implements MoveView {
*
* @param severity
* the severity to search for. Must be one of <code>FATAL
* </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
* </code>, <code>FAILED</code>, <code>WARNING</code> or <code>INFO</code>
* @param entries
* list of refactoring status
* @return the entry that matches the search criteria

View File

@ -373,7 +373,7 @@ final class PreviewViewImpl extends Window implements PreviewView {
*
* @param severity
* the severity to search for. Must be one of <code>FATAL
* </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
* </code>, <code>FAILED</code>, <code>WARNING</code> or <code>INFO</code>
* @param entries
* list of the refactoring status entries
* @return the entry that matches the search criteria

View File

@ -366,7 +366,7 @@ final class RenameViewImpl extends Window implements RenameView {
*
* @param severity
* the severity to search for. Must be one of <code>FATAL
* </code>, <code>ERROR</code>, <code>WARNING</code> or <code>INFO</code>
* </code>, <code>FAILED</code>, <code>WARNING</code> or <code>INFO</code>
* @param entries
* list of refactoring status
* @return the entry that matches the search criteria

View File

@ -147,7 +147,7 @@ public class SourceFromBytecodeGeneratorTest extends BaseTest {
String source = new SourcesFromBytecodeGenerator().generateSource(enumType);
assertThat(source).contains("\n" +
"public final enum DispatcherType {\n" +
" FORWARD, INCLUDE, REQUEST, ASYNC, ERROR;\n" +
" FORWARD, INCLUDE, REQUEST, ASYNC, FAILED;\n" +
"\n" +
" public static javax.servlet.DispatcherType[] values() { /* compiled code */ }\n" +
"\n" +

View File

@ -164,7 +164,7 @@ public class Utils {
}
public static void appendProblem(StringBuffer problems, IProblem problem, char[] source, int problemCount) {
problems.append(problemCount + (problem.isError() ? ". ERROR" : ". WARNING"));
problems.append(problemCount + (problem.isError() ? ". FAILED" : ". WARNING"));
problems.append(" in " + new String(problem.getOriginatingFileName()));
if (source != null) {
problems.append(((DefaultProblem)problem).errorReportSource(source));

View File

@ -6319,8 +6319,8 @@ public class LocalCorrectionsQuickFixTest extends QuickFixTest {
// @Test
// public void testHidingVariable1() throws Exception {
// Hashtable hashtable= JavaCore.getOptions();
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.FAILED);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.FAILED);
// JavaCore.setOptions(hashtable);
//
// IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
@ -6344,8 +6344,8 @@ public class LocalCorrectionsQuickFixTest extends QuickFixTest {
// @Test
// public void testHidingVariable2() throws Exception {
// Hashtable hashtable= JavaCore.getOptions();
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.FAILED);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.FAILED);
// JavaCore.setOptions(hashtable);
//
// IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
@ -6368,8 +6368,8 @@ public class LocalCorrectionsQuickFixTest extends QuickFixTest {
// @Test
// public void testHidingVariable3() throws Exception {
// Hashtable hashtable= JavaCore.getOptions();
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.FAILED);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.FAILED);
// JavaCore.setOptions(hashtable);
//
// IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
@ -6393,8 +6393,8 @@ public class LocalCorrectionsQuickFixTest extends QuickFixTest {
//
// public void testHidingVariable4() throws Exception {
// Hashtable hashtable= JavaCore.getOptions();
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.FAILED);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.FAILED);
// JavaCore.setOptions(hashtable);
//
// IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
@ -6419,8 +6419,8 @@ public class LocalCorrectionsQuickFixTest extends QuickFixTest {
//
// public void testHidingVariable5() throws Exception {
// Hashtable hashtable= JavaCore.getOptions();
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.FAILED);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.FAILED);
// JavaCore.setOptions(hashtable);
//
// IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
@ -6446,8 +6446,8 @@ public class LocalCorrectionsQuickFixTest extends QuickFixTest {
//
// public void testHidingVariable6() throws Exception {
// Hashtable hashtable= JavaCore.getOptions();
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.ERROR);
// hashtable.put(JavaCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaCore.FAILED);
// hashtable.put(JavaCore.COMPILER_PB_FIELD_HIDING, JavaCore.FAILED);
// JavaCore.setOptions(hashtable);
//
// IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);

View File

@ -12,7 +12,7 @@ package org.eclipse.che.ide.ext.machine.server.ssh;
import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.core.notification.EventSubscriber;
import org.eclipse.che.api.machine.shared.dto.event.MachineStatusEvent;
import org.eclipse.che.api.workspace.shared.dto.event.MachineStatusEvent;
import org.eclipse.che.api.ssh.server.SshManager;
import org.eclipse.che.plugin.docker.client.DockerConnector;
import org.eclipse.che.plugin.docker.client.DockerConnectorProvider;

View File

@ -15,7 +15,7 @@ import org.eclipse.che.api.core.model.user.User;
import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.core.notification.EventSubscriber;
import org.eclipse.che.api.core.util.LineConsumer;
import org.eclipse.che.api.machine.shared.dto.event.MachineStatusEvent;
import org.eclipse.che.api.workspace.shared.dto.event.MachineStatusEvent;
import org.eclipse.che.api.ssh.server.SshManager;
import org.eclipse.che.api.ssh.server.model.impl.SshPairImpl;
import org.eclipse.che.plugin.docker.client.DockerConnector;

View File

@ -192,7 +192,7 @@ public class SshMachineExecAgentLauncher {
process.start(lineConsumer);
} catch (ConflictException e) {
try {
machine.getLogger().writeLine(format("[ERROR] %s", e.getMessage()));
machine.getLogger().writeLine(format("[FAILED] %s", e.getMessage()));
} catch (IOException ignored) {
}
} finally {

View File

@ -12,8 +12,8 @@ package org.eclipse.che.wsagent.server;
import org.eclipse.che.api.core.ApiException;
import org.eclipse.che.api.core.rest.HttpJsonRequestFactory;
import org.eclipse.che.api.machine.shared.dto.MachineDto;
import org.eclipse.che.api.machine.shared.dto.ServerDto;
import org.eclipse.che.api.workspace.shared.dto.MachineDto;
import org.eclipse.che.api.workspace.shared.dto.ServerDto;
import org.eclipse.che.api.workspace.shared.dto.WorkspaceDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012-2017 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.machine.shared.dto;
import org.eclipse.che.api.core.model.machine.MachineLimits;
import org.eclipse.che.dto.shared.DTO;
/**
* @author Alexander Garagatyi
*/
@DTO
public interface MachineLimitsDto extends MachineLimits {
MachineLimitsDto withRam(int memorySizeMB);
}

View File

@ -1,63 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012-2017 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.machine.shared.dto;
import org.eclipse.che.api.core.factory.FactoryParameter;
import org.eclipse.che.api.core.model.machine.MachineSource;
import org.eclipse.che.dto.shared.DTO;
import static org.eclipse.che.api.core.factory.FactoryParameter.Obligation.MANDATORY;
import static org.eclipse.che.api.core.factory.FactoryParameter.Obligation.OPTIONAL;
/**
* @author Alexander Garagatyi
*/
@DTO
public interface MachineSourceDto extends MachineSource {
@Override
@FactoryParameter(obligation = MANDATORY)
String getType();
void setType(String type);
MachineSourceDto withType(String type);
@Override
@FactoryParameter(obligation = OPTIONAL)
String getLocation();
void setLocation(String location);
MachineSourceDto withLocation(String location);
/**
* @return content of the machine source. No need to use an external link.
*/
@Override
@FactoryParameter(obligation = OPTIONAL)
String getContent();
/**
* Defines the new content to use for this machine source.
* Alternate way is to provide a location
* @param content the content instead of an external link like with location
*/
void setContent(String content);
/**
* Defines the new content to use for this machine source.
* Alternate way is to provide a location
* @param content the content instead of an external link like with location
* @return the current intance of the object
*/
MachineSourceDto withContent(String content);
}

View File

@ -1,30 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012-2017 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.machine.shared.dto;
import org.eclipse.che.dto.shared.DTO;
/**
* Describes snapshot creation information
*
* @author Alexander Garagatyi
*/
@DTO
public interface NewSnapshotDescriptor {
/**
* Description of machine saved in snapshot
*/
String getDescription();
void setDescription(String description);
NewSnapshotDescriptor withDescription(String description);
}

View File

@ -1,59 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012-2017 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.machine.shared.dto;
import org.eclipse.che.api.core.rest.shared.dto.Hyperlinks;
import org.eclipse.che.api.core.rest.shared.dto.Link;
import org.eclipse.che.api.core.model.machine.Snapshot;
import org.eclipse.che.dto.shared.DTO;
import java.util.List;
/**
* @author Alexander Garagatyi
*/
@DTO
public interface SnapshotDto extends Snapshot, Hyperlinks {
void setId(String id);
SnapshotDto withId(String id);
void setType(String type);
SnapshotDto withType(String type);
void setDescription(String description);
SnapshotDto withDescription(String description);
void setCreationDate(long creationDate);
SnapshotDto withCreationDate(long creationDate);
void setWorkspaceId(String workspaceId);
SnapshotDto withWorkspaceId(String workspaceId);
void setDev(boolean isDev);
SnapshotDto withDev(boolean isDev);
SnapshotDto withMachineName(String name);
void setMachineName(String name);
SnapshotDto withEnvName(String envName);
void setEnvName(String envName);
@Override
SnapshotDto withLinks(List<Link> links);
}

View File

@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.machine.shared.dto;
package org.eclipse.che.api.workspace.shared.dto;
import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.dto.shared.DTO;

View File

@ -13,7 +13,6 @@ package org.eclipse.che.api.workspace.shared.dto;
import org.eclipse.che.api.core.model.workspace.Runtime;
import org.eclipse.che.api.core.rest.shared.dto.Hyperlinks;
import org.eclipse.che.api.core.rest.shared.dto.Link;
import org.eclipse.che.api.machine.shared.dto.MachineDto;
import org.eclipse.che.dto.shared.DTO;
import java.util.List;

View File

@ -8,7 +8,7 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.machine.shared.dto;
package org.eclipse.che.api.workspace.shared.dto;
import org.eclipse.che.api.core.model.workspace.runtime.Server;
import org.eclipse.che.api.core.model.workspace.runtime.ServerStatus;

View File

@ -8,9 +8,9 @@
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.api.machine.shared.dto.event;
package org.eclipse.che.api.workspace.shared.dto.event;
import org.eclipse.che.api.core.notification.EventOrigin;
import org.eclipse.che.api.workspace.shared.dto.RuntimeIdentityDto;
import org.eclipse.che.dto.shared.DTO;
/**
@ -19,22 +19,16 @@ import org.eclipse.che.dto.shared.DTO;
* @author Eugene Voevodin
* @author Alexander Garagatyi
*/
@EventOrigin("machine")
//@EventOrigin("machine")
@DTO
public interface MachineStatusEvent {
enum EventType {
CREATING,
STARTING,
RUNNING,
DESTROYING,
DESTROYED,
ERROR
STOPPED,
FAILED
}
boolean isDev();
MachineStatusEvent withDev(boolean isDev);
void setDev(boolean isDev);
EventType getEventType();
@ -42,23 +36,22 @@ public interface MachineStatusEvent {
MachineStatusEvent withEventType(EventType eventType);
String getMachineId();
void setMachineId(String machineId);
MachineStatusEvent withMachineId(String machineId);
String getError();
void setError(String error);
MachineStatusEvent withError(String error);
String getWorkspaceId();
MachineStatusEvent withWorkspaceId(String workspaceId);
String getMachineName();
MachineStatusEvent withMachineName(String machineName);
/**
* @return runtime identity
*/
RuntimeIdentityDto getIdentity();
MachineStatusEvent withIdentity(RuntimeIdentityDto identity);
}

View File

@ -22,8 +22,8 @@ import org.eclipse.che.api.core.model.workspace.config.SourceStorage;
import org.eclipse.che.api.core.model.workspace.runtime.Machine;
import org.eclipse.che.api.core.model.workspace.runtime.Server;
import org.eclipse.che.api.workspace.shared.dto.CommandDto;
import org.eclipse.che.api.machine.shared.dto.MachineDto;
import org.eclipse.che.api.machine.shared.dto.ServerDto;
import org.eclipse.che.api.workspace.shared.dto.MachineDto;
import org.eclipse.che.api.workspace.shared.dto.ServerDto;
import org.eclipse.che.api.workspace.server.model.impl.stack.StackImpl;
import org.eclipse.che.api.workspace.shared.dto.EnvironmentDto;
import org.eclipse.che.api.workspace.shared.dto.MachineConfigDto;

View File

@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.che.api.workspace.server;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import java.net.MalformedURLException;
import java.net.URL;

View File

@ -12,7 +12,7 @@ package org.eclipse.che.api.workspace.server;
import com.google.inject.ImplementedBy;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import java.net.MalformedURLException;
import java.net.URL;
@ -27,9 +27,9 @@ import java.net.URL;
public interface URLRewriter {
/**
* Rewrites URL according to Strategy rules. May depend on RuntimeIdentity(workspace, owner,..) and name (some id)
* Rewrites URL according to Strategy rules. May depend on RuntimeIdentityImpl(workspace, owner,..) and name (some id)
* of this particular URL
* @param identity RuntimeIdentity (may be null)
* @param identity RuntimeIdentityImpl (may be null)
* @param name symbolic name of the server (may be null)
* @param url URL to rewrite
* @return Result

View File

@ -20,13 +20,14 @@ import org.eclipse.che.api.core.model.workspace.Runtime;
import org.eclipse.che.api.core.model.workspace.Workspace;
import org.eclipse.che.api.core.model.workspace.WorkspaceStatus;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl;
import org.eclipse.che.api.workspace.server.model.impl.RuntimeImpl;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.InternalInfrastructureException;
import org.eclipse.che.api.workspace.server.spi.InternalRuntime;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentityImpl;
import org.eclipse.che.api.workspace.server.spi.RuntimeInfrastructure;
import org.eclipse.che.api.workspace.shared.dto.event.WorkspaceStatusEvent;
import org.eclipse.che.api.workspace.shared.dto.event.WorkspaceStatusEvent.EventType;
@ -66,7 +67,7 @@ public class WorkspaceRuntimes {
private final ImmutableMap<String, RuntimeInfrastructure> infraByRecipe;
private final ConcurrentMap<String, InternalRuntime> runtimes;
private final EventService eventsService;
private final EventService eventService;
private final WorkspaceSharedPool sharedPool;
@Inject
@ -74,7 +75,7 @@ public class WorkspaceRuntimes {
Set<RuntimeInfrastructure> infrastructures,
WorkspaceSharedPool sharedPool) {
this.runtimes = new ConcurrentHashMap<>();
this.eventsService = eventsService;
this.eventService = eventsService;
this.sharedPool = sharedPool;
// TODO: consider extracting to a strategy interface(1. pick the last, 2. fail with conflict)
@ -93,6 +94,7 @@ public class WorkspaceRuntimes {
}
}
infraByRecipe = ImmutableMap.copyOf(tmp);
}
@PostConstruct
@ -112,7 +114,7 @@ public class WorkspaceRuntimes {
}
}
//TODO do we need some validation on start
//TODO do we need some validation on start?
private InternalRuntime validate(InternalRuntime runtime) {
return runtime;
}
@ -232,11 +234,11 @@ public class WorkspaceRuntimes {
InfrastructureException,
ConflictException {
eventsService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class)
.withWorkspaceId(workspaceId)
.withPrevStatus(WorkspaceStatus.RUNNING)
.withStatus(WorkspaceStatus.STOPPING)
.withEventType(EventType.STOPPING));
eventService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class)
.withWorkspaceId(workspaceId)
.withPrevStatus(WorkspaceStatus.RUNNING)
.withStatus(WorkspaceStatus.STOPPING)
.withEventType(EventType.STOPPING));
InternalRuntime runtime = runtimes.get(workspaceId);
if (runtime == null) {
@ -252,7 +254,7 @@ public class WorkspaceRuntimes {
.withPrevStatus(WorkspaceStatus.STOPPING);
event.setStatus(WorkspaceStatus.STOPPED);
event.setEventType(EventType.STOPPED);
eventsService.publish(event);
eventService.publish(event);
}
/**
@ -308,11 +310,11 @@ public class WorkspaceRuntimes {
"' because its status is 'RUNNING'");
}
eventsService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class)
.withWorkspaceId(workspaceId)
.withStatus(WorkspaceStatus.STARTING)
.withEventType(EventType.STARTING)
.withPrevStatus(WorkspaceStatus.STOPPED));
eventService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class)
.withWorkspaceId(workspaceId)
.withStatus(WorkspaceStatus.STARTING)
.withEventType(EventType.STARTING)
.withPrevStatus(WorkspaceStatus.STOPPED));
// Start environment
@ -321,7 +323,7 @@ public class WorkspaceRuntimes {
}
Subject subject = EnvironmentContext.getCurrent().getSubject();
RuntimeIdentity runtimeId = new RuntimeIdentity(workspaceId, envName, subject.getUserName());
RuntimeIdentity runtimeId = new RuntimeIdentityImpl(workspaceId, envName, subject.getUserName());
try {
InternalRuntime runtime = infra.prepare(runtimeId, environment).start(options);
@ -333,11 +335,11 @@ public class WorkspaceRuntimes {
}
runtimes.put(workspaceId, runtime);
eventsService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class)
.withWorkspaceId(workspaceId)
.withStatus(WorkspaceStatus.RUNNING)
.withEventType(EventType.RUNNING)
.withPrevStatus(WorkspaceStatus.STARTING));
eventService.publish(DtoFactory.newDto(WorkspaceStatusEvent.class)
.withWorkspaceId(workspaceId)
.withStatus(WorkspaceStatus.RUNNING)
.withEventType(EventType.RUNNING)
.withPrevStatus(WorkspaceStatus.STARTING));
} catch (InternalInfrastructureException e) {
LOG.error(format("Error occurs on workspace '%s' start. Error: %s", workspaceId, e));
throw new InfrastructureException(e.getMessage(), e);

View File

@ -17,6 +17,7 @@ import org.eclipse.che.api.core.model.workspace.WorkspaceStatus;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.config.MachineConfig;
import org.eclipse.che.api.core.model.workspace.config.Recipe;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.core.rest.HttpRequestHelper;
import org.slf4j.Logger;
@ -39,20 +40,19 @@ public abstract class RuntimeContext {
private static final Logger LOG = getLogger(RuntimeInfrastructure.class);
protected final Environment environment;
protected final RuntimeIdentity identity;
protected final RuntimeIdentity identity;
protected final RuntimeInfrastructure infrastructure;
// TODO other than WorkspaceStatus impl
private WorkspaceStatus state;
protected final InternalRecipe recipe;
protected final Map<String, InternalMachineConfig> internalMachines = new HashMap<>();
protected final URL statusChannel;
//protected final URL statusChannel;
public RuntimeContext(Environment environment,
RuntimeIdentity identity,
RuntimeInfrastructure infrastructure,
AgentSorter agentSorter,
AgentRegistry agentRegistry,
String statusChannel)
AgentRegistry agentRegistry)
throws ValidationException, InfrastructureException {
this.environment = environment;
this.identity = identity;
@ -64,15 +64,6 @@ public abstract class RuntimeContext {
internalMachines.put(entry.getKey(), new InternalMachineConfig(entry.getValue(), agentRegistry, agentSorter));
}
URL tmp;
try {
tmp = new URL(statusChannel);
} catch (MalformedURLException e) {
tmp = null;
LOG.error("URL building error for RuntimeContext status channel: " + infrastructure.getName() + " : " + e.getMessage());
}
this.statusChannel = tmp;
}
/**
@ -164,17 +155,18 @@ public abstract class RuntimeContext {
UnsupportedOperationException;
/**
* Status Channel URL should be passed by Workspace API level. It is used for events about any kind of status changes, such as:
* - Agent installing statuses
* - Servers statuses
* - Infrastructure specific events
* Infrastructure MUST NOT use this channel for long-lived output (process stdout, logs etc)
* @return URL of status channel
*/
public URL getStatusChannel() {
return statusChannel;
}
// /**
// * Status Channel URL should be passed by Workspace API level. It is used for events about any kind of status changes, such as:
// * - Agent installing statuses
// * - Servers statuses
// * - Infrastructure specific events
// * Infrastructure MUST NOT use this channel for long-lived output (process stdout, logs etc)
// * @return URL of status channel
// */
// public URL getStatusChannel() {
// return statusChannel;
// }
/**
@ -182,18 +174,18 @@ public abstract class RuntimeContext {
* It is not necessary that all of this information is used for identifying
* Runtime outside of SPI framework (in practice workspace ID looks like enough)
*
* @return the RuntimeIdentity
* @return the RuntimeIdentityImpl
*/
public RuntimeIdentity getIdentity() {
return identity;
}
/**
* @return incoming Workspace Environment
*/
public Environment getEnvironment() {
return environment;
}
// /**
// * @return incoming Workspace Environment
// */
// public Environment getEnvironment() {
// return environment;
// }
/**
* @return RuntimeInfrastructure the Context created from

View File

@ -10,29 +10,34 @@
*******************************************************************************/
package org.eclipse.che.api.workspace.server.spi;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
/**
* @author gazarenkov
*/
public final class RuntimeIdentity {
public final class RuntimeIdentityImpl implements RuntimeIdentity {
private final String workspaceId;
private final String envName;
private final String owner;
public RuntimeIdentity(String workspaceId, String envName, String owner) {
public RuntimeIdentityImpl(String workspaceId, String envName, String owner) {
this.workspaceId = workspaceId;
this.envName = envName;
this.owner = owner;
}
@Override
public String getWorkspaceId() {
return workspaceId;
}
@Override
public String getEnvName() {
return envName;
}
@Override
public String getOwner() {
return owner;
}
@ -44,14 +49,14 @@ public final class RuntimeIdentity {
@Override
public boolean equals(Object obj) {
if(! (obj instanceof RuntimeIdentity) )
if(! (obj instanceof RuntimeIdentityImpl) )
return false;
RuntimeIdentity other = (RuntimeIdentity) obj;
RuntimeIdentityImpl other = (RuntimeIdentityImpl) obj;
return workspaceId.equals(other.workspaceId) && envName.equals(other.envName);
}
@Override
public String toString() {
return "RuntimeIdentity: { workspace: " + workspaceId + " environment: " + envName + " owner: " + owner +" }";
return "RuntimeIdentityImpl: { workspace: " + workspaceId + " environment: " + envName + " owner: " + owner +" }";
}
}

View File

@ -15,6 +15,8 @@ import com.google.common.collect.ImmutableSet;
import org.eclipse.che.api.core.ValidationException;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.core.notification.EventService;
import java.util.Collection;
import java.util.Objects;
@ -28,13 +30,15 @@ import java.util.Set;
*/
public abstract class RuntimeInfrastructure {
protected final Set<String> recipeTypes;
protected final String name;
protected final Set<String> recipeTypes;
protected final String name;
protected final EventService eventService;
public RuntimeInfrastructure(String name, Collection<String> types) {
public RuntimeInfrastructure(String name, Collection<String> types, EventService eventService) {
Preconditions.checkArgument(!types.isEmpty());
this.name = Objects.requireNonNull(name);
this.recipeTypes = ImmutableSet.copyOf(types);
this.eventService = eventService;
}
/**
@ -52,6 +56,15 @@ public abstract class RuntimeInfrastructure {
return recipeTypes;
}
/**
*
* @return EventService
*/
public final EventService getEventService() {
return eventService;
}
/**
* An Infrastructure implementation should be able to preliminary estimate incoming Environment.
* For example: for validating it before storing
@ -95,7 +108,7 @@ public abstract class RuntimeInfrastructure {
* after shutting down Master server.
*
* @param id
* the RuntimeIdentity
* the RuntimeIdentityImpl
* @return the Runtime
* @throws UnsupportedOperationException
* if implementation does not support runtimes tracking
@ -112,7 +125,7 @@ public abstract class RuntimeInfrastructure {
* On the second phase Runtime is created with RuntimeContext.start() which is supposedly "long" method
*
* @param id
* the RuntimeIdentity
* the RuntimeIdentityImpl
* @param environment
* incoming Environment (configuration)
* @return new RuntimeContext object

View File

@ -14,9 +14,10 @@ import com.google.inject.Singleton;
import org.eclipse.che.api.core.ValidationException;
import org.eclipse.che.api.core.model.workspace.config.Environment;
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
import org.eclipse.che.api.core.notification.EventService;
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.api.workspace.server.spi.RuntimeContext;
import org.eclipse.che.api.workspace.server.spi.RuntimeIdentity;
import org.eclipse.che.api.workspace.server.spi.RuntimeInfrastructure;
import java.util.Collections;
@ -24,8 +25,8 @@ import java.util.Collections;
@Singleton
public class DummyRuntimeInfrastructure extends RuntimeInfrastructure {
public DummyRuntimeInfrastructure() {
super("dummy", Collections.singletonList("dummy"));
public DummyRuntimeInfrastructure(EventService eventService) {
super("dummy", Collections.singletonList("dummy"), eventService);
}
@Override

View File

@ -348,7 +348,7 @@ public class RuntimesTest {
// // then
// verify(eventService).publish(DtoFactory.newDto(WorkspaceStatusEvent.class)
// .withWorkspaceId(workspace.getId())
// .withEventType(EventType.ERROR)
// .withEventType(EventType.FAILED)
// .withPrevStatus(WorkspaceStatus.STARTING));
// }
// }
@ -406,7 +406,7 @@ public class RuntimesTest {
// // then
// verify(eventService).publish(DtoFactory.newDto(WorkspaceStatusEvent.class)
// .withWorkspaceId(workspace.getId())
// .withEventType(WorkspaceStatusEvent.EventType.ERROR)
// .withEventType(WorkspaceStatusEvent.EventType.FAILED)
// .withPrevStatus(WorkspaceStatus.STOPPING)
// .withError("Test error"));
// }
@ -755,7 +755,7 @@ public class RuntimesTest {
//
// public static class TestRuntimeInfra extends RuntimeInfrastructure {
//
// private Map<RuntimeIdentity, InternalRuntime> runtimes = new HashMap<>();
// private Map<RuntimeIdentityImpl, InternalRuntime> runtimes = new HashMap<>();
//
// public TestRuntimeInfra() throws ValidationException {
// super("test", singleton("test"));
@ -767,17 +767,17 @@ public class RuntimesTest {
// }
//
// @Override
// public Set<RuntimeIdentity> getIdentities() {
// public Set<RuntimeIdentityImpl> getIdentities() {
// return runtimes.keySet();
// }
//
// @Override
// public InternalRuntime getRuntime(RuntimeIdentity id) {
// public InternalRuntime getRuntime(RuntimeIdentityImpl id) {
// return runtimes.get(id);
// }
//
// @Override
// public RuntimeContext prepare(RuntimeIdentity id, Environment environment) throws ValidationException, ApiException, IOException {
// public RuntimeContext prepare(RuntimeIdentityImpl id, Environment environment) throws ValidationException, ApiException, IOException {
// return new TestRuntimeContext(environment, id, this);
// }
//
@ -785,13 +785,13 @@ public class RuntimesTest {
//
// @Override
// public void stop(RuntimeIdentity runtimeId, Map<String, String> options) {
// public void stop(RuntimeIdentityImpl runtimeId, Map<String, String> options) {
// LOG.info("Stopped " + runtimeId.getWorkspaceId());
// }
//
//
// @Override
// public Runtime start(RuntimeIdentity runtimeId, Environment environment, MessageConsumer<MachineLogMessage> logger,
// public Runtime start(RuntimeIdentityImpl runtimeId, Environment environment, MessageConsumer<MachineLogMessage> logger,
// Map<String, String> options, Subject subject)
// throws NotFoundException, ConflictException, ServerException {
//
@ -801,13 +801,13 @@ public class RuntimesTest {
// }
//
// @Override
// public Map<RuntimeIdentity, Runtime> getAll() {
// public Map<RuntimeIdentityImpl, Runtime> getAll() {
// return runtimes;
// }
// }
//
// public static class TestRuntimeContext extends RuntimeContext {
// public TestRuntimeContext(Environment environment, RuntimeIdentity identity,
// public TestRuntimeContext(Environment environment, RuntimeIdentityImpl identity,
// RuntimeInfrastructure infrastructure) throws ApiException, IOException, ValidationException {
// super(environment, identity, infrastructure, null);
// }