Commit | Line | Data |
---|---|---|
d132bcc7 BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Bernd Hufmann - Initial API and implementation | |
11 | **********************************************************************/ | |
115b4a01 | 12 | package org.eclipse.linuxtools.internal.lttng2.stubs.service; |
eb1bab5b BH |
13 | |
14 | import org.eclipse.core.commands.ExecutionException; | |
15 | import org.eclipse.core.runtime.Status; | |
115b4a01 BH |
16 | import org.eclipse.linuxtools.internal.lttng2.stubs.shells.LTTngToolsFileShell; |
17 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.IRemoteSystemProxy; | |
18 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ICommandShell; | |
eb1bab5b BH |
19 | import org.eclipse.rse.core.model.IRSECallback; |
20 | import org.eclipse.rse.core.subsystems.ICommunicationsListener; | |
21 | import org.eclipse.rse.core.subsystems.ISubSystem; | |
22 | import org.eclipse.rse.services.shells.IShellService; | |
23 | import org.eclipse.rse.services.terminals.ITerminalService; | |
bbb3538a | 24 | import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; |
eb1bab5b | 25 | |
115b4a01 | 26 | |
eb1bab5b | 27 | public class TestRemoteSystemProxy implements IRemoteSystemProxy { |
d132bcc7 BH |
28 | |
29 | private LTTngToolsFileShell fShell = null; | |
30 | private String fTestFile = null; | |
31 | private String fScenario = null; | |
eb1bab5b BH |
32 | |
33 | @Override | |
34 | public IShellService getShellService() { | |
35 | return null; | |
36 | } | |
37 | ||
38 | @Override | |
39 | public ITerminalService getTerminalService() { | |
40 | return null; | |
41 | } | |
42 | ||
43 | @Override | |
44 | public ISubSystem getShellServiceSubSystem() { | |
45 | return null; | |
46 | } | |
47 | ||
48 | @Override | |
49 | public ISubSystem getTerminalServiceSubSystem() { | |
50 | return null; | |
51 | } | |
bbb3538a BH |
52 | @Override |
53 | public IFileServiceSubSystem getFileServiceSubSystem() { | |
54 | return null; | |
55 | } | |
eb1bab5b BH |
56 | |
57 | @Override | |
58 | public void connect(IRSECallback callback) throws ExecutionException { | |
59 | if (callback != null) { | |
60 | callback.done(Status.OK_STATUS, null); | |
61 | } | |
62 | } | |
63 | ||
64 | @Override | |
65 | public void disconnect() throws ExecutionException { | |
d132bcc7 | 66 | fShell = null; |
eb1bab5b BH |
67 | } |
68 | ||
69 | @Override | |
70 | public ICommandShell createCommandShell() throws ExecutionException { | |
d132bcc7 BH |
71 | if (fShell == null) { |
72 | fShell = CommandShellFactory.getInstance().getFileShell(); | |
73 | if ((fTestFile != null) && (fScenario != null)) { | |
74 | try { | |
75 | fShell.loadScenarioFile(fTestFile); | |
76 | } catch (Exception e) { | |
77 | throw new ExecutionException(e.toString()); | |
78 | } | |
79 | fShell.setScenario(fScenario); | |
80 | } | |
81 | } | |
82 | return fShell; | |
eb1bab5b BH |
83 | } |
84 | ||
85 | @Override | |
86 | public void addCommunicationListener(ICommunicationsListener listener) { | |
87 | } | |
88 | ||
89 | @Override | |
90 | public void removeCommunicationListener(ICommunicationsListener listener) { | |
91 | } | |
d132bcc7 BH |
92 | |
93 | public void setTestFile(String testFile) { | |
94 | fTestFile = testFile; | |
95 | } | |
96 | ||
97 | public void setScenario(String scenario) { | |
98 | fScenario = scenario; | |
99 | if (fShell != null) { | |
100 | fShell.setScenario(fScenario); | |
101 | } | |
102 | } | |
eb1bab5b | 103 | } |