summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-01-17 08:01:20 (EST)
committerChristian Campo2008-01-17 08:01:20 (EST)
commit1d86ae74f59bfc320d7455fbac68f59bc3b679fb (patch)
tree41293d940a3f04128a2b71fb82513779b96ac378
parentdc7deb1814ed05c7d349569d8139dfaf5c6886bf (diff)
downloadorg.eclipse.riena-1d86ae74f59bfc320d7455fbac68f59bc3b679fb.zip
org.eclipse.riena-1d86ae74f59bfc320d7455fbac68f59bc3b679fb.tar.gz
org.eclipse.riena-1d86ae74f59bfc320d7455fbac68f59bc3b679fb.tar.bz2
initial checkin
-rw-r--r--org.eclipse.riena.communication.console/.classpath7
-rw-r--r--org.eclipse.riena.communication.console/.project28
-rw-r--r--org.eclipse.riena.communication.console/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--org.eclipse.riena.communication.console/META-INF/MANIFEST.MF10
-rw-r--r--org.eclipse.riena.communication.console/about.html24
-rw-r--r--org.eclipse.riena.communication.console/build.properties4
-rw-r--r--org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/Activator.java65
-rw-r--r--org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/CommunicationConsole.java125
-rw-r--r--org.eclipse.riena.communication.core/.classpath7
-rw-r--r--org.eclipse.riena.communication.core/.project28
-rw-r--r--org.eclipse.riena.communication.core/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--org.eclipse.riena.communication.core/META-INF/MANIFEST.MF21
-rw-r--r--org.eclipse.riena.communication.core/about.html24
-rw-r--r--org.eclipse.riena.communication.core/build.properties6
-rw-r--r--org.eclipse.riena.communication.core/plugin.xml5
-rw-r--r--org.eclipse.riena.communication.core/readme.txt42
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceProtocol.java40
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceReference.java132
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceRegistration.java49
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceRegistry.java88
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/RemoteServiceDescription.java353
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/config/SymbolConfigPlugin.java81
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/IRemoteServiceFactory.java70
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceBuilder.java104
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactory.java351
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceReference.java190
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/AbstractHooksProxy.java139
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/CallContext.java79
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallHook.java21
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallMessageContext.java26
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallMessageContextAccessor.java18
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceHook.java21
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceMessageContext.java24
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceMessageContextAccessor.java17
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ServiceContext.java76
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/IServicePublishEventDispatcher.java38
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/IServicePublisher.java62
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/RSDPublisherProperties.java42
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/util/CommunicationUtil.java41
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java76
-rw-r--r--org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/factory/CallHooksProxy.java95
41 files changed, 2637 insertions, 0 deletions
diff --git a/org.eclipse.riena.communication.console/.classpath b/org.eclipse.riena.communication.console/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/org.eclipse.riena.communication.console/.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/org.eclipse.riena.communication.console/.project b/org.eclipse.riena.communication.console/.project
new file mode 100644
index 0000000..8913b20
--- /dev/null
+++ b/org.eclipse.riena.communication.console/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.riena.communication.console</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/org.eclipse.riena.communication.console/.settings/org.eclipse.pde.core.prefs b/org.eclipse.riena.communication.console/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 0000000..7f55240
--- /dev/null
+++ b/org.eclipse.riena.communication.console/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Mon Jun 18 16:45:37 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/org.eclipse.riena.communication.console/META-INF/MANIFEST.MF b/org.eclipse.riena.communication.console/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..19122c2
--- /dev/null
+++ b/org.eclipse.riena.communication.console/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Riena Communication Console (Incubation)
+Bundle-SymbolicName: org.eclipse.riena.communication.console
+Bundle-Version: 0.0.1
+Bundle-Activator: org.eclipse.riena.internal.communication.console.Activator
+Import-Package: org.osgi.framework;version="1.4.0"
+Require-Bundle: org.eclipse.riena.communication.core,
+ org.eclipse.osgi,
+ org.eclipse.riena.core
diff --git a/org.eclipse.riena.communication.console/about.html b/org.eclipse.riena.communication.console/about.html
new file mode 100644
index 0000000..fc81119
--- /dev/null
+++ b/org.eclipse.riena.communication.console/about.html
@@ -0,0 +1,24 @@
+<!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>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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>
+
+<div style="position: absolute; width: 28px; height: 28px; z-index: 1000; display: none;"></div><img style="position: absolute; width: 35px; height: 29px; z-index: 1000; display: none;" src="about-Dateien/launch.png"></body></html> \ No newline at end of file
diff --git a/org.eclipse.riena.communication.console/build.properties b/org.eclipse.riena.communication.console/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.eclipse.riena.communication.console/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/Activator.java b/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/Activator.java
new file mode 100644
index 0000000..677a264
--- /dev/null
+++ b/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/Activator.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.communication.console;
+
+import java.util.Hashtable;
+
+import org.eclipse.osgi.framework.console.CommandProvider;
+import org.eclipse.riena.communication.core.IRemoteServiceRegistry;
+import org.eclipse.riena.communication.core.publisher.IServicePublishEventDispatcher;
+import org.eclipse.riena.communication.core.publisher.RSDPublisherProperties;
+import org.eclipse.riena.core.service.ServiceInjector;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+
+public class Activator implements BundleActivator {
+
+ private ServiceRegistration consoleReg;
+ private ServiceInjector publisherInjector;
+ private ServiceInjector registryInjector;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ // register new OSGi command interpreter
+ CommunicationConsole console = new CommunicationConsole();
+ // the filter applies only if the service is living in this container
+ // e.g. server.
+ String filter = "(" + RSDPublisherProperties.PROP_IS_REMOTE + "=true)";
+ publisherInjector = new ServiceInjector(context, IServicePublishEventDispatcher.ID, filter, console, "bindServicePublisher",
+ "unbindServicePublisher");
+ publisherInjector.start();
+ registryInjector = new ServiceInjector(context, IRemoteServiceRegistry.ID, console, "bindServiceRegistry", "unbindServiceRegistry");
+ registryInjector.start();
+
+ consoleReg = context.registerService(CommandProvider.class.getName(), console, new Hashtable<String, String>());
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ publisherInjector.dispose();
+ publisherInjector = null;
+ registryInjector.dispose();
+ registryInjector = null;
+ consoleReg.unregister();
+ consoleReg = null;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/CommunicationConsole.java b/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/CommunicationConsole.java
new file mode 100644
index 0000000..8dca1c4
--- /dev/null
+++ b/org.eclipse.riena.communication.console/src/org/eclipse/riena/internal/communication/console/CommunicationConsole.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.communication.console;
+
+import java.util.List;
+
+import org.eclipse.osgi.framework.console.CommandInterpreter;
+import org.eclipse.osgi.framework.console.CommandProvider;
+import org.eclipse.riena.communication.core.IRemoteServiceReference;
+import org.eclipse.riena.communication.core.IRemoteServiceRegistration;
+import org.eclipse.riena.communication.core.IRemoteServiceRegistry;
+import org.eclipse.riena.communication.core.RemoteServiceDescription;
+import org.eclipse.riena.communication.core.publisher.IServicePublishEventDispatcher;
+
+public class CommunicationConsole implements CommandProvider {
+ IServicePublishEventDispatcher servicePublisher;
+ IRemoteServiceRegistry serviceRegistry;
+
+ public String getHelp() {
+ return "---riena communication---\n\tremotestatus - list all services";
+ }
+
+ public void _remotestatus(CommandInterpreter ci) throws Exception {
+ printToPublishServices();
+ printPublishedServices();
+ printRegisteredRemoteServices();
+
+ }
+
+ private void printToPublishServices() {
+ if (servicePublisher == null) {
+ return;
+ }
+ RemoteServiceDescription[] rsDescs = servicePublisher.getAllServices();
+
+ // boolean found = false;
+ for (RemoteServiceDescription rsDesc : rsDescs) {
+ if (rsDesc.getType() == RemoteServiceDescription.STATUS_UNREGISTERED) {
+ // found = true;
+ System.out.println("Riena:: not published end point=(" + rsDesc + ")");
+ }
+ }
+ // if (!found) {
+ // System.out.println("Riena:: no OSGi services to publish");
+ // return;
+ // }
+
+ }
+
+ private void printPublishedServices() {
+ if (servicePublisher == null) {
+ return;
+ }
+ RemoteServiceDescription[] rsDescs = servicePublisher.getAllServices();
+ boolean found = false;
+ for (RemoteServiceDescription rsDesc : rsDescs) {
+ if (rsDesc.getType() == RemoteServiceDescription.STATUS_REGISTERED) {
+ found = true;
+ System.out.println("Riena:: published end point=(" + rsDesc + ")");
+ }
+ }
+ if (!found) {
+ System.out.println("Riena:: no OSGi services published");
+ return;
+ }
+
+ }
+
+ private void printRegisteredRemoteServices() {
+ if (serviceRegistry == null) {
+ // System.out.println("Riena:: no OSGi services registered");
+ return;
+ }
+ List<IRemoteServiceRegistration> rsRegs = serviceRegistry.registeredServices("*");
+ if (rsRegs.size() == 0) {
+ System.out.println("Riena:: no Remote OSGi services registered");
+ return;
+ }
+ for (IRemoteServiceRegistration rsReg : rsRegs) {
+ IRemoteServiceReference rsRef = rsReg.getReference();
+ System.out.println("Riena:: registered remoteServiceRef=(" + rsRef + ")");
+ }
+ }
+
+ /**
+ * @param servicePublisher
+ * the servicePublisher to bind
+ */
+ public void bindServicePublisher(IServicePublishEventDispatcher servicePublisher) {
+ this.servicePublisher = servicePublisher;
+ }
+
+ /**
+ * @param servicePublisher
+ * the servicePublisher to unbind
+ */
+ public void unbindServicePublisher(IServicePublishEventDispatcher servicePublisher) {
+ this.servicePublisher = null;
+ }
+
+ /**
+ * @param serviceRegistry
+ * the serviceRegistry to bind
+ */
+ public void bindServiceRegistry(IRemoteServiceRegistry serviceRegistry) {
+ this.serviceRegistry = serviceRegistry;
+ }
+
+ /**
+ * @param serviceRegistry
+ * the serviceRegistry to unbind
+ */
+ public void unbindServiceRegistry(IRemoteServiceRegistry serviceRegistry) {
+ this.serviceRegistry = null;
+ }
+
+}
diff --git a/org.eclipse.riena.communication.core/.classpath b/org.eclipse.riena.communication.core/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/org.eclipse.riena.communication.core/.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/org.eclipse.riena.communication.core/.project b/org.eclipse.riena.communication.core/.project
new file mode 100644
index 0000000..c24e371
--- /dev/null
+++ b/org.eclipse.riena.communication.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.riena.communication.core</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/org.eclipse.riena.communication.core/.settings/org.eclipse.pde.core.prefs b/org.eclipse.riena.communication.core/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 0000000..443c042
--- /dev/null
+++ b/org.eclipse.riena.communication.core/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Tue Oct 16 11:42:22 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=true
+resolve.requirebundle=false
diff --git a/org.eclipse.riena.communication.core/META-INF/MANIFEST.MF b/org.eclipse.riena.communication.core/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..53cdfe1
--- /dev/null
+++ b/org.eclipse.riena.communication.core/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Riena Communication Core (Incubation)
+Bundle-SymbolicName: org.eclipse.riena.communication.core;singleton:=true
+Bundle-Version: 0.0.1
+Bundle-Activator: org.eclipse.riena.internal.communication.core.Activator
+Import-Package: javax.servlet.http;version="2.4.0",
+ org.osgi.framework;version="1.4.0"
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.riena.communication.core,
+ org.eclipse.riena.communication.core.factory,
+ org.eclipse.riena.communication.core.hooks,
+ org.eclipse.riena.communication.core.publisher,
+ org.eclipse.riena.communication.core.util
+Eclipse-BuddyPolicy: registered
+Eclipse-RegisterBuddy: com.caucho.hessian
+Require-Bundle: org.eclipse.osgi.services,
+ org.junit;resolution:=optional,
+ org.eclipse.core.runtime,
+ com.caucho.hessian,
+ org.eclipse.riena.core
diff --git a/org.eclipse.riena.communication.core/about.html b/org.eclipse.riena.communication.core/about.html
new file mode 100644
index 0000000..fc81119
--- /dev/null
+++ b/org.eclipse.riena.communication.core/about.html
@@ -0,0 +1,24 @@
+<!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>June 5, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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>
+
+<div style="position: absolute; width: 28px; height: 28px; z-index: 1000; display: none;"></div><img style="position: absolute; width: 35px; height: 29px; z-index: 1000; display: none;" src="about-Dateien/launch.png"></body></html> \ No newline at end of file
diff --git a/org.eclipse.riena.communication.core/build.properties b/org.eclipse.riena.communication.core/build.properties
new file mode 100644
index 0000000..2181018
--- /dev/null
+++ b/org.eclipse.riena.communication.core/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
+src.includes = readme.txt
diff --git a/org.eclipse.riena.communication.core/plugin.xml b/org.eclipse.riena.communication.core/plugin.xml
new file mode 100644
index 0000000..33ca93c
--- /dev/null
+++ b/org.eclipse.riena.communication.core/plugin.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+</plugin>
diff --git a/org.eclipse.riena.communication.core/readme.txt b/org.eclipse.riena.communication.core/readme.txt
new file mode 100644
index 0000000..1704993
--- /dev/null
+++ b/org.eclipse.riena.communication.core/readme.txt
@@ -0,0 +1,42 @@
+==========================================================================
+=== Nyota Notes About Generic Class Loading and Instantiation Behavior ===
+==========================================================================
+
+The Nyota bundle content includes generic class loading and object instantiation or delegates this behavior to other
+Nyota bundles. In the follow to situations Nyota load classes or instantiate objects generically.
+
+a) a IRemoteServiceFactory creates a proxy reference (IRemoteServiceReference) by an end point description
+b) a web service request or response becomes serialized or deserialized.
+
+Usually an application bundle defines service interfaces and API types. Each bundle has their own context class
+loader. A Bundle determines which type becomes exported (visible for other bundles). A bundle "A" known about
+(exported) types only if bundle "A" is depend on an other bundle which defines or reexports a type.
+
+The de.compeople.nyota.core bundle and other (Nyota) factory or publisher bundles are like generic factory bundles.
+They have no dependency to any application bundle.
+
+That Nyota can work correctly it is requisite that Nyota know the external interface and API class types.
+Nyota supports the Eclipse buddy concept. Application bundles should be registered to de.compeople.nyota.core
+bundle. The de.compeople.nyota.core bundle is like a "single point of buddy configuration" for all Nyota bundles.
+
+Nyota Eclipse-BuddyPolicy sample
+
+ ==================================================
+ | Manifest.mf: de.compeople.nyota.core |
+ |------------------------------------------------|
+ | .. |
+ | Eclipse-BuddyPolicy: registered |
+ | .. |
+ ==================================================
+ |
+ / \
+ |
+ | buddy
+ |
+ ==================================================
+ | Manifest.mf: foo.myapplication.api |
+ |------------------------------------------------|
+ | .. |
+ | Eclipse-RegisterBuddy: de.compeople.nyota.core | |
+ | .. |
+ ==================================================
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceProtocol.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceProtocol.java
new file mode 100644
index 0000000..1c5518f
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceProtocol.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core;
+
+import org.eclipse.riena.communication.core.factory.IRemoteServiceFactory;
+import org.eclipse.riena.communication.core.publisher.IServicePublisher;
+
+/**
+ * This interface is used for all components that support a specific remote service type i.e. end point transport
+ * protocol.
+ *
+ * @author Alexander Ziegler
+ * @author Christian Campo
+ *
+ * @see IServicePublisher
+ * @see IRemoteServiceFactory
+ *
+ */
+public interface IRemoteServiceProtocol {
+
+ /**
+ * Defines the OSGi Service property for protocol type. An OSGi Service should set this property and the protocol
+ * name
+ */
+ String PROP_PROTOCOL = "riena.protocol";
+
+ /**
+ *
+ * @return the protocol name for this IRemoteServiceFactory is responsible.
+ */
+ String getProtocol();
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceReference.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceReference.java
new file mode 100644
index 0000000..31493a6
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceReference.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ManagedService;
+
+/**
+ * A IRemoteServiceReference holds a representation of a remote OSGi Service. A
+ * remote OSGi Service is defined by a service instance i.e. proxy reference and
+ * whose remote end point description. IRemoteServiceReference become registered
+ * or unregistered into the {@link IRemoteServiceRegistry} OSGi Service. The
+ * service instance itself become registered or unregistered into the OSGi
+ * Service Registry by the the IRemoteServiceRegistry OSGi Service. After the
+ * service instance is registered it represents the remote OSGi Service.
+ * <p>
+ * A IRemoteServiceReference is managed by the IRemoteServiceRegistry OSGi
+ * Service.
+ *
+ * @author Alexander Ziegler
+ *
+ * @see IRemoteServiceRegistry#registerService(IRemoteServiceReference)
+ * @see IRemoteServiceRegistry#unregisterService(IRemoteServiceReference)
+ *
+ *
+ */
+public interface IRemoteServiceReference {
+
+ /**
+ * @return the hostId who is responsible for this remote service object
+ */
+ String getHostId();
+
+ /**
+ *
+ * @return the URL of the remote end point
+ */
+ String getURL();
+
+ /**
+ * Sets the service instance of this remote service reference
+ *
+ * @param serviceInstance
+ */
+ void setServiceInstance(Object serviceInstance);
+
+ /**
+ *
+ * @return the service instance i.e. proxy reference. The service instance
+ * represents the remote OSGi Service
+ */
+ Object getServiceInstance();
+
+ /**
+ *
+ * @return the remote end point description
+ */
+ RemoteServiceDescription getDescription();
+
+ /**
+ * The serviceId represents the id of the service instance after it is
+ * registered as remote OSGi Service. User can find the remote OSGi Service
+ * by this serviceId. Typically the serviceId is a full qualified type name
+ * of the service interface
+ *
+ * @return serviceId of the service instance
+ *
+ * @see BundleContext#getServiceReference(String)
+ * @see BundleContext#getServiceReference(String,String)
+ */
+ String getServiceInterfaceClassName();
+
+ /**
+ * @return the OSGi ServiceRegistration for the service instance after it is
+ * registered as remote OSGi Service.
+ */
+ ServiceRegistration getServiceRegistration();
+
+ /**
+ * Sets the given OSGI ServiceRegistration for the service instance after it
+ * is registered as remote OSGi Service.
+ *
+ * @param serviceRegistration
+ */
+ void setServiceRegistration(ServiceRegistration serviceRegistration);
+
+ /**
+ * @return the service instance of the ManagedService that can configure
+ * this remote service reference (null if there is no such
+ * ManagedService)
+ */
+ ManagedService getConfigServiceInstance();
+
+ /**
+ * @return the ServicePID for the ConfigService Instance
+ */
+ String getConfigServicePID();
+
+ /**
+ * @param configServiceRegistration
+ * the ServiceRegistration instance of the registered
+ * ManagedService
+ */
+ void setConfigServiceRegistration(ServiceRegistration configServiceRegistration);
+
+ /**
+ * @return the ServiceRegistration instance of the ManagedService
+ */
+ ServiceRegistration getConfigServiceRegistration();
+
+ /**
+ * Sets the hostId who is responsible for this remote service object
+ *
+ * @param hostId
+ */
+ void setHostId(String hostId);
+
+ /**
+ * Disposes this reference
+ */
+ void dispose();
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceRegistration.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceRegistration.java
new file mode 100644
index 0000000..0673dda
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceRegistration.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core;
+
+/**
+ * A IRemoteServiceRegistration holds all information about a {@link IRemoteServiceReference} which is registered in the
+ * {@link IRemoteServiceRegistry} OSGi Service. A IRemoteServiceRegistration allows to unregister a
+ * IRemoteServiceReference from the {@link IRemoteServiceRegistry} OSGi Service by invoke {@link #unregister()}
+ *
+ * @author Alexander Ziegler
+ *
+ * @see IRemoteServiceRegistry#registerService(IRemoteServiceReference)
+ * @see IRemoteServiceReference
+ *
+ *
+ *
+ */
+public interface IRemoteServiceRegistration {
+
+ /**
+ *
+ * @return the remote service reference
+ */
+ IRemoteServiceReference getReference();
+
+ /**
+ * Sets the given remote service reference
+ *
+ * @param reference
+ */
+ void setReference(IRemoteServiceReference reference);
+
+ /**
+ * Unregisters the RemoteServiceReference from the RemoteServiceRegistry. The RemoteServiceReferences is not more
+ * available into the OSGi ServiceRegistry
+ *
+ * @see IRemoteServiceRegistry#registerService(IRemoteServiceReference)
+ */
+ void unregister();
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceRegistry.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceRegistry.java
new file mode 100644
index 0000000..7cf468a
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/IRemoteServiceRegistry.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core;
+
+import java.util.List;
+
+import org.eclipse.riena.communication.core.factory.IRemoteServiceFactory;
+import org.eclipse.riena.communication.core.publisher.IServicePublishEventDispatcher;
+
+/**
+ * The IRemoteServiceRegistry adds the ability to register, unregister and manage "remote services" as OSGi Services
+ * within an OSGi runtime (called client container). A "remote service" could be an OSGi Services which is hosted within
+ * another OSGi runtime (called server container). A "remote service" is represented by a
+ * {@link IRemoteServiceReference} within the client container. A IRemoteServiceReference holds a proxy reference which
+ * points the service end point.
+ * <p>
+ * A IRemoteServiceReferences becomes registered as "remote" OSGi Service within the client container by call
+ * {@link #registerService(IRemoteServiceReference)} . #registerService returns a registration object
+ * {@link IRemoteServiceRegistration} which points the registered "remote" OSGi service. Call
+ * {@link #unregisterService(IRemoteServiceReference)} or {@link IRemoteServiceRegistration#unregister()} to unregister
+ * a "remote" OSGi Service
+ * <p>
+ * The RemoteServiceRegistry is available as OSGi Service. The registration name is {@link #ID}.
+ * <p>
+ * The {@link IRemoteServiceFactory} can use to create a IRemoteServiceReference by given end points parameters and to
+ * register a IRemoteServiceReference into the IRemoteServiceRegistry.
+ * <p>
+ * OSGi Service could be published as service end point from a server container by the
+ * {@link IServicePublishEventDispatcher}
+ *
+ * @author Alexander Ziegler
+ *
+ * @see IRemoteServiceReference
+ * @see IRemoteServiceFactory
+ * @see IServicePublishEventDispatcher
+ *
+ */
+public interface IRemoteServiceRegistry {
+
+ /**
+ * Service ID
+ */
+ String ID = IRemoteServiceRegistry.class.getName();
+
+ /**
+ * Registers the given reference as OSGi Service. Answers a {@link IRemoteServiceRegistration} object which points
+ * the registered reference. A registered reference becomes automatically registered as "remote" OSGi Service within the
+ * local OSGi container.
+ * <p>
+ * To unregister a reference from the Remote Service Registry call
+ * {@link #unregisterService(IRemoteServiceReference)} or {@link IRemoteServiceRegistration#unregister()}
+ *
+ * @param reference
+ * @return the RemoteServiceRegistration object
+ *
+ * @see #unregisterService(IRemoteServiceReference)
+ * @see IRemoteServiceRegistration#unregister()
+ */
+ IRemoteServiceRegistration registerService(IRemoteServiceReference reference);
+
+ /**
+ * Unregisters the given reference from the Remote Service Registry. The associated "remote" OSGi Service become
+ * automatically unregistered.
+ *
+ * @param reference
+ * to unregister
+ *
+ * @see #registerService(IRemoteServiceReference)
+ */
+ void unregisterService(IRemoteServiceReference reference);
+
+ /**
+ * Answers a list of {@link IRemoteServiceRegistration} objects for all registered "remote" OSGi Services for the
+ * given hostId
+ *
+ * @param hostId
+ * @return a list of IRemoteServiceRegistration objects
+ */
+ List<IRemoteServiceRegistration> registeredServices(String hostId);
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/RemoteServiceDescription.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/RemoteServiceDescription.java
new file mode 100644
index 0000000..2028f9e
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/RemoteServiceDescription.java
@@ -0,0 +1,353 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core;
+
+import static org.eclipse.riena.communication.core.publisher.RSDPublisherProperties.PROP_CONFIG_ID;
+import static org.eclipse.riena.communication.core.publisher.RSDPublisherProperties.PROP_REMOTE_PATH;
+import static org.eclipse.riena.communication.core.publisher.RSDPublisherProperties.PROP_REMOTE_PROTOCOL;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.riena.communication.core.factory.IRemoteServiceFactory;
+import org.eclipse.riena.communication.core.publisher.IServicePublishEventDispatcher;
+import org.eclipse.riena.communication.core.publisher.IServicePublisher;
+import org.eclipse.riena.communication.core.util.CommunicationUtil;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * The RemoteServiceDescription describes an remote service end point. Usually an service end point describes a
+ * published OSGi Service within a server container.
+ * <p>
+ * For example Riena communication has defined an "remote" OSGi service {@link IServicePublishEventDispatcher} which provides a list
+ * of all published OSGi Services within a server container
+ * <p>
+ * Usually a RemoteServiceDescription becomes instantiated within an server container and is used by an
+ * IServicePublisher within an server and by an {@link IRemoteServiceFactory} within a client container
+ *
+ *
+ * @author Alexander Ziegler
+ * @author Christian Campo
+ *
+ * @see IServicePublishEventDispatcher
+ * @see IServicePublisher
+ * @see IRemoteServiceFactory
+ */
+public class RemoteServiceDescription {
+
+ private static final String PROP_SERVICE_CLASSNAME = "objectClass";
+
+ /**
+ * The "remote" OSGi Service was registered
+ */
+ public final static int STATUS_REGISTERED = 0x00000001;
+ /**
+ * The "remote" OSGi Service was modified
+ */
+ public final static int STATUS_MODIFIED = 0x00000002;
+ /**
+ * The "remote" OSGi Service was unregistered
+ */
+ public final static int STATUS_UNREGISTERED = 0x00000004;
+
+ private int type = STATUS_REGISTERED;
+ private transient Class<?> serviceInterfaceClass;
+ private transient Object service;
+ private transient ServiceReference serviceRef;
+ private String path;
+ private String version;
+ private String bundleName;
+ private String serviceInterfaceClassName;
+ private String url;
+ private String protocol;
+ private Map<String, Object> properties = new HashMap<String, Object>();
+ private String configid;
+
+ /**
+ * Create a instance of a RemoteServiceDescription
+ */
+ public RemoteServiceDescription() {
+ super();
+ }
+
+ /**
+ * Create an instance of a RemoteServiceDescription with the given service reference and service object
+ *
+ * @param serviceRef
+ * @param service
+ */
+ public RemoteServiceDescription(ServiceReference serviceRef, Object service, Class serverInterface) {
+ this();
+ this.serviceRef = serviceRef;
+ this.service = service;
+ String[] keys = serviceRef.getPropertyKeys();
+ for (String key : keys) {
+ if (key.equals(PROP_SERVICE_CLASSNAME)) {
+ // String obejctClassName = CommunicationUtil.accessProperty(serviceRef.getProperty(PROP_SERVICE_CLASSNAME),
+ // null);
+ serviceInterfaceClass = serverInterface;
+ serviceInterfaceClassName = serviceInterfaceClass.getName();
+ } else {
+ if (key.equals(PROP_REMOTE_PROTOCOL)) {
+ protocol = CommunicationUtil.accessProperty(serviceRef.getProperty(PROP_REMOTE_PROTOCOL), null);
+ } else {
+ if (key.equals(PROP_REMOTE_PATH)) {
+ path = CommunicationUtil.accessProperty(serviceRef.getProperty(PROP_REMOTE_PATH), null);
+ } else {
+ if (key.equals(PROP_CONFIG_ID)) {
+ configid = CommunicationUtil.accessProperty(serviceRef.getProperty(PROP_CONFIG_ID), null);
+ } else {
+ setProperty(key, CommunicationUtil.accessProperty(serviceRef.getProperty(key), null));
+ }
+ }
+ }
+ }
+ }
+ bundleName = serviceRef.getBundle().getSymbolicName();
+ }
+
+ /**
+ * Disposes this RemoteServiceDescription. release all references.
+ */
+ public void dispose() {
+ bundleName = null;
+ service = null;
+ serviceRef = null;
+ serviceInterfaceClass = null;
+ serviceInterfaceClassName = null;
+ path = null;
+ url = null;
+ version = null;
+ protocol = null;
+ }
+
+ /**
+ * @return the bundle name from where the service comes
+ */
+ public String getBundleName() {
+ return bundleName;
+ }
+
+ /**
+ *
+ * @return the content path where the service end point is published
+ */
+ public String getPath() {
+ return path;
+ }
+
+ /**
+ *
+ * @return the protocol under the service end point is available
+ */
+ public String getProtocol() {
+ return protocol;
+ }
+
+ /**
+ *
+ * @return the service i.e. the OSGi Service
+ */
+ public Object getService() {
+ return service;
+ }
+
+ /**
+ *
+ * @return the service interface of the service
+ */
+ public Class<?> getServiceInterfaceClass() {
+ return serviceInterfaceClass;
+ }
+
+ /**
+ *
+ * @return the service interface name of the service
+ */
+ public String getServiceInterfaceClassName() {
+ return serviceInterfaceClassName;
+ }
+
+ /**
+ *
+ * @return the service reference for the service
+ */
+ public ServiceReference getServiceRef() {
+ return serviceRef;
+ }
+
+ /**
+ * The state of the service. Values are:<br>
+ * <br>
+ * {@link #STATUS_REGISTERED}<br>
+ * {@link #STATUS_MODIFIED}<br>
+ * {@link #STATUS_UNREGISTERED}<br>
+ *
+ * @return the current state of the service
+ */
+ public int getType() {
+ return type;
+ }
+
+ /**
+ *
+ * @return the absolute URL the the service end point is published
+ */
+ public String getURL() {
+ return url;
+ }
+
+ /**
+ *
+ * @return the service or bundle version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public int hashCode() {
+ return getPath().hashCode();
+ }
+
+ /**
+ * Sets the bundle name from where the service comes
+ *
+ * @param bundleName
+ */
+ public void setBundleName(String bundleName) {
+ this.bundleName = bundleName;
+ }
+
+ /**
+ * Sets the content path where the service end point becomes published
+ *
+ * @param path
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /**
+ * Sets the protocol under the service end point becomes available
+ *
+ * @param protocol
+ */
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ /**
+ * Sets the service i.e. the OSGi Service
+ *
+ * @param service
+ */
+ public void setService(Object service) {
+ this.service = service;
+ }
+
+ /**
+ * Sets the service interface of the service
+ *
+ * @param interfaceClass
+ */
+ public void setServiceInterfaceClass(Class<?> interfaceClass) {
+ this.serviceInterfaceClass = interfaceClass;
+ }
+
+ /**
+ * the service interface name of the service
+ *
+ * @param interfaceClassName
+ */
+ public void setServiceInterfaceClassName(String interfaceClassName) {
+ this.serviceInterfaceClassName = interfaceClassName;
+
+ }
+
+ /**
+ * Sets the service reference for the service
+ *
+ * @param serviceRef
+ */
+ public void setServiceRef(ServiceReference serviceRef) {
+ this.serviceRef = serviceRef;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ /**
+ * Sets the absolute URL the the service end point is published
+ *
+ * @param url
+ */
+ public void setURL(String url) {
+ this.url = url;
+ }
+
+ public String getConfigid() {
+ return configid;
+ }
+
+ public void setConfigid(String configid) {
+ this.configid = configid;
+ }
+
+ /**
+ * Sets the service or bundle version
+ *
+ * @param version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ @Override
+ public String toString() {
+ return "protocol=" + protocol + ", url=" + url + ", interface=" + serviceInterfaceClassName;
+ }
+
+ /**
+ * Sets the given property
+ *
+ * @param name
+ * @param value
+ */
+ public void setProperty(String name, Object value) {
+ properties.put(name, value);
+ }
+
+ /**
+ * Answers the property value for the given name
+ *
+ * @param name
+ * @return the property value
+ */
+ public Object getProperty(String name) {
+ return properties.get(name);
+ }
+
+ // find interfaceClass by interfaceName
+ private Class<?> findInterfClazz(Object service, String interfaceName) {
+ Class<?> serviceInterfaceClass = null;
+ for (Class<?> aInterface : service.getClass().getInterfaces()) {
+ if (aInterface.getName().equals(interfaceName)) {
+ serviceInterfaceClass = aInterface;
+ break;
+ }
+ }
+ return serviceInterfaceClass;
+
+ }
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/config/SymbolConfigPlugin.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/config/SymbolConfigPlugin.java
new file mode 100644
index 0000000..ddac893
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/config/SymbolConfigPlugin.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.config;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.RegistryFactory;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationPlugin;
+
+/**
+ * @deprecated
+ */
+public class SymbolConfigPlugin implements ConfigurationPlugin {
+
+ private HashMap<String, String> symbolTable = new HashMap<String, String>();
+
+ public SymbolConfigPlugin() {
+ super();
+
+ IExtensionRegistry registry = RegistryFactory.getRegistry();
+ IExtension[] cfgExtensions = registry.getExtensionPoint("org.eclipse.riena.communication.core.configProxies").getExtensions();
+ for (IExtension cfgExt : cfgExtensions) {
+ IConfigurationElement[] configs = cfgExt.getConfigurationElements();
+ for (IConfigurationElement config : configs) {
+ IConfigurationElement[] properties = config.getChildren();
+ for (IConfigurationElement prop : properties) {
+ String name = prop.getAttribute("name");
+ String value = prop.getAttribute("value");
+ symbolTable.put(name, value);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void modifyConfiguration(ServiceReference servicereference, Dictionary dictionary) {
+ Enumeration<String> keyEnum = dictionary.keys();
+ while (keyEnum.hasMoreElements()) {
+ String key = keyEnum.nextElement();
+ String value = (String) dictionary.get(key);
+ dictionary.put(key, replaceSymbol(value));
+ }
+ }
+
+ private String replaceSymbol(String value) {
+ StringBuilder sb = new StringBuilder(value);
+ for (int i = 0; i < sb.length() - 1; i++) {
+ if (sb.substring(i, i + 2).equals("${")) {
+ int x = sb.substring(i).indexOf('}');
+ if (x > 0) {
+ String key = value.substring(i + 2, i + x);
+ sb.replace(i, i + x + 1, lookupSymbol(key));
+ }
+ }
+ }
+ return sb.toString();
+ }
+
+ private String lookupSymbol(String symbol) {
+ String value = symbolTable.get(symbol);
+ if (value == null) {
+ return "${" + symbol + "}";
+ } else {
+ return value;
+ }
+ }
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/IRemoteServiceFactory.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/IRemoteServiceFactory.java
new file mode 100644
index 0000000..08802ba
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/IRemoteServiceFactory.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.factory;
+
+import org.eclipse.riena.communication.core.IRemoteServiceProtocol;
+import org.eclipse.riena.communication.core.IRemoteServiceReference;
+import org.eclipse.riena.communication.core.RemoteServiceDescription;
+import org.eclipse.riena.communication.core.hooks.ICallMessageContextAccessor;
+import org.eclipse.riena.communication.core.publisher.IServicePublisher;
+
+/**
+ * The IRemoteServiceFactory creates {@link IRemoteServiceReference} for given protocol specifically service end point
+ * description. The IRemoteServiceReference holds a proxy reference instance to the service end point.
+ * <p>
+ * An implementation of an IRemoteServiceFactory is responsible for a protocol (e.g. Hessian). The implementation has be
+ * registered as OSGi Service and set with follow property (see also {@link IRemoteServiceProtocol}):<br>
+ *
+ * <p>
+ * Code sample:<br>
+ * <code>
+ * public void start(BundleContext context) throws Exception {
+ * factory = new RemoteServiceFactoryHessian();
+ * Hashtable properties = new Hashtable(1);
+ * properties.put(IRemoteServiceFactory.PROP_PROTOCOL, factory.getProtocol());
+ *
+ * regFactory = context.registerService(IRemoteServiceFactory.ID, factory, properties); <br>
+ * }
+ * </code>
+ * <p>
+ *
+ * <b>NOTE</b><br>
+ * The Riena communication bundle content includes generic class loading and object instantiation or delegates this behavior to other
+ * Riena communication bundles. Riena supports Eclipse-BuddyPolicy concept. For further information about Riena class loading and
+ * instanciation please read /readme.txt.
+ *
+ *
+ * @author Alexander Ziegler
+ *
+ * @see IRemoteServiceProtocol
+ * @see IRemoteServiceReference
+ * @see RemoteServiceFactory
+ * @see IServicePublisher
+ *
+ */
+public interface IRemoteServiceFactory extends IRemoteServiceProtocol {
+
+ /**
+ * The OSGi Service name
+ */
+ String ID = IRemoteServiceFactory.class.getName();
+
+ /**
+ * Creates a protocol specifically IRemoteServcieRefernce for the given end point description. Answers the
+ * IRemoteServiceReference.
+ *
+ * @param remoteServiceDesc
+ * @return the remote service references
+ */
+ IRemoteServiceReference createProxy(RemoteServiceDescription remoteServiceDesc);
+
+ ICallMessageContextAccessor getMessageContextAccessor();
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceBuilder.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceBuilder.java
new file mode 100644
index 0000000..a381879
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceBuilder.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.factory;
+
+import org.eclipse.riena.communication.core.IRemoteServiceRegistration;
+import org.eclipse.riena.communication.core.IRemoteServiceRegistry;
+import org.eclipse.riena.communication.core.publisher.IServicePublisher;
+import org.eclipse.riena.communication.core.publisher.RSDPublisherProperties;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * The RemoteServiceBuilder creates, registers and unregisters OSGi Services by Service Declaration. A Service
+ * Declaration defines an remote service end point by properties. The RemoteServiceBuilder use the properties to create
+ * a proxy reference (see {@link IRemoteServiceFactory}) and register this For this purpose define RemoteServiceBuilder
+ * as implementation class within the component declaration and sets follow properties:
+ * <p>
+ * <ul>
+ * <li>'riena.interface' - defines the the interface class of the "remote OSGi Service. The OSGi Service become
+ * registered with this name too</li>
+ * <li>'riena.remote.path' - defines the context path for the remote service end point</li>
+ * <li>'riena.remote.protocol' - defines the web service protocol. See also {@link IServicePublisher} and
+ * {@link IRemoteServiceFactory}
+ * <li>
+ * </ul>
+ * <p>
+ * Usage e.g.
+ * <p>
+ *
+ * &lt;component name=&quot;foo.my.component&quot; immediate=&quot;true&quot;&gt;<br>
+ * &nbsp;&nbsp;&nbsp;&nbsp;&lt;implementation
+ * class=&quot;org.eclipse.riena.communication.core.factory.RemoteServiceBuilder&quot;/&gt;<br>
+ * &nbsp;&nbsp;&nbsp;&nbsp;&lt;property name=&quot;riena.interface&quot; value=&quot;foo.my.service.MyService&quot;/&gt;<br>
+ * &nbsp;&nbsp;&nbsp;&nbsp;&lt;property name=&quot;riena.remote.path&quot;
+ * value=&quot;http://localhost/hessian/MyServiceWS&quot;/&gt;<br>
+ * &nbsp;&nbsp;&nbsp;&nbsp;&lt;property name=&quot;riena.remote.protocol&quot; value=&quot;hessian&quot;/&gt;<br>
+ * &lt;/component&gt;<br>
+ * <p>
+ *
+ * @author Christian Campo
+ *
+ */
+public class RemoteServiceBuilder {
+
+ private static final String HOST_ID = RemoteServiceBuilder.class.getName();
+ private IRemoteServiceRegistration rsReg;
+
+ /**
+ * Create a instance of RemoteServiceBuilder
+ */
+ public RemoteServiceBuilder() {
+ super();
+ System.out.println("Riena::RemoteServiceBuilder:: debug construct");
+ }
+
+ /**
+ * Creates a proxy reference for a end point described by Service Declaration. Register the proxy reference as
+ * remote service into the {@link IRemoteServiceRegistry}. The "remote" service become registered as OSGi Service
+ * within this client container. The property "riena.interface" defines the interface type and OSGi Service name.
+ * The context holds the declarated properties for the remote end point.
+ *
+ * @param context
+ */
+ protected void activate(ComponentContext context) {
+ System.out.println("Riena::RemoteServiceBuilder:: debug activate");
+ try {
+ String serviceClassName = (String) context.getProperties().get(RSDPublisherProperties.PROP_INTERFACE);
+ Class<?> serviceClass = Class.forName(serviceClassName);
+ String path = (String) context.getProperties().get(RSDPublisherProperties.PROP_REMOTE_PATH);
+ String protocol = (String) context.getProperties().get(RSDPublisherProperties.PROP_REMOTE_PROTOCOL);
+
+ RemoteServiceFactory factory = new RemoteServiceFactory();
+ rsReg = factory.createAndRegisterProxy(serviceClass, path, protocol, null, HOST_ID);
+
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Unregister the "remote" service from the {@link IRemoteServiceRegistry}.
+ *
+ * @param bundle
+ * @param reg
+ * @param service
+ */
+ public void ungetService(Bundle bundle, ServiceRegistration reg, Object service) {
+ System.out.println("Riena::RemoteServiceBuilder:: debug ungetService");
+ if (rsReg != null) {
+ rsReg.unregister();
+ rsReg = null;
+ }
+ }
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactory.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactory.java
new file mode 100644
index 0000000..a9e52a6
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceFactory.java
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.factory;
+
+import java.lang.reflect.Proxy;
+import java.util.Hashtable;
+
+import org.eclipse.riena.communication.core.IRemoteServiceReference;
+import org.eclipse.riena.communication.core.IRemoteServiceRegistration;
+import org.eclipse.riena.communication.core.IRemoteServiceRegistry;
+import org.eclipse.riena.communication.core.RemoteServiceDescription;
+import org.eclipse.riena.communication.core.publisher.RSDPublisherProperties;
+import org.eclipse.riena.internal.communication.core.Activator;
+import org.eclipse.riena.internal.communication.core.factory.CallHooksProxy;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationPlugin;
+
+/**
+ * The IRemoteServiceFactory creates {@link IRemoteServiceReference} for given
+ * service end point description. The IRemoteServiceReference holds a proxy
+ * reference instance to the service end point. The RemoteService Factory can
+ * register an IRemoteServiceReference into the {@link IRemoteServiceRegistry}.
+ * To create a {@link IRemoteServiceReference} call {@link #createProxy(..)}.
+ * To create and register a "remote" OSGi Service in one step call
+ * {@link #createAndRegisterProxy(..)}
+ * <p>
+ * This RemoteServiceFactory do not create IRemoteServiceReference itself. This
+ * RemoteServiceFactory delegates the behaviour to a protocol specifically
+ * {@link IRemoteServiceFactory} OSGi Service. This RemoteServiceFactory finds a
+ * corresponding IRemoteServiceFactory by the filter
+ * "riena.remote.protocol=[aProtocol]" (e.g. aProtcol replaced with 'hessian').
+ * <p>
+ * This RemoteServiceFactory does nothing if no protocol specifically
+ * IRemoteServiceFactory is available.
+ * <p>
+ * <b>NOTE</b><br>
+ * The Riena communication bundle content includes generic class loading and object
+ * instantiation or delegates this behavior to other Riena communication bundles. Riena
+ * supports Eclipse-BuddyPolicy concept. For further information about Riena
+ * class loading and instanciation please read /readme.txt.
+ *
+ * @author Alexander Ziegler
+ * @author Christian Campo
+ *
+ */
+public class RemoteServiceFactory {
+
+ private static final String HOST_ID = RemoteServiceFactory.class.getName();
+ private BundleContext context;
+
+ /**
+ * Creates a RemoteServiceFactory instance with the default bundle context.
+ * Prerequisite: application bundle should registered as
+ * Eclipse-RegisterBuddy. Sample Manifest.mf of foo.myapplication.api:
+ *
+ * Eclipse-RegisterBuddy: org.eclipse.riena.communication.core
+ *
+ */
+ public RemoteServiceFactory() {
+ this(Activator.getContext());
+ }
+
+ /**
+ * Creates a RemoteServiceFactory instance with the given bundle context.
+ * This bundle context should refer the service interface type.
+ *
+ * @param context
+ */
+ public RemoteServiceFactory(BundleContext context) {
+ this.context = context;
+ }
+
+ /**
+ * Creates and registers a protocol specifically remote service reference
+ * and registers the reference into the {@link IRemoteServiceRegistry}. A
+ * registered reference becomes automatically registered as "remote" OSGi
+ * Service within the local OSGi container. Answers the registration object
+ * for the reference. If no protocol specific {@link IRemoteServiceFactory}
+ * OSGI Service available answers <code>null</code>.
+ *
+ * @param interfaceClass
+ * @param url
+ * @param protocol
+ * @return the registration object or <code>null</code>
+ *
+ */
+ public IRemoteServiceRegistration createAndRegisterProxy(
+ Class<?> interfaceClass, String url, String protocol,
+ String configid) {
+ return createAndRegisterProxy(interfaceClass, url, protocol, configid,
+ HOST_ID);
+ }
+
+ /**
+ * Creates and registers a protocol specifically remote service reference
+ * and registers the reference into the {@link IRemoteServiceRegistry}. A
+ * registered reference becomes automatically registered as "remote" OSGi
+ * Service within the local OSGi container. Answers the registration object
+ * for the reference. If no protocol specific {@link IRemoteServiceFactory}
+ * OSGI Service available answers <code>null</code>.<br>
+ * <p>
+ * The hostId identifies who is responsible for this remote service
+ * registration
+ *
+ * @param interfaceClass
+ * @param url
+ * @param protocol
+ * @param hostId
+ * @return the registration object or <code>null</code>
+ */
+ public IRemoteServiceRegistration createAndRegisterProxy(
+ Class<?> interfaceClass, String url, String protocol,
+ String configid, String hostId) {
+ RemoteServiceDescription rsd = createDescription(interfaceClass, url,
+ protocol, configid);
+ return createAndRegisterProxy(rsd);
+ }
+
+ /**
+ * Creates and registers a protocol specifically remote service reference
+ * and registers the reference into the {@link IRemoteServiceRegistry}. A
+ * registered reference becomes automatically registered as "remote" OSGi
+ * Service within the local OSGi container. Answers the registration object
+ * for the reference. If no protocol specific {@link IRemoteServiceFactory}
+ * OSGI Service available answers <code>null</code>.
+ *
+ * @param rsDesc
+ * @return the registration object or <code>null</code>
+ */
+ public IRemoteServiceRegistration createAndRegisterProxy(
+ RemoteServiceDescription rsDesc) {
+ return createAndRegisterProxy(rsDesc, HOST_ID);
+ }
+
+ /**
+ * Creates and registers a protocol specifically remote service reference
+ * and registers the reference into the {@link IRemoteServiceRegistry}. A
+ * registered reference becomes automatically registered as "remote" OSGi
+ * Service within the local OSGi container. Answers the registration object
+ * for the reference. If no protocol specific {@link IRemoteServiceFactory}
+ * OSGI Service available answers <code>null</code>.<br>
+ * <p>
+ * The hostId identifies who is responsible for this remote service
+ * registration
+ *
+ * @param rsDesc
+ * @param hostId
+ * @return the registration object or <code>null</code>
+ */
+ public IRemoteServiceRegistration createAndRegisterProxy(
+ RemoteServiceDescription rsDesc, String hostId) {
+ // create proxy first
+ final IRemoteServiceReference rsRef = createProxy(rsDesc);
+ if (rsRef == null) {
+ System.out
+ .println("Riena::RemoteServiceFactory::could not create proxy for "
+ + rsDesc);
+ return null;
+ }
+ rsRef.setHostId(hostId);
+ // get registry and register directly
+ ServiceReference refRegistry = context
+ .getServiceReference(IRemoteServiceRegistry.ID);
+ if (refRegistry != null) {
+ IRemoteServiceRegistry registry = (IRemoteServiceRegistry) context
+ .getService(refRegistry);
+ if (registry != null) {
+ IRemoteServiceRegistration reg = registry
+ .registerService(rsRef);
+ return reg;
+ }
+ }
+ ServiceListener sl = new ServiceListener() {
+ public void serviceChanged(ServiceEvent event) {
+ ServiceReference refRegistry = event.getServiceReference();
+ IRemoteServiceRegistry registry = (IRemoteServiceRegistry) Activator
+ .getContext().getService(refRegistry);
+ if (registry != null) {
+ registry.registerService(rsRef);
+ }
+ }
+ };
+ try {
+ Activator.getContext().addServiceListener(sl,
+ "(objectClass=" + IRemoteServiceRegistry.ID + ")");
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
+ }
+ return null;
+
+ }
+
+ /**
+ * Creates a protocol specifically proxy reference (IRemoteServcieRefernce)
+ * with given end point parameters. Answers the IRemoteServiceReference. If
+ * no protocol specific {@link IRemoteServiceFactory} OSGI Service available
+ * answers <code>null</code>.
+ *
+ * @param interfaceClass
+ * @param url
+ * @param protocol
+ * @return the proxy references or <code>null</code>
+ */
+ public IRemoteServiceReference createProxy(Class<?> interfaceClass,
+ String url, String protocol, String configid) {
+ RemoteServiceDescription rsd = createDescription(interfaceClass, url,
+ protocol, configid);
+ return createProxy(rsd);
+ }
+
+ private RemoteServiceDescription createDescription(Class<?> interfaceClass,
+ String url, String protocol, String configid) {
+ RemoteServiceDescription rsd = new RemoteServiceDescription();
+ rsd.setServiceInterfaceClass(interfaceClass);
+ rsd.setServiceInterfaceClassName(interfaceClass.getName());
+ rsd.setURL(url);
+ rsd.setProtocol(protocol);
+ rsd.setConfigid(configid);
+ return rsd;
+ }
+
+ /**
+ * Creates a protocol specifically IRemoteServcieRefernce for the given end
+ * point description. Answers the IRemoteServiceReference.. If no end point
+ * specific {@link IRemoteServiceFactory} OSGI Service available answers
+ * <code>null</code>.
+ *
+ * @param rsd
+ * @return the proxy references or <code>null</code>
+ */
+ public IRemoteServiceReference createProxy(RemoteServiceDescription rsd) {
+ // consult ConfigurationPlugins for URL
+ try {
+ ServiceReference[] pluginRefs = Activator.getContext()
+ .getServiceReferences(ConfigurationPlugin.class.getName(),
+ null);
+ Hashtable<String, String> props = new Hashtable<String, String>();
+ props.put(RSDPublisherProperties.PROP_URL, rsd.getURL());
+ if (pluginRefs != null) {
+ for (ServiceReference pluginRef : pluginRefs) {
+ ConfigurationPlugin plugin = (ConfigurationPlugin) Activator
+ .getContext().getService(pluginRef);
+ if (plugin != null) {
+ plugin.modifyConfiguration(null, props);
+ }
+ }
+ }
+ rsd.setURL(props.get(RSDPublisherProperties.PROP_URL));
+ } catch (InvalidSyntaxException e1) {
+ e1.printStackTrace();
+ }
+ ServiceReference[] references;
+ if (rsd.getProtocol() == null) {
+ return null;
+ }
+ // find a factory for this specific protocol
+ String filter = "(" + IRemoteServiceFactory.PROP_PROTOCOL + "="
+ + rsd.getProtocol() + ")";
+ try {
+ references = context.getServiceReferences(IRemoteServiceFactory.ID,
+ filter);
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
+ return null;
+ }
+ // no factory for this protocol
+ if (references == null) {
+ System.out
+ .println("Riena::RemoteServiceFactory:: WARN no IRemoteServiceFactory serviceRef available protocol ["
+ + rsd.getProtocol() + "]");
+ return null;
+ }
+
+ ServiceReference refFactory = null;
+ IRemoteServiceFactory factory = null;
+ for (ServiceReference reference : references) {
+ factory = (IRemoteServiceFactory) context.getService(reference);
+ if (factory != null) {
+ refFactory = reference;
+ break;
+ }
+ }
+
+ // could not get instance for existing reference
+ if (factory == null) {
+ System.out
+ .println("Riena::RemoteServiceFactory:: WARN no IRemoteServiceFactory service available protocol ["
+ + rsd.getProtocol()
+ + "] id ["
+ + rsd.getServiceInterfaceClassName() + "]");
+ return null;
+ }
+ System.out
+ .println("Riena::RemoteServiceFactory:: DEBUG IRemoteServiceFactory found protocol ["
+ + rsd.getProtocol() + "] " + factory);
+
+ // ask factory to create a proxy for me, and intercept the calls with a
+ // CallHooksProxy instance
+ try {
+ IRemoteServiceReference rsr = factory.createProxy(rsd);
+ CallHooksProxy callHooksProxy = new CallHooksProxy(rsr
+ .getServiceInstance());
+ callHooksProxy.setRemoteServiceDescription(rsd);
+ callHooksProxy.setMessageContextAccessor(factory
+ .getMessageContextAccessor());
+ rsr.setServiceInstance(Proxy.newProxyInstance(rsd
+ .getServiceInterfaceClass().getClassLoader(),
+ new Class[] { rsd.getServiceInterfaceClass() },
+ callHooksProxy));
+ return rsr;
+ } finally {
+ context.ungetService(refFactory);
+ }
+ }
+
+ /**
+ * This RemoteServiceFactory is responsible for all protocols because it
+ * delegates the behavior to {@link IRemoteServiceFactory} OSGi Services.
+ *
+ * @return all protocols
+ */
+ // public String getProtocol() {
+ // return "*";
+ // }
+ /**
+ * Load class types for the given intefaceClassName.
+ *
+ * @param interfaceClassName
+ * @return the class type for the given class Name
+ *
+ * @throws ClassNotFoundException
+ */
+ public Class<?> loadClass(String interfaceClassName)
+ throws ClassNotFoundException {
+
+ return getClass().getClassLoader().loadClass(interfaceClassName);
+ }
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceReference.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceReference.java
new file mode 100644
index 0000000..f4ce7e4
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/factory/RemoteServiceReference.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.factory;
+
+import org.eclipse.riena.communication.core.IRemoteServiceReference;
+import org.eclipse.riena.communication.core.RemoteServiceDescription;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ManagedService;
+
+/**
+ * This is a default implementation of {@link IRemoteServiceReference}.
+ *
+ * @author Alexander Ziegler
+ */
+public class RemoteServiceReference implements IRemoteServiceReference {
+ private Object serviceInstance;
+ private ServiceRegistration serviceRegistration;
+ private RemoteServiceDescription description;
+ private ManagedService configServiceInstance;
+ private String configServicePID;
+ private ServiceRegistration configServiceRegistration;
+ private String hostId;
+
+ /**
+ * Creates an instance with the given service end point description
+ *
+ * @param description
+ */
+ public RemoteServiceReference(RemoteServiceDescription description) {
+ this.description = description;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#getHostId()
+ */
+ public String getHostId() {
+ return hostId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#getURL()
+ */
+ public String getURL() {
+ return description.getURL();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#getServiceRegistration()
+ */
+ public ServiceRegistration getServiceRegistration() {
+ return serviceRegistration;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#setServiceRegistration(org.osgi.framework.ServiceRegistration)
+ */
+ public void setServiceRegistration(ServiceRegistration serviceRegistration) {
+ this.serviceRegistration = serviceRegistration;
+ }
+
+ /**
+ * Sets the service instance i.e. proxy reference. The service instance
+ * represents the remote OSGi Service
+ *
+ * @param serviceInstance
+ */
+ public void setServiceInstance(Object serviceInstance) {
+ this.serviceInstance = serviceInstance;
+ }
+
+ /*
+ * @see xeval.rsd.core.hessian.internal.IServiceEntry#getServiceInstance()
+ */
+ public Object getServiceInstance() {
+ return serviceInstance;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#getDescription()
+ */
+ public RemoteServiceDescription getDescription() {
+ return description;
+ }
+
+ /*
+ * @see xeval.rsd.core.hessian.internal.IServiceEntry#disbose()
+ */
+ public void dispose() {
+ serviceInstance = null;
+ serviceRegistration = null;
+ if (description != null) {
+ description.dispose();
+ description = null;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#getServiceInterfaceClassName()
+ */
+ public String getServiceInterfaceClassName() {
+ return description.getServiceInterfaceClassName();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#setHostId(java.lang.String)
+ */
+ public void setHostId(String hostId) {
+ this.hostId = hostId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#getConfigServiceInstance()
+ */
+ public ManagedService getConfigServiceInstance() {
+ return configServiceInstance;
+ }
+
+ /**
+ * @param configServiceInstance
+ * Service Instance of the ManagedService that can handle this
+ * remote service reference
+ */
+ public void setConfigServiceInstance(ManagedService configServiceInstance) {
+ this.configServiceInstance = configServiceInstance;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#getConfigServicePID()
+ */
+ public String getConfigServicePID() {
+ return configServicePID;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#getConfigServiceRegistration()
+ */
+ public ServiceRegistration getConfigServiceRegistration() {
+ return configServiceRegistration;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.communication.core.IRemoteServiceReference#setConfigServiceRegistration(org.osgi.framework.ServiceRegistration)
+ */
+ public void setConfigServiceRegistration(ServiceRegistration configServiceRegistration) {
+ this.configServiceRegistration = configServiceRegistration;
+ }
+
+ /**
+ * @param configServicePID
+ * sets the ServicePID for the ManagedService entry
+ */
+ public void setConfigServicePID(String configServicePID) {
+ this.configServicePID = configServicePID;
+ }
+
+ @Override
+ public String toString() {
+ return "hostId= " + hostId + ", end point=(" + getDescription() + ")";
+ }
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/AbstractHooksProxy.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/AbstractHooksProxy.java
new file mode 100644
index 0000000..d7804cb
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/AbstractHooksProxy.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.hooks;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.security.auth.Subject;
+
+public abstract class AbstractHooksProxy implements InvocationHandler {
+
+ private Object proxiedInstance;
+ private HashMap<String, List<Method>> methodTable = new HashMap<String, List<Method>>();
+
+ public AbstractHooksProxy(Object proxiedInstance) {
+ this.proxiedInstance = proxiedInstance;
+
+ Method[] methods = proxiedInstance.getClass().getMethods();
+
+ for (Method method : methods) {
+
+ Class<?>[] param = method.getParameterTypes();
+ String computedMethodName = computeMethodName(method, param.length);
+ List<Method> mList = methodTable.get(computedMethodName);
+ if (mList == null) {
+ mList = new ArrayList<Method>();
+ methodTable.put(computedMethodName, mList);
+ }
+ mList.add(method);
+ }
+ }
+
+ private String computeMethodName(Method method, int paramSize) {
+ return method.getName() + "__" + paramSize;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ // Class<?>[] clazzParm;
+ // if (args == null) {
+ // clazzParm = new Class[0];
+ // } else {
+ // clazzParm = new Class[args.length];
+ // for (int i = 0; i < args.length; i++) {
+ // clazzParm[i] = args[i].getClass();
+ // }
+ // }
+
+ String computedMethodName;
+ if (args != null) {
+ computedMethodName = computeMethodName(method, args.length);
+ } else {
+ computedMethodName = computeMethodName(method, 0);
+ }
+ List<Method> mList = methodTable.get(computedMethodName);
+ Method proxyMethod = null;
+ if (mList.size() == 1) {
+ proxyMethod = mList.get(0);
+ } else {
+ for (Method tmpMethod : mList) {
+ Class<?>[] paramTypes = tmpMethod.getParameterTypes();
+ int i = 0;
+ boolean found = true;
+ for (Class param : paramTypes) {
+ if (!param.isAssignableFrom(args[i].getClass())) {
+ found = false;
+ break;
+ }
+ }
+ if (found) {
+ proxyMethod = tmpMethod;
+ break;
+ }
+ }
+ }
+ if (proxyMethod == null) {
+ throw new NoSuchMethodException(proxiedInstance + " " + method.getName() + "," + args);
+ }
+ Subject subject = getSubject();
+ if (subject == null) {
+ return proxyMethod.invoke(proxiedInstance, args);
+ } else {
+ MySecurityAction myAction = new MySecurityAction(proxyMethod, proxiedInstance, args);
+ try {
+ Subject.doAsPrivileged(subject, myAction, null);
+ } catch (PrivilegedActionException pae) {
+ Throwable cause = pae.getCause();
+ if (cause instanceof InvocationTargetException) {
+ cause = ((InvocationTargetException) cause).getTargetException();
+ }
+ throw cause;
+ }
+ return myAction.getResult();
+ }
+ }
+
+ protected Object getProxiedInstance() {
+ return proxiedInstance;
+ }
+
+ public abstract Subject getSubject();
+
+}
+
+class MySecurityAction implements PrivilegedExceptionAction {
+
+ private Method proxyMethod;
+ private Object proxiedInstance;
+ private Object[] args;
+ private Object result;
+
+ MySecurityAction(Method proxyMethod, Object proxiedInstance, Object[] args) {
+ this.proxyMethod = proxyMethod;
+ this.proxiedInstance = proxiedInstance;
+ this.args = args;
+ }
+
+ public Object run() throws Exception {
+ result = proxyMethod.invoke(proxiedInstance, args);
+ return result;
+ }
+
+ public Object getResult() {
+ return result;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/CallContext.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/CallContext.java
new file mode 100644
index 0000000..213e925
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/CallContext.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.hooks;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.riena.communication.core.RemoteServiceDescription;
+
+public class CallContext {
+
+ private RemoteServiceDescription rsd;
+ private String method;
+ private HashMap<String, String> properties;
+ private ICallMessageContext messageContext;
+
+ public CallContext(RemoteServiceDescription rsd, String method, ICallMessageContext messageContext) {
+ this.rsd = rsd;
+ this.method = method;
+ this.messageContext = messageContext;
+ }
+
+ public String getInterfaceName() {
+ return rsd.getServiceInterfaceClassName();
+ }
+
+ public String getMethodName() {
+ return method;
+ }
+
+ public void setProperty(String name, String value) {
+ if (properties == null) {
+ properties = new HashMap<String, String>();
+ }
+ properties.put(name, value);
+ return;
+ }
+
+ public String getProperty(String name) {
+ if (properties == null) {
+ return null;
+ }
+ return properties.get(name);
+ }
+
+ public ICallMessageContext getMessageContext() {
+ return messageContext;
+ }
+
+ public void setCookie(String name, String value) {
+ messageContext.addRequestHeader("Cookie", name + "=" + value);
+ return;
+ }
+
+ public Map<String, String> getSetCookies() {
+ Map<String, List<String>> respHeaders = messageContext.listResponseHeaders();
+ if (respHeaders == null) {
+ return null;
+ }
+ List<String> listSetCookies = respHeaders.get("Set-Cookie");
+ if (listSetCookies == null) {
+ return null;
+ }
+ Map<String, String> setCookies = new HashMap<String, String>();
+ for (String temp : listSetCookies) {
+ setCookies.put(temp.substring(0, temp.indexOf("=")), temp.substring(temp.indexOf("=") + 1));
+ }
+ return setCookies;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallHook.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallHook.java
new file mode 100644
index 0000000..f51015c
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallHook.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.hooks;
+
+public interface ICallHook {
+
+ String ID = ICallHook.class.getName();
+
+ void beforeCall(CallContext context);
+
+ void afterCall(CallContext context);
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallMessageContext.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallMessageContext.java
new file mode 100644
index 0000000..1bb9a10
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallMessageContext.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.hooks;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ICallMessageContext {
+
+ void addRequestHeader(String name, String value);
+
+ Map<String, List<String>> listRequestHeaders();
+
+ Map<String, List<String>> listResponseHeaders();
+
+ List<String> getResponseHeaderValues(String name);
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallMessageContextAccessor.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallMessageContextAccessor.java
new file mode 100644
index 0000000..cc06411
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ICallMessageContextAccessor.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.hooks;
+
+public interface ICallMessageContextAccessor {
+
+ ICallMessageContext createMessageContext(Object proxy);
+
+ ICallMessageContext getMessageContext();
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceHook.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceHook.java
new file mode 100644
index 0000000..77bb80b
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceHook.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.hooks;
+
+public interface IServiceHook {
+
+ String ID = IServiceHook.class.getName();
+
+ void beforeService(ServiceContext context);
+
+ void afterService(ServiceContext context);
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceMessageContext.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceMessageContext.java
new file mode 100644
index 0000000..20b3d0f
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceMessageContext.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.hooks;
+
+import java.util.List;
+import java.util.Map;
+
+public interface IServiceMessageContext {
+
+ Map<String, List<String>> listRequestHeaders();
+
+ List<String> getRequestHeaderValue(String name);
+
+ void addResponseHeader(String name, String value);
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceMessageContextAccessor.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceMessageContextAccessor.java
new file mode 100644
index 0000000..d0e096e
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/IServiceMessageContextAccessor.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.hooks;
+
+public interface IServiceMessageContextAccessor {
+
+ IServiceMessageContext getMessageContext();
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ServiceContext.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ServiceContext.java
new file mode 100644
index 0000000..54ff0d6
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/hooks/ServiceContext.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.hooks;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.servlet.http.Cookie;
+
+import org.eclipse.riena.communication.core.RemoteServiceDescription;
+
+public class ServiceContext {
+
+ private RemoteServiceDescription rsd;
+ private String method;
+ private HashMap<String, Object> properties;
+ private IServiceMessageContext messageContext;
+
+ public ServiceContext(RemoteServiceDescription rsd, String method, IServiceMessageContext messageContext) {
+ this.rsd = rsd;
+ this.method = method;
+ this.messageContext = messageContext;
+ }
+
+ public String getInterfaceName() {
+ return rsd.getServiceInterfaceClassName();
+ }
+
+ public String getMethodName() {
+ return method;
+ }
+
+ public void setProperty(String name, Object value) {
+ if (properties == null) {
+ properties = new HashMap<String, Object>();
+ }
+ properties.put(name, value);
+ return;
+ }
+
+ public Object getProperty(String name) {
+ if (properties == null) {
+ return null;
+ }
+ return properties.get(name);
+ }
+
+ public IServiceMessageContext getMessageContext() {
+ return messageContext;
+ }
+
+ public Cookie[] getCookies() {
+ List<String> cookieValues = messageContext.getRequestHeaderValue("Cookie");
+ if (cookieValues == null || cookieValues.size() == 0) {
+ return null;
+ }
+ List<Cookie> cookies = new ArrayList<Cookie>();
+ for (String temp : cookieValues) {
+ cookies.add(new Cookie(temp.substring(0, temp.indexOf("=")), temp.substring(temp.indexOf("=") + 1)));
+ }
+ return cookies.toArray(new Cookie[cookies.size()]);
+ }
+
+ public void addCookie(Cookie cookie) {
+ messageContext.addResponseHeader("Set-Cookie", cookie.getName() + "=" + cookie.getValue());
+ }
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/IServicePublishEventDispatcher.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/IServicePublishEventDispatcher.java
new file mode 100644
index 0000000..4a476e1
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/IServicePublishEventDispatcher.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.publisher;
+
+import org.eclipse.riena.communication.core.RemoteServiceDescription;
+
+/**
+ * Implementations of IServicePublishEventDispatcher provide a List of all service end points for published OSGi
+ * Services within a container.
+ *
+ * An implementation should be registered as OSGi Service and maybe published as "remote" OSGi service itself.
+ *
+ * @author Alexander Ziegler
+ * @author Christian Campo
+ *
+ * @see RemoteServiceDescription
+ *
+ */
+public interface IServicePublishEventDispatcher {
+ /**
+ * The name of the OSGi Service.
+ */
+ String ID = IServicePublishEventDispatcher.class.getName();
+
+ /**
+ *
+ * @return the list of service end points for published OSGi Services.
+ */
+ RemoteServiceDescription[] getAllServices();
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/IServicePublisher.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/IServicePublisher.java
new file mode 100644
index 0000000..a52fd5a
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/IServicePublisher.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.publisher;
+
+import org.eclipse.riena.communication.core.IRemoteServiceProtocol;
+import org.eclipse.riena.communication.core.RemoteServiceDescription;
+import org.eclipse.riena.communication.core.factory.IRemoteServiceFactory;
+import org.eclipse.riena.communication.core.hooks.IServiceMessageContextAccessor;
+
+/**
+ * Implementations of IServicePublisher publish OSGi services as service end points.
+ *
+ * An implementation is responsible for a specifically protocol (e.g. Hessian). The implementation has be registered as
+ * OSGi Service and set with follow key/value property (see also {@link IRemoteServiceProtocol}):<br>
+ *
+ * 'riena.protocol'=[aProtocol] (e.g. for aProtocol set 'hessian')<br>
+ * <p>
+ * Code sample:<br>
+ * <code>
+ * public void start(BundleContext context) throws Exception {
+ * publisher = new XYZRemoteServicePublisher();
+ * Hashtable properties = new Hashtable(1);
+ * properties.put(IServicePublisher.PROP_PROTOCOL, publisher.getProtocol()); <br>
+ *
+ * regPublisher = context.registerService(IServicePublisher.ID, publisher, properties); <br>
+ * }
+ * </code>
+ * <p>
+ *
+ * <b>NOTE</b><br>
+ * The Riena communication bundle content includes generic class loading and object instantiation or delegates this behavior to other
+ * Riena communication bundles. Riena supports Eclipse-BuddyPolicy concept. For further information about Riena class loading and
+ * instanciation please read /readme.txt.
+ *
+ *
+ * @author Alexander Ziegler
+ * @author Christian Campo
+ *
+ *
+ * @see IRemoteServiceProtocol
+ * @see RemoteServiceDescription
+ * @see IRemoteServiceFactory
+ */
+public interface IServicePublisher extends IRemoteServiceProtocol {
+
+ String ID = IServicePublisher.class.getName();
+
+ String publishService(RemoteServiceDescription rsd);
+
+ void unpublishService(String path);
+
+ IServiceMessageContextAccessor getMessageContextAccessor();
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/RSDPublisherProperties.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/RSDPublisherProperties.java
new file mode 100644
index 0000000..4c50134
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/publisher/RSDPublisherProperties.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.publisher;
+
+/**
+ * Defines some properties required by "remote" OSGi service registration
+ *
+ * @author Alexander Ziegler
+ *
+ */
+public class RSDPublisherProperties {
+
+ /**
+ * Defines whether an OSGi Service is remote or not
+ */
+ public static final String PROP_IS_REMOTE = "riena.remote";
+ /**
+ * Defines the protocol under which the OSGi Serives is published
+ */
+ public static final String PROP_REMOTE_PROTOCOL = "riena.remote.protocol";
+ /**
+ * Defines the content path where the service end point becomes published
+ */
+ public static final String PROP_REMOTE_PATH = "riena.remote.path";
+
+ /**
+ * defines a configuration id with which the proxy can receive configuration information at runtime
+ */
+ public static final String PROP_CONFIG_ID = "riena.config.id";
+
+ public static final String PROP_INTERFACE = "riena.interface";
+
+ public static final String PROP_URL ="riena.url";
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/util/CommunicationUtil.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/util/CommunicationUtil.java
new file mode 100644
index 0000000..206c91b
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/communication/core/util/CommunicationUtil.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.communication.core.util;
+
+/**
+ * CommunicationUtil class
+ *
+ * @author Alexander Ziegler
+ *
+ */
+public class CommunicationUtil {
+
+ /**
+ * Answers the String value for the given propValue object. If the propValue not compatible to String or String[]
+ * answers the given <code>returnIfNoString</code> as default. If propValue is an instance of String[] then
+ * answers the item with index=0.
+ *
+ * @param propValue
+ * @param returnIfNoString
+ * @return the String value for propValue or the default value <code>returnIfNoString</code>
+ */
+ public static String accessProperty(Object propValue, String returnIfNoString) {
+ if (propValue instanceof String) { // if api programmed we receive
+ return (String) propValue; // a String
+ } else {
+ if (propValue instanceof String[]) { // for DS we receive a
+ return ((String[]) propValue)[0]; // String array
+ }
+ }
+ return returnIfNoString;
+ }
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java
new file mode 100644
index 0000000..3b2829b
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/Activator.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.communication.core;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.riena.communication.core.hooks.CallContext;
+import org.eclipse.riena.communication.core.hooks.ICallHook;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * @author Alexander Ziegler
+ * @author Christian Campo
+ *
+ */
+public class Activator implements BundleActivator {
+
+ private static BundleContext CONTEXT;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ CONTEXT = context;
+ context.registerService(ICallHook.ID, new ICallHook() {
+
+ public void afterCall(CallContext context) {
+ System.out.println("after call (in hook) method=" + context.getMethodName());
+ Map<String, List<String>> headers = context.getMessageContext().listResponseHeaders();
+ if (headers != null) {
+ for (String hName : headers.keySet()) {
+ StringBuffer sb = new StringBuffer();
+ for (String hValue : headers.get(hName)) {
+ sb.append(hValue + ", ");
+ }
+ System.out.println("header: name:" + hName + " value:" + sb);
+ }
+ }
+ }
+
+ public void beforeCall(CallContext context) {
+ context.getMessageContext().addRequestHeader("Cookie", "x-scpclient-test-sessionid=222");
+ System.out.println("before call (in hook) method=" + context.getMethodName());
+ }
+ }, null);
+
+ // context.registerService(ConfigurationPlugin.class.getName(), new SymbolConfigPlugin(), null);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ CONTEXT = null;
+ }
+
+ public static BundleContext getContext() {
+ return CONTEXT;
+ }
+
+}
diff --git a/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/factory/CallHooksProxy.java b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/factory/CallHooksProxy.java
new file mode 100644
index 0000000..e5d8f76
--- /dev/null
+++ b/org.eclipse.riena.communication.core/src/org/eclipse/riena/internal/communication/core/factory/CallHooksProxy.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2007 compeople AG 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:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.communication.core.factory;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashSet;
+
+import javax.security.auth.Subject;
+
+import org.eclipse.riena.communication.core.RemoteServiceDescription;
+import org.eclipse.riena.communication.core.hooks.AbstractHooksProxy;
+import org.eclipse.riena.communication.core.hooks.CallContext;
+import org.eclipse.riena.communication.core.hooks.ICallHook;
+import org.eclipse.riena.communication.core.hooks.ICallMessageContext;
+import org.eclipse.riena.communication.core.hooks.ICallMessageContextAccessor;
+import org.eclipse.riena.core.service.ServiceInjector;
+import org.eclipse.riena.internal.communication.core.Activator;
+
+public class CallHooksProxy extends AbstractHooksProxy {
+
+ private HashSet<ICallHook> callHooks = new HashSet<ICallHook>();
+ private ServiceInjector si;
+ private RemoteServiceDescription rsd;
+ private ICallMessageContextAccessor mca;
+
+ public CallHooksProxy(Object proxiedInstance) {
+ super(proxiedInstance);
+ si = new ServiceInjector(Activator.getContext(), ICallHook.ID, this, "addCallHook", "removeCallHook");
+ si.start();
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ ICallMessageContext mc = null;
+ if (mca != null) {
+ mc = mca.createMessageContext(getProxiedInstance());
+ }
+
+ CallContext context = null;
+ // only create context (might be expensive), if you have callHooks
+ if (callHooks.size() > 0) {
+ context = new CallContext(rsd, method.getName(), mc);
+
+ // call before service hook
+ for (ICallHook sHook : callHooks) {
+ sHook.beforeCall(context);
+ }
+ }
+
+ try {
+ return super.invoke(proxy, method, args);
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ } finally {
+ // context might be null and callHooks were injected during invoke
+ if (context != null) {
+ for (ICallHook sHook : callHooks) {
+ sHook.afterCall(context);
+ }
+ }
+ }
+ }
+
+ public void addCallHook(ICallHook serviceHook) {
+ callHooks.add(serviceHook);
+ }
+
+ public void removeCallHook(ICallHook serviceHook) {
+ callHooks.remove(serviceHook);
+ }
+
+ public Object getCallProxy() {
+ return getProxiedInstance();
+ }
+
+ public void setRemoteServiceDescription(RemoteServiceDescription rsd) {
+ this.rsd = rsd;
+ }
+
+ public void setMessageContextAccessor(ICallMessageContextAccessor mca) {
+ this.mca = mca;
+ }
+
+ public Subject getSubject() {
+ return null;
+ }
+}