Commit | Line | Data |
---|---|---|
d132bcc7 | 1 | /********************************************************************** |
00de7b32 | 2 | * Copyright (c) 2012, 2013 Ericsson |
cfdb727a | 3 | * |
d132bcc7 BH |
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 | |
cfdb727a AM |
8 | * |
9 | * Contributors: | |
d132bcc7 BH |
10 | * Bernd Hufmann - Initial API and implementation |
11 | **********************************************************************/ | |
8e8c0226 | 12 | package org.eclipse.linuxtools.internal.lttng2.control.stubs.service; |
eb1bab5b BH |
13 | |
14 | import org.eclipse.core.commands.ExecutionException; | |
15 | import org.eclipse.core.runtime.Status; | |
8e8c0226 AM |
16 | import org.eclipse.linuxtools.internal.lttng2.control.stubs.shells.LTTngToolsFileShell; |
17 | import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.ICommandShell; | |
18 | import org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote.IRemoteSystemProxy; | |
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 | |
cfdb727a | 26 | @SuppressWarnings("javadoc") |
eb1bab5b | 27 | public class TestRemoteSystemProxy implements IRemoteSystemProxy { |
cfdb727a | 28 | |
d132bcc7 BH |
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 { | |
b957fb8c | 59 | // System.out.println("in done: proxy connect "); |
eb1bab5b BH |
60 | if (callback != null) { |
61 | callback.done(Status.OK_STATUS, null); | |
62 | } | |
63 | } | |
64 | ||
65 | @Override | |
66 | public void disconnect() throws ExecutionException { | |
d132bcc7 | 67 | fShell = null; |
eb1bab5b BH |
68 | } |
69 | ||
70 | @Override | |
71 | public ICommandShell createCommandShell() throws ExecutionException { | |
cfdb727a | 72 | if (fShell == null) { |
d132bcc7 BH |
73 | fShell = CommandShellFactory.getInstance().getFileShell(); |
74 | if ((fTestFile != null) && (fScenario != null)) { | |
75 | try { | |
76 | fShell.loadScenarioFile(fTestFile); | |
77 | } catch (Exception e) { | |
78 | throw new ExecutionException(e.toString()); | |
79 | } | |
80 | fShell.setScenario(fScenario); | |
81 | } | |
82 | } | |
83 | return fShell; | |
eb1bab5b BH |
84 | } |
85 | ||
86 | @Override | |
87 | public void addCommunicationListener(ICommunicationsListener listener) { | |
88 | } | |
89 | ||
90 | @Override | |
91 | public void removeCommunicationListener(ICommunicationsListener listener) { | |
92 | } | |
cfdb727a | 93 | |
d132bcc7 BH |
94 | public void setTestFile(String testFile) { |
95 | fTestFile = testFile; | |
96 | } | |
cfdb727a | 97 | |
d132bcc7 BH |
98 | public void setScenario(String scenario) { |
99 | fScenario = scenario; | |
100 | if (fShell != null) { | |
101 | fShell.setScenario(fScenario); | |
102 | } | |
103 | } | |
00de7b32 BH |
104 | |
105 | @Override | |
106 | public int getPort() { | |
107 | return IRemoteSystemProxy.INVALID_PORT_NUMBER; | |
108 | } | |
109 | ||
110 | @Override | |
111 | public void setPort(int port) { | |
112 | } | |
a657b111 BH |
113 | |
114 | @Override | |
115 | public boolean isLocal() { | |
116 | return false; | |
117 | } | |
eb1bab5b | 118 | } |