tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r671397 - in /tuscany/java/sca/modules/binding-gdata-runtime/src: main/java/org/apache/tuscany/sca/binding/gdata/provider/GDataBindingInvoker.java test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
Date Wed, 25 Jun 2008 02:09:38 GMT
Author: lresende
Date: Tue Jun 24 19:09:38 2008
New Revision: 671397

URL: http://svn.apache.org/viewvc?rev=671397&view=rev
Log:
TUSCANY-2435 - Applying Douglas Path that adds support for query operation

Modified:
    tuscany/java/sca/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GDataBindingInvoker.java
    tuscany/java/sca/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java

Modified: tuscany/java/sca/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GDataBindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GDataBindingInvoker.java?rev=671397&r1=671396&r2=671397&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GDataBindingInvoker.java
(original)
+++ tuscany/java/sca/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GDataBindingInvoker.java
Tue Jun 24 19:09:38 2008
@@ -25,10 +25,10 @@
 import org.osoa.sca.ServiceRuntimeException;
 
 import com.google.gdata.client.GoogleService;
+import com.google.gdata.client.Query;
 import com.google.gdata.data.BaseEntry;
 import com.google.gdata.data.Entry;
 import com.google.gdata.data.Feed;
-import com.google.gdata.data.extensions.EventEntry;
 import java.net.URL;
 import com.google.gdata.util.ServiceException;
 import com.google.gdata.util.ResourceNotFoundException;
@@ -39,7 +39,7 @@
  * 
  * @version $Rev$ $Date$
  */
-class GDataBindingInvoker implements Invoker {
+class GDataBindingInvoker implements Invoker, DataExchangeSemantics {
 
     Operation operation;
     String uri;
@@ -73,8 +73,7 @@
             try {
                 String id = (String) ((Object[]) msg.getBody())[0];
 
-                //FIXME - Adapt the class to each kind of entry
-                BaseEntry searchedEntry = service.getEntry(new URL(id), EventEntry.class);
+                BaseEntry searchedEntry = service.getEntry(new URL(id), Entry.class);
 
                 msg.setBody(searchedEntry);
 
@@ -82,8 +81,9 @@
                 msg.setFaultBody(new ServiceRuntimeException(ex));
             } catch (ServiceException ex) {
                 msg.setFaultBody(new ServiceRuntimeException(ex));
+            } finally {
+                return msg;
             }
-            return msg;
         }
     }
 
@@ -110,9 +110,9 @@
                 msg.setFaultBody(new ServiceRuntimeException(ex));
             } catch (ServiceException ex) {
                 msg.setFaultBody(new ServiceRuntimeException(ex));
+            } finally {
+                return msg;
             }
-
-            return msg;
         }
     }
 
@@ -141,9 +141,9 @@
                 msg.setFaultBody(new ServiceRuntimeException(ex));
             } catch (ServiceException ex) {
                 msg.setFaultBody(new ServiceRuntimeException(ex));
+            } finally {
+                return msg;
             }
-
-            return msg;
         }
     }
 
@@ -161,14 +161,14 @@
             try {
                 String id = (String) ((Object[]) msg.getBody())[0];
                 service.delete(new URL(id));
-                
+
             } catch (IOException ex) {
                 msg.setFaultBody(new ServiceRuntimeException(ex));
             } catch (ServiceException ex) {
                 msg.setFaultBody(new ServiceRuntimeException(ex));
+            } finally {
+                return msg;
             }
-
-            return msg;
         }
     }
 
@@ -196,9 +196,9 @@
                 msg.setFaultBody(new ServiceRuntimeException(ex));
             } catch (Exception ex) {
                 msg.setFaultBody(new ServiceRuntimeException(ex));
+            } finally {
+                return msg;
             }
-
-            return msg;
         }
     }
 
@@ -213,8 +213,22 @@
 
         @Override
         public Message invoke(Message msg) {
-            // TODO implement
-            return super.invoke(msg);
+            try {
+
+                String strQuery = (String) ((Object[]) msg.getBody())[0];
+
+                Query query = new Query(new URL(uri));
+                query.setFullTextQuery(strQuery);
+                Feed feed = service.query(query, Feed.class);
+                msg.setBody(feed);
+
+            } catch (IOException ex) {
+                msg.setFaultBody(new ServiceRuntimeException(ex));
+            } catch (ServiceException ex) {
+                msg.setFaultBody(new ServiceRuntimeException(ex));
+            } finally {
+                return msg;
+            }
         }
     }
 

Modified: tuscany/java/sca/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java?rev=671397&r1=671396&r2=671397&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
(original)
+++ tuscany/java/sca/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
Tue Jun 24 19:09:38 2008
@@ -96,8 +96,20 @@
                 "\n//--------------------------" +
                 "\n// Delete an Entry" +
                 "\n//--------------------------\n");
-        
+
         resourceCollection.delete(updatedEntry.getEditLink().getHref());
 
+        System.out.println(
+                "\n//--------------------------" +
+                "\n// Execute a query" +
+                "\n//--------------------------\n");
+
+        feed = resourceCollection.query("Students");
+        
+        System.out.println("Feed content - " + feed.getUpdated().toString() + ":\n");
+        for (Entry e : feed.getEntries()) {
+            System.out.println("# " + e.getTitle().getPlainText());
+        }
+
     }
 }



Mime
View raw message