summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-01-25 11:42:15 (EST)
committerChristian Campo2008-01-25 11:42:15 (EST)
commit07a6f0b56a5ff956339029e723ad04634395f5af (patch)
tree61ddf7e9b62597a7037911ea804a9b08c0001e6a
parentae5e0a11632346fb61a0d94384edfc4b3001f204 (diff)
downloadorg.eclipse.riena-07a6f0b56a5ff956339029e723ad04634395f5af.zip
org.eclipse.riena-07a6f0b56a5ff956339029e723ad04634395f5af.tar.gz
org.eclipse.riena-07a6f0b56a5ff956339029e723ad04634395f5af.tar.xz
initial code contribution of the server part of multiple simple samples on how to use riena. the server bundle contains the osgi service implementation that is published as webservice endpoint
-rw-r--r--org.eclipse.riena.sample.app.server/.classpath7
-rw-r--r--org.eclipse.riena.sample.app.server/.project28
-rw-r--r--org.eclipse.riena.sample.app.server/META-INF/MANIFEST.MF9
-rw-r--r--org.eclipse.riena.sample.app.server/OSGI-INF/permissions.perm13
-rw-r--r--org.eclipse.riena.sample.app.server/Riena Sample App Server (mit security).launch22
-rw-r--r--org.eclipse.riena.sample.app.server/Riena Sample App Server.launch22
-rw-r--r--org.eclipse.riena.sample.app.server/about.html24
-rw-r--r--org.eclipse.riena.sample.app.server/build.properties4
-rw-r--r--org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/Activator.java135
-rw-r--r--org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/Customers.java230
-rw-r--r--org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/HelloWorldService.java30
11 files changed, 524 insertions, 0 deletions
diff --git a/org.eclipse.riena.sample.app.server/.classpath b/org.eclipse.riena.sample.app.server/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/.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.sample.app.server/.project b/org.eclipse.riena.sample.app.server/.project
new file mode 100644
index 0000000..85b8033
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.riena.sample.app.server</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.sample.app.server/META-INF/MANIFEST.MF b/org.eclipse.riena.sample.app.server/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a8033c8
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Riena Sample App Server (Incubation)
+Bundle-SymbolicName: org.eclipse.riena.sample.app.server
+Bundle-Version: 0.0.1
+Bundle-Activator: org.eclipse.riena.internal.sample.app.server.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.riena.sample.app.common,
+ org.eclipse.riena.communication.core
diff --git a/org.eclipse.riena.sample.app.server/OSGI-INF/permissions.perm b/org.eclipse.riena.sample.app.server/OSGI-INF/permissions.perm
new file mode 100644
index 0000000..a969452
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/OSGI-INF/permissions.perm
@@ -0,0 +1,13 @@
+# specify all necessary permissions for this bundle to work
+# so that security can be active, we can still check permissions
+# based on principal and allow additional permissions if required
+
+(java.io.FilePermission "<<ALL FILES>>" "read,write")
+(org.osgi.framework.AdminPermission)
+(org.osgi.framework.PackagePermission "*" "export,import")
+(org.osgi.framework.BundlePermission "*" "provide,require")
+#(java.util.PropertyPermission "*" "read,write")
+(org.osgi.framework.ServicePermission "*" "register,get")
+(java.lang.RuntimePermission "*")
+(java.security.SecurityPermission "*")
+(javax.security.auth.AuthPermission "*")
diff --git a/org.eclipse.riena.sample.app.server/Riena Sample App Server (mit security).launch b/org.eclipse.riena.sample.app.server/Riena Sample App Server (mit security).launch
new file mode 100644
index 0000000..af4f636
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/Riena Sample App Server (mit security).launch
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Riena Sample App Server (mit security)"/>
+<booleanAttribute key="default_auto_start" value="true"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-clean -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.eclipse.equinox.http.jetty.http.port=8080&#13;&#10;-Djava.security.manager -Djava.security.properties=&quot;${workspace_loc}\org.eclipse.riena.security.services.config\config\projekte.security&quot; -Djava.security.policy==${workspace_loc}\org.eclipse.riena.security.services.config\config\sampleazn.policy -Djava.security.auth.login.config==${workspace_loc}\org.eclipse.riena.security.services.config\config\sample_jaas.config -Xbootclasspath/p:${workspace_loc}\org.eclipse.riena.security.common.bootpolicy\lib\bootpolicy.jar"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="target_bundles" value="javax.servlet@default:default,org.apache.commons.logging@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default,org.junit@default:default,org.junit4@default:default,org.mortbay.jetty@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="workspace_bundles" value="com.caucho.hessian@default:default,org.apache.log4j@default:default,org.eclipse.equinox.cm@default:default,org.eclipse.equinox.log@default:default,org.eclipse.equinox.security.auth@default:default,org.eclipse.riena.communication.console@default:default,org.eclipse.riena.communication.core@default:default,org.eclipse.riena.communication.publisher@default:default,org.eclipse.riena.communication.publisher.hessian@5:default,org.eclipse.riena.core@default:default,org.eclipse.riena.sample.app.common@6:default,org.eclipse.riena.sample.app.server@6:default,org.eclipse.riena.security.authenticationservice@default:default,org.eclipse.riena.security.authorizationservice@default:default,org.eclipse.riena.security.common@default:default,org.eclipse.riena.security.server@default:default,org.eclipse.riena.security.services.config@default:default,org.eclipse.riena.security.sessionservice@default:default"/>
+</launchConfiguration>
diff --git a/org.eclipse.riena.sample.app.server/Riena Sample App Server.launch b/org.eclipse.riena.sample.app.server/Riena Sample App Server.launch
new file mode 100644
index 0000000..544929c
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/Riena Sample App Server.launch
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<launchConfiguration type="org.eclipse.pde.ui.EquinoxLauncher">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Riena Sample App Server"/>
+<booleanAttribute key="default_auto_start" value="true"/>
+<intAttribute key="default_start_level" value="4"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-clean -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.eclipse.equinox.http.jetty.http.port=8080"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="target_bundles" value="javax.servlet@default:default,org.apache.commons.logging@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default,org.mortbay.jetty@default:default"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<stringAttribute key="workspace_bundles" value="com.caucho.hessian@default:default,org.apache.log4j@default:default,org.eclipse.core.runtime.compatibility.registry@default:default,org.eclipse.equinox.cm@default:default,org.eclipse.equinox.log@default:default,org.eclipse.equinox.log@default:default,org.eclipse.riena.communication.console@default:default,org.eclipse.riena.communication.core@default:default,org.eclipse.riena.communication.publisher@default:default,org.eclipse.riena.communication.publisher.hessian@5:default,org.eclipse.riena.core@default:default,org.eclipse.riena.sample.app.common@6:default,org.eclipse.riena.sample.app.server@6:default,org.eclipse.riena.security.common@default:default,org.junit@default:default"/>
+</launchConfiguration>
diff --git a/org.eclipse.riena.sample.app.server/about.html b/org.eclipse.riena.sample.app.server/about.html
new file mode 100644
index 0000000..fc81119
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/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.sample.app.server/build.properties b/org.eclipse.riena.sample.app.server/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/Activator.java b/org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/Activator.java
new file mode 100644
index 0000000..86ffb58
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/Activator.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * 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.sample.app.server;
+
+import java.util.Hashtable;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.riena.communication.core.publisher.RSDPublisherProperties;
+import org.eclipse.riena.sample.app.common.model.ICustomerSearch;
+import org.eclipse.riena.sample.app.common.model.ICustomers;
+import org.eclipse.riena.sample.app.common.model.IHelloWorldService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ private static final String REMOTE_PROTOCOL_HESSIAN = "hessian";
+
+ // The shared instance
+ private static Activator plugin;
+
+ private Customers customers;
+ private ServiceRegistration regCustomerSearch;
+ private ServiceRegistration regCustomers;
+ private HelloWorldService helloWorldService;
+ private ServiceRegistration regHelloWorldService;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+
+ super();
+
+ customers = new Customers();
+ helloWorldService = new HelloWorldService();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+
+ startCustomerSearch(context);
+ startCustomers(context);
+ startHelloWorldService(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+
+ stopCustomerSearch();
+ stopCustomers();
+ stopHelloWorldService();
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ private void startCustomerSearch(BundleContext context) {
+
+ Hashtable<String, String> properties = new Hashtable<String, String>(3);
+
+ properties.put(RSDPublisherProperties.PROP_IS_REMOTE, "true");
+ properties.put(RSDPublisherProperties.PROP_REMOTE_PROTOCOL, REMOTE_PROTOCOL_HESSIAN);
+ properties.put(RSDPublisherProperties.PROP_REMOTE_PATH, "/CustomerSearchWS");
+
+ regCustomerSearch = context.registerService(ICustomerSearch.ID, customers, properties);
+ }
+
+ public void stopCustomerSearch() {
+
+ regCustomerSearch.unregister();
+ regCustomerSearch = null;
+ }
+
+ private void startCustomers(BundleContext context) {
+
+ Hashtable<String, String> properties = new Hashtable<String, String>(3);
+
+ properties.put(RSDPublisherProperties.PROP_IS_REMOTE, "true");
+ properties.put(RSDPublisherProperties.PROP_REMOTE_PROTOCOL, REMOTE_PROTOCOL_HESSIAN);
+ properties.put(RSDPublisherProperties.PROP_REMOTE_PATH, "/CustomersWS");
+
+ regCustomers = context.registerService(ICustomers.ID, customers, properties);
+ }
+
+ public void stopCustomers() {
+
+ regCustomers.unregister();
+ regCustomers = null;
+ }
+
+ private void startHelloWorldService(BundleContext context) {
+
+ Hashtable<String, String> properties = new Hashtable<String, String>(3);
+
+ properties.put(RSDPublisherProperties.PROP_IS_REMOTE, "true");
+ properties.put(RSDPublisherProperties.PROP_REMOTE_PROTOCOL, REMOTE_PROTOCOL_HESSIAN);
+ properties.put(RSDPublisherProperties.PROP_REMOTE_PATH, "/HelloWorldServiceWS");
+
+ regHelloWorldService = context.registerService(IHelloWorldService.ID, helloWorldService, properties);
+ }
+
+ public void stopHelloWorldService() {
+
+ regHelloWorldService.unregister();
+ regHelloWorldService = null;
+ }
+}
diff --git a/org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/Customers.java b/org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/Customers.java
new file mode 100644
index 0000000..56137eb
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/Customers.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * 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.sample.app.server;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.riena.sample.app.common.model.Address;
+import org.eclipse.riena.sample.app.common.model.BankData;
+import org.eclipse.riena.sample.app.common.model.Birth;
+import org.eclipse.riena.sample.app.common.model.Customer;
+import org.eclipse.riena.sample.app.common.model.CustomersPermission;
+import org.eclipse.riena.sample.app.common.model.ICustomerSearch;
+import org.eclipse.riena.sample.app.common.model.ICustomers;
+import org.eclipse.riena.sample.app.common.model.Offer;
+
+/**
+ * Customers Service Class that is exposed as Webservice. It implements
+ * ICustomers (the customer maintaince interface) and ICustomerSearch (the
+ * interface for search on the customer data)
+ */
+public class Customers implements ICustomers, ICustomerSearch {
+
+ private Map<Integer, Customer> customers;
+ private Map<Integer, Set<Offer>> offers;
+ private int nextUniqueCustomerNumber;
+
+ public Customers() {
+
+ customers = new HashMap<Integer, Customer>();
+ offers = new HashMap<Integer, Set<Offer>>();
+ nextUniqueCustomerNumber = 1;
+
+ initializeCustomers();
+ initializeOffers();
+ }
+
+ /**
+ * @see org.eclipse.riena.sample.app.common.model.ICustomers#getNextUniqueCustomerNumber()
+ */
+ public Integer getNextUniqueCustomerNumber() {
+
+ return nextUniqueCustomerNumber++;
+ }
+
+ /**
+ * @see org.eclipse.riena.sample.app.common.model.ICustomers#store(org.eclipse.riena.sample.app.common.model.Customer)
+ */
+ public void store(Customer customer) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(new CustomersPermission("riena.sample", "store"));
+ }
+ storeInternal(customer);
+ }
+
+ /**
+ * This method is also used internally to store customers. No security is
+ * checked.
+ *
+ * @param customer
+ */
+ private void storeInternal(Customer customer) {
+ customer.id = customer.getCustomerNumber();
+ customers.put(customer.getCustomerNumber(), customer);
+
+ }
+
+ /**
+ * @see org.eclipse.riena.sample.app.common.model.ICustomerSearch#findCustomer(org.eclipse.riena.sample.app.common.model.Customer)
+ */
+ public Customer[] findCustomer(Customer searchedCustomer) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(new CustomersPermission("riena.sample", "find"));
+ }
+
+ List<Customer> l = new ArrayList<Customer>();
+
+ for (Customer c : customers.values()) {
+ if (isIdentical(c, searchedCustomer)) {
+ l.add(c);
+ }
+ }
+
+ return l.toArray(new Customer[l.size()]);
+ }
+
+ /**
+ * @see org.eclipse.riena.sample.app.common.model.ICustomers#getOffers(java.lang.Integer)
+ */
+ public Offer[] getOffers(Integer customerNumber) {
+
+ Set<Offer> customerOffers = offers.get(customerNumber);
+ if (customerOffers == null) {
+ return new Offer[0];
+ } else {
+ return customerOffers.toArray(new Offer[customerOffers.size()]);
+ }
+ }
+
+ private boolean isIdentical(Customer customer, Customer searchedCustomer) {
+
+ if (searchedCustomer.getCustomerNumber() != null && !searchedCustomer.getCustomerNumber().equals(customer.getCustomerNumber())) {
+ return false;
+ }
+
+ if (!contains(customer.getLastName(), searchedCustomer.getLastName())) {
+ return false;
+ }
+
+ if (!contains(customer.getFirstName(), searchedCustomer.getFirstName())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean contains(String original, String other) {
+
+ if (other == null || other.equals("")) {
+ return true;
+ }
+
+ return original.toUpperCase().contains(other.toUpperCase());
+ }
+
+ private void initializeCustomers() {
+
+ Customer customer = new Customer();
+ customer.setFirstName("Han");
+ customer.setLastName("Solo");
+ Address address = new Address();
+ address.setCity("Frankfurt am Main");
+ address.setStreet("Am Main 233");
+ address.setZipCode("61236");
+ address.setCountry("Germany");
+ customer.setAddress(address);
+
+ customer.setBirth(new Birth());
+ SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy");
+ try {
+ customer.getBirth().setBirthDay(format.parse("01.04.1962"));
+ } catch (ParseException e) {
+ // TODO Throw exception
+ e.printStackTrace();
+ }
+ customer.getBirth().setBirthPlace("Frankfurt");
+ customer.setBankData(new ArrayList<BankData>());
+ initializeCustomerNumber(customer);
+
+ customer = new Customer();
+ customer.setFirstName("Luke");
+ customer.setLastName("Skywalker");
+ address = new Address();
+ address.setCity("Washington");
+ address.setStreet("Any Road 845");
+ address.setZipCode("98123898");
+ address.setCountry("USA");
+ customer.setAddress(address);
+ customer.setBirth(new Birth());
+ try {
+ customer.getBirth().setBirthDay(format.parse("01.04.1963"));
+ } catch (ParseException e) {
+ // TODO Throw exception
+ e.printStackTrace();
+ }
+ customer.getBirth().setBirthPlace("Frankfurt");
+ customer.setBankData(new ArrayList<BankData>());
+ initializeCustomerNumber(customer);
+
+ customer = new Customer();
+ customer.setFirstName("Frodo");
+ customer.setLastName("Baggins");
+ address = new Address();
+ address.setCity("Hanau");
+ address.setStreet("Grüner Weg 3");
+ address.setZipCode("62342");
+ address.setCountry("Germany");
+ customer.setAddress(address);
+ customer.setBirth(new Birth());
+ try {
+ customer.getBirth().setBirthDay(format.parse("01.04.1964"));
+ } catch (ParseException e) {
+ // TODO Throw exception
+ e.printStackTrace();
+ }
+ customer.getBirth().setBirthPlace("Frankfurt");
+ customer.setBankData(new ArrayList<BankData>());
+ initializeCustomerNumber(customer);
+ }
+
+ private void initializeOffers() {
+
+ Offer offer = new Offer(1, 1);
+ addOffer(offer);
+ offer = new Offer(1, 2);
+ addOffer(offer);
+ }
+
+ private void addOffer(Offer offer) {
+
+ Set<Offer> customerOffers = offers.get(offer.getCustomerNumber());
+ if (customerOffers == null) {
+ customerOffers = new HashSet<Offer>();
+ offers.put(offer.getCustomerNumber(), customerOffers);
+ }
+ customerOffers.add(offer);
+ }
+
+ private void initializeCustomerNumber(Customer customer) {
+
+ customer.setCustomerNumber(getNextUniqueCustomerNumber());
+ storeInternal(customer);
+ }
+}
diff --git a/org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/HelloWorldService.java b/org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/HelloWorldService.java
new file mode 100644
index 0000000..aed60b1
--- /dev/null
+++ b/org.eclipse.riena.sample.app.server/src/org/eclipse/riena/internal/sample/app/server/HelloWorldService.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.sample.app.server;
+
+import java.util.Date;
+
+import org.eclipse.riena.sample.app.common.model.IHelloWorldService;
+
+/**
+ * HellowWorldService is a very simple Web Service for our simple HelloService
+ * example.
+ */
+public class HelloWorldService implements IHelloWorldService {
+
+ /**
+ * @see org.eclipse.riena.sample.app.common.model.IHelloWorldService#getMessage()
+ */
+ public String getMessage() {
+
+ return new Date() + ": Hello World!";
+ }
+}