summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/assembly/src
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-01-17 01:27:23 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-01-17 01:27:23 +0000
commit558e63a849e90059c16a8834f87b8c39b629b237 (patch)
tree6642696ecdd62d78e4e66b9dd2c10ce972ef54af /branches/sca-java-1.x/modules/assembly/src
parentcbb14b9965208792bdba2f313bc57951c90c1a12 (diff)
TUSCANY-2463 - Storing extended attributes in a second list, wrapped into a extension class that stores the attribute QName, it's value
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@735197 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules/assembly/src')
-rw-r--r--branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultExtensionFactory.java36
-rw-r--r--branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java7
-rw-r--r--branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java65
-rw-r--r--branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ExtensionFactory.java28
-rw-r--r--branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java6
-rw-r--r--branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java63
-rw-r--r--branches/sca-java-1.x/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.ExtensionFactory18
7 files changed, 223 insertions, 0 deletions
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultExtensionFactory.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultExtensionFactory.java
new file mode 100644
index 0000000000..2ed02e214b
--- /dev/null
+++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultExtensionFactory.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.assembly;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.impl.ExtensionImpl;
+
+public class DefaultExtensionFactory implements ExtensionFactory {
+
+ public Extension createExtension() {
+ return new ExtensionImpl();
+ }
+
+ public Extension createExtension(QName name, Object value, boolean isAttribute) {
+ return new ExtensionImpl(name, value, isAttribute);
+ }
+
+}
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
index 3577a94d1e..593b7de88b 100644
--- a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
+++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
@@ -33,5 +33,12 @@ public interface Extensible {
* @return a list of extension objects container in this model object
*/
List<Object> getExtensions();
+
+ /**
+ * Returns a list of attribute extensions contained in this model object
+ *
+ * @return a list of attribute extensions contained in this model object
+ */
+ List<Extension> getAttributeExtensions();
}
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java
new file mode 100644
index 0000000000..499c97c278
--- /dev/null
+++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java
@@ -0,0 +1,65 @@
+/*
+ * 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.assembly;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Base interface for storing contents of extensible assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Extension {
+
+ /**
+ * Return QName for the extension
+ * @return the extension QName
+ */
+ QName getQName();
+
+ /**
+ * Set QName for the extension
+ * @param qName the extension QName
+ */
+ void setQName(QName qName);
+
+ /**
+ * Return the original extension value
+ * @return the extension value
+ */
+ Object getValue();
+
+ /**
+ * Set the original extension value
+ * @param value the extension value
+ */
+ void setValue(Object value);
+
+ /**
+ * Return whether or not the extension is an attribute
+ * @return
+ */
+ boolean isAttribute();
+
+ /**
+ * Set whether or not the extension is an attribute
+ * @param value
+ */
+ void setIsAttribute(boolean isAttribute);
+}
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ExtensionFactory.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ExtensionFactory.java
new file mode 100644
index 0000000000..214cf59748
--- /dev/null
+++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ExtensionFactory.java
@@ -0,0 +1,28 @@
+/*
+ * 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.assembly;
+
+import javax.xml.namespace.QName;
+
+public interface ExtensionFactory {
+
+ Extension createExtension();
+
+ Extension createExtension(QName qName, Object value, boolean isAttribute);
+}
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
index 9a7ca09e43..0a2e25aa43 100644
--- a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
+++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.Extension;
/**
* Convenience base class for extensible assembly model objects.
@@ -30,6 +31,7 @@ import org.apache.tuscany.sca.assembly.Extensible;
*/
public abstract class ExtensibleImpl extends BaseImpl implements Extensible {
private List<Object> extensions = new ArrayList<Object>();
+ private List<Extension> attributeExtensions = new ArrayList<Extension>();
/**
* Constructs a new base model object.
@@ -40,5 +42,9 @@ public abstract class ExtensibleImpl extends BaseImpl implements Extensible {
public List<Object> getExtensions() {
return extensions;
}
+
+ public List<Extension> getAttributeExtensions() {
+ return attributeExtensions;
+ }
}
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java
new file mode 100644
index 0000000000..2753bcc091
--- /dev/null
+++ b/branches/sca-java-1.x/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java
@@ -0,0 +1,63 @@
+/*
+ * 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.assembly.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Extension;
+
+public class ExtensionImpl implements Extension {
+ private QName qName;
+ private Object value;
+ boolean isAttribute = false;
+
+ public ExtensionImpl() {
+
+ }
+
+ public ExtensionImpl(QName qName, Object value, boolean isAttribute) {
+ this.qName = qName;
+ this.value = value;
+ this.isAttribute = isAttribute;
+ }
+
+ public QName getQName() {
+ return qName;
+ }
+
+ public void setQName(QName qName) {
+ this.qName = qName;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public boolean isAttribute() {
+ return isAttribute;
+ }
+
+ public void setIsAttribute(boolean isAttribute) {
+ this.isAttribute = isAttribute;
+ }
+}
diff --git a/branches/sca-java-1.x/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.ExtensionFactory b/branches/sca-java-1.x/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.ExtensionFactory
new file mode 100644
index 0000000000..bea25da958
--- /dev/null
+++ b/branches/sca-java-1.x/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.ExtensionFactory
@@ -0,0 +1,18 @@
+# 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.
+
+org.apache.tuscany.sca.assembly.DefaultExtensionFactory \ No newline at end of file