Skip to contentSkip to conversation

Separate org.yocto.remote.utils plugin

PATCH Superseded Ioana Grigoropol 2 participants 9 messages May 9, 2013 – May 10, 2013

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Separate org.yocto.remote.utils plugin

- initial commit & populate for remote utils common plugin

Ioana Grigoropol (6):
Initial commit for separate remote utilities plugin Move RSEHelper to a separate plugin
Move RemoteShellExec to separate plugin
Move ShellSession to org.yocto.remote.utils separate plugin Move CommonHelper to org.yocto.remote.utils separate plugin Move TerminalHandler to org.yocto.remote.utils

 plugins/org.yocto.remote.utils/.classpath          |    7 +
 plugins/org.yocto.remote.utils/.project            |   28 ++
 .../.settings/org.eclipse.jdt.core.prefs           |    7 +
 .../org.yocto.remote.utils/META-INF/MANIFEST.MF    |   28 ++
 plugins/org.yocto.remote.utils/build.properties    |    4 +
 .../org.yocto.remote.utils/resources/ust_tar.sh    |   19 +
 .../org.yocto.remote.utils/resources/yocto_tool.sh |  125 ++++++
 .../org.yocto.remote.utils/resources/yocto_ust.sh  |   35 ++
 .../src/org/yocto/remote/utils/Activator.java      |   62 +++
 .../src/org/yocto/remote/utils/CommonHelper.java   |   46 +++
 .../src/org/yocto/remote/utils/Messages.java       |   35 ++
 .../src/org/yocto/remote/utils/RSEHelper.java      |  344 ++++++++++++++++
 .../org/yocto/remote/utils/RemoteShellExec.java    |  140 +++++++
 .../src/org/yocto/remote/utils/ShellSession.java   |  327 +++++++++++++++
 .../org/yocto/remote/utils/TerminalHandler.java    |  128 ++++++
 .../org.yocto.sdk.remotetools/META-INF/MANIFEST.MF |    3 +-
 .../org.yocto.sdk.remotetools/resources/ust_tar.sh |   19 -
 .../resources/yocto_tool.sh                        |  125 ------
 .../resources/yocto_ust.sh                         |   35 --
 .../org/yocto/sdk/remotetools/CommonHelper.java    |   44 --
 .../src/org/yocto/sdk/remotetools/RSEHelper.java   |  419 --------------------
 .../org/yocto/sdk/remotetools/ShellSession.java    |  341 ----------------
 .../yocto/sdk/remotetools/actions/BaseModel.java   |    4 +-
 .../sdk/remotetools/actions/BaseSettingDialog.java |    2 +-
 .../sdk/remotetools/actions/DialogHandler.java     |    1 +
 .../sdk/remotetools/actions/OprofileModel.java     |    2 +-
 .../sdk/remotetools/actions/SystemtapModel.java    |    2 +-
 .../actions/SystemtapSettingDialog.java            |    2 +-
 .../sdk/remotetools/actions/TerminalHandler.java   |  128 ------
 .../sdk/remotetools/remote/RemoteShellExec.java    |  149 -------
 30 files changed, 1344 insertions(+), 1267 deletions(-)
 create mode 100644 plugins/org.yocto.remote.utils/.classpath
 create mode 100644 plugins/org.yocto.remote.utils/.project
 create mode 100644 plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs
 create mode 100644 plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF
 create mode 100644 plugins/org.yocto.remote.utils/build.properties
 create mode 100755 plugins/org.yocto.remote.utils/resources/ust_tar.sh
 create mode 100755 plugins/org.yocto.remote.utils/resources/yocto_tool.sh
 create mode 100755 plugins/org.yocto.remote.utils/resources/yocto_ust.sh
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RSEHelper.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java
 delete mode 100755 plugins/org.yocto.sdk.remotetools/resources/ust_tar.sh
 delete mode 100755 plugins/org.yocto.sdk.remotetools/resources/yocto_tool.sh
 delete mode 100755 plugins/org.yocto.sdk.remotetools/resources/yocto_ust.sh
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/CommonHelper.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/RSEHelper.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/ShellSession.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/TerminalHandler.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/remote/RemoteShellExec.java
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/6 Initial commit for separate remote utilities plugin

---
 plugins/org.yocto.remote.utils/.classpath          |    7 +++
 plugins/org.yocto.remote.utils/.project            |   28 +++++++++
 .../.settings/org.eclipse.jdt.core.prefs           |    7 +++
 .../org.yocto.remote.utils/META-INF/MANIFEST.MF    |   10 ++++
 plugins/org.yocto.remote.utils/build.properties    |    4 ++
 .../src/org/yocto/remote/utils/Activator.java      |   60 ++++++++++++++++++++
 6 files changed, 116 insertions(+)
 create mode 100644 plugins/org.yocto.remote.utils/.classpath
 create mode 100644 plugins/org.yocto.remote.utils/.project
 create mode 100644 plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs
 create mode 100644 plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF
 create mode 100644 plugins/org.yocto.remote.utils/build.properties
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java
plugins/org.yocto.remote.utils/.classpath new file +7 -0
new file mode 100644
index 0000000..ad32c83
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
plugins/org.yocto.remote.utils/.project new file +28 -0
new file mode 100644
index 0000000..29a2a5a
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.yocto.remote.utils</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs new file +7 -0
new file mode 100644
index 0000000..f42de36
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF new file +10 -0
new file mode 100644
index 0000000..16c86e9
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Utils
+Bundle-SymbolicName: org.yocto.remote.utils
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.yocto.remote.utils.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
plugins/org.yocto.remote.utils/build.properties new file +4 -0
new file mode 100644
index 0000000..34d2e4d
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/6] Initial commit for separate remote utilities plugin

Hi Ioana,

Seems you're still using Java 1.7, can you change to 1.6?

Thanks,
Jessica

+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ioana Grigoropol
Sent: Thursday, May 09, 2013 2:19 PM
To: [email protected]
Subject: [yocto] [PATCH 1/6] Initial commit for separate remote utilities plugin

---
 plugins/org.yocto.remote.utils/.classpath          |    7 +++
 plugins/org.yocto.remote.utils/.project            |   28 +++++++++
 .../.settings/org.eclipse.jdt.core.prefs           |    7 +++
 .../org.yocto.remote.utils/META-INF/MANIFEST.MF    |   10 ++++
 plugins/org.yocto.remote.utils/build.properties    |    4 ++
 .../src/org/yocto/remote/utils/Activator.java      |   60 ++++++++++++++++++++
 6 files changed, 116 insertions(+)
 create mode 100644 plugins/org.yocto.remote.utils/.classpath
 create mode 100644 plugins/org.yocto.remote.utils/.project
 create mode 100644 plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs
 create mode 100644 plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF
 create mode 100644 plugins/org.yocto.remote.utils/build.properties
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java
plugins/org.yocto.remote.utils/.classpath new file +6 -0
new file mode 100644
index 0000000..ad32c83
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="output" path="bin"/> </classpath>
plugins/org.yocto.remote.utils/.project new file +28 -0
new file mode 100644
index 0000000..29a2a5a
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.yocto.remote.utils</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.pref new file +0 -0
new file mode 100644
index 0000000..f42de36

+++ s
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7

plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF new file +10 -0
new file mode 100644
index 0000000..16c86e9
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Utils
+Bundle-SymbolicName: org.yocto.remote.utils
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.yocto.remote.utils.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
plugins/org.yocto.remote.utils/build.properties new file +4 -0
new file mode 100644
index 0000000..34d2e4d
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activato new file +0 -0
new file mode 100644
index 0000000..047d900

+++ r.java
@@ -0,0 +1,60 @@ +/**********************************************************************
+*********
+ * Copyright (c) 2013 Intel Corporation.
+ * 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:
+ * Intel - initial API and implementation
+***********************************************************************
+********/
+package org.yocto.remote.utils;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle */ public class +Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.yocto.remote.utils";
+//$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*

+        * (non-Javadoc)
+        * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+        */

+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*

+        * (non-Javadoc)
+        * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+        */

+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**

+        * Returns the shared instance
+        *
+        * @return the shared instance
+        */

+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
--
1.7.9.5

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#3 lore raw

PATCH 2/6 Move RSEHelper to a separate plugin

In reply to Ioana Grigoropol

- move RSEHelper to newly created separate plugin org.yocto.remote.utils
- clean-up RSEHelper code by removing all unused methods
- moved message strings that are relevant for this plugin to the corresponding class
- modify remotetools plugin to use RSEHelper from org.yocto.remote.utils
- add plugin resources need for RSEHelper

---
 .../org.yocto.remote.utils/META-INF/MANIFEST.MF    |   11 +
 .../org.yocto.remote.utils/resources/ust_tar.sh    |   19 +
 .../org.yocto.remote.utils/resources/yocto_tool.sh |  125 ++++++
 .../org.yocto.remote.utils/resources/yocto_ust.sh  |   35 ++
 .../src/org/yocto/remote/utils/Activator.java      |    4 +-
 .../src/org/yocto/remote/utils/Messages.java       |   35 ++
 .../src/org/yocto/remote/utils/RSEHelper.java      |  344 ++++++++++++++++
 .../org.yocto.sdk.remotetools/META-INF/MANIFEST.MF |    3 +-
 .../org.yocto.sdk.remotetools/resources/ust_tar.sh |   19 -
 .../resources/yocto_tool.sh                        |  125 ------
 .../resources/yocto_ust.sh                         |   35 --
 .../src/org/yocto/sdk/remotetools/RSEHelper.java   |  419 --------------------
 .../yocto/sdk/remotetools/actions/BaseModel.java   |    2 +-
 .../sdk/remotetools/actions/BaseSettingDialog.java |    2 +-
 .../sdk/remotetools/actions/TerminalHandler.java   |    2 +-
 .../sdk/remotetools/remote/RemoteShellExec.java    |    2 +-
 16 files changed, 578 insertions(+), 604 deletions(-)
 create mode 100755 plugins/org.yocto.remote.utils/resources/ust_tar.sh
 create mode 100755 plugins/org.yocto.remote.utils/resources/yocto_tool.sh
 create mode 100755 plugins/org.yocto.remote.utils/resources/yocto_ust.sh
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RSEHelper.java
 delete mode 100755 plugins/org.yocto.sdk.remotetools/resources/ust_tar.sh
 delete mode 100755 plugins/org.yocto.sdk.remotetools/resources/yocto_tool.sh
 delete mode 100755 plugins/org.yocto.sdk.remotetools/resources/yocto_ust.sh
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/RSEHelper.java
plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF +11 -0
index 16c86e9..6c4fb35 100644
@@ -8,3 +8,14 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.rse.core,
+ org.eclipse.rse.core.model,
+ org.eclipse.rse.core.subsystems,
+ org.eclipse.rse.services,
+ org.eclipse.rse.services.files,
+ org.eclipse.rse.services.shells,
+ org.eclipse.rse.subsystems.files.core.servicesubsystem,
+ org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem,
+ org.eclipse.rse.subsystems.terminals.core
+Export-Package: org.yocto.remote.utils
+>>>>>>> 2504c89... Move RSEHelper to a separate plugin
plugins/org.yocto.remote.utils/resources/ust_tar.sh new file +19 -0
new file mode 100755
index 0000000..20a8039
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#set PATH to include sbin dirs
+export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
+
+if [ ! -d "$@" ] || [ -z "$@" ]; then
+  exit 1
+fi
+
+DATESTRING="$(date +%Y%m%d%H%M%S%N)"
+BASENAME=`basename $@`
+DATAFILE=/tmp/${BASENAME}-${DATESTRING}.tar
+cd $@
+cd ..
+
+tar -cf  ${DATAFILE} ${BASENAME} &> /dev/null || exit $?
+
+echo -e "ustfile:$DATAFILE\n"
+
plugins/org.yocto.remote.utils/resources/yocto_tool.sh new file +125 -0

125 lines not on this page · raw message

plugins/org.yocto.remote.utils/resources/yocto_ust.sh new file +35 -0
new file mode 100755
index 0000000..a1637db
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+#set PATH to include sbin dirs
+export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
+
+DATESTRING="$(date +%Y%m%d%H%M%S%N)"
+TEMPFILE="/tmp/yocto-ust-tmp-$DATESTRING"
+
+rm -f ${TEMPFILE}
+usttrace $@ &> ${TEMPFILE}
+ret=$?
+
+if [ $ret -ne 0 ]; then
+  cat $TEMPFILE
+  rm -f $TEMPFILE
+  exit $ret
+fi
+
+#search for output dir
+USTDIR=`cat ${TEMPFILE} | awk '/^Trace was output in:/ { print $5}'`
+rm -f ${TEMPFILE}
+
+if [ -z "$USTDIR" ]; then
+  exit 1
+fi
+
+BASENAME=`basename $USTDIR`
+DATAFILE=/tmp/${BASENAME}.tar
+cd $USTDIR
+cd ..
+
+tar -cf  ${DATAFILE} ${BASENAME} &> /dev/null || exit $?
+
+echo -e "ustfile:$DATAFILE\n"
+
plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java +3 -1
index 047d900..da66a3e 100644
@@ -23,7 +23,7 @@ public class Activator extends AbstractUIPlugin {
 
 	// The shared instance
 	private static Activator plugin;
-	
+
 	/**
 	 * The constructor
 	 */
@@ -34,6 +34,7 @@ public class Activator extends AbstractUIPlugin {
 	 * (non-Javadoc)
 	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
 	 */
+	@Override
 	public void start(BundleContext context) throws Exception {
 		super.start(context);
 		plugin = this;
@@ -43,6 +44,7 @@ public class Activator extends AbstractUIPlugin {
 	 * (non-Javadoc)
 	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
 	 */
+	@Override
 	public void stop(BundleContext context) throws Exception {
 		plugin = null;
 		super.stop(context);
plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java new file +35 -0
new file mode 100644
index 0000000..fc696d6
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Intel Corporation.
+ * 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:
+ * Intel - initial API and implementation
+ *******************************************************************************/
+package org.yocto.remote.utils;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.yocto.remote.utils.messages"; //$NON-NLS-1$
+
+	public static String ErrorNoSubsystem;
+	public static String ErrorConnectSubsystem;
+
+	public static String InfoDownload;
+	public static String InfoUpload;
+
+	public static String RemoteShellExec_1;
+	public static String RemoteShellExec_2;
+
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+	}
+
+	private Messages() {
+	}
+}
plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RSEHelper.java new file +344 -0

344 lines not on this page · raw message

plugins/org.yocto.sdk.remotetools/META-INF/MANIFEST.MF +2 -1
index d10a56e..c34ad9e 100644
@@ -24,7 +24,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Import-Package: org.eclipse.core.resources,
  org.eclipse.debug.internal.ui,
  org.eclipse.rse.shells.ui,
- org.eclipse.ui.forms.widgets
+ org.eclipse.ui.forms.widgets,
+ org.yocto.remote.utils
 Bundle-Vendor: %Bundle-Vendor
 Bundle-ClassPath: lib/json-simple-1.1.1.jar,
  .
plugins/org.yocto.sdk.remotetools/resources/ust_tar.sh deleted +0 -19
deleted file mode 100755
index 20a8039..0000000
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-#set PATH to include sbin dirs
-export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
-
-if [ ! -d "$@" ] || [ -z "$@" ]; then
-  exit 1
-fi
-
-DATESTRING="$(date +%Y%m%d%H%M%S%N)"
-BASENAME=`basename $@`
-DATAFILE=/tmp/${BASENAME}-${DATESTRING}.tar
-cd $@
-cd ..
-
-tar -cf  ${DATAFILE} ${BASENAME} &> /dev/null || exit $?
-
-echo -e "ustfile:$DATAFILE\n"
-
plugins/org.yocto.sdk.remotetools/resources/yocto_tool.sh deleted +0 -125

125 lines not on this page · raw message

plugins/org.yocto.sdk.remotetools/resources/yocto_ust.sh deleted +0 -35
deleted file mode 100755
index a1637db..0000000
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-#set PATH to include sbin dirs
-export PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
-
-DATESTRING="$(date +%Y%m%d%H%M%S%N)"
-TEMPFILE="/tmp/yocto-ust-tmp-$DATESTRING"
-
-rm -f ${TEMPFILE}
-usttrace $@ &> ${TEMPFILE}
-ret=$?
-
-if [ $ret -ne 0 ]; then
-  cat $TEMPFILE
-  rm -f $TEMPFILE
-  exit $ret
-fi
-
-#search for output dir
-USTDIR=`cat ${TEMPFILE} | awk '/^Trace was output in:/ { print $5}'`
-rm -f ${TEMPFILE}
-
-if [ -z "$USTDIR" ]; then
-  exit 1
-fi
-
-BASENAME=`basename $USTDIR`
-DATAFILE=/tmp/${BASENAME}.tar
-cd $USTDIR
-cd ..
-
-tar -cf  ${DATAFILE} ${BASENAME} &> /dev/null || exit $?
-
-echo -e "ustfile:$DATAFILE\n"
-
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/RSEHelper.java deleted +0 -419

419 lines not on this page · raw message

plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java +1 -1
index 2e15e48..08cb873 100644
@@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.rse.core.model.IHost;
-import org.yocto.sdk.remotetools.RSEHelper;
+import org.yocto.remote.utils.RSEHelper;
 import org.yocto.sdk.remotetools.remote.RemoteShellExec;
 
 abstract public class BaseModel implements IRunnableWithProgress {
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseSettingDialog.java +1 -1
index 962a20a..7845959 100644
@@ -21,9 +21,9 @@
 
 package org.yocto.sdk.remotetools.actions;
 
+import org.yocto.remote.utils.RSEHelper;
 import org.yocto.sdk.remotetools.Messages;
 import org.yocto.sdk.remotetools.SWTFactory;
-import org.yocto.sdk.remotetools.RSEHelper;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.rse.core.model.IHost;
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/TerminalHandler.java +1 -1
index 9e7c169..4ad8688 100644
@@ -33,8 +33,8 @@ import org.eclipse.swt.events.DisposeListener;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
 import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
+import org.yocto.remote.utils.RSEHelper;
 import org.yocto.sdk.remotetools.CommonHelper;
-import org.yocto.sdk.remotetools.RSEHelper;
 
 abstract public class TerminalHandler extends AbstractHandler {
 	
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/remote/RemoteShellExec.java +1 -1
index bb4859d..bfcbbfc 100644
@@ -22,7 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 //import org.eclipse.tcf.services.IProcesses;
 //import org.eclipse.tcf.util.TCFTask;
 import org.eclipse.rse.core.model.IHost;
-import org.yocto.sdk.remotetools.RSEHelper;
+import org.yocto.remote.utils.RSEHelper;
 
 public class RemoteShellExec {
 	
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 3/6 Move RemoteShellExec to separate plugin

In reply to Ioana Grigoropol

- RemoteShellExec is a wrapper over a remote executiong of a command in a shell and it belongs to org.yocto.remote.utils plugin
- remove RemoteShellExec from remotetools plugin and add it to org.yocto.remote.utils
- modify org.yocto.sdk.remotetools to use implementation from org.yocto.remote.utils

---
 .../org/yocto/remote/utils/RemoteShellExec.java    |  140 ++++++++++++++++++
 .../yocto/sdk/remotetools/actions/BaseModel.java   |    2 +-
 .../sdk/remotetools/remote/RemoteShellExec.java    |  149 --------------------
 3 files changed, 141 insertions(+), 150 deletions(-)
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/remote/RemoteShellExec.java
plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java new file +140 -0
new file mode 100644
index 0000000..48b4f4d
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Intel Corporation.
+ * 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:
+ * Intel - initial API and implementation
+ *******************************************************************************/
+package org.yocto.remote.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.rse.core.model.IHost;
+
+public class RemoteShellExec {
+
+	public static final int
+    STATE_NULL = 0,
+    STATE_RUNNING = 1,
+    STATE_EXITED = 2;
+
+	private final String command;
+	private final IHost host;
+
+	private InputStream fInStream;
+    private OutputStream fOutStream;
+    private InputStream fErrStream;
+    private Process remoteShellProcess;
+
+	private int exitCode = 0;
+	private int status = STATE_NULL;
+
+	private final String RETURN_VALUE_TAG = "org.yocto.sdk.remotetools.RVTAG";
+	private final String RETURN_VALUE_CMD = ";echo \"" + RETURN_VALUE_TAG + "$?\"";
+
+	public RemoteShellExec(IHost host, String command) {
+		assert(host != null);
+		this.host = host;
+		this.command = command;
+	}
+
+	public int getStatus() {
+		return status;
+	}
+
+	public int getExitCode() {
+		return exitCode;
+	}
+
+	private void reset() {
+		fInStream = null;
+		fOutStream = null;
+		fErrStream = null;
+
+		remoteShellProcess = null;
+		exitCode = 0;
+		status = STATE_NULL;
+	}
+
+	public InputStream getInputStream() {
+        return fInStream;
+    }
+
+    public OutputStream getOutputStream() {
+        return fOutStream;
+    }
+
+    public InputStream getErrStream() {
+        return fErrStream;
+    }
+
+	public synchronized void start(String prelaunchCmd, String argument, IProgressMonitor monitor) throws Exception {
+		if(status == STATE_RUNNING)
+				return;
+
+		reset();
+		argument = (argument == null ? RETURN_VALUE_CMD : argument + RETURN_VALUE_CMD);
+		remoteShellProcess = RSEHelper.remoteShellExec(this.host, prelaunchCmd, this.command, argument, monitor);
+		fInStream = remoteShellProcess.getInputStream();
+		fOutStream = remoteShellProcess.getOutputStream();
+		fErrStream = remoteShellProcess.getErrorStream();
+		status = STATE_RUNNING;
+	}
+
+	 public synchronized void terminate() throws Exception {
+		 if(status != STATE_RUNNING || remoteShellProcess != null)
+			 return;
+
+		 remoteShellProcess.destroy();
+		 reset();
+	 }
+
+	 public int waitFor(IProgressMonitor monitor) throws InterruptedException {
+		 while(status == STATE_RUNNING) {
+			 if(monitor != null) {
+	    			if(monitor.isCanceled()) {
+	    				throw new InterruptedException("User Cancelled");
+	    			}
+ 			 }
+
+			 try {
+				 remoteShellProcess.waitFor();
+			 }catch(InterruptedException e){
+				 //get the return value
+				 try {
+					 if(fInStream.available() != 0) {
+						 BufferedReader in = new BufferedReader(new InputStreamReader(fInStream));
+						 String thisline;
+						 int idx;
+						 while((thisline = in.readLine()) != null) {
+							    if(thisline.indexOf(RETURN_VALUE_CMD) == -1) {
+									idx = thisline.indexOf(RETURN_VALUE_TAG);
+									if(idx != -1) {
+										try {
+											exitCode=(new Integer(thisline.substring(idx+RETURN_VALUE_TAG.length()))).intValue();
+										}catch(NumberFormatException e2) {
+										}
+										break;
+									}
+							    }
+						 }
+					 }
+				 }catch(IOException e1) {
+					 //do nothing
+				 }
+			 }finally {
+				 status=STATE_EXITED;
+			 }
+		 }
+		 return exitCode;
+	 }
+}
+
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/BaseModel.java +1 -1
index 08cb873..dacd192 100644
@@ -19,7 +19,7 @@ import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.rse.core.model.IHost;
 import org.yocto.remote.utils.RSEHelper;
-import org.yocto.sdk.remotetools.remote.RemoteShellExec;
+import org.yocto.remote.utils.RemoteShellExec;
 
 abstract public class BaseModel implements IRunnableWithProgress {
 	protected IHost host;
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/remote/RemoteShellExec.java deleted +0 -149

149 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 4/6 Move ShellSession to org.yocto.remote.utils separate plugin

In reply to Ioana Grigoropol

- ShellSession is used as a wrapper for a remote shell used for running commands on a remote machine with bitbake environment
- move ShellSession org.yocto.remote.plugin since it is part of remote utilities
- remove shell session class from remotetools plugin
- modify org.yocto.sdk.remotetools to use implementation from org.yocto.remote.utils

---
 .../src/org/yocto/remote/utils/ShellSession.java   |  327 +++++++++++++++++++
 .../org/yocto/sdk/remotetools/ShellSession.java    |  341 --------------------
 .../sdk/remotetools/actions/SystemtapModel.java    |    2 +-
 3 files changed, 328 insertions(+), 342 deletions(-)
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/ShellSession.java
plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java new file +327 -0
new file mode 100644
index 0000000..751933f
@@ -0,0 +1,327 @@
+/*****************************************************************************
+ * Copyright (c) 2009 Ken Gilmer
+ * 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:
+ *     Ken Gilmer - initial API and implementation
+ *     Jessica Zhang - Adopt for Yocto Tools plugin
+ *******************************************************************************/
+package org.yocto.remote.utils;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+
+public class ShellSession {
+	/**
+	 * Bash shell
+	 */
+	public static final int SHELL_TYPE_BASH = 1;
+	/**
+	 * sh shell
+	 */
+	public static final int SHELL_TYPE_SH = 2;
+	private volatile boolean interrupt = false;
+	/**
+	 * String used to isolate command execution
+	 */
+	public static final String TERMINATOR = "build$";
+	public static final String LT = System.getProperty("line.separator");
+	private Process process;
+
+	private OutputStream pos = null;
+
+	private String shellPath = null;
+	private final String initCmd;
+	private final File root;
+
+	private OutputStreamWriter out;
+
+	public static String getFilePath(String file) throws IOException {
+		File f = new File(file);
+
+		if (!f.exists() || f.isDirectory()) {
+			throw new IOException("Path passed is not a file: " + file);
+		}
+
+		StringBuffer sb = new StringBuffer();
+
+		String elems[] = file.split(File.separator);
+
+		for (int i = 0; i < elems.length - 1; ++i) {
+			sb.append(elems[i]);
+			sb.append(File.separator);
+		}
+
+		return sb.toString();
+	}
+
+	public ShellSession(int shellType, File root, String initCmd, OutputStream out) throws IOException {
+		this.root = root;
+		this.initCmd  = initCmd;
+		if (out == null) {
+			this.out = new OutputStreamWriter(null);
+		} else {
+			this.out = new OutputStreamWriter(out);
+		}
+		if (shellType == SHELL_TYPE_SH) {
+			shellPath = "/bin/sh";
+		}
+		shellPath  = "/bin/bash";
+
+		initializeShell();
+	}
+
+	private void initializeShell() throws IOException {
+		process = Runtime.getRuntime().exec(shellPath);
+		pos = process.getOutputStream();
+
+		if (root != null) {
+			execute("cd " + root.getAbsolutePath());
+		}
+
+		if (initCmd != null) {
+			execute("source " + initCmd);
+		}
+	}
+
+	synchronized
+	public String execute(String command, int[] retCode) throws IOException {
+		String errorMessage = null;
+
+		interrupt = false;
+		out.write(command);
+		out.write(LT);
+
+		sendToProcessAndTerminate(command);
+
+		if (process.getErrorStream().available() > 0) {
+			byte[] msg = new byte[process.getErrorStream().available()];
+
+			process.getErrorStream().read(msg, 0, msg.length);
+			String msg_str = new String(msg);
+			out.write(msg_str);
+			out.write(LT);
+			if (!msg_str.contains("WARNING"))
+				errorMessage = "Error while executing: " + command + LT + new String(msg);
+		}
+
+		BufferedReader br = new BufferedReader(new InputStreamReader(process
+				.getInputStream()));
+
+		StringBuffer sb = new StringBuffer();
+		String line = null;
+
+		while (true) {
+			line = br.readLine();
+			if (line != null) {
+				sb.append(line);
+				sb.append(LT);
+				out.write(line);
+				out.write(LT);
+			}
+			if (line.endsWith(TERMINATOR))
+				break;
+		}
+ 		if (interrupt) {
+			process.destroy();
+			initializeShell();
+			interrupt = false;
+		}else if (line != null && retCode != null) {
+			try {
+				retCode[0]=Integer.parseInt(line.substring(0,line.lastIndexOf(TERMINATOR)));
+			}catch (NumberFormatException e) {
+				throw new IOException("Can NOT get return code" + command + LT + line);
+			}
+		}
+		out.flush();
+		if (errorMessage != null) {
+			throw new IOException(errorMessage);
+		}
+		return sb.toString();
+	}
+
+	synchronized
+	public void execute(String command) throws IOException {
+		interrupt = false;
+		String errorMessage = null;
+
+		sendToProcessAndTerminate(command);
+		boolean cancel = false;
+		try {
+			InputStream is = process.getInputStream();
+			InputStream es = process.getErrorStream();
+			String info;
+			while (!cancel) {
+				info = null;
+				StringBuffer buffer = new StringBuffer();
+				int c;
+				while (is.available() > 0) {
+					c = is.read();
+					char ch = (char) c;
+					buffer.append(ch);
+					if (ch == '\n') {
+						info = buffer.toString();
+						if (!info.trim().endsWith(TERMINATOR)) {
+							out.write(info);
+							out.write(LT);
+							buffer.delete(0, buffer.length());
+						} else {
+							cancel = true;
+							break;
+						}
+					}
+				}
+				while (es.available() > 0) {
+					c = es.read();
+					char ch = (char) c;
+					buffer.append(ch);
+					if (ch == '\n') {
+						info = buffer.toString();
+						if (!info.contains("WARNING"))
+							errorMessage += info;
+						out.write(info);
+						out.write(LT);
+						buffer.delete(0, buffer.length());
+					}
+				}
+			}
+		} catch (IOException e) {
+			try {
+				throw new InvocationTargetException(e);
+			} catch (InvocationTargetException e1) {
+				e1.printStackTrace();
+			}
+		}
+		out.flush();
+		if (errorMessage != null) {
+			throw new IOException(errorMessage);
+		}
+		if (interrupt) {
+			process.destroy();
+			initializeShell();
+			interrupt = false;
+		}
+	}
+	synchronized
+	public boolean ensureKnownHostKey(String user, String host) throws IOException {
+
+		boolean loadKeysMatch = false;
+		boolean accepted = false;
+		Process proc = Runtime.getRuntime().exec("ssh -o LogLevel=DEBUG3 " + user + "@" + host);
+		Pattern patternLoad = Pattern.compile("^debug3: load_hostkeys: loaded (\\d+) keys");
+		Pattern patternAuthSucceeded = Pattern.compile("^debug1: Authentication succeeded.*");
+
+		try {
+			InputStream es = proc.getErrorStream();
+			String info;
+			while (!loadKeysMatch) {
+				info = null;
+				StringBuffer buffer = new StringBuffer();
+				int c;
+				while (es.available() > 0) {
+					c = es.read();
+					char ch = (char) c;
+					buffer.append(ch);
+					if (ch == '\r') {
+						info = buffer.toString().trim();
+						Matcher m = patternLoad.matcher(info);
+						if(m.matches()) {
+							int keys = new Integer(m.group(1));
+							if (keys == 0) {
+								proc.destroy();
+								accepted = MessageDialog.openQuestion(null, "Host authenticity", "The authenticity of host '" + host + "(" + host + ")' can't be established.\nAre you sure you want to continue connecting ?");
+								if (accepted){
+									proc = Runtime.getRuntime().exec("ssh -o StrictHostKeyChecking=no " + user + "@" + host);//add host key to known_hosts
+									try {
+										Thread.sleep(2000); //wait for process to finish
+									} catch (InterruptedException e) {
+										e.printStackTrace();
+									}
+									proc.destroy();
+								} else {
+									MessageDialog.openError(null, "Host authenticity", "Host key verification failed.");
+								}
+							} else {
+								String errorMsg = "";
+								// wait to check if key is the same and authentication succeeds
+								while (es.available() > 0) {
+									c = es.read();
+									ch = (char) c;
+									buffer.append(ch);
+									if (ch == '\r') {
+										info = buffer.toString().trim();
+										Matcher mAuthS = patternAuthSucceeded.matcher(info);
+										if(mAuthS.matches()) {
+											accepted = true;
+											break;
+										} else {
+											if (!info.startsWith("debug"))
+												errorMsg += info + "\n";
+										}
+										try {
+											Thread.sleep(100);
+										} catch (InterruptedException e) {
+											// TODO Auto-generated catch block
+											e.printStackTrace();
+										}
+										buffer.delete(0, buffer.length());
+									}
+								}
+								if (!accepted && !errorMsg.isEmpty())
+									MessageDialog.openError(null, "Host authenticity", errorMsg);
+							}
+							loadKeysMatch = true;
+							break;
+						}
+						buffer.delete(0, buffer.length());
+					}
+				}
+			}
+			es.close();
+		} catch (IOException e) {
+			try {
+				throw new InvocationTargetException(e);
+			} catch (InvocationTargetException e1) {
+				e1.printStackTrace();
+			}
+		}
+		return accepted;
+	}
+
+	/**
+	 * Send command string to shell process and add special terminator string so
+	 * reader knows when output is complete.
+	 *
+	 * @param command
+	 * @throws IOException
+	 */
+	private void sendToProcessAndTerminate(String command) throws IOException {
+		pos.write(command.getBytes());
+		pos.write(LT.getBytes());
+		pos.flush();
+		pos.write("echo $?".getBytes());
+		pos.write(TERMINATOR.getBytes());
+		pos.write(LT.getBytes());
+		pos.flush();
+	}
+
+	/**
+	 * Interrupt any running processes.
+	 */
+	public void interrupt() {
+		interrupt = true;
+	}
+}
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/ShellSession.java deleted +0 -341

341 lines not on this page · raw message

plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapModel.java +1 -1
index ed8960d..f443e00 100644
@@ -19,7 +19,7 @@ import org.eclipse.ui.console.ConsolePlugin;
 import org.eclipse.ui.console.IConsole;
 import org.eclipse.ui.console.IConsoleManager;
 import org.eclipse.ui.console.MessageConsole;
-import org.yocto.sdk.remotetools.ShellSession;
+import org.yocto.remote.utils.ShellSession;
 
 public class SystemtapModel extends BaseModel {
 	protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env";
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 5/6 Move CommonHelper to org.yocto.remote.utils separate plugin

In reply to Ioana Grigoropol

- common helper is better suited to org.yocto.remote.utils since it is used for:
- running commands
- displaying error dialogs
- remove common helper from remote tools plugin and add it to a separated plugin
- modify org.yocto.sdk.remotetools to use implementation from org.yocto.remote.utils

---
 .../src/org/yocto/remote/utils/CommonHelper.java   |   46 ++++++++++++++++++++
 .../org/yocto/sdk/remotetools/CommonHelper.java    |   44 -------------------
 .../sdk/remotetools/actions/OprofileModel.java     |    2 +-
 .../actions/SystemtapSettingDialog.java            |    2 +-
 .../sdk/remotetools/actions/TerminalHandler.java   |    2 +-
 5 files changed, 49 insertions(+), 47 deletions(-)
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/CommonHelper.java
plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java new file +46 -0
new file mode 100644
index 0000000..c01e866
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Intel Corporation.
+ * 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:
+ * Intel - initial API and implementation
+ *******************************************************************************/
+package org.yocto.remote.utils;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.widgets.Display;
+
+public class CommonHelper {
+
+	static public boolean isExecAvail(String exec) {
+		boolean ret = false;
+		try {
+			Process p = Runtime.getRuntime().exec(new String[] {"which", exec});
+			p.waitFor();
+			if(p.exitValue() == 0) {
+				ret = true;
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return ret;
+	}
+
+	public static void showErrorDialog(final String dialogTitle, final String errorMessage, final String reason) {
+		//needs to be run in the ui thread otherwise swt throws invalid thread access
+		Display.getDefault().syncExec(new Runnable() {
+			@Override
+			public void run() {
+				ErrorDialog.openError(null, dialogTitle, errorMessage,
+						new Status(IStatus.ERROR,Activator.PLUGIN_ID,reason));
+			}
+		});
+
+	}
+
+}
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/CommonHelper.java deleted +0 -44

44 lines not on this page · raw message

plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/OprofileModel.java +1 -1
index c125df7..7fbe7c6 100644
@@ -21,9 +21,9 @@ import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.rse.core.model.IHost;
 import org.eclipse.ui.IWorkbenchWindow;
+import org.yocto.remote.utils.CommonHelper;
 import org.yocto.sdk.ide.YoctoSDKPlugin;
 import org.yocto.sdk.ide.preferences.PreferenceConstants;
-import org.yocto.sdk.remotetools.CommonHelper;
 import org.yocto.sdk.remotetools.LocalJob;
 import org.yocto.sdk.remotetools.Messages;
 
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SystemtapSettingDialog.java +1 -1
index 8b4703c..c447569 100644
@@ -27,8 +27,8 @@ import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
+import org.yocto.remote.utils.CommonHelper;
 import org.yocto.sdk.remotetools.Activator;
-import org.yocto.sdk.remotetools.CommonHelper;
 import org.yocto.sdk.remotetools.Messages;
 import org.yocto.sdk.remotetools.SWTFactory;
 
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/TerminalHandler.java +1 -1
index 4ad8688..ae04dc9 100644
@@ -33,8 +33,8 @@ import org.eclipse.swt.events.DisposeListener;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
 import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector;
+import org.yocto.remote.utils.CommonHelper;
 import org.yocto.remote.utils.RSEHelper;
-import org.yocto.sdk.remotetools.CommonHelper;
 
 abstract public class TerminalHandler extends AbstractHandler {
 	
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 6/6 Move TerminalHandler to org.yocto.remote.utils

In reply to Ioana Grigoropol

- move TerminalHandler to separate plugin since it performs actions that are best suited for remote utilities
- remove TerminalHandler from remotetools plugin
- modify org.yocto.sdk.remotetools to use implementation from org.yocto.remote.utils

---
 .../org.yocto.remote.utils/META-INF/MANIFEST.MF    |    9 +-
 .../org/yocto/remote/utils/TerminalHandler.java    |  128 ++++++++++++++++++++
 .../sdk/remotetools/actions/DialogHandler.java     |    1 +
 .../sdk/remotetools/actions/TerminalHandler.java   |  128 --------------------
 4 files changed, 137 insertions(+), 129 deletions(-)
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/TerminalHandler.java
plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF +8 -1
index 6c4fb35..a9b65f7 100644
@@ -11,11 +11,18 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Import-Package: org.eclipse.rse.core,
  org.eclipse.rse.core.model,
  org.eclipse.rse.core.subsystems,
+ org.eclipse.rse.internal.terminals.ui,
+ org.eclipse.rse.internal.terminals.ui.views,
  org.eclipse.rse.services,
  org.eclipse.rse.services.files,
  org.eclipse.rse.services.shells,
+ org.eclipse.rse.services.terminals,
  org.eclipse.rse.subsystems.files.core.servicesubsystem,
  org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem,
- org.eclipse.rse.subsystems.terminals.core
+ org.eclipse.rse.subsystems.terminals.core,
+ org.eclipse.rse.subsystems.terminals.core.elements,
+ org.eclipse.rse.ui,
+ org.eclipse.tm.internal.terminal.control,
+ org.eclipse.tm.internal.terminal.provisional.api
 Export-Package: org.yocto.remote.utils
 >>>>>>> 2504c89... Move RSEHelper to a separate plugin
plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java new file +128 -0

128 lines not on this page · raw message

plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/DialogHandler.java +1 -0
index 67d33ba..5031e70 100644
@@ -15,6 +15,7 @@ import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.rse.core.model.IHost;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.handlers.HandlerUtil;
+import org.yocto.remote.utils.TerminalHandler;
 
 abstract public class DialogHandler extends TerminalHandler {
 
plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/TerminalHandler.java deleted +0 -128

128 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#8 lore raw
In reply to Ioana Grigoropol

Please fix your license to 2013.

Thanks,
Jessica

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ioana Grigoropol
Sent: Thursday, May 09, 2013 2:19 PM
To: [email protected]
Subject: [yocto] [PATCH 0/6] Separate org.yocto.remote.utils plugin

- initial commit & populate for remote utils common plugin

Ioana Grigoropol (6):
Initial commit for separate remote utilities plugin Move RSEHelper to a separate plugin
Move RemoteShellExec to separate plugin
Move ShellSession to org.yocto.remote.utils separate plugin Move CommonHelper to org.yocto.remote.utils separate plugin Move TerminalHandler to org.yocto.remote.utils

 plugins/org.yocto.remote.utils/.classpath          |    7 +
 plugins/org.yocto.remote.utils/.project            |   28 ++
 .../.settings/org.eclipse.jdt.core.prefs           |    7 +
 .../org.yocto.remote.utils/META-INF/MANIFEST.MF    |   28 ++
 plugins/org.yocto.remote.utils/build.properties    |    4 +
 .../org.yocto.remote.utils/resources/ust_tar.sh    |   19 +
 .../org.yocto.remote.utils/resources/yocto_tool.sh |  125 ++++++
 .../org.yocto.remote.utils/resources/yocto_ust.sh  |   35 ++
 .../src/org/yocto/remote/utils/Activator.java      |   62 +++
 .../src/org/yocto/remote/utils/CommonHelper.java   |   46 +++
 .../src/org/yocto/remote/utils/Messages.java       |   35 ++
 .../src/org/yocto/remote/utils/RSEHelper.java      |  344 ++++++++++++++++
 .../org/yocto/remote/utils/RemoteShellExec.java    |  140 +++++++
 .../src/org/yocto/remote/utils/ShellSession.java   |  327 +++++++++++++++
 .../org/yocto/remote/utils/TerminalHandler.java    |  128 ++++++
 .../org.yocto.sdk.remotetools/META-INF/MANIFEST.MF |    3 +-
 .../org.yocto.sdk.remotetools/resources/ust_tar.sh |   19 -
 .../resources/yocto_tool.sh                        |  125 ------
 .../resources/yocto_ust.sh                         |   35 --
 .../org/yocto/sdk/remotetools/CommonHelper.java    |   44 --
 .../src/org/yocto/sdk/remotetools/RSEHelper.java   |  419 --------------------
 .../org/yocto/sdk/remotetools/ShellSession.java    |  341 ----------------
 .../yocto/sdk/remotetools/actions/BaseModel.java   |    4 +-
 .../sdk/remotetools/actions/BaseSettingDialog.java |    2 +-
 .../sdk/remotetools/actions/DialogHandler.java     |    1 +
 .../sdk/remotetools/actions/OprofileModel.java     |    2 +-
 .../sdk/remotetools/actions/SystemtapModel.java    |    2 +-
 .../actions/SystemtapSettingDialog.java            |    2 +-
 .../sdk/remotetools/actions/TerminalHandler.java   |  128 ------
 .../sdk/remotetools/remote/RemoteShellExec.java    |  149 -------
 30 files changed, 1344 insertions(+), 1267 deletions(-)  create mode 100644 plugins/org.yocto.remote.utils/.classpath
 create mode 100644 plugins/org.yocto.remote.utils/.project
 create mode 100644 plugins/org.yocto.remote.utils/.settings/org.eclipse.jdt.core.prefs
 create mode 100644 plugins/org.yocto.remote.utils/META-INF/MANIFEST.MF
 create mode 100644 plugins/org.yocto.remote.utils/build.properties
 create mode 100755 plugins/org.yocto.remote.utils/resources/ust_tar.sh
 create mode 100755 plugins/org.yocto.remote.utils/resources/yocto_tool.sh
 create mode 100755 plugins/org.yocto.remote.utils/resources/yocto_ust.sh
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Activator.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/CommonHelper.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/Messages.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RSEHelper.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/RemoteShellExec.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/ShellSession.java
 create mode 100644 plugins/org.yocto.remote.utils/src/org/yocto/remote/utils/TerminalHandler.java
 delete mode 100755 plugins/org.yocto.sdk.remotetools/resources/ust_tar.sh
 delete mode 100755 plugins/org.yocto.sdk.remotetools/resources/yocto_tool.sh
 delete mode 100755 plugins/org.yocto.sdk.remotetools/resources/yocto_ust.sh
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/CommonHelper.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/RSEHelper.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/ShellSession.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/TerminalHandler.java
 delete mode 100644 plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/remote/RemoteShellExec.java

--
1.7.9.5

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto