Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2008-02-25 18:27:10 -0500
committereutarass2008-02-25 18:27:10 -0500
commit94fbe6cda0f6ddb394b08594e49ffa6de7d87d33 (patch)
treea25f9d8b653234d12553a20bd01eec172a6d844f /examples
parent521178c66ba2989ab837a9d7bb1c4a75216cfde2 (diff)
downloadorg.eclipse.tcf-94fbe6cda0f6ddb394b08594e49ffa6de7d87d33.tar.gz
org.eclipse.tcf-94fbe6cda0f6ddb394b08594e49ffa6de7d87d33.tar.xz
org.eclipse.tcf-94fbe6cda0f6ddb394b08594e49ffa6de7d87d33.zip
Added example agent project: examples/org.eclipse.tm.tcf.examples.daytime.agent.
Renamed agent/memory.[hc] to agent/memoryservice.[hc] to avoid conflict with standard header file.
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/.cproject209
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/.project77
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile30
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/config.h65
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.c60
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.h23
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime/.classpath14
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime/.project56
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime/build.properties12
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/Activator.java98
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/DaytimeServiceProxy.java128
-rw-r--r--examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/IDaytimeService.java84
12 files changed, 660 insertions, 196 deletions
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/.cproject b/examples/org.eclipse.tm.tcf.examples.daytime.agent/.cproject
new file mode 100644
index 000000000..29f2c4a3a
--- /dev/null
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/.cproject
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="0.1030292515">
+<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1030292515" moduleId="org.eclipse.cdt.core.settings" name="Default">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<configuration artifactName="org.eclipse.tm.tcf.examples.daytime.agent" buildProperties="" description="" id="0.1030292515" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+<folderInfo id="0.1030292515." name="/" resourcePath="">
+<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.646171937" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
+<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.646171937.252390378" name=""/>
+<builder id="org.eclipse.cdt.build.core.settings.default.builder.1220803001" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
+<tool id="org.eclipse.cdt.build.core.settings.holder.libs.997801155" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
+<tool id="org.eclipse.cdt.build.core.settings.holder.57900273" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
+<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1447522501" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+</tool>
+<tool id="org.eclipse.cdt.build.core.settings.holder.959540451" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
+<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1941675218" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+</tool>
+<tool id="org.eclipse.cdt.build.core.settings.holder.169557224" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
+<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1296401318" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
+</tool>
+</toolChain>
+</folderInfo>
+</configuration>
+</storageModule>
+<storageModule moduleId="scannerConfiguration">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<scannerConfigBuildInfo instanceId="0.1030292515">
+<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="makefileGenerator">
+<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC">
+<buildOutputProvider>
+<openAction enabled="true" filePath=""/>
+<parser enabled="true"/>
+</buildOutputProvider>
+<scannerInfoProvider id="specsFile">
+<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/>
+<parser enabled="true"/>
+</scannerInfoProvider>
+</profile>
+</scannerConfigBuildInfo>
+</storageModule>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+<project id="org.eclipse.tm.tcf.examples.daytime.agent.null.744502123" name="org.eclipse.tm.tcf.examples.daytime.agent"/>
+</storageModule>
+</cproject>
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/.project b/examples/org.eclipse.tm.tcf.examples.daytime.agent/.project
new file mode 100644
index 000000000..ff60b2db8
--- /dev/null
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/.project
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tm.tcf.examples.daytime.agent</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <triggers>clean,full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+ <value>clean</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>?name?</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.append_environment</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildCommand</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.contents</key>
+ <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildArguments</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+ <value>all</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ </natures>
+</projectDescription>
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile b/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile
new file mode 100644
index 000000000..64d3ba729
--- /dev/null
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/Makefile
@@ -0,0 +1,30 @@
+CC=gcc
+CFLAGS=-O -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -I. -I../../agent -I-
+
+CFILES=$(basename $(wildcard *.c)) $(basename $(notdir $(wildcard ../../agent/*.c)))
+OFILES=$(filter-out main%.o, $(addsuffix .o, $(CFILES)))
+HFILES=$(wildcard *.h) $(wildcard ../../agent/*.h) Makefile
+
+EXES=agent
+
+UNAME=$(shell uname -o)
+
+ifeq ($(UNAME),Cygwin)
+LIBS=-lpthread -lws2_32
+else
+LIBS=-lpthread -lrt -lelf
+endif
+
+all: $(EXES)
+
+agent: main.o $(OFILES)
+ $(CC) $(CFLAGS) -o $@ main.o $(OFILES) $(LIBS)
+
+%.o: %.c $(HFILES)
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+%.o: ../../agent/%.c $(HFILES)
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f *.o $(EXES)
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/config.h b/examples/org.eclipse.tm.tcf.examples.daytime.agent/config.h
new file mode 100644
index 000000000..eff8d739e
--- /dev/null
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/config.h
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+
+/*
+ * This file contains "define" statements that control agent configuration.
+ * SERVICE_* definitions control which service implementations are included into the agent.
+ *
+ * This is example agent configuration. It includes only few standard services,
+ * and one example service: Day Time.
+ */
+
+#ifndef D_config
+#define D_config
+
+#if defined(WIN32) || defined(__CYGWIN__)
+# define TARGET_WINDOWS 1
+# define TARGET_VXWORKS 0
+# define TARGET_UNIX 0
+#elif defined(_WRS_KERNEL)
+# define TARGET_WINDOWS 0
+# define TARGET_VXWORKS 1
+# define TARGET_UNIX 0
+#else
+# define TARGET_WINDOWS 0
+# define TARGET_VXWORKS 0
+# define TARGET_UNIX 1
+#endif
+
+#define SERVICE_FileSystem 1
+#define SERVICE_SysMonitor TARGET_UNIX
+
+#endif
+
+#ifdef CONFIG_MAIN
+/*
+ * This part of config.h contains services initialization code,
+ * which is executed during agent startup.
+ */
+
+#include "filesystem.h"
+#include "sysmon.h"
+#include "diagnostics.h"
+#include "daytime.h"
+
+static void ini_services(Protocol * proto, TCFBroadcastGroup * bcg, TCFSuspendGroup * spg) {
+#if SERVICE_FileSystem
+ ini_file_system_service(proto);
+#endif
+#if SERVICE_SysMonitor
+ ini_sys_mon_service(proto);
+#endif
+ ini_diagnostics_service(proto);
+ ini_daytime_service(proto);
+}
+
+#endif
+
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.c b/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.c
new file mode 100644
index 000000000..73f672a5d
--- /dev/null
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.c
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+
+/*
+ * Sample TCF service implementation.
+ */
+
+#include <time.h>
+#include "daytime.h"
+#include "json.h"
+#include "errors.h"
+
+static const char * DAYTIME = "Daytime";
+
+static void command_get_time_of_day(char * token, Channel * c) {
+ char str[0x100];
+ char res[0x100];
+ time_t t;
+
+ // Read command argumnet: string TZ - time zone name
+ json_read_string(&c->inp, str, sizeof(str));
+ // Each JSON encoded argument should end with zero byte
+ if (c->inp.read(&c->inp) != 0) exception(ERR_JSON_SYNTAX);
+ // Done reading arguments.
+ // The command message should end with MARKER_EOM (End Of Message)
+ if (c->inp.read(&c->inp) != MARKER_EOM) exception(ERR_JSON_SYNTAX);
+
+ // Execute the command: retrieve current time as a string.
+ // Note: we ignore command argument for simplicity,
+ // a real command handler should do something better then that.
+ time(&t);
+ strcpy(res, ctime(&t));
+
+ // Start reply message with zero terminated string "R"
+ write_stringz(&c->out, "R");
+ // Send back the command token
+ write_stringz(&c->out, token);
+ // Send reply data
+ json_write_string(&c->out, res);
+ // JSON encoded data should end with zero byte
+ c->out.write(&c->out, 0);
+ // Done sending reply data.
+ // The reply message should end with MARKER_EOM (End Of Message)
+ c->out.write(&c->out, MARKER_EOM);
+ // Done sending reply message.
+ // Command handling is complete.
+}
+
+void ini_daytime_service(Protocol * proto) {
+ // Install command handler
+ add_command_handler(proto, DAYTIME, "getTimeOfDay", command_get_time_of_day);
+}
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.h b/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.h
new file mode 100644
index 000000000..c65fd1339
--- /dev/null
+++ b/examples/org.eclipse.tm.tcf.examples.daytime.agent/daytime.h
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
+ * 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+
+/*
+ * Sample TCF service header file.
+ */
+
+#ifndef DAYTIME_H_
+#define DAYTIME_H_
+
+#include "protocol.h"
+
+extern void ini_daytime_service(Protocol * proto);
+
+#endif /*DAYTIME_H_*/
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime/.classpath b/examples/org.eclipse.tm.tcf.examples.daytime/.classpath
index 021596729..751c8f2e5 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime/.classpath
+++ b/examples/org.eclipse.tm.tcf.examples.daytime/.classpath
@@ -1,7 +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>
+<?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/org.eclipse.tm.tcf.examples.daytime/.project b/examples/org.eclipse.tm.tcf.examples.daytime/.project
index d9c4d399a..0dbc2599c 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime/.project
+++ b/examples/org.eclipse.tm.tcf.examples.daytime/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tm.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>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tm.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/org.eclipse.tm.tcf.examples.daytime/build.properties b/examples/org.eclipse.tm.tcf.examples.daytime/build.properties
index 2d5759904..786b1df93 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime/build.properties
+++ b/examples/org.eclipse.tm.tcf.examples.daytime/build.properties
@@ -1,6 +1,6 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html
diff --git a/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/Activator.java b/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/Activator.java
index 1d2b74ae8..6dd916def 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/Activator.java
+++ b/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/Activator.java
@@ -1,49 +1,49 @@
-package org.eclipse.tm.internal.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 = "org.eclipse.tm.tcf.examples.daytime";
-
- // 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;
- }
-}
+package org.eclipse.tm.internal.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 = "org.eclipse.tm.tcf.examples.daytime";
+
+ // 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/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/DaytimeServiceProxy.java b/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/DaytimeServiceProxy.java
index 066fea0a2..246f832ca 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/DaytimeServiceProxy.java
+++ b/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/DaytimeServiceProxy.java
@@ -1,64 +1,64 @@
-package org.eclipse.tm.internal.tcf.examples.daytime;
-
-import org.eclipse.tm.tcf.core.Command;
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.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 "org.eclipse.tm.tcf.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));
- }
- });
- }
-}
+package org.eclipse.tm.internal.tcf.examples.daytime;
+
+import org.eclipse.tm.tcf.core.Command;
+import org.eclipse.tm.tcf.protocol.IChannel;
+import org.eclipse.tm.tcf.protocol.IToken;
+import org.eclipse.tm.tcf.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 "org.eclipse.tm.tcf.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/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/IDaytimeService.java b/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/IDaytimeService.java
index cc8edbb30..cc13f60d9 100644
--- a/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/IDaytimeService.java
+++ b/examples/org.eclipse.tm.tcf.examples.daytime/src/org/eclipse/tm/internal/tcf/examples/daytime/IDaytimeService.java
@@ -1,42 +1,42 @@
-package org.eclipse.tm.internal.tcf.examples.daytime;
-
-import org.eclipse.tm.tcf.protocol.IService;
-import org.eclipse.tm.tcf.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);
- }
-}
+package org.eclipse.tm.internal.tcf.examples.daytime;
+
+import org.eclipse.tm.tcf.protocol.IService;
+import org.eclipse.tm.tcf.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