diff options
Diffstat (limited to 'branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata')
5 files changed, 74 insertions, 79 deletions
diff --git a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBinding.java b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBinding.java index ab2acef234..a3a0b834cd 100644 --- a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBinding.java +++ b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBinding.java @@ -40,10 +40,39 @@ public interface GdataBinding extends Binding { */ void setTitle(String title); + /** + * Returns the username to be used when authenticating with GData Services + * @return + */ String getUsername(); + + /** + * Sets the username to be used when authenticating with GData Services + * @param username + */ + void setUsername(String username); + + /** + * Returns the password to be used when authenticating with GData Services + * @return + */ String getPassword(); - String getServiceType(); - void setUsername(String username); + + /** + * Sets the password to be used when authenticating with GData Services + * @param password + */ void setPassword(String password); + + /** + * Returns the type os service being used + * @return + */ + String getServiceType(); + + /** + * Sets the type of service being used + * @param serviceType + */ void setServiceType(String serviceType); } diff --git a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBindingFactory.java b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBindingFactory.java index 847bb6956b..5cfc688dcb 100644 --- a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBindingFactory.java +++ b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBindingFactory.java @@ -22,6 +22,7 @@ package org.apache.tuscany.sca.binding.gdata; /** * Factory for the GData binding * + * @version $Rev$ $Date$ */ public interface GdataBindingFactory { diff --git a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingFactoryImpl.java b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingFactoryImpl.java index 656776c358..87f3597248 100644 --- a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingFactoryImpl.java +++ b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingFactoryImpl.java @@ -25,6 +25,7 @@ import org.apache.tuscany.sca.binding.gdata.GdataBindingFactory; /** * Factory for the GData binding model. * + * @version $Rev$ $Date$ */ public class GdataBindingFactoryImpl implements GdataBindingFactory { diff --git a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingImpl.java b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingImpl.java index c389bacdc9..409fd497ac 100644 --- a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingImpl.java +++ b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingImpl.java @@ -22,10 +22,6 @@ package org.apache.tuscany.sca.binding.gdata.impl; import java.util.ArrayList; import java.util.List; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.OptimizableBinding; import org.apache.tuscany.sca.binding.gdata.GdataBinding; import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.IntentAttachPointType; @@ -35,6 +31,7 @@ import org.apache.tuscany.sca.policy.PolicySetAttachPoint; /** * Implementation of the GData binding model. * + * @version $Rev$ $Date$ */ class GdataBindingImpl implements GdataBinding, PolicySetAttachPoint { @@ -44,15 +41,12 @@ class GdataBindingImpl implements GdataBinding, PolicySetAttachPoint { private String username; private String password; private String serviceType; + private List<Intent> requiredIntents = new ArrayList<Intent>(); private List<PolicySet> policySets = new ArrayList<PolicySet>(); private IntentAttachPointType intentAttachPointType; private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>(); - public List<PolicySet> getApplicablePolicySets() { - return applicablePolicySets; - } - public String getName() { return name; } @@ -61,6 +55,10 @@ class GdataBindingImpl implements GdataBinding, PolicySetAttachPoint { return uri; } + public String getTitle() { + return title; + } + public String getUsername(){ return username; } @@ -80,6 +78,10 @@ class GdataBindingImpl implements GdataBinding, PolicySetAttachPoint { public void setURI(String uri) { this.uri = uri; } + + public void setTitle(String title) { + this.title = title; + } public void setUsername(String username) { this.username = username; @@ -93,15 +95,6 @@ class GdataBindingImpl implements GdataBinding, PolicySetAttachPoint { this.serviceType = serviceType; } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - public boolean isUnresolved() { // The binding is always resolved return false; @@ -111,6 +104,12 @@ class GdataBindingImpl implements GdataBinding, PolicySetAttachPoint { // The binding is always resolved } + //Policy related getters/setters + + public List<PolicySet> getApplicablePolicySets() { + return applicablePolicySets; + } + public List<PolicySet> getPolicySets() { return policySets; } @@ -139,4 +138,4 @@ class GdataBindingImpl implements GdataBinding, PolicySetAttachPoint { public Object clone() throws CloneNotSupportedException { return super.clone(); } -} +}
\ No newline at end of file diff --git a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/xml/GdataBindingProcessor.java b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/xml/GdataBindingProcessor.java index 18795837c4..660b96243e 100644 --- a/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/xml/GdataBindingProcessor.java +++ b/branches/sca-equinox/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/xml/GdataBindingProcessor.java @@ -18,9 +18,6 @@ */ package org.apache.tuscany.sca.binding.gdata.xml; -import java.util.ArrayList; -import java.util.List; - import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; @@ -34,27 +31,21 @@ import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; /** * A processor for <binding.gdata> elements. + * + * @version $Rev$ $Date$ */ public class GdataBindingProcessor implements StAXArtifactProcessor<GdataBinding> { private QName BINDING_GDATA = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "binding.gdata"); private final GdataBindingFactory factory; - private IntentAttachPointTypeFactory intentAttachPointTypeFactory; - //private PolicyAttachPointProcessor policyProcessor; - public GdataBindingProcessor(FactoryExtensionPoint modelFactories) { this.factory = modelFactories.getFactory(GdataBindingFactory.class); - this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); + System.out.println("[Debug Info]GdataBindingProcessor reached"); } public QName getArtifactType() { @@ -67,90 +58,64 @@ public class GdataBindingProcessor implements StAXArtifactProcessor<GdataBinding public GdataBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { GdataBinding gdataBinding = factory.createGdataBinding(); - IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType(); - bindingType.setName(getArtifactType()); - bindingType.setUnresolved(true); - ((PolicySetAttachPoint)gdataBinding).setType(bindingType); String name = reader.getAttributeValue(null, "name"); if (name != null) { - gdataBinding.setName(name); + gdataBinding.setName(name); } String uri = reader.getAttributeValue(null, "uri"); if (uri != null) { - gdataBinding.setURI(uri); + gdataBinding.setURI(uri); } - + String serviceType = reader.getAttributeValue(null, "serviceType"); if (serviceType != null) { - gdataBinding.setServiceType(serviceType); + gdataBinding.setServiceType(serviceType); } - + String username = reader.getAttributeValue(null, "username"); if (username != null) { - gdataBinding.setUsername(username); + gdataBinding.setUsername(username); } - + String password = reader.getAttributeValue(null, "password"); if (password != null) { - gdataBinding.setPassword(password); + gdataBinding.setPassword(password); } - - //policyProcessor.readPolicies(echoBinding, reader); + return gdataBinding; } public void write(GdataBinding gdataBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - - //policyProcessor.writePolicyPrefixes(gdataBinding, writer); writer.writeStartElement(BINDING_GDATA.getNamespaceURI(), BINDING_GDATA.getLocalPart()); - //policyProcessor.writePolicyAttributes(gdataBinding, writer); - + if (gdataBinding.getName() != null) { - writer.writeAttribute("name", gdataBinding.getName()); + writer.writeAttribute("name", gdataBinding.getName()); } - + if (gdataBinding.getURI() != null) { - writer.writeAttribute("uri", gdataBinding.getURI()); + writer.writeAttribute("uri", gdataBinding.getURI()); } - + if (gdataBinding.getServiceType() != null) { - writer.writeAttribute("serviceType", gdataBinding.getServiceType()); + writer.writeAttribute("serviceType", gdataBinding.getServiceType()); } - + if (gdataBinding.getUsername() != null) { - writer.writeAttribute("username", gdataBinding.getUsername()); + writer.writeAttribute("username", gdataBinding.getUsername()); } - + if (gdataBinding.getPassword() != null) { - writer.writeAttribute("password", gdataBinding.getPassword()); + writer.writeAttribute("password", gdataBinding.getPassword()); } - + writer.writeEndElement(); } - //FIXME: Resolve the attached policySet, might not needed (the echo binding implementation example) public void resolve(GdataBinding gdataBinding, ModelResolver resolver) throws ContributionResolveException { - PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)gdataBinding; - List<Intent> requiredIntents = new ArrayList<Intent>(); - Intent resolvedIntent = null; - for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) { - resolvedIntent = resolver.resolveModel(Intent.class, intent); - requiredIntents.add(resolvedIntent); - } - policySetAttachPoint.getRequiredIntents().clear(); - policySetAttachPoint.getRequiredIntents().addAll(requiredIntents); - - List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>(); - PolicySet resolvedPolicySet = null; - for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) { - resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet); - resolvedPolicySets.add(resolvedPolicySet); - } - policySetAttachPoint.getPolicySets().clear(); - policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets); + } } |