empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franci...@apache.org
Subject svn commit: r1158258 - in /incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample: client/ common/ server/
Date Tue, 16 Aug 2011 13:09:17 GMT
Author: francisdb
Date: Tue Aug 16 13:09:16 2011
New Revision: 1158258

URL: http://svn.apache.org/viewvc?rev=1158258&view=rev
Log:
EMPIREDB-99 Refactor cxf example for new error handling

Modified:
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeServiceClient.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeService.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/EmployeeServiceImpl.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/SampleConfig.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerControl.java

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeServiceClient.java?rev=1158258&r1=1158257&r2=1158258&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeServiceClient.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/EmployeeServiceClient.java
Tue Aug 16 13:09:16 2011
@@ -60,19 +60,18 @@ public class EmployeeServiceClient
         return service.getEmmployee(id);
     }
 
-    public boolean saveEmployee(Employee e)
+    public void 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 = service.saveEmmployee(holder);
+        service.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)
+    public void deleteEmployee(int id)
     {
-        return service.deleteEmmployee(id);
+        service.deleteEmmployee(id);
     }
 
     public List<Employee> searchEmployee(Integer id, String firstName, String lastName,
Integer department)

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeService.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeService.java?rev=1158258&r1=1158257&r2=1158258&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeService.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/common/EmployeeService.java
Tue Aug 16 13:09:16 2011
@@ -23,9 +23,9 @@ import java.util.List;
 
 import javax.jws.WebMethod;
 import javax.jws.WebParam;
+import javax.jws.WebParam.Mode;
 import javax.jws.WebResult;
 import javax.jws.WebService;
-import javax.jws.WebParam.Mode;
 import javax.xml.ws.Holder;
 
 //specifies the the attribute wsdl:portType
@@ -50,11 +50,11 @@ public interface EmployeeService
 
     @WebMethod(operationName = "saveEmmployee")
     @WebResult(name = "saveResponse")
-    public boolean saveEmmployee(@WebParam(name = "employee", mode = Mode.INOUT) Holder<Employee>
e);
+    public void 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);
+    public void deleteEmmployee(@WebParam(name = "id", mode = Mode.IN) int id);
 
     @WebMethod(operationName = "getDepartments")
     @WebResult(name = "allDepartments")

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/EmployeeServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/EmployeeServiceImpl.java?rev=1158258&r1=1158257&r2=1158258&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/EmployeeServiceImpl.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/EmployeeServiceImpl.java
Tue Aug 16 13:09:16 2011
@@ -55,26 +55,22 @@ public class EmployeeServiceImpl impleme
         T_EMP = db.EMPLOYEES;
     }
 
-    public boolean saveEmmployee(javax.xml.ws.Holder<Employee> empHolder)
+    public void saveEmmployee(javax.xml.ws.Holder<Employee> empHolder)
     {
         DBRecord r = new DBRecord();
         Employee emp = empHolder.value;
         boolean init;
         if (emp.isNew())
-            init = r.create(T_EMP, conn);
+            r.create(T_EMP, conn);
         else
-            init = r.read(T_EMP, emp.getEmployeeId(), conn);
+            r.read(T_EMP, emp.getEmployeeId(), conn);
 
-        boolean fill = r.setBeanValues(emp);
-        boolean save = r.update(conn);
+        r.setBeanValues(emp);
+        r.update(conn);
 
-        if (init && fill && save)
-        {
-            r.getBeanProperties(emp);
-            emp.setNew(false);
-        }
 
-        return init && fill && save;
+        r.getBeanProperties(emp);
+        emp.setNew(false);
     }
 
     public List<Employee> searchEmmployee(Integer id, String firstName, String lastName,
Integer department)
@@ -128,17 +124,17 @@ public class EmployeeServiceImpl impleme
         Employee emp = new Employee();
 
         // null, so that no IDs are wasted.
-        boolean create = r.create(T_EMP, null);
-        boolean fill = r.getBeanProperties(emp);
+        r.create(T_EMP, null);
+        r.getBeanProperties(emp);
 
         emp.setNew(true);
 
-        return (create && fill ? emp : null);
+        return emp;
     }
 
-    public boolean deleteEmmployee(int id)
+    public void deleteEmmployee(int id)
     {
-        return T_EMP.deleteRecord(id, conn);
+        T_EMP.deleteRecord(id, conn);
     }
 
     public Employee getEmmployee(int id)
@@ -146,10 +142,9 @@ public class EmployeeServiceImpl impleme
         DBRecord r = new DBRecord();
         Employee emp = new Employee();
 
-        boolean read = r.read(T_EMP, id, conn);
-        boolean fill = r.getBeanProperties(emp);
-
-        return (read && fill ? emp : null);
+        r.read(T_EMP, id, conn);
+        r.getBeanProperties(emp);
+        return emp;
     }
 
     public boolean ping()

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/SampleConfig.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/SampleConfig.java?rev=1158258&r1=1158257&r2=1158258&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/SampleConfig.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/SampleConfig.java
Tue Aug 16 13:09:16 2011
@@ -41,15 +41,13 @@ public class SampleConfig extends XMLCon
 	 * 
 	 * @return true on success
 	 */
-	public boolean init(String filename) {
+	public void init(String filename) {
 		// Read the properties file
-		if (super.init(filename, false) == false)
-			return false;
+		super.init(filename, false);
 		// Done
-		if (readProperties(this, "properties")==false)
-			return false;
+		readProperties(this, "properties");
 		// Reader Provider Properties
-		return readProperties(this, "properties-" + databaseProvider);
+		readProperties(this, "properties-" + databaseProvider);
 	}
 
 	public String getDatabaseProvider() {

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerControl.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerControl.java?rev=1158258&r1=1158257&r2=1158258&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerControl.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/server/ServerControl.java
Tue Aug 16 13:09:16 2011
@@ -117,7 +117,8 @@ public class ServerControl
 
         // Open Database (and create if not existing)
         log.info("*** open database ***");
-        if (!db.open(driver, conn) || !databaseExists(conn))
+        db.open(driver, conn);
+        if (!databaseExists(conn))
         {
             // STEP 4: Create Database
             log.info("*** create Database ***");
@@ -231,8 +232,8 @@ public class ServerControl
         script.run(driver, conn, false);
         db.commit(conn);
         // Open again
-        if (!db.isOpen() && !db.open(driver, conn)){
-            throw new RuntimeException(driver.getErrorMessage());
+        if (!db.isOpen()){
+    		db.open(driver, conn);
         }
         // Insert Sample Departments
         int idDevDep = insertDepartmentSampleRecord(conn, "Development", "ITTK");
@@ -255,11 +256,7 @@ public class ServerControl
         rec.create(db.DEPARTMENTS);
         rec.setValue(db.DEPARTMENTS.NAME, department_name);
         rec.setValue(db.DEPARTMENTS.BUSINESS_UNIT, businessUnit);
-        if (!rec.update(conn))
-        {
-            log.error(rec.getErrorMessage());
-            return 0;
-        }
+        rec.update(conn);
         // Return Department ID
         return rec.getInt(db.DEPARTMENTS.DEPARTMENT_ID);
     }
@@ -278,11 +275,7 @@ public class ServerControl
         rec.setValue(db.EMPLOYEES.LASTNAME, lastName);
         rec.setValue(db.EMPLOYEES.GENDER, gender);
         rec.setValue(db.EMPLOYEES.DEPARTMENT_ID, depID);
-        if (!rec.update(conn))
-        {
-            log.error(rec.getErrorMessage());
-            return 0;
-        }
+        rec.update(conn);
         // Return Employee ID
         return rec.getInt(db.EMPLOYEES.EMPLOYEE_ID);
     }



Mime
View raw message