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 | **********************************************************************/ | |
eb1bab5b BH |
12 | package org.eclipse.linuxtools.lttng.stubs.service; |
13 | ||
14 | import org.eclipse.core.commands.ExecutionException; | |
15 | import org.eclipse.core.runtime.Status; | |
d132bcc7 | 16 | import org.eclipse.linuxtools.lttng.stubs.service.shells.LTTngToolsFileShell; |
eb1bab5b BH |
17 | import org.eclipse.linuxtools.lttng.ui.views.control.remote.IRemoteSystemProxy; |
18 | import org.eclipse.linuxtools.lttng.ui.views.control.service.ICommandShell; | |
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 BH |
25 | |
26 | public class TestRemoteSystemProxy implements IRemoteSystemProxy { | |
d132bcc7 BH |
27 | |
28 | private LTTngToolsFileShell fShell = null; | |
29 | private String fTestFile = null; | |
30 | private String fScenario = null; | |
eb1bab5b BH |
31 | |
32 | @Override | |
33 | public IShellService getShellService() { | |
34 | return null; | |
35 | } | |
36 | ||
37 | @Override | |
38 | public ITerminalService getTerminalService() { | |
39 | return null; | |
40 | } | |
41 | ||
42 | @Override | |
43 | public ISubSystem getShellServiceSubSystem() { | |
44 | return null; | |
45 | } | |
46 | ||
47 | @Override | |
48 | public ISubSystem getTerminalServiceSubSystem() { | |
49 | return null; | |
50 | } | |
bbb3538a BH |
51 | @Override |
52 | public IFileServiceSubSystem getFileServiceSubSystem() { | |
53 | return null; | |
54 | } | |
eb1bab5b BH |
55 | |
56 | @Override | |
57 | public void connect(IRSECallback callback) throws ExecutionException { | |
58 | if (callback != null) { | |
59 | callback.done(Status.OK_STATUS, null); | |
60 | } | |
61 | } | |
62 | ||
63 | @Override | |
64 | public void disconnect() throws ExecutionException { | |
d132bcc7 | 65 | fShell = null; |
eb1bab5b BH |
66 | } |
67 | ||
68 | @Override | |
69 | public ICommandShell createCommandShell() throws ExecutionException { | |
d132bcc7 BH |
70 | if (fShell == null) { |
71 | fShell = CommandShellFactory.getInstance().getFileShell(); | |
72 | if ((fTestFile != null) && (fScenario != null)) { | |
73 | try { | |
74 | fShell.loadScenarioFile(fTestFile); | |
75 | } catch (Exception e) { | |
76 | throw new ExecutionException(e.toString()); | |
77 | } | |
78 | fShell.setScenario(fScenario); | |
79 | } | |
80 | } | |
81 | return fShell; | |
eb1bab5b BH |
82 | } |
83 | ||
84 | @Override | |
85 | public void addCommunicationListener(ICommunicationsListener listener) { | |
86 | } | |
87 | ||
88 | @Override | |
89 | public void removeCommunicationListener(ICommunicationsListener listener) { | |
90 | } | |
d132bcc7 BH |
91 | |
92 | public void setTestFile(String testFile) { | |
93 | fTestFile = testFile; | |
94 | } | |
95 | ||
96 | public void setScenario(String scenario) { | |
97 | fScenario = scenario; | |
98 | if (fShell != null) { | |
99 | fShell.setScenario(fScenario); | |
100 | } | |
101 | } | |
eb1bab5b | 102 | } |