Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHE-3620:Remove MachineServiceClient and related classes #3963

Merged
merged 6 commits into from
Mar 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
import com.google.web.bindery.event.shared.EventBus;

import org.eclipse.che.api.core.model.machine.Machine;
import org.eclipse.che.api.machine.shared.dto.MachineDto;
import org.eclipse.che.api.promises.client.Operation;
import org.eclipse.che.api.promises.client.OperationException;
import org.eclipse.che.ide.Resources;
import org.eclipse.che.ide.api.action.Action;
import org.eclipse.che.ide.api.action.ActionEvent;
Expand All @@ -28,7 +25,7 @@
import org.eclipse.che.ide.api.command.CommandProducer;
import org.eclipse.che.ide.api.component.Component;
import org.eclipse.che.ide.api.constraints.Constraints;
import org.eclipse.che.ide.api.machine.MachineServiceClient;
import org.eclipse.che.ide.api.machine.ActiveRuntime;
import org.eclipse.che.ide.api.machine.events.MachineStateEvent;
import org.eclipse.che.ide.api.machine.events.WsAgentStateEvent;
import org.eclipse.che.ide.api.machine.events.WsAgentStateHandler;
Expand Down Expand Up @@ -61,7 +58,6 @@ public class CommandProducerActionManager implements MachineStateEvent.Handler,
private final ActionManager actionManager;
private final CommandProducerActionFactory commandProducerActionFactory;
private final AppContext appContext;
private final MachineServiceClient machineServiceClient;
private final Resources resources;

private final List<Machine> machines;
Expand All @@ -77,12 +73,10 @@ public CommandProducerActionManager(EventBus eventBus,
ActionManager actionManager,
CommandProducerActionFactory commandProducerActionFactory,
AppContext appContext,
MachineServiceClient machineServiceClient,
Resources resources) {
this.actionManager = actionManager;
this.commandProducerActionFactory = commandProducerActionFactory;
this.appContext = appContext;
this.machineServiceClient = machineServiceClient;
this.resources = resources;

machines = new ArrayList<>();
Expand Down Expand Up @@ -119,14 +113,12 @@ private void start(Set<CommandProducer> commandProducers) {

@Override
public void start(final Callback<Component, Exception> callback) {
machineServiceClient.getMachines(appContext.getWorkspaceId()).then(new Operation<List<MachineDto>>() {
@Override
public void apply(List<MachineDto> arg) throws OperationException {
machines.addAll(arg);
ActiveRuntime activeRuntime = appContext.getActiveRuntime();
if (activeRuntime != null) {
machines.addAll(activeRuntime.getMachines());
}

callback.onSuccess(CommandProducerActionManager.this);
}
});
callback.onSuccess(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ public Workspace getWorkspace() {
public void setWorkspace(Workspace workspace) {
if (workspace != null) {
usersWorkspace = workspace;
runtime = new ActiveRuntime(workspace.getRuntime());
if (workspace.getRuntime() != null) {
runtime = new ActiveRuntime(workspace.getRuntime());
}
} else {
usersWorkspace = null;
runtime = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import org.eclipse.che.ide.api.keybinding.KeyBindingAgent;
import org.eclipse.che.ide.api.machine.ExecAgentCommandManager;
import org.eclipse.che.ide.api.machine.ExecAgentEventManager;
import org.eclipse.che.ide.api.machine.MachineServiceClient;
import org.eclipse.che.ide.api.machine.MachineServiceClientImpl;
import org.eclipse.che.ide.api.machine.RecipeServiceClient;
import org.eclipse.che.ide.api.machine.RecipeServiceClientImpl;
import org.eclipse.che.ide.api.machine.execagent.ConnectedEventHandler;
Expand Down Expand Up @@ -138,7 +136,6 @@ protected void configure() {
bind(GitServiceClient.class).to(GitServiceClientImpl.class).in(Singleton.class);
bind(SshServiceClient.class).to(SshServiceClientImpl.class).in(Singleton.class);
bind(RecipeServiceClient.class).to(RecipeServiceClientImpl.class).in(Singleton.class);
bind(MachineServiceClient.class).to(MachineServiceClientImpl.class).in(Singleton.class);

// IDE agents
bind(SelectionAgent.class).to(SelectionAgentImpl.class).asEagerSingleton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.google.gwt.core.client.Callback;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;

Expand All @@ -24,7 +23,6 @@
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.component.Component;
import org.eclipse.che.ide.api.dialogs.DialogFactory;
import org.eclipse.che.ide.api.machine.MachineManager;
import org.eclipse.che.ide.api.notification.NotificationManager;
import org.eclipse.che.ide.api.preferences.PreferencesManager;
import org.eclipse.che.ide.api.workspace.WorkspaceServiceClient;
Expand Down Expand Up @@ -53,7 +51,6 @@ public DefaultWorkspaceComponent(WorkspaceServiceClient workspaceServiceClient,
DtoUnmarshallerFactory dtoUnmarshallerFactory,
EventBus eventBus,
AppContext appContext,
Provider<MachineManager> machineManagerProvider,
NotificationManager notificationManager,
MessageBusProvider messageBusProvider,
BrowserAddress browserAddress,
Expand All @@ -69,7 +66,6 @@ public DefaultWorkspaceComponent(WorkspaceServiceClient workspaceServiceClient,
dtoUnmarshallerFactory,
eventBus,
appContext,
machineManagerProvider,
notificationManager,
messageBusProvider,
browserAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.google.gwt.core.client.Callback;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;

Expand All @@ -30,7 +29,6 @@
import org.eclipse.che.ide.api.component.Component;
import org.eclipse.che.ide.api.dialogs.DialogFactory;
import org.eclipse.che.ide.api.factory.FactoryServiceClient;
import org.eclipse.che.ide.api.machine.MachineManager;
import org.eclipse.che.ide.api.notification.NotificationManager;
import org.eclipse.che.ide.api.preferences.PreferencesManager;
import org.eclipse.che.ide.api.workspace.WorkspaceServiceClient;
Expand Down Expand Up @@ -74,7 +72,6 @@ public FactoryWorkspaceComponent(WorkspaceServiceClient workspaceServiceClient,
DtoUnmarshallerFactory dtoUnmarshallerFactory,
EventBus eventBus,
AppContext appContext,
Provider<MachineManager> machineManagerProvider,
NotificationManager notificationManager,
MessageBusProvider messageBusProvider,
BrowserAddress browserAddress,
Expand All @@ -91,7 +88,6 @@ public FactoryWorkspaceComponent(WorkspaceServiceClient workspaceServiceClient,
dtoUnmarshallerFactory,
eventBus,
appContext,
machineManagerProvider,
notificationManager,
messageBusProvider,
browserAddress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.google.gwt.core.client.Callback;
import com.google.gwt.core.client.Scheduler;
import com.google.inject.Provider;
import com.google.web.bindery.event.shared.EventBus;

import org.eclipse.che.api.core.model.workspace.Workspace;
Expand All @@ -28,7 +27,6 @@
import org.eclipse.che.ide.api.dialogs.CancelCallback;
import org.eclipse.che.ide.api.dialogs.ConfirmCallback;
import org.eclipse.che.ide.api.dialogs.DialogFactory;
import org.eclipse.che.ide.api.machine.MachineManager;
import org.eclipse.che.ide.api.machine.events.WsAgentStateEvent;
import org.eclipse.che.ide.api.machine.events.WsAgentStateHandler;
import org.eclipse.che.ide.api.notification.NotificationManager;
Expand Down Expand Up @@ -74,7 +72,6 @@ public abstract class WorkspaceComponent implements Component, WsAgentStateHandl
protected final StartWorkspacePresenter startWorkspacePresenter;

private final EventBus eventBus;
private final Provider<MachineManager> machineManagerProvider;
private final MessageBusProvider messageBusProvider;
private final WorkspaceEventsHandler workspaceEventsHandler;
private final LoaderPresenter loader;
Expand All @@ -90,7 +87,6 @@ public WorkspaceComponent(WorkspaceServiceClient workspaceServiceClient,
DtoUnmarshallerFactory dtoUnmarshallerFactory,
EventBus eventBus,
AppContext appContext,
Provider<MachineManager> machineManagerProvider,
NotificationManager notificationManager,
MessageBusProvider messageBusProvider,
BrowserAddress browserAddress,
Expand All @@ -106,7 +102,6 @@ public WorkspaceComponent(WorkspaceServiceClient workspaceServiceClient,
this.dtoUnmarshallerFactory = dtoUnmarshallerFactory;
this.eventBus = eventBus;
this.appContext = appContext;
this.machineManagerProvider = machineManagerProvider;
this.notificationManager = notificationManager;
this.messageBusProvider = messageBusProvider;
this.browserAddress = browserAddress;
Expand Down Expand Up @@ -202,7 +197,6 @@ public void onOpen() {
public void execute() {
loader.setSuccess(STARTING_WORKSPACE_RUNTIME);
eventBus.fireEvent(new WorkspaceStartedEvent(workspace));
machineManagerProvider.get();//start instance of machine manager
}
});
break;
Expand Down
Loading