tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r675221 - in /tuscany/java/sca/modules/binding-gdata: ./ src/main/java/org/apache/tuscany/sca/binding/gdata/ src/main/java/org/apache/tuscany/sca/binding/gdata/impl/ src/main/resources/META-INF/services/
Date Wed, 09 Jul 2008 15:11:07 GMT
Author: lresende
Date: Wed Jul  9 08:11:06 2008
New Revision: 675221

URL: http://svn.apache.org/viewvc?rev=675221&view=rev
Log:
TUSCANY-2467 - Adding GDataImplementationProcessor

Added:
    tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java
  (with props)
Modified:
    tuscany/java/sca/modules/binding-gdata/pom.xml
    tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBinding.java
    tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingImpl.java
    tuscany/java/sca/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor

Modified: tuscany/java/sca/modules/binding-gdata/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-gdata/pom.xml?rev=675221&r1=675220&r2=675221&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-gdata/pom.xml (original)
+++ tuscany/java/sca/modules/binding-gdata/pom.xml Wed Jul  9 08:11:06 2008
@@ -36,6 +36,12 @@
             <version>1.4-SNAPSHOT</version>
         </dependency>
 
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-assembly-xml</artifactId>
+			<version>1.4-SNAPSHOT</version>
+		</dependency>
+		
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

Modified: tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBinding.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBinding.java?rev=675221&r1=675220&r2=675221&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBinding.java
(original)
+++ tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBinding.java
Wed Jul  9 08:11:06 2008
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-
 package org.apache.tuscany.sca.binding.gdata;
 
 import org.apache.tuscany.sca.assembly.Binding;
@@ -27,17 +26,24 @@
  * @version $Rev$ $Date$
  */
 public interface GDataBinding extends Binding {
-    
+
     /**
      * Returns the title of the Atom collection.
      * @return
      */
     String getTitle();
-    
+
     /**
      * Sets the title of the Atom collection.
      * @param title
      */
     void setTitle(String title);
+
+    String getLogin();
+
+    void setLogin(String login);
+    
+    String getPassword();
     
+    void setPassword(String password);
 }

Added: tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java?rev=675221&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java
(added)
+++ tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java
Wed Jul  9 08:11:06 2008
@@ -0,0 +1,92 @@
+/*
+ *  Copyright 2008 douglas.
+ * 
+ *  Licensed 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.
+ *  under the License.
+ */
+package org.apache.tuscany.sca.binding.gdata;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+public class GDataImplementationProcessor implements StAXArtifactProcessor<GDataBinding>
{
+
+    private GDataBindingFactory gdataFactory;
+    protected static final QName BINDING_GDATA = new QName(Constants.SCA10_TUSCANY_NS, "binding.gdata");
+
+    public GDataImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor
monitor) {
+        
+        this.gdataFactory = modelFactories.getFactory(GDataBindingFactory.class);
+    }
+
+    public GDataBinding read(XMLStreamReader reader) {
+
+        assert BINDING_GDATA.equals(reader.getName());
+
+        GDataBinding gdataBinding = gdataFactory.createAtomBinding();
+
+        /*
+         * <tuscany:binding.gdata uri="..." 
+         *  login="..." 
+         *  password="..."/>           
+         */
+
+        String uri = reader.getAttributeValue(null, "uri");
+        String login = reader.getAttributeValue(null, "login");
+        String password = reader.getAttributeValue(null, "password");
+
+        gdataBinding.setURI(uri);
+        gdataBinding.setLogin(login);
+        gdataBinding.setPassword(password);
+
+        return gdataBinding;
+    }
+
+    public void write(GDataBinding gdataBinding, XMLStreamWriter writer) throws XMLStreamException
{
+        if (gdataBinding != null) {
+            writer.writeStartElement(BINDING_GDATA.getNamespaceURI(), BINDING_GDATA.getLocalPart());
+
+            if (gdataBinding.getURI() != null) {
+                writer.writeAttribute("uri", gdataBinding.getURI());
+            }
+            if (gdataBinding.getLogin() != null) {
+                writer.writeAttribute("login", gdataBinding.getLogin());
+            }
+            if (gdataBinding.getPassword() != null) {
+                writer.writeAttribute("password", gdataBinding.getPassword());
+            }
+
+            writer.writeEndElement();
+        }
+    }
+
+    public QName getArtifactType() {
+        return BINDING_GDATA;
+    }
+
+    public void resolve(GDataBinding arg0, ModelResolver arg1) throws ContributionResolveException
{
+    }
+
+    public Class<GDataBinding> getModelType() {
+        return GDataBinding.class;
+    }
+}

Propchange: tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingImpl.java?rev=675221&r1=675220&r2=675221&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingImpl.java
(original)
+++ tuscany/java/sca/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingImpl.java
Wed Jul  9 08:11:06 2008
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-
 package org.apache.tuscany.sca.binding.gdata.impl;
 
 import java.util.ArrayList;
@@ -39,6 +38,8 @@
  */
 class GDataBindingImpl implements GDataBinding, OptimizableBinding, PolicySetAttachPoint
{
 
+    private String password;
+    private String login;
     private String name;
     private String uri;
     private String title;
@@ -70,7 +71,7 @@
     public String getTitle() {
         return title;
     }
-    
+
     public void setTitle(String title) {
         this.title = title;
     }
@@ -87,7 +88,7 @@
     public List<PolicySet> getPolicySets() {
         return policySets;
     }
-    
+
     public List<Intent> getRequiredIntents() {
         return requiredIntents;
     }
@@ -95,51 +96,65 @@
     public IntentAttachPointType getType() {
         return intentAttachPointType;
     }
-    
+
     public void setType(IntentAttachPointType intentAttachPointType) {
         this.intentAttachPointType = intentAttachPointType;
-    }
-
-    //FIXME Temporary to get access to the target binding information
+    }    //FIXME Temporary to get access to the target binding information
     // To be removed when the distributed domain supports wiring of other
     // bindings than the SCA binding
-    private Binding targetBinding; 
-    private Component targetComponent; 
-    private ComponentService targetComponentService; 
-    
+    private Binding targetBinding;
+    private Component targetComponent;
+    private ComponentService targetComponentService;
+
     public Object clone() throws CloneNotSupportedException {
         return super.clone();
     }
-    
+
     public Binding getTargetBinding() {
         return targetBinding;
     }
-    
+
     public void setTargetBinding(Binding binding) {
         this.targetBinding = binding;
     }
-    
+
     public Component getTargetComponent() {
         return targetComponent;
     }
-    
+
     public void setTargetComponent(Component component) {
         this.targetComponent = component;
     }
-    
+
     public ComponentService getTargetComponentService() {
         return targetComponentService;
     }
-    
+
     public void setTargetComponentService(ComponentService service) {
-        this.targetComponentService = service; 
+        this.targetComponentService = service;
     }
 
     public void setPolicySets(List<PolicySet> policySets) {
-        this.policySets = policySets; 
+        this.policySets = policySets;
     }
 
     public void setRequiredIntents(List<Intent> intents) {
         this.requiredIntents = intents;
     }
+
+    public String getLogin() {
+        return this.login;
+    }
+
+    public void setLogin(String login) {
+        this.login = login;
+    }
+
+    public String getPassword() {
+        return this.password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
 }

Modified: tuscany/java/sca/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=675221&r1=675220&r2=675221&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
(original)
+++ tuscany/java/sca/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
Wed Jul  9 08:11:06 2008
@@ -16,4 +16,6 @@
 # under the License. 
 
 # Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.gdata,model=org.apache.tuscany.sca.binding.gdata.GDataBinding,factory=org.apache.tuscany.sca.binding.gdata.GDataBindingFactory
\ No newline at end of file
+
+#org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.gdata,model=org.apache.tuscany.sca.binding.gdata.GDataBinding,factory=org.apache.tuscany.sca.binding.gdata.GDataBindingFactory
+org.apache.tuscany.sca.binding.gdata.GDataImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.gdata,model=org.apache.tuscany.sca.binding.gdata.GDataBinding,factory=org.apache.tuscany.sca.binding.gdata.GDataBindingFactory
\ No newline at end of file



Mime
View raw message