summaryrefslogtreecommitdiffstats
path: root/branches/sca-android/modules/binding-gdata/src/main/java/org
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-09-15 00:26:00 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2008-09-15 00:26:00 +0000
commitd5f1d093fe6fa491cdec392dca7137639e98d149 (patch)
treeb98c79d8231a2617ee1dce43b1782d30d93686bc /branches/sca-android/modules/binding-gdata/src/main/java/org
parentf4e3e383071b6947d56794d9af5e9e6438aa3235 (diff)
Pulled a recent revision of trunk into the sca-android branch, to apply the android patches from JIRA TUSCANY-2440 to it.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@695318 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-android/modules/binding-gdata/src/main/java/org')
-rw-r--r--branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBinding.java77
-rw-r--r--branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBindingFactory.java35
-rw-r--r--branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java100
-rw-r--r--branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingFactoryImpl.java36
-rw-r--r--branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingImpl.java137
5 files changed, 385 insertions, 0 deletions
diff --git a/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBinding.java b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBinding.java
new file mode 100644
index 0000000000..c1868f05dc
--- /dev/null
+++ b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBinding.java
@@ -0,0 +1,77 @@
+/*
+ * 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.tuscany.sca.binding.gdata;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * GData binding model.
+ *
+ * @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);
+
+ /*
+ * Returns the username of a Google account
+ * @return
+ */
+ String getUsername();
+
+ /*
+ * Sets the username of a Google account
+ * @param username
+ */
+ void setUsername(String username);
+
+ /*
+ * Returns the password of a Google account
+ * @return
+ */
+ String getPassword();
+
+ /*
+ * Sets the password of a Google account
+ * @param password
+ */
+ void setPassword(String password);
+
+ /*
+ * Retruns the name of the Google service to which we are connecting. Sample names of services might include "cl" (Calendar), "mail" (GMail), or "blogger" (Blogger)
+ * @return
+ */
+ String getServiceType();
+
+ /*
+ * Sets the name of the Google service to which we are connecting. Sample names of services might include "cl" (Calendar), "mail" (GMail), or "blogger" (Blogger)
+ * @param serviceType
+ */
+ void setServiceType(String serviceType);
+}
diff --git a/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBindingFactory.java b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBindingFactory.java
new file mode 100644
index 0000000000..ec2f179fdb
--- /dev/null
+++ b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataBindingFactory.java
@@ -0,0 +1,35 @@
+/*
+ * 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.tuscany.sca.binding.gdata;
+
+/**
+ * Factory for the GData binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface GDataBindingFactory {
+
+ /**
+ * Creates a new Atom binding.
+ * @return the new Atom binding
+ */
+ GDataBinding createAtomBinding();
+
+}
diff --git a/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java
new file mode 100644
index 0000000000..5797629bed
--- /dev/null
+++ b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GDataImplementationProcessor.java
@@ -0,0 +1,100 @@
+/*
+ * 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.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 = (GDataBindingFactory) 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 serviceType = reader.getAttributeValue(null, "serviceType");
+ String login = reader.getAttributeValue(null, "username");
+ String password = reader.getAttributeValue(null, "password");
+
+ gdataBinding.setURI(uri);
+ gdataBinding.setServiceType(serviceType);
+ gdataBinding.setUsername(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.getServiceType() != null) {
+ writer.writeAttribute("serviceType", gdataBinding.getServiceType());
+ }
+ if (gdataBinding.getUsername() != null) {
+ writer.writeAttribute("username", gdataBinding.getUsername());
+ }
+ 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;
+ }
+}
diff --git a/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingFactoryImpl.java b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingFactoryImpl.java
new file mode 100644
index 0000000000..e0c3bfbe78
--- /dev/null
+++ b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingFactoryImpl.java
@@ -0,0 +1,36 @@
+/*
+ * 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.tuscany.sca.binding.gdata.impl;
+
+import org.apache.tuscany.sca.binding.gdata.GDataBinding;
+import org.apache.tuscany.sca.binding.gdata.GDataBindingFactory;
+
+/**
+ * Factory for the GData binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class GDataBindingFactoryImpl implements GDataBindingFactory {
+
+ public GDataBinding createAtomBinding() {
+ return new GDataBindingImpl();
+ }
+
+}
diff --git a/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingImpl.java b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingImpl.java
new file mode 100644
index 0000000000..baba882c4c
--- /dev/null
+++ b/branches/sca-android/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GDataBindingImpl.java
@@ -0,0 +1,137 @@
+/*
+ * 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.tuscany.sca.binding.gdata.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.binding.gdata.GDataBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Implementation of the GData binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+class GDataBindingImpl implements GDataBinding, PolicySetAttachPoint {
+
+ private String password;
+ private String username;
+ private String name;
+ private String serviceType;
+ private String uri;
+ private String title;
+ 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;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public boolean isUnresolved() {
+ // The binding is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The binding is always resolved
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return intentAttachPointType;
+ }
+
+ public void setType(IntentAttachPointType intentAttachPointType) {
+ this.intentAttachPointType = intentAttachPointType;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+ public String getUsername() {
+ return this.username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return this.password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getServiceType() {
+ return this.serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+}