summaryrefslogtreecommitdiffstats
path: root/branches/sca-equinox/modules/contribution-xml
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-equinox/modules/contribution-xml')
-rw-r--r--branches/sca-equinox/modules/contribution-xml/LICENSE205
-rw-r--r--branches/sca-equinox/modules/contribution-xml/META-INF/MANIFEST.MF34
-rw-r--r--branches/sca-equinox/modules/contribution-xml/NOTICE6
-rw-r--r--branches/sca-equinox/modules/contribution-xml/pom.xml52
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyAttributeProcessor.java68
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyElementProcessor.java309
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java50
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java130
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java216
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java72
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor20
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties23
-rw-r--r--branches/sca-equinox/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java145
15 files changed, 0 insertions, 1368 deletions
diff --git a/branches/sca-equinox/modules/contribution-xml/LICENSE b/branches/sca-equinox/modules/contribution-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/LICENSE
+++ /dev/null
@@ -1,205 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
-
-
-
diff --git a/branches/sca-equinox/modules/contribution-xml/META-INF/MANIFEST.MF b/branches/sca-equinox/modules/contribution-xml/META-INF/MANIFEST.MF
deleted file mode 100644
index 4f8d3ee0f8..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,34 +0,0 @@
-Manifest-Version: 1.0
-Export-Package: org.apache.tuscany.sca.contribution.xml;uses:="org.apa
- che.tuscany.sca.assembly,org.apache.tuscany.sca.core,org.apache.tusca
- ny.sca.contribution,org.apache.tuscany.sca.monitor,javax.xml.namespac
- e,javax.xml.stream,org.apache.tuscany.sca.contribution.resolver,org.a
- pache.tuscany.sca.contribution.processor";version="1.4"
-Private-Package: org.apache.tuscany.sca.contribution.processor.xml;ver
- sion="1.4"
-Tool: Bnd-0.0.255
-Bundle-Name: Apache Tuscany SCA XML Contribution Model
-Created-By: 1.6.0_07 (Sun Microsystems Inc.)
-Bundle-Vendor: The Apache Software Foundation
-Bundle-Version: 1.4
-Bnd-LastModified: 1225397199187
-Bundle-ManifestVersion: 2
-Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
-Bundle-Description: Apache Tuscany SCA XML Contribution Model
-Import-Package: javax.xml.namespace,
- javax.xml.parsers,
- javax.xml.stream,
- org.apache.tuscany.sca.assembly;version="1.4",
- org.apache.tuscany.sca.contribution;version="1.4",
- org.apache.tuscany.sca.contribution.processor;version="1.4",
- org.apache.tuscany.sca.contribution.resolver;version="1.4",
- org.apache.tuscany.sca.contribution.xml;version="1.4",
- org.apache.tuscany.sca.core;version="1.4",
- org.apache.tuscany.sca.monitor;version="1.4",
- org.apache.tuscany.sca.policy;version="1.4.0",
-
- org.w3c.dom,
- org.w3c.dom.traversal
-Bundle-SymbolicName: org.apache.tuscany.sca.contribution.xml
-Bundle-DocURL: http://www.apache.org/
-
diff --git a/branches/sca-equinox/modules/contribution-xml/NOTICE b/branches/sca-equinox/modules/contribution-xml/NOTICE
deleted file mode 100644
index fdfa0e9faa..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2008 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-equinox/modules/contribution-xml/pom.xml b/branches/sca-equinox/modules/contribution-xml/pom.xml
deleted file mode 100644
index eaeacd65e3..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-modules</artifactId>
- <version>1.4-EQUINOX-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution-xml</artifactId>
- <name>Apache Tuscany SCA XML Contribution Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.4-EQUINOX-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyAttributeProcessor.java b/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyAttributeProcessor.java
deleted file mode 100644
index 503a9c96d2..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyAttributeProcessor.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.contribution.processor.xml;
-
-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.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A Policy Processor used for testing.
- *
- * @version $Rev$ $Date$
- */
-public class AnyAttributeProcessor extends BaseStAXArtifactProcessor implements StAXAttributeProcessor<String> {
- private static final QName ANY_ATTRIBUTE = new QName("http://www.w3.org/2001/XMLSchema", "anyAttribute");
-
- public AnyAttributeProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) {
-
- }
-
- public QName getArtifactType() {
- return ANY_ATTRIBUTE;
- }
-
- public Class<String> getModelType() {
- return String.class;
- }
-
- public String read(QName attributeName, XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- return reader.getAttributeValue(attributeName.getNamespaceURI(), attributeName.getLocalPart());
- }
-
- public void write(String value, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- writer.setPrefix(ANY_ATTRIBUTE.getPrefix(), ANY_ATTRIBUTE.getNamespaceURI());
- writer.writeAttribute(ANY_ATTRIBUTE.getLocalPart(), value);
- }
-
-
- public void resolve(String arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-}
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyElementProcessor.java b/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyElementProcessor.java
deleted file mode 100644
index 38da7740cd..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyElementProcessor.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * 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.contribution.processor.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.ArrayList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-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.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.traversal.DocumentTraversal;
-import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.NodeIterator;
-import org.w3c.dom.traversal.TreeWalker;
-
-public class AnyElementProcessor implements StAXArtifactProcessor<Object> {
- private static final QName ANY_ELEMENT = new QName("http://www.w3.org/2001/XMLSchema", "anyElement");
-
- private static final Logger logger = Logger.getLogger(AnyElementProcessor.class.getName());
- private DocumentBuilderFactory documentBuilderFactory;
- private Document document;
- private Monitor monitor;
-
- public AnyElementProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) {
- documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
- this.monitor = monitor;
- }
-
-
- public QName getArtifactType() {
- return ANY_ELEMENT;
- }
-
- public Class<Object> getModelType() {
- return Object.class;
- }
-
- /**
- * Reads the contetns of the unknown elements and generates the DOM
- * @param reader
- * @param name
- * @return
- * @throws XMLStreamException
- */
- public Object read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- int event = reader.getEventType();
- int level = 0;
- ArrayList<String> elementList = new ArrayList<String>();
- document = createDocument();
-
- QName name = reader.getName();
-
- while(reader.hasNext()){
- switch(event){
- case START_ELEMENT:
- elementList.add(reader.getName().getLocalPart());
- if(level == 0){
- generateDOM(reader,null);
- level++;
- }
- else{
- generateDOM(reader,elementList.get(elementList.size()-2).toString());
- }
-
- break;
- case END_ELEMENT:
- elementList.remove(reader.getName().getLocalPart());
- }
- if(reader.hasNext()){
- event = reader.next();
- }
-
- if(event == START_ELEMENT || event == END_ELEMENT){
- if(reader.getName().equals(name)){
- break;
- }
- }
- }
- return document;
- }
-
- /**
- * Writes unknown portions back to the writer
- * @param model
- * @param writer
- */
- public void write(Object model, XMLStreamWriter writer) {
-
- if( ! (model instanceof Document)) {
- return;
- }
-
- Document doc = (Document)model;
- try{
- DocumentTraversal traversal = (DocumentTraversal)doc;
- TreeWalker walker = traversal.createTreeWalker(doc.getDocumentElement(),NodeFilter.SHOW_ALL, null, true);
- writeDOM(walker,writer);
- }
- catch(Exception e){
- if (logger.isLoggable(Level.SEVERE)) {
- logger.log(Level.SEVERE, "Document not created ");
- }
- error("Document not created",document,e);
- }
- }
-
- public void resolve(Object arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
- /**
- * Method to generate the DOM
- * @param reader
- * @param parent
- * @throws Exception
- */
- //private void generateDOM(String elementText, String parent) {
- private void generateDOM(XMLStreamReader reader, String parent) {
- try{
- String elePrefix = reader.getPrefix();
- String eleQName = reader.getLocalName();
- if (elePrefix != null && elePrefix.length() != 0) {
- eleQName = elePrefix + ":" + eleQName;
- }
-
- Element element = document.createElementNS(reader.getNamespaceURI(), eleQName);
-
- int attributeCount = reader.getAttributeCount();
- for(int i = 0;i < attributeCount;i++){
- String ns = reader.getAttributeNamespace(i);
- String prefix = reader.getAttributePrefix(i);
- String qname = reader.getAttributeLocalName(i);
- String value = reader.getAttributeValue(i);
- if (prefix != null && prefix.length() != 0) {
- qname = prefix + ":" + qname;
- }
- element.setAttributeNS(ns,qname,value);
- }
- if(parent == null){
- if(document != null){
- document.appendChild(element);
- }
- else{
- if (logger.isLoggable(Level.SEVERE)) {
- logger.log(Level.SEVERE, "Document not created ");
- }
- error("Document not created",document,element);
- }
- }
- else{
- Node parentNode = getParentNode(document,parent);
- if(parentNode != null){
- parentNode.appendChild(element);
- }
- else{
- if (logger.isLoggable(Level.SEVERE)) {
- logger.log(Level.SEVERE, "Parent node not found");
- }
- error("Parent node not found",document,parentNode.getNodeName());
- }
- }
- }
- catch(Exception e){
- e.printStackTrace();
- if (logger.isLoggable(Level.SEVERE)) {
- logger.log(Level.SEVERE, "Document not created ");
- }
- error("Document not created",document,e);
- }
- }
-
- /**
- * Method to create an empty document
- * @return
- */
- private Document createDocument() {
- try {
- document = documentBuilderFactory.newDocumentBuilder().newDocument();
- return document;
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * Method to traverse the DOM structure and write the elements
- * @param walker
- * @param writer
- * @throws XMLStreamException
- */
- private void writeDOM(TreeWalker walker,XMLStreamWriter writer) throws XMLStreamException {
-
- Node parent = walker.getCurrentNode();
-
- writer.writeStartElement(parent.getPrefix(), parent.getLocalName(), parent.getNamespaceURI());
-
- NamedNodeMap attributes = parent.getAttributes();
-
- for(int i = 0;i<attributes.getLength();i++){
- writer.writeAttribute(attributes.item(i).getPrefix(), attributes.item(i).getNamespaceURI(), attributes.item(i).getLocalName(), attributes.item(i).getNodeValue());
- }
-
- for (Node n = walker.firstChild();n != null;n = walker.nextSibling()) {
- writeDOM(walker,writer);
- }
- writer.writeEndElement();
-
- walker.setCurrentNode(parent);
- }
-
- /**
- * Method to get the Parent node out of the DOM structure
- * @param doc
- * @param parent
- * @return
- */
- private Node getParentNode(Node doc,String parent) {
- Node parentNode = null;
- try{
- DocumentTraversal traversal = (DocumentTraversal)doc;
-
- CharSequence prefixChar = ":";
- NodeIterator iterator = traversal.createNodeIterator(document.getDocumentElement(), NodeFilter.SHOW_ELEMENT, null, true);
- for (Node n = iterator.nextNode(); n != null; n = iterator.nextNode()) {
- String nodeName = n.getNodeName();
- String[] str = null;
- if(n.getNodeName().contains(prefixChar)){
- str = nodeName.split(":");
- nodeName = str[str.length-1];
- }
- if(parent.equalsIgnoreCase(nodeName)){
- parentNode = n;
- }
- }
- return parentNode;
- }
- catch(Exception e){
- e.printStackTrace();
- }
- return parentNode;
- }
-
- /**
- * Marshals exceptions into the monitor
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
-}
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java b/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java
deleted file mode 100644
index ff7bf7068a..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.contribution.xml;
-
-import javax.xml.stream.XMLInputFactory;
-
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * URLArtifactProcessor that handles sca-contribution-generated.xml files.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionGeneratedMetadataDocumentProcessor extends ContributionMetadataDocumentProcessor {
-
- public ContributionGeneratedMetadataDocumentProcessor(XMLInputFactory inputFactory,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- super(inputFactory, staxProcessor, monitor);
- }
-
- public ContributionGeneratedMetadataDocumentProcessor(FactoryExtensionPoint modelFactories,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- super(modelFactories, staxProcessor, monitor);
- }
-
- @Override
- public String getArtifactType() {
- return "sca-contribution-generated.xml";
- }
-}
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java b/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
deleted file mode 100644
index c293649135..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.contribution.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-
-/**
- * URLArtifactProcessor that handles sca-contribution.xml files.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionMetadataDocumentProcessor implements URLArtifactProcessor<ContributionMetadata>{
- private final StAXArtifactProcessor staxProcessor;
- private final XMLInputFactory inputFactory;
- private final Monitor monitor;
-
- public ContributionMetadataDocumentProcessor(XMLInputFactory inputFactory,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- this.inputFactory = inputFactory;
- this.staxProcessor = staxProcessor;
- this.monitor = monitor;
- }
-
- public ContributionMetadataDocumentProcessor(FactoryExtensionPoint modelFactories,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- this.inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- this.staxProcessor = staxProcessor;
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), "contribution-xml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public String getArtifactType() {
- return "sca-contribution.xml";
- }
-
- public Class<ContributionMetadata> getModelType() {
- return ContributionMetadata.class;
- }
-
- public ContributionMetadata read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
- InputStream urlStream = null;
- try {
-
- // Create a stream reader
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- urlStream = connection.getInputStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
- reader.nextTag();
-
- // Read the contribution model
- ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader);
-
- return contribution;
-
- } catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", inputFactory, ex);
- throw ex;
- } catch (IOException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("IOException", inputFactory, ex);
- throw ex;
- } finally {
- try {
- if (urlStream != null) {
- urlStream.close();
- urlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(ContributionMetadata contribution, ModelResolver resolver) throws ContributionResolveException {
- staxProcessor.resolve(contribution, resolver);
- }
-
-}
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java b/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
deleted file mode 100644
index 02c5d48eb3..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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.contribution.xml;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-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.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-
-/**
- * Processor for contribution metadata
- *
- * @version $Rev$ $Date$
- */
-public class ContributionMetadataProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<ContributionMetadata> {
-
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
-
- private static final QName CONTRIBUTION_QNAME = new QName(SCA10_NS, "contribution");
- private static final QName DEPLOYABLE_QNAME = new QName(SCA10_NS, "deployable");
-
- private final AssemblyFactory assemblyFactory;
- private final ContributionFactory contributionFactory;
-
- private final StAXArtifactProcessor<Object> extensionProcessor;
- private Monitor monitor;
-
- public ContributionMetadataProcessor(AssemblyFactory assemblyFactory,
- ContributionFactory contributionFactory,
- StAXArtifactProcessor<Object> extensionProcessor,
- Monitor monitor) {
- this.assemblyFactory = assemblyFactory;
- this.contributionFactory = contributionFactory;
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), "contribution-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public ContributionMetadataProcessor(FactoryExtensionPoint modelFactories,
- StAXArtifactProcessor<Object> extensionProcessor,
- Monitor monitor) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- }
-
-
- public QName getArtifactType() {
- return CONTRIBUTION_QNAME;
- }
-
- public Class<ContributionMetadata> getModelType() {
- return ContributionMetadata.class;
- }
-
- public ContributionMetadata read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- ContributionMetadata contribution = null;
- QName name = null;
-
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- name = reader.getName();
-
- if (CONTRIBUTION_QNAME.equals(name)) {
-
- // Read <contribution>
- contribution = this.contributionFactory.createContributionMetadata();
- contribution.setUnresolved(true);
-
- } else if (DEPLOYABLE_QNAME.equals(name)) {
-
- // Read <deployable>
- QName compositeName = getQName(reader, "composite");
- if (compositeName == null) {
- error("AttributeCompositeMissing", reader);
- //throw new ContributionReadException("Attribute 'composite' is missing");
- } else {
- if (contribution != null) {
- Composite composite = assemblyFactory.createComposite();
- composite.setName(compositeName);
- composite.setUnresolved(true);
- contribution.getDeployables().add(composite);
- }
- }
- } else {
-
- // Read an extension element
- Object extension = extensionProcessor.read(reader);
- if (extension != null && contribution != null) {
- if (extension instanceof Import) {
- contribution.getImports().add((Import)extension);
- } else if (extension instanceof Export) {
- contribution.getExports().add((Export)extension);
- }
- }
- }
- break;
-
- case XMLStreamConstants.END_ELEMENT:
- if (CONTRIBUTION_QNAME.equals(reader.getName())) {
- return contribution;
- }
- break;
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return contribution;
- }
-
- public void write(ContributionMetadata contribution, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <contribution>
- writeStartDocument(writer, CONTRIBUTION_QNAME.getNamespaceURI(), CONTRIBUTION_QNAME.getLocalPart());
-
- // Write <import>
- for (Import imp: contribution.getImports()) {
- extensionProcessor.write(imp, writer);
- }
-
- // Write <export>
- for (Export export: contribution.getExports()) {
- extensionProcessor.write(export, writer);
- }
-
- // Write <deployable>
- for (Composite deployable: contribution.getDeployables()) {
- writeStart(writer, DEPLOYABLE_QNAME.getNamespaceURI(), DEPLOYABLE_QNAME.getLocalPart(),
- new XAttr("composite", deployable.getName()));
- writeEnd(writer);
- }
-
- writeEndDocument(writer);
- }
-
- public void resolve(ContributionMetadata contribution, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve imports and exports
- for (Export export: contribution.getExports()) {
- extensionProcessor.resolve(export, resolver);
- }
- for (Import import_: contribution.getImports()) {
- extensionProcessor.resolve(import_, resolver);
- }
-
- // Resolve deployable composites
- List<Composite> deployables = contribution.getDeployables();
- for (int i = 0, n = deployables.size(); i < n; i++) {
- Composite deployable = deployables.get(i);
- Composite resolved = (Composite)resolver.resolveModel(Composite.class, deployable);
- if (resolved != deployable) {
- deployables.set(i, resolved);
- }
- }
-
- contribution.setUnresolved(false);
- }
-}
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java b/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java
deleted file mode 100644
index ddc768b61c..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.contribution.xml;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-
-/**
- * A Model Resolver for Contribution models.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionModelResolver implements ModelResolver {
-
- private Map<String, Contribution> map = new HashMap<String, Contribution>();
-
- public ContributionModelResolver(Contribution contribution, FactoryExtensionPoint modelFactories) {
- }
-
- public void addModel(Object resolved) {
- Contribution contribution = (Contribution)resolved;
- map.put(contribution.getURI(), contribution);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((Contribution)resolved).getURI());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- // Lookup a contribution for the given URI
- String uri = ((Contribution)unresolved).getURI();
- if (uri != null) {
- Contribution resolved = (Contribution) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
- return unresolved;
- } else {
-
- // If no URI was specified, just return the first contribution
- if (!map.isEmpty()) {
- Contribution resolved = map.values().iterator().next();
- return modelClass.cast(resolved);
- } else {
- return unresolved;
- }
- }
- }
-
-}
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index b69ea1e135..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.contribution.xml.ContributionMetadataProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#contribution,model=org.apache.tuscany.sca.contribution.ContributionMetadata
-org.apache.tuscany.sca.contribution.processor.xml.AnyElementProcessor;qname=http://www.w3.org/2001/XMLSchema#anyElement,model=java.lang.Object
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index 23adab56b9..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;type=sca-contribution.xml,model=org.apache.tuscany.sca.contribution.ContributionMetadata
-org.apache.tuscany.sca.contribution.xml.ContributionGeneratedMetadataDocumentProcessor;type=sca-contribution-generated.xml
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index 68030bf6e6..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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.contribution.xml.ContributionModelResolver;model=org.apache.tuscany.sca.contribution.Contribution
diff --git a/branches/sca-equinox/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties b/branches/sca-equinox/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties
deleted file mode 100644
index 3e1a0187fe..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# 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.
-#
-#
-XMLStreamException = XMLStreamException occured due to:
-IOException = IOException occured due to:
-AttributeCompositeMissing = Attribute 'composite' is missing \ No newline at end of file
diff --git a/branches/sca-equinox/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java b/branches/sca-equinox/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
deleted file mode 100644
index ddb660a139..0000000000
--- a/branches/sca-equinox/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.contribution.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.DefaultMonitorFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test the contribution metadata processor.
- *
- * @version $Rev$ $Date$
- */
-
-public class ContributionMetadataProcessorTestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
- + "<deployable composite=\"ns:Composite1\"/>"
- + "<deployable composite=\"ns:Composite2\"/>"
- + "</contribution>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
- + "<deployable composite=\"ns:Composite1\"/>"
- + "<deployable/>"
- + "</contribution>";
-
- private static XMLInputFactory inputFactory;
- private static XMLOutputFactory outputFactory;
- private static StAXArtifactProcessor<Object> staxProcessor;
- private static Monitor monitor;
-
- @BeforeClass
- public static void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
-
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactory();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors =
- extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- @Test
- public void testRead() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader);
- assertNotNull(contribution);
- assertEquals(2, contribution.getDeployables().size());
- }
-
- @Test
- public void testReadInvalid() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
- /*try {
- staxProcessor.read(reader);
- fail("InvalidException should have been thrown");
- } catch (ContributionReadException e) {
- assertTrue(true);
- }*/
- staxProcessor.read(reader);
- Problem problem = monitor.getLastProblem();
- assertNotNull(problem);
- assertEquals("AttributeCompositeMissing", problem.getMessageId());
- }
-
- @Test
- public void testWrite() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader);
-
- validateContribution(contribution);
-
- //write the contribution metadata contents
- StringWriter stringWriter = new StringWriter();
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stringWriter);
- staxProcessor.write(contribution, writer);
- stringWriter.close();
-
- reader = inputFactory.createXMLStreamReader(new StringReader(stringWriter.toString()));
- contribution = (ContributionMetadata)staxProcessor.read(reader);
-
- validateContribution(contribution);
- }
-
- private void validateContribution(ContributionMetadata contribution) {
- QName deployable;
-
- assertNotNull(contribution);
- assertEquals(2, contribution.getDeployables().size());
- deployable = new QName("http://ns", "Composite1");
- assertEquals(deployable, contribution.getDeployables().get(0).getName());
- deployable = new QName("http://ns", "Composite2");
- assertEquals(deployable, contribution.getDeployables().get(1).getName());
- }
-
-}