empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r748189 [1/3] - in /incubator/empire-db/trunk: ./ empire-db-examples/ empire-db-examples/empire-db-example-struts2-cxf/ empire-db-examples/empire-db-example-struts2-cxf/src/ empire-db-examples/empire-db-example-struts2-cxf/src/main/ empire-...
Date Thu, 26 Feb 2009 15:54:35 GMT
Author: doebele
Date: Thu Feb 26 15:54:32 2009
New Revision: 748189

URL: http://svn.apache.org/viewvc?rev=748189&view=rev
Log:
Added example web application showing the use of empire-db / empire-db-struts2 extensions with a  apache-xcf webservice.

Added:
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/pom.xml   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeManagementProxy.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Department.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Employee.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeManagementInterface.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/common/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/common/Errors.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleContext.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleHtmlTagDictionary.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleRequest.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleUser.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/DetailAction.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/SampleAction.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/ws/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/ws/SampleBeanClass.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/ws/SampleBeanDomain.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/ws/SampleRecord.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/ws/records/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/ws/records/DepartmentRecord.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/ws/records/EmployeeRecord.java   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/resources/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/resources/log4j.dtd   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/resources/log4j.xml   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/resources/messages_de.properties   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/resources/messages_en.properties   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/resources/struts.properties   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/resources/struts.xml   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/WEB-INF/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/WEB-INF/config.xml   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/WEB-INF/empire-tags.tld   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/WEB-INF/web.xml   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/css/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/css/main.css   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/index.html   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/jsp/
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/jsp/employeeDetails.jsp   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/jsp/employeeList.jsp   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/jsp/employeeSearch.jsp   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/jsp/error.jsp   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/webapp/jsp/login.jsp   (with props)
    incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/test/
Modified:
    incubator/empire-db/trunk/empire-assembly-all.xml
    incubator/empire-db/trunk/empire-db-examples/pom.xml

Modified: incubator/empire-db/trunk/empire-assembly-all.xml
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-assembly-all.xml?rev=748189&r1=748188&r2=748189&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-assembly-all.xml (original)
+++ incubator/empire-db/trunk/empire-assembly-all.xml Thu Feb 26 15:54:32 2009
@@ -65,6 +65,7 @@
 				<include>empire-db-struts2/**</include>
 				<include>empire-db-examples/empire-db-example-struts2/**</include>
 				<include>empire-db-examples/empire-db-example-cxf/**</include>
+				<include>empire-db-examples/empire-db-example-struts2-cxf/**</include>
 			</includes>
 			<excludes>
 				<exclude>**/empire-db/target/**</exclude>
@@ -98,6 +99,7 @@
 				<include>org.apache.empire-db:empire-db-example-advanced</include>
     			<include>org.apache.empire-db:empire-db-example-struts2</include>
     			<include>org.apache.empire-db:empire-db-example-cxf</include>
+    			<include>org.apache.empire-db:empire-db-example-struts2-cxf</include>
 			</includes>
 			<binaries>
 				<outputDirectory>lib</outputDirectory>

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/pom.xml
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/pom.xml?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/pom.xml (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/pom.xml Thu Feb 26 15:54:32 2009
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+	<!--
+		Licensed to the Apache Software Foundation (ASF) under one or more
+		contributor license agreements. See the NOTICE file distributed with
+		this work for additional information regarding copyright ownership.
+		The ASF licenses this file to You under the Apache License, Version
+		2.0 (the "License"); you may not use this file except in compliance
+		with the License. You may obtain a copy of the License at
+
+		http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+		applicable law or agreed to in writing, software distributed under the
+		License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+		CONDITIONS OF ANY KIND, either express or implied. See the License for
+		the specific language governing permissions and limitations under the
+		License.
+	-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<artifactId>empire-db-examples</artifactId>
+		<groupId>org.apache.empire-db</groupId>
+		<version>2.0.5-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.apache.empire-db</groupId>
+	<artifactId>empire-db-example-struts2-cxf</artifactId>
+	<packaging>war</packaging>
+	<name>Empire-db Struts2/CXF Example</name>
+	<version>2.0.5-SNAPSHOT</version>
+	<description>Examples showing the use of empire-db.</description>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.empire-db</groupId>
+			<artifactId>empire-db</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.empire-db</groupId>
+			<artifactId>empire-db-struts2</artifactId>
+		</dependency>
+
+	    <dependency>
+			<groupId>org.apache.cxf</groupId>
+			<artifactId>cxf-rt-frontend-jaxws</artifactId>
+			<version>2.1.3</version>
+		</dependency>
+		
+	        <!-- Jetty is needed if you're are not using the CXFServlet -->
+		<dependency>
+			<groupId>org.apache.cxf</groupId>
+			<artifactId>cxf-rt-transports-http-jetty</artifactId>
+			<version>2.1.3</version>
+		</dependency>
+	</dependencies>
+	
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.mortbay.jetty</groupId>
+				<artifactId>maven-jetty-plugin</artifactId>
+				<version>6.1.10</version>
+				<configuration>
+					<scanIntervalSeconds>10</scanIntervalSeconds>
+					<stopKey>foo</stopKey>
+					<stopPort>9999</stopPort>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeManagementProxy.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeManagementProxy.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeManagementProxy.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeManagementProxy.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.empire.samples.cxf.wssample.client;
+
+import java.util.List;
+
+import javax.xml.ws.Holder;
+
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.empire.samples.cxf.wssample.common.Department;
+import org.apache.empire.samples.cxf.wssample.common.Employee;
+import org.apache.empire.samples.cxf.wssample.common.EmployeeManagementInterface;
+
+// The access to WebService.
+public class EmployeeManagementProxy
+{
+    private EmployeeManagementInterface proxy = null;
+    private String                      serviceAddress;
+
+    public EmployeeManagementProxy(String serviceAddress)
+    {
+        this.serviceAddress = serviceAddress;
+        init();
+    }
+
+    private void init()
+    {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.getInInterceptors().add(new LoggingInInterceptor());
+        factory.getOutInterceptors().add(new LoggingOutInterceptor());
+        factory.setServiceClass(EmployeeManagementInterface.class);
+        factory.setAddress(serviceAddress);
+        this.proxy = (EmployeeManagementInterface) factory.create();
+    }
+
+    public Employee createEmmployee()
+    {
+        return proxy.createEmmployee();
+    }
+
+    public List<Department> getDepartments()
+    {
+        return proxy.getDepartments();
+    }
+
+    public Employee getEmmployee(int id)
+    {
+        return proxy.getEmmployee(id);
+    }
+
+    public boolean saveEmployee(Employee e)
+    {
+        // Employee is here a INOUT parameter, and therfore has to be placed in a Holder.
+        Holder<Employee> holder = new Holder<Employee>(e);
+        boolean retVal = proxy.saveEmmployee(holder);
+        // In order to retrieve changes made by the webservice we copy the content to our local variable.
+        e.set(holder.value);
+        return retVal;
+    }
+
+    public boolean deleteEmployee(int id)
+    {
+        return proxy.deleteEmmployee(id);
+    }
+
+    public List<Employee> searchEmployee(Integer id, String firstName, String lastName, Integer department)
+    {
+        return proxy.searchEmmployee(id, firstName, lastName, department);
+    }
+
+    public String test()
+    {
+        return proxy.test();
+    }
+
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeManagementProxy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Department.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Department.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Department.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Department.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.empire.samples.cxf.wssample.common;
+
+import java.util.Date;
+
+import org.apache.empire.db.DBRecord;
+
+
+// Holds all the data represented by a department-record from the database
+public class Department {
+
+	private long departmentId = DBRecord.REC_NEW;
+	private String name = "";
+	private String head = "";
+	private String businessUnit = "";
+	private Date updateTimestamp = null;
+
+	public void setDepartmentId(long id) {
+		departmentId = id;
+	}
+
+	public long getDepartmentId() {
+		return departmentId;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setHead(String head) {
+		this.head = head;
+	}
+
+	public String getHead() {
+		return head;
+	}
+
+	public void setBusinessUnit(String businessUnit) {
+		this.businessUnit = businessUnit;
+	}
+
+	public String getBusinessUnit() {
+		return businessUnit;
+	}
+
+	public void setUpdateTimestamp(Date d) {
+		this.updateTimestamp = d;
+	}
+
+	public Date getUpdateTimestamp() {
+		return updateTimestamp;
+	}
+	
+	public String toString()
+	{
+		return name;
+	}
+
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Department.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Employee.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Employee.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Employee.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Employee.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.empire.samples.cxf.wssample.common;
+
+import java.util.Date;
+
+//Holds all the data represented by a employee-record from the database
+public class Employee {
+
+	private long employeeId = -1;
+	private String salutation = "";
+	private String firstname = "";
+	private String lastname = "";
+	private Date dateOfBirth = null;
+	private long departmentId = -1;
+	private String gender = "";
+	private String phoneNumber = "";
+	private String email = "";
+	private double salary = -1;
+	private boolean retired = false;
+	private Date updateTimestamp = null;
+	private boolean isNew = false;
+
+	public void set(Employee e) {
+		employeeId = e.getDepartmentId();
+		salutation = e.getSalutation();
+		firstname = e.getFirstname();
+		lastname = e.getLastname();
+		dateOfBirth = e.getDateOfBirth();
+		departmentId = e.getDepartmentId();
+		gender = e.getGender();
+		phoneNumber = e.getPhoneNumber();
+		email = e.getEmail();
+		salary = e.getSalary();
+		retired = e.isRetired();
+		updateTimestamp = e.getUpdateTimestamp();
+		isNew = e.isNew();
+	}
+
+	public void setEmployeeId(long id) {
+		employeeId = id;
+	}
+
+	public long getEmployeeId() {
+		return employeeId;
+	}
+
+	public void setSalutation(String salutation) {
+		this.salutation = salutation;
+	}
+
+	public String getSalutation() {
+		return salutation;
+	}
+
+	public void setFirstname(String firstname) {
+		this.firstname = firstname;
+	}
+
+	public String getFirstname() {
+		return firstname;
+	}
+
+	public void setLastname(String lastname) {
+		this.lastname = lastname;
+	}
+
+	public String getLastname() {
+		return lastname;
+	}
+
+	public void setDateOfBirth(Date dateOfBirth) {
+		this.dateOfBirth = dateOfBirth;
+	}
+
+	public Date getDateOfBirth() {
+		return dateOfBirth;
+	}
+
+	public void setDepartmentId(long departmentId) {
+		this.departmentId = departmentId;
+	}
+
+	public long getDepartmentId() {
+		return departmentId;
+	}
+
+	public void setGender(String gender) {
+		this.gender = gender;
+	}
+
+	public String getGender() {
+		return gender;
+	}
+
+	public void setPhoneNumber(String phone) {
+		this.phoneNumber = phone;
+	}
+
+	public String getPhoneNumber() {
+		return phoneNumber;
+	}
+
+	public void setEmail(String email) {
+		this.email = email;
+	}
+
+	public String getEmail() {
+		return email;
+	}
+
+	public void setRetired(boolean retired) {
+		this.retired = retired;
+	}
+
+	public boolean isRetired() {
+		return retired;
+	}
+
+	public void setUpdateTimestamp(Date d) {
+		this.updateTimestamp = d;
+	}
+
+	public Date getUpdateTimestamp() {
+		return updateTimestamp;
+	}
+
+	public void setSalary(double salary) {
+		this.salary = salary;
+	}
+
+	public double getSalary() {
+		return salary;
+	}
+
+	@Override
+	public String toString() {
+		String str = "";
+		str += getEmployeeId() + ": ";
+		str += getSalutation() + " ";
+		str += getFirstname() + " ";
+		str += getLastname();
+
+		return str;
+	}
+
+	public void setNew(boolean isNew) {
+		this.isNew = isNew;
+	}
+
+	public boolean isNew() {
+		return isNew;
+	}
+
+}
\ No newline at end of file

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/Employee.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeManagementInterface.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeManagementInterface.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeManagementInterface.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeManagementInterface.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.empire.samples.cxf.wssample.common;
+
+import java.util.List;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.WebParam.Mode;
+import javax.xml.ws.Holder;
+
+//specifies the the attribute wsdl:portType
+@WebService(name = "employeeManagement")
+
+public interface EmployeeManagementInterface
+{
+
+    @WebMethod(operationName = "searchEmmployee")
+    @WebResult(name = "searchResponse")
+    public List<Employee> searchEmmployee(@WebParam(name = "id", mode = Mode.IN) Integer id,
+                                          @WebParam(name = "firstName", mode = Mode.IN) String firstName,
+                                          @WebParam(name = "lastName", mode = Mode.IN) String lastName,
+                                          @WebParam(name = "department", mode = Mode.IN) Integer department);
+
+    @WebMethod(operationName = "getEmmployee")
+    @WebResult(name = "employee")
+    public Employee getEmmployee(@WebParam(name = "id", mode = Mode.IN) int id);
+
+    @WebMethod(operationName = "createEmmployee")
+    @WebResult(name = "newEmployee")
+    public Employee createEmmployee();
+
+    @WebMethod(operationName = "saveEmmployee")
+    @WebResult(name = "saveResponse")
+    public boolean saveEmmployee(@WebParam(name = "employee", mode = Mode.INOUT) Holder<Employee> e);
+
+    @WebMethod(operationName = "deleteEmmployee")
+    @WebResult(name = "deleteResponse")
+    public boolean deleteEmmployee(@WebParam(name = "id", mode = Mode.IN) int id);
+
+    @WebMethod(operationName = "test")
+    @WebResult(name = "testResponse")
+    public String test();
+
+    @WebMethod(operationName = "getDepartments")
+    @WebResult(name = "allDepartments")
+    public List<Department> getDepartments();
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeManagementInterface.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/common/Errors.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/common/Errors.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/common/Errors.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/common/Errors.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.empire.struts2.websample.common;
+
+import org.apache.empire.commons.ErrorType;
+
+public class Errors {
+    public static final ErrorType WebServiceNotAvailable = new ErrorType(
+            "error.wsnav", "WebService not Responding!");
+}
\ No newline at end of file

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/common/Errors.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web;
+
+import javax.servlet.ServletContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.empire.samples.cxf.wssample.client.EmployeeManagementProxy;
+import org.apache.empire.struts2.actionsupport.TextProviderActionSupport;
+import org.apache.empire.struts2.html.HtmlTagDictionary;
+import org.apache.empire.struts2.web.WebApplication;
+import org.apache.empire.struts2.websample.ws.SampleBeanDomain;
+
+public class SampleApplication implements WebApplication {
+	// Logger
+	protected static Log log = LogFactory.getLog(SampleApplication.class);
+
+	// must be singleton
+	private static SampleApplication application;
+
+	public static SampleApplication getInstance() {
+		return application;
+	}
+
+	// Non-Static
+	private SampleBeanDomain beanDomain = new SampleBeanDomain();
+	private SampleConfig config = new SampleConfig();
+	
+	private EmployeeManagementProxy ws = new EmployeeManagementProxy(config
+			.getServiceAddress());
+
+	public void init(ServletContext servletContext) {
+		try {
+
+			// Application
+			if (application != null) {
+				log.fatal("Application has already been initiallized!");
+				return;
+			}
+			application = this;
+
+			// register all controls
+			// InputControlManager.registerControl("myType", new
+			// MyTypeInputControl());
+			config.init(servletContext.getRealPath("WEB-INF/config.xml"));
+
+			// Set Html Dictionary
+			HtmlTagDictionary.set(new SampleHtmlTagDictionary());
+
+			// Set Database to Servlet Context
+			servletContext.setAttribute("db", beanDomain);
+
+			// Get a Webservice Connection
+			log.info("*** testing Webservice Connection ***");
+			ws = initWebServiceProxy();
+
+			// Disable Message caching
+			TextProviderActionSupport.setCachingEnabled(false);
+
+			// Done
+			log.info("Application initialized ");
+
+		} catch (Exception e) {
+			// Error
+			log.info(e.toString());
+			e.printStackTrace();
+		}
+
+	}
+
+	public SampleBeanDomain getBeanDomain() {
+		return beanDomain;
+	}
+
+	public EmployeeManagementProxy getWebServiceProxy() {
+		return ws;
+	}
+
+	public void releaseEmployeeProxy(EmployeeManagementProxy ws) {
+		// Return Connection to Connection Pool
+	}
+
+	private EmployeeManagementProxy initWebServiceProxy() {
+		String addr = config.getServiceAddress();
+		try {
+			EmployeeManagementProxy emp = new EmployeeManagementProxy(addr);
+			String info = emp.test();
+			log.info(info);
+			return emp;
+		} catch (Throwable e) {
+			log.error("Failed to connect directly to '" + addr + "'");
+			throw new RuntimeException(e);
+		}
+
+	}
+
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleApplication.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web;
+
+import org.apache.empire.xml.XMLConfiguration;
+
+public class SampleConfig extends XMLConfiguration {
+	
+	private String databaseProvider = "webservice";
+	
+	private String serviceHost = "http://localhost";
+
+	private String servicePort = "8080";
+
+	private String serviceName = "WSSAMPLE";
+
+
+	/**
+	 * Initialize the configuration
+	 */
+	public boolean init(String filename) {
+		// Read the properties file
+		if (super.init(filename, false, true) == false)
+			return false;
+		// Done
+		if (readProperties(this, "properties") == false)
+			return false;
+		// Reader Provider Properties
+		return readProperties(this, "properties-" + databaseProvider);
+	}
+
+	public String getDatabaseProvider() {
+		return databaseProvider;
+	}
+
+	public String getServiceHost() {
+		return serviceHost;
+	}
+
+	public String getServicePort() {
+		return servicePort;
+	}
+
+	public String getServiceName() {
+		return serviceName;
+	}
+
+	public String getServiceAddress() {
+		return serviceHost + ":" + servicePort + "/" + serviceName;
+	}
+
+	// ------- Setters -------
+
+	public void setDatabaseProvider(String databaseProvider) {
+		this.databaseProvider = databaseProvider;
+	}
+
+	public void setServiceHost(String serviceHost) {
+		this.serviceHost = serviceHost;
+	}
+
+	public void setServicePort(String servicePort) {
+		this.servicePort = servicePort;
+	}
+
+	public void setServiceName(String serviceName) {
+		this.serviceName = serviceName;
+	}
+
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleConfig.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleContext.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleContext.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleContext.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleContext.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web;
+
+import org.apache.empire.samples.cxf.wssample.client.EmployeeManagementProxy;
+import org.apache.empire.struts2.websample.ws.SampleBeanDomain;
+
+public class SampleContext
+{
+
+    /*
+     * This is just a very simple implementation of a "context" object.
+     * You may add user specific information here.
+     * 
+     */
+    
+    public SampleBeanDomain getBeanDomain()
+    {
+        return SampleApplication.getInstance().getBeanDomain();
+    }
+
+    public EmployeeManagementProxy getWebserviceProxy()
+    {
+        return SampleApplication.getInstance().getWebServiceProxy();
+    }
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleHtmlTagDictionary.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleHtmlTagDictionary.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleHtmlTagDictionary.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleHtmlTagDictionary.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web;
+
+import org.apache.empire.struts2.html.DefaultHtmlTagDictionary;
+
+public class SampleHtmlTagDictionary extends DefaultHtmlTagDictionary
+{
+    // ------- Input Control -------
+
+    @Override
+    public boolean InputReadOnlyAsData()
+    {
+        return false; // Show Read Only Input as Data (not as disabled input)
+    }
+    
+    @Override
+    public int InputMaxCharSize()
+    {
+        return 40; // Maximum horizontal size in characters
+    }
+
+    @Override
+    public String InputWrapperTag()
+    {
+        return "tr";
+    }
+
+    @Override
+    public String InputLabelTag()
+    {
+        return "td";
+    }
+
+    @Override
+    public String InputControlTag()
+    {
+        return "td";
+    }
+
+    // ------- Errors -------
+
+    @Override
+    public String ErrorItemEntryClass()
+    {
+        return "errorMessage";
+    }
+
+    @Override
+    public String ErrorActionEntryClass()
+    {
+        return "errorMessage";
+    }
+
+    @Override
+    public String ErrorEntryWrapperTag()
+    {
+        return "span";
+    }
+
+    // ------- Message -------
+
+    @Override
+    public String MessageTag()
+    {
+        return "div";
+    }
+
+    @Override
+    public String MessageClass()
+    {
+        return "actionMessage";
+    }
+
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleHtmlTagDictionary.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleRequest.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleRequest.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleRequest.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleRequest.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.empire.samples.cxf.wssample.client.EmployeeManagementProxy;
+import org.apache.empire.struts2.web.EmpireStrutsDispatcher;
+import org.apache.empire.struts2.web.WebRequest;
+
+
+public class SampleRequest implements WebRequest
+{
+    // Logger
+    protected static Log log = LogFactory.getLog(SampleRequest.class);
+
+    private HttpServletRequest  httpRequest;
+    private HttpServletResponse httpResponse;
+    private SampleSession       session;
+    private EmployeeManagementProxy          ws;  // Connection for this request
+    
+    public static SampleRequest getInstance()
+    {
+        return (SampleRequest)EmpireStrutsDispatcher.getCurrentRequest();        
+    }
+    
+    public boolean init(HttpServletRequest request, HttpServletResponse response, Object session)
+    {
+        this.httpRequest = request;
+        this.httpResponse = response;
+        // Set Internal objects
+        this.session = (SampleSession)session;
+        if (this.session==null)
+        {   // Error
+            log.fatal("Internal Error: Session object is null");
+            return false;
+        }
+        // continue processing
+        return true;
+    }
+
+    public void exit(int exitCode)
+    {
+    	//TODO: how to roll back on webservice?
+        // Cleanup
+        if (ws!=null)
+        {   // Commit or rollback connection depending on the exit code
+            if (exitCode>=0)
+            {   // 0 or positive exitCode indicates success
+                log.debug("Request ended sucessfully. Committing database changes.");
+                //getApplication().getDatabase().commit(connection);
+            }
+            else 
+            {   // negative exitCode indicates an error
+                log.warn("Request ended with errors. Database changes will be rolled back.");
+                //getApplication().getDatabase().rollback(connection);
+            }
+            // Release Connection
+            getApplication().releaseEmployeeProxy(ws);
+            ws= null;
+        }
+        // Release objects
+        this.httpRequest = null;
+        this.httpResponse = null;
+    }
+
+    // Get Session
+    public SampleSession getSession()
+    {
+        return session;
+    }
+
+    // Get Application
+    public SampleApplication getApplication()
+    {
+        return session.getApplication();
+    }
+
+    // Get Connection
+    public EmployeeManagementProxy getEmployeeManagementProxy()
+    {
+        // Get a Connection for the Connection Pool 
+        if (ws==null)
+        	ws= getApplication().getWebServiceProxy();
+        // return connection
+        return ws;
+    }
+    
+    public HttpServletRequest getHttpRequest()
+    {
+        return httpRequest;
+    }
+
+    public HttpServletResponse getHttpResponse()
+    {
+        return httpResponse;
+    }
+    
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleRequest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web;
+
+import java.util.HashMap;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.empire.struts2.web.WebSession;
+
+
+public class SampleSession implements WebSession
+{
+    // Logger
+    protected static Log log = LogFactory.getLog(SampleSession.class);
+
+    // Non-Static
+    private SampleApplication application = null;
+    public SampleUser user = null;
+    public HashMap<String, Object> objectMap = new HashMap<String, Object>();
+    
+    // Init Session
+    public void init(HttpSession session, Object application)
+    {
+        this.application = (SampleApplication) application;
+        if (this.application==null)
+        {
+            throw new RuntimeException("Fatal: Application object is null!");
+        }
+        log.info("Session created ");
+    }
+
+    // Get Application
+    public SampleApplication getApplication()
+    {
+        return application;
+    }
+
+    public SampleUser getUser()
+    {
+        return user;
+    }
+
+    public void setUser(SampleUser user)
+    {
+        this.user = user;
+    }
+    
+    public Object getObject(String name)
+    {
+        return objectMap.get(name);
+    }
+    
+    public final Object getObject(Class objclass)
+    {
+        return getObject(objclass.getName());
+    }
+    
+    public Object setObject(String name, Object obj)
+    {
+        return objectMap.put(name, obj);
+    }
+    
+    public final Object setObject(Class objclass, Object obj)
+    {
+        return setObject(objclass.getName(), obj);
+    }
+    
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleSession.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleUser.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleUser.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleUser.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleUser.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web;
+
+import java.util.Locale;
+
+public class SampleUser
+{
+    private String userId;
+    private String displayName;
+    private Locale locale = Locale.ENGLISH;
+
+    public SampleUser(String userId, String displayName)
+    {
+        this.userId = userId;
+        this.displayName = displayName;
+    }
+
+    public String getDisplayName()
+    {
+        return displayName;
+    }
+
+    public String getUserId()
+    {
+        return userId;
+    }
+
+    public Locale getLocale()
+    {
+        return locale;
+    }
+
+    public void setLocale(Locale locale)
+    {
+        if(locale!=null)
+            this.locale = locale;
+    }
+
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/SampleUser.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web.actions;
+
+import org.apache.empire.samples.cxf.wssample.client.EmployeeManagementProxy;
+import org.apache.empire.samples.cxf.wssample.common.Employee;
+import org.apache.empire.struts2.actionsupport.SessionPersistence;
+import org.apache.empire.struts2.websample.web.SampleApplication;
+import org.apache.empire.struts2.websample.web.SampleContext;
+import org.apache.empire.struts2.websample.web.actiontypes.BeanDetailAction;
+import org.apache.empire.struts2.websample.ws.records.EmployeeRecord;
+
+/**
+ * EmployeeDetailAction
+ * <p>
+ * This class provides form processing functions for an Employee record.<br>
+ * The class uses a RecordActionSupport object which does most of the work.<br>
+ * For multi-record forms it is possible to have several RecordActionSupport members.<br>
+ * In this case each must be given a differnt property name however (see RecordActionSupport overloads).
+ * </p>
+ */
+public class EmployeeDetailAction extends BeanDetailAction<Employee>
+{
+    private EmployeeManagementProxy proxy = SampleApplication.getInstance().getWebServiceProxy();
+
+    // ------- Action Construction -------
+
+    public EmployeeDetailAction()
+    {
+        super(new EmployeeRecord(new SampleContext()), SessionPersistence.Key);
+
+    }
+
+    /*
+     * 
+     * public EmployeeDetailAction2() { super(SampleBeanDomain.getInstance().T_EMPLOYEES,SessionPersistence.Key); }
+     */
+
+    // ------- Action Properties -------
+    // ------- the have to overridables -------
+    @Override
+    public Employee createBean()
+    {
+        Employee e = proxy.createEmmployee();
+        return e;
+    }
+
+    @Override
+    public boolean deleteBean(Object[] key)
+    {
+        int id = Integer.parseInt(key[0].toString());
+        return proxy.deleteEmployee(id);
+    }
+
+    @Override
+    public Employee loadBean(Object[] key)
+    {
+        //TODO: not working properly!
+        int id = Integer.parseInt(key[0].toString());
+        return proxy.getEmmployee(id);
+    }
+
+    @Override
+    public boolean saveBean(Employee bean, boolean isNew)
+    {
+        return proxy.saveEmployee(bean);
+    }
+
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeDetailAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web.actions;
+
+import java.util.List;
+
+import org.apache.empire.commons.Options;
+import org.apache.empire.samples.cxf.wssample.common.Employee;
+import org.apache.empire.struts2.websample.web.SampleContext;
+import org.apache.empire.struts2.websample.web.actiontypes.SampleAction;
+import org.apache.empire.struts2.websample.ws.records.EmployeeRecord;
+
+/**
+ * EmployeeListAction
+ * <p>
+ * This class provides form functions for searching and displaying a list of employees. This implementation shows two optional
+ * approaches for this. 1. Use a ReaderListActionSupport object to directly display database query results in the JSP.<br>
+ * This is most efficient, however it lacks some flexibility.<br>
+ * 2. Use a BeanListActionSupport object to obtain a list of JavaBean objects from the query.<br>
+ * From the JSP the data of the list will be accessed though their getter and setters.<br>
+ * While this is not a efficent as the Reader approach, it is more flexible since post processing of the query result is
+ * possbile.
+ * </p>
+ */
+public class EmployeeListAction extends SampleAction
+{
+    /**
+     * Action mappings
+     */
+    public static final String SEARCH = "search";
+    public static final String LIST   = "list";
+
+    // the search info
+    public static class SearchInfo
+    {
+        private Integer employeeId;
+        private String  firstName;
+        private String  lastName;
+        private Integer departmentId;
+
+        public Integer getEmployeeId()
+        {
+            return employeeId;
+        }
+
+        public void setEmployeeId(Integer employeeId)
+        {
+            this.employeeId = employeeId;
+        }
+
+        public Integer getDepartmentId()
+        {
+            return departmentId;
+        }
+
+        public void setDepartmentId(Integer departmentId)
+        {
+            this.departmentId = departmentId;
+        }
+
+        public String getFirstName()
+        {
+            return firstName;
+        }
+
+        public void setFirstName(String firstName)
+        {
+            this.firstName = firstName;
+        }
+
+        public String getLastName()
+        {
+            return lastName;
+        }
+
+        public void setLastName(String lastName)
+        {
+            this.lastName = lastName;
+        }
+    }
+
+    private List<Employee> employeeBeanList = null;
+    private Options        departments      = null;
+
+    // ------- Action Construction -------
+
+    public EmployeeListAction()
+    {
+
+    }
+
+    // ------- Action Properties -------
+
+    public SearchInfo getSearchInfo()
+    {
+        return (SearchInfo) getActionBean(SearchInfo.class, true);
+    }
+
+    // -------- Employee Bean List --------
+
+    public List<Employee> getEmployees()
+    {
+        return employeeBeanList;
+    }
+
+    // -------- Action Methods --------
+
+    public String doInit()
+    {
+        // check webservice availability!
+        checkWebService();
+        return SEARCH;
+    }
+
+    public String doReset()
+    {
+        removeActionBean(SearchInfo.class);
+        // check webservice availability!
+        checkWebService();
+        return SEARCH;
+    }
+
+    public String doQuery()
+    {
+        // Reset list status
+        return doList();
+    }
+
+    public String doList()
+    {
+        SearchInfo si = getSearchInfo();
+        // check webservice availability!
+        if (checkWebService())
+        {
+            employeeBeanList = getWSProxy().searchEmployee(si.getEmployeeId(), si.getFirstName(), si.getLastName(),
+                                                           si.getDepartmentId());
+            return LIST;
+        } else
+            return SEARCH;
+
+    }
+
+    public Options getDepartments()
+    {
+        if (!isWebServiceAV())
+            return new Options(); // Webservice is note not available ... so do nothing
+
+        if (departments == null)
+            departments = EmployeeRecord.getDepartments(new SampleContext());
+
+        return departments;
+    }
+
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/EmployeeListAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web.actions;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.empire.commons.Errors;
+import org.apache.empire.commons.OptionEntry;
+import org.apache.empire.commons.Options;
+import org.apache.empire.struts2.websample.web.SampleUser;
+import org.apache.empire.struts2.websample.web.actiontypes.SampleAction;
+
+import com.opensymphony.xwork2.config.entities.Parameterizable;
+
+@SuppressWarnings("serial")
+public class LoginAction extends SampleAction implements Parameterizable // StaticParametersInterceptor
+{
+    // Login Targets
+    public static final String INPUT   = "input";
+    public static final String SUCCESS = "success";
+
+    // LoginInfo
+    public class LoginInfo
+    {
+        private String name;
+        private String pwd;
+        private String locale;
+
+        public String getName()
+        {
+            return name;
+        }
+
+        public void setName(String name)
+        {
+            this.name = name;
+        }
+
+        public String getPwd()
+        {
+            return pwd;
+        }
+
+        public void setPwd(String pwd)
+        {
+            this.pwd = pwd;
+        }
+
+        public String getLocale()
+        {
+            return locale;
+        }
+
+        public void setLocale(String locale)
+        {
+            this.locale = locale;
+        }
+    }
+
+    // Login Action
+    public LoginAction()
+    {
+        // Constructor
+    }
+
+    // Login requried for this action
+    @Override
+    public boolean loginRequired()
+    {
+        return false;
+    }
+
+    // Login form bean
+    private LoginInfo loginInfo = new LoginInfo();
+
+    public LoginInfo getLoginInfo()
+    {
+        return loginInfo;
+    }
+
+    public String doInit()
+    {
+        SampleUser user = getSession().getUser();
+        if (user != null)
+            loginInfo.setName(user.getUserId());
+        
+        // check webservice availability!
+        checkWebService();
+        
+        // Done
+        return INPUT;
+    }
+
+    public String doLogin()
+    {
+        String userID = loginInfo.getName();
+        String userName = userID;
+
+        if (userID == null || userID.length() == 0)
+        {
+            setActionError(Errors.InvalidPassword);
+            return INPUT;
+        }
+
+        // Login
+        SampleUser user = new SampleUser(userID, userName);
+        user.setLocale(new Locale(loginInfo.getLocale()));
+        getSession().setUser(user);
+        // Done
+        return SUCCESS;
+    }
+
+    public String doLogout()
+    {
+        getSession().setUser(null);
+        // check webservice availability!
+        checkWebService();
+        return INPUT;
+    }
+
+    public String doError()
+    {
+        log.info("An error as occurred");
+        return INPUT;
+    }
+
+    /*
+     * Implementation of Parameterizable
+     */
+
+    private Map<String, Object> actionConfigParams = null;
+
+    public void addParam(String name, Object value)
+    {
+        actionConfigParams.put(name, value);
+    }
+
+    public Map<String, Object> getParams()
+    {
+        return actionConfigParams;
+    }
+
+    public void setParams(Map<String, Object> actionConfigParams)
+    {
+        this.actionConfigParams = actionConfigParams;
+    }
+
+    public Options getLanguages()
+    {
+        Options o = new Options();
+        o.add(new OptionEntry(Locale.ENGLISH, Locale.ENGLISH.getDisplayLanguage()));
+        o.add(new OptionEntry(Locale.GERMAN, Locale.GERMAN.getDisplayLanguage()));
+        return o;
+    }
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actions/LoginAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web.actiontypes;
+
+import org.apache.empire.commons.Errors;
+import org.apache.empire.data.Record;
+import org.apache.empire.data.bean.BeanClass;
+import org.apache.empire.data.bean.BeanRecordProxy;
+import org.apache.empire.struts2.actionsupport.BeanActionSupport;
+import org.apache.empire.struts2.actionsupport.SessionPersistence;
+import org.apache.empire.struts2.web.WebErrors;
+
+import com.opensymphony.xwork2.interceptor.NoParameters;
+
+
+/**
+ * BeanDetailAction
+ * <p>
+ * This class allows using a JavaBean or Data Transfer Object (DTO) for form data processing.
+ * Metadata for the Beans should be provided using the BeanClass and BeanProperty classes.
+ * </p>
+ * @author Rainer
+ */
+public abstract class BeanDetailAction<T> extends DetailAction
+    implements NoParameters // set this to provide custom parameter handling
+{
+    protected final BeanActionSupport<T> beanSupport;
+    
+    /**
+     * Constructs a BeanDetailAction from a BeanRecordProxy object
+     * @param record the BeanRecordProxy for the bean 
+     * @param persistence persistence level
+     */
+    public BeanDetailAction(BeanRecordProxy<T> record, SessionPersistence persistence)
+    {
+        beanSupport = new BeanActionSupport<T>(this, record, persistence);
+    }
+
+    /**
+     * Constructs a BeanDetailAction from a BeanClass definition
+     * @param beanClass the bean class defining the bean's metadata 
+     * @param persistence persistence level
+     */
+    public BeanDetailAction(BeanClass beanClass, SessionPersistence persistence)
+    {
+        beanSupport = new BeanActionSupport<T>(this, beanClass, persistence);
+    }
+    
+    /**
+     * Returns the Record interface implmentation for the bean.
+     * @return the Record interface implmentation for the bean. 
+     */
+    public Record getRecord() 
+    {
+        return beanSupport.getRecord();
+    }
+
+    @Override
+    public String doCreate() 
+    {
+        T bean = createBean();
+        if (bean==null)
+        {   // Must have an action error set!
+            if (!hasActionError())
+                setActionError(Errors.ObjectNotValid, beanSupport.getRecordPropertyName());
+            return doCancel();
+        }
+        beanSupport.setData(bean);
+        return INPUT;
+    }
+
+    @Override
+    public String doLoad() 
+    {
+        // Read Record
+        Object[] key = beanSupport.getActionParamKey();
+        if (key!=null)
+        {   // Load the bean
+            T bean = loadBean(key);
+            if (bean==null)
+            {   // Must have an action error set!
+                if (!hasActionError())
+                    setActionError(Errors.ItemNotFound, beanSupport.getRecordKeyString());
+                return doCancel();
+            }
+            beanSupport.setData(bean);
+        }
+        // Check if record is valid
+        if (beanSupport.isValid()==false)
+        {
+            setActionError(WebErrors.InvalidFormData);
+            return doCancel();
+        }
+        // Test
+        return INPUT;
+    }
+
+    @Override
+    public String doDelete() 
+    {
+        Object[] key = null;
+        if (beanSupport.hasActionKey(true))
+        {
+            if (beanSupport.getActionParamNewFlag()==false)
+                key = beanSupport.getActionParamKey();
+        }
+        else
+        {   // Get the bean key
+            if (beanSupport.getRecord().isNew()==false)
+                key = beanSupport.getRecordKeyValues();
+        }
+        // Delete the bean
+        if (key!=null && deleteBean(key)==false)
+        {   // An Error has occurred;
+            return doCancel();
+        }
+        // Clear Data
+        beanSupport.setData(null);
+        return RETURN;
+    }
+
+    @Override
+    public String doSave() {
+
+        // bean Support
+        if (beanSupport.isValid()==false)
+        {   // Create new or reload existing item
+            T bean;
+            if (beanSupport.getActionParamNewFlag())
+            {   // crate new Item
+                bean = createBean();
+            }
+            else
+            {   // reload existing item
+                bean = loadBean(beanSupport.getActionParamKey());
+            }
+            if (bean==null)
+            {   // Must have an action error set!
+                if (!hasActionError())
+                    setActionError(Errors.ItemNotFound, beanSupport.getRecordKeyString());
+                return doCancel();
+            }
+            beanSupport.setData(bean);
+        }
+        else if (beanSupport.getRecord().isNew()==false) 
+        {   // Check whether we have the right key
+            if (!beanSupport.checkKey())
+            {   // Record's don't match
+                setActionError(WebErrors.InvalidFormData);
+                return doCancel();
+            }
+        }
+        // LoadFormData 
+        if (beanSupport.loadFormData()==false)
+        {   // Error loading form data
+            return INPUT;
+        }
+        
+        // Save the record
+        boolean isNew = beanSupport.getRecord().isNew();
+        if (saveBean(beanSupport.getData(), isNew)==false)
+        {   // Error saving bean
+            return INPUT;
+        }
+        
+        // Record has been saved successfully
+        // beanSupport.updateSessionKey();
+        beanSupport.setData(null);
+        
+        return RETURN;
+    }
+    
+    // ------- overridables -------
+    
+    /**
+     * Returns the bean for the supplied object key.
+     * If an error occurs the fuction must set an action error and return null.
+     * @return the bean object
+     */
+    public abstract T createBean();
+    
+    /**
+     * Returns the bean for the supplied object key.
+     * If an error occurs the fuction must set an action error and return null.
+     * @param key the bean's key values
+     * @return the bean object
+     */
+    public abstract T loadBean(Object[] key);
+    
+    /**
+     * Saves a bean object 
+     * @param bean 
+     * @param isNew true the bean is a newly created object or false otherwise
+     * @return true if the bean has been stored sucessfully or false otherwise
+     */
+    public abstract boolean saveBean(T bean, boolean isNew);
+    
+    /**
+     * Deletes a bean object
+     * @param bean 
+     * @return true if the bean has been stored sucessfully or false otherwise
+     */
+    public abstract boolean deleteBean(Object[] key);
+    
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/BeanDetailAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/DetailAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/DetailAction.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/DetailAction.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/DetailAction.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web.actiontypes;
+
+
+public abstract class DetailAction extends SampleAction
+{
+    /**
+     * Action mappings
+     */
+    public static final String INPUT  = "input";
+    public static final String RETURN = "return";
+
+    // Detail Action
+    public DetailAction()
+    {
+        // Default constructor
+    }
+        
+    public abstract String doCreate();
+    
+    public abstract String doLoad();
+
+    public abstract String doSave();
+
+    public abstract String doDelete();
+
+    // Optional overridable
+    public String doCancel()
+    {
+        return RETURN;
+    }
+    
+}

Propchange: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/DetailAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/SampleAction.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/SampleAction.java?rev=748189&view=auto
==============================================================================
--- incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/SampleAction.java (added)
+++ incubator/empire-db/trunk/empire-db-examples/empire-db-example-struts2-cxf/src/main/java/org/apache/empire/struts2/websample/web/actiontypes/SampleAction.java Thu Feb 26 15:54:32 2009
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.struts2.websample.web.actiontypes;
+
+import java.util.Locale;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.empire.samples.cxf.wssample.client.EmployeeManagementProxy;
+import org.apache.empire.struts2.action.WebAction;
+import org.apache.empire.struts2.websample.common.Errors;
+import org.apache.empire.struts2.websample.web.SampleApplication;
+import org.apache.empire.struts2.websample.web.SampleRequest;
+import org.apache.empire.struts2.websample.web.SampleSession;
+
+public abstract class SampleAction extends WebAction
+{
+    // Logger
+    protected static Log log = LogFactory.getLog(SampleAction.class);
+    private EmployeeManagementProxy proxy = SampleApplication.getInstance().getWebServiceProxy();
+
+    public SampleAction()
+    {
+        // Constructor
+    }
+
+    // Login requried for this action
+    @Override
+    public boolean loginRequired()
+    {
+        return (getSession().getUser() == null);
+    }
+
+    @Override
+    public Locale getLocale()
+    {
+        if (getRequest().getSession().getUser() == null)
+            return Locale.ENGLISH;
+        else
+            return getRequest().getSession().getUser().getLocale();
+    }
+
+    // Request
+    public static SampleRequest getRequest()
+    {
+        return SampleRequest.getInstance();
+    }
+
+    // Application getters
+    public SampleApplication getApplication()
+    {
+        return getRequest().getApplication();
+    }
+
+    public SampleSession getSession()
+    {
+        return getRequest().getSession();
+    }
+
+    public boolean checkWebService()
+    {
+        try
+        {
+            proxy.test();
+            return true;
+        } catch (Exception e)
+        {
+            setActionError(Errors.WebServiceNotAvailable);
+            return false;
+        }
+    }
+    
+    public boolean isWebServiceAV()
+    {
+        try
+        {
+            proxy.test();
+            return true;
+        } catch (Exception e)
+        {
+            return false;
+        }
+    }
+    
+    public EmployeeManagementProxy getWSProxy()
+    {
+        return proxy;
+    }
+
+}



Mime
View raw message