Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2008-02-15 21:45:25 +0000
committereutarass2008-02-15 21:45:25 +0000
commit5ac36a50b1e59e1c89d7f8c4a549f52205928f66 (patch)
tree9cd06cefbc27700422054a451bf990a14462d711 /examples
parent6459bb640308817d92790bb1b7b61348c5418ba8 (diff)
downloadorg.eclipse.tcf-5ac36a50b1e59e1c89d7f8c4a549f52205928f66.tar.gz
org.eclipse.tcf-5ac36a50b1e59e1c89d7f8c4a549f52205928f66.tar.xz
org.eclipse.tcf-5ac36a50b1e59e1c89d7f8c4a549f52205928f66.zip
The new version 0.2.0 of Target Communication Framework has major improvements
in several areas: 1. Target agent improvements: a. Generic communication and discovery code is separated from TCP/IP specific code. Now the agent can support multiple transport protocols simultaneously. b. Multiple agents can run on same host. One of them is automatically elected to be a master discovery server. c. Agent now can have different sets of services on different server sockets. 2. TCF debugger prototype is reworked in order to improve remote data caching logic. Now, for example, stack frame attributes, like source code position, are reused from cache when a thread is suspended; only frames that did not change during thread execution are reused - usually bottom part of a stack. 3. DSF/TCF integration is extended to include TCF implementation of several DSF services. 4. Many bugs are fixed in the code.
Diffstat (limited to 'examples')
-rw-r--r--examples/com.windriver.tcf.examples.daytime/.classpath7
-rw-r--r--examples/com.windriver.tcf.examples.daytime/.project28
-rw-r--r--examples/com.windriver.tcf.examples.daytime/META-INF/MANIFEST.MF11
-rw-r--r--examples/com.windriver.tcf.examples.daytime/about.html28
-rw-r--r--examples/com.windriver.tcf.examples.daytime/build.properties6
-rw-r--r--examples/com.windriver.tcf.examples.daytime/plugin.xml9
-rw-r--r--examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/Activator.java49
-rw-r--r--examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/DaytimeServiceProxy.java63
-rw-r--r--examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/IDaytimeService.java42
9 files changed, 243 insertions, 0 deletions
diff --git a/examples/com.windriver.tcf.examples.daytime/.classpath b/examples/com.windriver.tcf.examples.daytime/.classpath
new file mode 100644
index 000000000..021596729
--- /dev/null
+++ b/examples/com.windriver.tcf.examples.daytime/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/examples/com.windriver.tcf.examples.daytime/.project b/examples/com.windriver.tcf.examples.daytime/.project
new file mode 100644
index 000000000..48540c766
--- /dev/null
+++ b/examples/com.windriver.tcf.examples.daytime/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>com.windriver.tcf.examples.daytime</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>
diff --git a/examples/com.windriver.tcf.examples.daytime/META-INF/MANIFEST.MF b/examples/com.windriver.tcf.examples.daytime/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..922606346
--- /dev/null
+++ b/examples/com.windriver.tcf.examples.daytime/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Examples Plug-in
+Bundle-SymbolicName: com.windriver.tcf.examples.daytime;singleton:=true
+Bundle-Version: 0.2.0
+Bundle-Activator: com.windriver.tcf.examples.daytime.Activator
+Bundle-Vendor: WINDRIVER
+Require-Bundle: org.eclipse.core.runtime,
+ com.windriver.tcf.api
+Eclipse-LazyStart: true
+Export-Package: com.windriver.tcf.examples.daytime
diff --git a/examples/com.windriver.tcf.examples.daytime/about.html b/examples/com.windriver.tcf.examples.daytime/about.html
new file mode 100644
index 000000000..6c5b3615b
--- /dev/null
+++ b/examples/com.windriver.tcf.examples.daytime/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>January 10, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/examples/com.windriver.tcf.examples.daytime/build.properties b/examples/com.windriver.tcf.examples.daytime/build.properties
new file mode 100644
index 000000000..2d5759904
--- /dev/null
+++ b/examples/com.windriver.tcf.examples.daytime/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/examples/com.windriver.tcf.examples.daytime/plugin.xml b/examples/com.windriver.tcf.examples.daytime/plugin.xml
new file mode 100644
index 000000000..649ea70dc
--- /dev/null
+++ b/examples/com.windriver.tcf.examples.daytime/plugin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension point="com.windriver.tcf.api.startup">
+ <class name="com.windriver.tcf.examples.daytime.DaytimeServiceProxy"/>
+ </extension>
+
+</plugin>
diff --git a/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/Activator.java b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/Activator.java
new file mode 100644
index 000000000..1b1ff794e
--- /dev/null
+++ b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/Activator.java
@@ -0,0 +1,49 @@
+package com.windriver.tcf.examples.daytime;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.windriver.tcf.examples";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#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;
+ }
+}
diff --git a/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/DaytimeServiceProxy.java b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/DaytimeServiceProxy.java
new file mode 100644
index 000000000..2bf385471
--- /dev/null
+++ b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/DaytimeServiceProxy.java
@@ -0,0 +1,63 @@
+package com.windriver.tcf.examples.daytime;
+
+import com.windriver.tcf.api.core.Command;
+import com.windriver.tcf.api.protocol.IChannel;
+import com.windriver.tcf.api.protocol.IToken;
+import com.windriver.tcf.api.protocol.Protocol;
+
+public class DaytimeServiceProxy implements IDaytimeService {
+
+ private final IChannel channel;
+
+ DaytimeServiceProxy(IChannel channel) {
+ this.channel = channel;
+ }
+
+ /**
+ * Return service name, as it appears on the wire - a TCF name of the service.
+ */
+ public String getName() {
+ return NAME;
+ }
+
+ /**
+ * The method translates arguments to JSON string and sends the command message
+ * to remote server. When response arrives, it is translated from JSON to
+ * Java object, which are used to call call-back object.
+ *
+ * The translation (marshaling) is done by using utility class Command.
+ */
+ public IToken getTimeOfDay(String tz, final DoneGetTimeOfDay done) {
+ return new Command(channel, this, "getTimeOfDay", new Object[]{ tz }) {
+ @Override
+ public void done(Exception error, Object[] args) {
+ String str = null;
+ if (error == null) {
+ assert args.length == 3;
+ error = toError(args[0], args[1]);
+ str = (String)args[2];
+ }
+ done.doneGetTimeOfDay(token, error, str);
+ }
+ }.token;
+ }
+
+ static {
+ /*
+ * Make Daytime Service proxy available to all potential clients by creating
+ * the proxy object every time a TCF communication channel is opened.
+ * Note: extension point "com.windriver.tcf.api.startup" is used to load this class
+ * at TCF startup time, so proxy factory is properly activated even if nobody
+ * import directly from this plugin.
+ */
+ Protocol.addChannelOpenListener(new Protocol.ChannelOpenListener() {
+
+ public void onChannelOpen(IChannel channel) {
+ // Check if remote server provides Daytime service
+ if (channel.getRemoteService(IDaytimeService.NAME) == null) return;
+ // Create service proxy
+ channel.setServiceProxy(IDaytimeService.class, new DaytimeServiceProxy(channel));
+ }
+ });
+ }
+}
diff --git a/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/IDaytimeService.java b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/IDaytimeService.java
new file mode 100644
index 000000000..a8cf242fe
--- /dev/null
+++ b/examples/com.windriver.tcf.examples.daytime/src/com/windriver/tcf/examples/daytime/IDaytimeService.java
@@ -0,0 +1,42 @@
+package com.windriver.tcf.examples.daytime;
+
+import com.windriver.tcf.api.protocol.IService;
+import com.windriver.tcf.api.protocol.IToken;
+
+/**
+ * IDaytimeService allows retrieving the time of day from a remote system.
+ */
+public interface IDaytimeService extends IService {
+
+ /**
+ * This service name, as it appears on the wire - a TCF name of the service.
+ */
+ public static final String NAME = "Daytime";
+
+ /**
+ * Retrieve the time of day from remote system.
+ * The method sends the command to remote server and returns -
+ * it does not wait for the server response. Instead a client should provide
+ * a call-back object that will be called when the server answers the command
+ * or when the command is aborted by communication error.
+ * @param tz - time zone name.
+ * @param done - a call-back object.
+ * @return a handle for the pending command. The handle can be used to cancel the command,
+ * and to match responses to requests - if same call-back object is used for
+ * multiple requests.
+ */
+ IToken getTimeOfDay(String tz, DoneGetTimeOfDay done);
+
+ /**
+ * Call-back interface for getTimeOfDay() command.
+ */
+ interface DoneGetTimeOfDay {
+ /**
+ * This method is called when getTimeOfDay() command is completed.
+ * @param token - pending command handle.
+ * @param error - null if the command is successful.
+ * @param str - a String of the form "01 MAR 2006 11:25:12 CET"
+ */
+ void doneGetTimeOfDay(IToken token, Exception error, String str);
+ }
+}

Back to the top