tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adrianocrest...@apache.org
Subject svn commit: r653133 [7/33] - in /incubator/tuscany/sandbox/mobile-android: android-jdk-classes/ android-jdk-classes/src/ android-jdk-classes/src/javax/ android-jdk-classes/src/javax/xml/ android-jdk-classes/src/javax/xml/namespace/ android-jdk-classes/...
Date Sat, 03 May 2008 20:52:58 GMT
Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java Sat May  3 13:52:41 2008
@@ -0,0 +1,51 @@
+/*
+ * 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;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * An artifact processor that can read models from a URL.
+ * 
+ * @version $Rev: 616114 $ $Date: 2008-01-28 16:05:37 -0800 (Mon, 28 Jan 2008) $
+ */
+public interface URLArtifactProcessor<M> extends ArtifactProcessor<M> {
+
+    /**
+     * Reads a model from a URL.
+     * 
+     * @param contributionURL Contribution location URL
+     * @param artifactURI Artifact URI
+     * @param artifactURL Artifact location URL 
+     * @return A model representation of the input.
+     */
+    M read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException;
+    
+    /**
+     * Returns the type of artifact handled by this artifact processor.
+     *  
+     * @return The type of artifact handled by this artifact processor
+     */
+    String getArtifactType();
+
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java Sat May  3 13:52:41 2008
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+/**
+ * An extension point for URL artifact processors.
+ * 
+ * @version $Rev: 616114 $ $Date: 2008-01-28 16:05:37 -0800 (Mon, 28 Jan 2008) $
+ */
+public interface URLArtifactProcessorExtensionPoint extends
+    ArtifactProcessorExtensionPoint<URLArtifactProcessor> {
+    
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java Sat May  3 13:52:41 2008
@@ -0,0 +1,336 @@
+/*
+ * 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;
+
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.StreamReaderDelegate;
+import javax.xml.validation.Schema;
+import javax.xml.validation.ValidatorHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * 
+ * A validating XMLStreamReader that reports XMLSchema validation errors.
+ *
+ * @version $Rev: 616114 $ $Date: 2008-01-28 16:05:37 -0800 (Mon, 28 Jan 2008) $
+ */
+class ValidatingXMLStreamReader extends StreamReaderDelegate implements XMLStreamReader {
+    private static final Logger logger = Logger.getLogger(ValidatingXMLStreamReader.class.getName());
+    
+    private int level;
+    private ValidatorHandler handler;
+    
+    /**
+     * Constructs a new ValidatingXMLStreamReader.
+     * 
+     * @param reader
+     * @param schema
+     * @throws XMLStreamException
+     */
+    ValidatingXMLStreamReader(XMLStreamReader reader, Schema schema) throws XMLStreamException {
+        super(reader);
+        if (schema == null) {
+            return;
+        }
+        
+        handler = schema.newValidatorHandler();
+        handler.setDocumentLocator(new LocatorAdapter());
+        try {
+            handler.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+        } catch (SAXException e) {
+            throw new XMLStreamException(e);
+        }
+        
+        // These validation errors are just warnings for us as we want to support
+        // running from an XML document with XSD validation errors, as long as we can
+        // get the metadata we need from the document
+        handler.setErrorHandler(new ErrorHandler() {
+            private String getMessage(SAXParseException e) {
+                return "XMLSchema validation problem in: " + e.getSystemId() + ", line: " + e.getLineNumber() + ", column: " + e.getColumnNumber() + "\n" + e.getMessage();
+            }
+            
+            public void error(SAXParseException exception) throws SAXException {
+                logger.warning(getMessage(exception));
+            }
+            
+            public void fatalError(SAXParseException exception) throws SAXException {
+                logger.warning(getMessage(exception));
+            }
+            
+            public void warning(SAXParseException exception) throws SAXException {
+                logger.warning(getMessage(exception));
+            }
+        });
+    }
+
+    @Override
+    public int next() throws XMLStreamException {
+        if (handler == null) {
+            return super.next();
+        }
+
+        int event = super.next();
+        try {
+            switch (event) {
+                case XMLStreamConstants.START_DOCUMENT:
+                    level++;
+                    handler.startDocument();
+                    break;
+                case XMLStreamConstants.START_ELEMENT:
+                    level++;
+                    handleStartElement();
+                    break;
+                case XMLStreamConstants.PROCESSING_INSTRUCTION:
+                    handler.processingInstruction(super.getPITarget(), super.getPIData());
+                    break;
+                case XMLStreamConstants.CHARACTERS:
+                case XMLStreamConstants.CDATA:
+                case XMLStreamConstants.SPACE:
+                case XMLStreamConstants.ENTITY_REFERENCE:
+                    handler.characters(super.getTextCharacters(), super.getTextStart(), super.getTextLength());
+                    break;
+                case XMLStreamConstants.END_ELEMENT:
+                    handleEndElement();
+                    level--;
+                    break;
+                case XMLStreamConstants.END_DOCUMENT:
+                    handler.endDocument();
+                    break;
+            }
+        } catch (SAXException e) {
+            throw new XMLStreamException(e.getMessage(), e);
+        }
+        return event;
+    }
+    
+    @Override
+    public int nextTag() throws XMLStreamException {
+        if (handler == null) {
+            return super.nextTag();
+        }
+        
+        for (;;) {
+            int event = super.getEventType();
+            try {
+                switch (event) {
+                    case XMLStreamConstants.START_DOCUMENT:
+                        level++;
+                        handler.startDocument();
+                        break;
+                    case XMLStreamConstants.START_ELEMENT:
+                        level++;
+                        handleStartElement();
+                        return event;
+                    case XMLStreamConstants.PROCESSING_INSTRUCTION:
+                        handler.processingInstruction(super.getPITarget(), super.getPIData());
+                        break;
+                    case XMLStreamConstants.CHARACTERS:
+                    case XMLStreamConstants.CDATA:
+                    case XMLStreamConstants.SPACE:
+                    case XMLStreamConstants.ENTITY_REFERENCE:
+                        handler.characters(super.getTextCharacters(), super.getTextStart(), super.getTextLength());
+                        break;
+                    case XMLStreamConstants.END_ELEMENT:
+                        handleEndElement();
+                        level--;
+                        return event;
+                    case XMLStreamConstants.END_DOCUMENT:
+                        handler.endDocument();
+                        return event;
+                }
+            } catch (SAXException e) {
+                throw new XMLStreamException(e);
+            }
+            super.next();
+        }
+    }
+    
+    @Override
+    public String getElementText() throws XMLStreamException {
+        if (handler == null) {
+            return super.getElementText();
+        }
+
+        if (getEventType() != XMLStreamConstants.START_ELEMENT) {
+            return super.getElementText();
+        }
+        StringBuffer text = new StringBuffer();
+
+        for (;;) {
+            int event = next();
+            switch (event) {
+                case XMLStreamConstants.END_ELEMENT:
+                    return text.toString();
+                    
+                case XMLStreamConstants.COMMENT:
+                case XMLStreamConstants.PROCESSING_INSTRUCTION:
+                    continue;
+                    
+                case CHARACTERS:
+                case CDATA:
+                case SPACE:
+                case ENTITY_REFERENCE:
+                    text.append(getText());
+                    break;
+                    
+                default:
+                    break;
+            }
+        }
+    }
+    
+    /**
+     * Handle a start element event.
+     * 
+     * @throws SAXException
+     */
+    private void handleStartElement() throws SAXException {
+
+        // send startPrefixMapping events immediately before startElement event
+        int nsCount = super.getNamespaceCount();
+        for (int i = 0; i < nsCount; i++) {
+            String prefix = super.getNamespacePrefix(i);
+            if (prefix == null) { // true for default namespace
+                prefix = "";
+            }
+            handler.startPrefixMapping(prefix, super.getNamespaceURI(i));
+        }
+
+        // fire startElement
+        QName qname = super.getName();
+        String prefix = qname.getPrefix();
+        String rawname;
+        if (prefix == null || prefix.length() == 0) {
+            rawname = qname.getLocalPart();
+        } else {
+            rawname = prefix + ':' + qname.getLocalPart();
+        }
+        Attributes attrs = getAttributes();
+        handler.startElement(qname.getNamespaceURI(), qname.getLocalPart(), rawname, attrs);
+    }
+
+    /**
+     * Handle an endElement event.
+     * 
+     * @throws SAXException
+     */
+    private void handleEndElement() throws SAXException {
+
+        // fire endElement
+        QName qname = super.getName();
+        handler.endElement(qname.getNamespaceURI(), qname.getLocalPart(), qname.toString());
+
+        // send endPrefixMapping events immediately after endElement event
+        // we send them in the opposite order to that returned but this is not
+        // actually required by SAX
+        int nsCount = super.getNamespaceCount();
+        for (int i = nsCount - 1; i >= 0; i--) {
+            String prefix = super.getNamespacePrefix(i);
+            if (prefix == null) { // true for default namespace
+                prefix = "";
+            }
+            handler.endPrefixMapping(prefix);
+        }
+    }
+
+    /**
+     * Get the attributes associated with the current START_ELEMENT event.
+     * 
+     * @return the StAX attributes converted to org.xml.sax.Attributes
+     */
+    private Attributes getAttributes() {
+        AttributesImpl attrs = new AttributesImpl();
+
+        // add namespace declarations
+        for (int i = 0; i < super.getNamespaceCount(); i++) {
+            String prefix = super.getNamespacePrefix(i);
+            String uri = super.getNamespaceURI(i);
+            if (prefix == null) {
+                attrs.addAttribute("", "", "xmlns", "CDATA", uri);
+            } else {
+                attrs.addAttribute("", "", "xmlns:" + prefix, "CDATA", uri);
+            }
+        }
+
+        // Regular attributes
+        for (int i = 0; i < super.getAttributeCount(); i++) {
+            String uri = super.getAttributeNamespace(i);
+            if (uri == null) {
+                uri = "";
+            }
+            String localName = super.getAttributeLocalName(i);
+            String prefix = super.getAttributePrefix(i);
+            String qname;
+            if (prefix == null || prefix.length() == 0) {
+                qname = localName;
+            } else {
+                qname = prefix + ':' + localName;
+            }
+            String type = super.getAttributeType(i);
+            String value = super.getAttributeValue(i);
+
+            attrs.addAttribute(uri, localName, qname, type, value);
+        }
+
+        return attrs;
+    }
+
+    /**
+     * Adapter for mapping Locator information.
+     */
+    private final class LocatorAdapter implements Locator {
+
+        private LocatorAdapter() {
+        }
+
+        public int getColumnNumber() {
+            Location location = getLocation();
+            return location == null ? 0 : location.getColumnNumber();
+        }
+
+        public int getLineNumber() {
+            Location location = getLocation();
+            return location == null ? 0 : location.getLineNumber();
+        }
+
+        public String getPublicId() {
+            Location location = getLocation();
+            return location == null ? "" : location.getPublicId();
+        }
+
+        public String getSystemId() {
+            Location location = getLocation();
+            return location == null ? "" : location.getSystemId();
+        }
+    }
+    
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java Sat May  3 13:52:41 2008
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+import java.util.List;
+
+
+/**
+ * An extension point for XML schemas used for validation.
+ *
+ * @version $Rev: 581132 $ $Date: 2007-10-01 21:05:32 -0700 (Mon, 01 Oct 2007) $
+ */
+public interface ValidationSchemaExtensionPoint {
+    
+    /**
+     * Add a schema.
+     * 
+     * @param uri the URI of the schema
+     */
+    void addSchema(String uri);
+    
+    /**
+     * Remove a schema.
+     * 
+     * @param uri the URI of the schema
+     */
+    void removeSchema(String uri);
+    
+    /**
+     * Returns the list of schemas registered in the extension point.
+     * @return the list of schemas
+     */
+    List<String> getSchemas();
+    
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java Sat May  3 13:52:41 2008
@@ -0,0 +1,106 @@
+/*
+ * 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.resolver;
+
+import java.lang.ref.WeakReference;
+
+/**
+ * A weak reference to a class, which should be used to register classes
+ * with an ArtifactResolver and resolve these classes later.
+ * 
+ * FIXME The core contribution model should not have dependencies on classes
+ * and ClassLoaders. This should move to the Java import support module.
+ *
+ * @version $Rev: 639257 $ $Date: 2008-03-20 05:12:00 -0700 (Thu, 20 Mar 2008) $
+ */
+public class ClassReference {
+    
+    private WeakReference<Class> clazz;
+    private String className;
+
+    /**
+     * Constructs a new ClassReference.
+     * 
+     * @param clazz The class reference
+     */
+    public ClassReference(Class clazz) {
+        this.clazz = new WeakReference<Class>(clazz);
+        this.className = clazz.getName();
+    }
+    
+    /**
+     * Constructs a new ClassReference.
+     * 
+     * @param className The class name
+     */
+    public ClassReference(String className) {
+        this.className = className;
+    }
+    
+    /**
+     * Get the referenced class.
+     * 
+     * @return The referenced class
+     */
+    public Class getJavaClass() {
+        if (clazz != null) {
+            return clazz.get();
+        } else {
+            return null;
+        }
+    }
+    
+    /**
+     * Get the referenced class name.
+     * 
+     * @return The class name
+     */
+    public String getClassName() {
+        return className;
+    }
+    
+    /**
+     * Returns true if the class reference is unresolved.
+     * 
+     * @return Whether or not the class has been resolved
+     */
+    public boolean isUnresolved() {
+        return clazz == null;
+    }
+
+    @Override
+    public int hashCode() {
+        return className.hashCode();
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        } else {
+            if (obj instanceof ClassReference) {
+                return className.equals(((ClassReference)obj).className);
+            } else {
+                return false;
+            }
+        }
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java Sat May  3 13:52:41 2008
@@ -0,0 +1,80 @@
+/*
+ * 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.resolver;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.Export;
+import org.apache.tuscany.sca.contribution.Import;
+
+/**
+ * A model resolver implementation that considers Exports in any available contribution
+ *
+ * @version $Rev: 560435 $ $Date: 2007-07-27 18:26:55 -0700 (Fri, 27 Jul 2007) $
+ */
+public class DefaultImportAllModelResolver implements ModelResolver {
+    
+    private Import import_;
+    private List<Contribution> contributions;
+    
+    public DefaultImportAllModelResolver(Import import_, List<Contribution> contributions) {
+        this.import_ = import_;
+        this.contributions = contributions;
+    }
+
+    public void addModel(Object resolved) {
+        throw new IllegalStateException();
+    }
+
+    public Object removeModel(Object resolved) {
+        throw new IllegalStateException();
+    }
+
+    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+        
+        //TODO optimize and cache results of the resolution later
+        
+        // Go over all available contributions
+        for (Contribution contribution : contributions) {
+            
+            // Go over all exports in the contribution
+            for (Export export : contribution.getExports()) {
+                
+                    // If the export matches the export, try to resolve the model object
+                    if (import_.match(export)) {
+                        Object resolved = export.getModelResolver().resolveModel(modelClass, unresolved);
+                        
+                        // Return the resolved model object
+                        if (resolved instanceof Base) {
+                            if (!((Base)resolved).isUnresolved()) {
+                                return modelClass.cast(resolved);
+                            }
+                        }
+                    }
+            }
+        }
+
+        // Model object was not resolved
+        return unresolved;
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java Sat May  3 13:52:41 2008
@@ -0,0 +1,60 @@
+/*
+ * 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.resolver;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * A default implementation of a model resolver based on a map.
+ *
+ * @version $Rev: 631277 $ $Date: 2008-02-26 08:23:26 -0800 (Tue, 26 Feb 2008) $
+ */
+public class DefaultModelResolver implements ModelResolver {
+    
+    private Map<Object, Object> map = new HashMap<Object, Object>();
+    
+    public DefaultModelResolver() {
+    }
+    
+    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+        Object resolved = map.get(unresolved);
+        if (resolved != null) {
+            
+            // Return the resolved object
+            return modelClass.cast(resolved);
+            
+        } else {
+            
+            // Return the unresolved object
+            return unresolved;
+        }
+    }
+    
+    public void addModel(Object resolved) {
+        map.put(resolved, resolved);
+    }
+    
+    public Object removeModel(Object resolved) {
+        return map.remove(resolved);
+    }
+    
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java Sat May  3 13:52:41 2008
@@ -0,0 +1,114 @@
+/*
+ * 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.resolver;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+
+/**
+ * The default implementation of a model resolver extension point.
+ * 
+ * @version $Rev: 632642 $ $Date: 2008-03-01 10:16:44 -0800 (Sat, 01 Mar 2008) $
+ */
+public class DefaultModelResolverExtensionPoint implements ModelResolverExtensionPoint {
+    
+    private final Map<Class<?>, Class<? extends ModelResolver>> resolvers = new HashMap<Class<?>, Class<? extends ModelResolver>>();
+    private Map<String, ServiceDeclaration> loadedResolvers;
+
+    /**
+     * Constructs a new DefaultModelResolverExtensionPoint.
+     */
+    public DefaultModelResolverExtensionPoint() {
+    }
+
+    public void addResolver(Class<?> modelType, Class<? extends ModelResolver> resolver) {
+        resolvers.put(modelType, resolver);
+    }
+
+    public void removeResolver(Class<?> modelType) {
+        resolvers.remove(modelType);
+    }
+
+    @SuppressWarnings("unchecked")
+    public Class<? extends ModelResolver> getResolver(Class<?> modelType) {
+        loadModelResolvers();
+        
+        Class<?>[] classes = modelType.getInterfaces();
+        for (Class<?> c : classes) {
+            Class<? extends ModelResolver> resolver = resolvers.get(c);
+            if (resolver == null) {
+                ServiceDeclaration resolverClass = loadedResolvers.get(c.getName());
+                if (resolverClass != null) {
+                    try {
+                        return (Class<? extends ModelResolver>)resolverClass.loadClass();
+                    } catch (ClassNotFoundException e) {
+                        throw new IllegalArgumentException(e);
+                    }
+                }
+            } else {
+                return resolver;
+            }
+        }
+
+        Class<? extends ModelResolver > resolver = resolvers.get(modelType);
+        if (resolver == null) {
+            ServiceDeclaration resolverClass = loadedResolvers.get(modelType.getName());
+            if (resolverClass != null) {
+                try {
+                    return (Class<? extends ModelResolver>)resolverClass.loadClass();
+                } catch (ClassNotFoundException e) {
+                    throw new IllegalArgumentException(e);
+                }
+            }
+        }
+        return resolver;
+    }
+
+    /**
+     * Dynamically load model resolvers declared under META-INF/services
+     */
+    private void loadModelResolvers() {
+        if (loadedResolvers != null)
+            return;
+        loadedResolvers = new HashMap<String, ServiceDeclaration>();
+
+        // Get the model resolver service declarations
+        Set<ServiceDeclaration> modelResolverDeclarations; 
+        try {
+            modelResolverDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ModelResolver.class);
+        } catch (IOException e) {
+            throw new IllegalStateException(e);
+        }
+        
+        // Load model resolvers
+        for (ServiceDeclaration dataBindingDeclaration: modelResolverDeclarations) {
+            Map<String, String> attributes = dataBindingDeclaration.getAttributes();
+            String model = attributes.get("model");
+
+            loadedResolvers.put(model, dataBindingDeclaration);
+        }
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java Sat May  3 13:52:41 2008
@@ -0,0 +1,172 @@
+/*
+ * 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.resolver;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+
+/**
+ * An implementation of an extensible model resolver which delegates to the
+ * proper resolver extension based on the class of the model to resolve.
+ * 
+ * @version $Rev: 632499 $ $Date: 2008-02-29 15:59:39 -0800 (Fri, 29 Feb 2008) $
+ */
+public class ExtensibleModelResolver implements ModelResolver {
+    private final ModelResolverExtensionPoint resolvers;
+    private final ModelFactoryExtensionPoint factories;
+    private final Contribution contribution;
+    private final ModelResolver defaultResolver;
+    private final Map<Class<?>, ModelResolver> resolverInstances = new HashMap<Class<?>, ModelResolver>();
+    private Map<Object, Object> map = new HashMap<Object, Object>();
+
+    /**
+     * Constructs an extensible model resolver
+     * 
+     * @param resolvers
+     * @param contribution
+     * @param factories
+     */
+    @Deprecated
+    public ExtensibleModelResolver(Contribution contribution,
+                                   ModelResolverExtensionPoint resolvers,
+                                   ModelFactoryExtensionPoint factories,
+                                   ModelResolver defaultResolver) {
+        this.contribution = contribution;
+        this.resolvers = resolvers;
+        this.factories = factories;
+        //FIXME Remove this default resolver, this is currently used to resolve policy declarations
+        // but they should be handled by the contribution import/export mechanism instead of this
+        // defaultResolver hack.
+        this.defaultResolver = defaultResolver;
+    }
+
+    /**
+     * Constructs an extensible model resolver
+     * 
+     * @param resolvers
+     * @param contribution
+     * @param factories
+     */
+    public ExtensibleModelResolver(Contribution contribution,
+                                   ModelResolverExtensionPoint resolvers,
+                                   ModelFactoryExtensionPoint factories) {
+        this.contribution = contribution;
+        this.resolvers = resolvers;
+        this.factories = factories;
+        this.defaultResolver = null;
+    }
+
+    /**
+     * Returns the proper resolver instance based on the interfaces of the model
+     * If one is not available on the registry, instantiate on demand
+     * 
+     * @param modelType
+     * @return
+     */
+    private ModelResolver getModelResolverInstance(Class<?> modelType) {
+
+        // Look up a model resolver instance for the model class or
+        // each implemented interface
+        Class<?>[] interfaces = modelType.getInterfaces();
+        Class<?>[] classes = new Class<?>[interfaces.length + 1];
+        classes[0] = modelType;
+        if (interfaces.length != 0) {
+            System.arraycopy(interfaces, 0, classes, 1, interfaces.length);
+        }
+        for (Class<?> c : classes) {
+
+            // Look up an existing model resolver instance
+            ModelResolver resolverInstance = resolverInstances.get(c);
+            if (resolverInstance != null) {
+                return resolverInstance;
+            }
+
+            // We don't have an instance, lookup a model resolver class
+            // and instantiate it
+            Class<? extends ModelResolver> resolverClass = resolvers.getResolver(c);
+            if (resolverClass != null) {
+                try {
+                    Constructor<? extends ModelResolver> constructor =
+                        resolverClass
+                            .getConstructor(new Class[] {Contribution.class, ModelFactoryExtensionPoint.class});
+                    if (constructor != null) {
+
+                        // Construct the model resolver instance and cache it
+                        resolverInstance = constructor.newInstance(contribution, factories);
+                        resolverInstances.put(c, resolverInstance);
+                        return resolverInstance;
+                    }
+                } catch (Exception e) {
+                    throw new IllegalStateException(e);
+                }
+            }
+        }
+
+        return null;
+    }
+
+    public void addModel(Object resolved) {
+        ModelResolver resolver = getModelResolverInstance(resolved.getClass());
+        if (resolver != null) {
+            resolver.addModel(resolved);
+        } else {
+            map.put(resolved, resolved);
+        }
+    }
+
+    public Object removeModel(Object resolved) {
+        ModelResolver resolver = getModelResolverInstance(resolved.getClass());
+        if (resolver != null) {
+            return resolver.removeModel(resolved);
+        } else {
+            return map.remove(resolved);
+        }
+    }
+
+    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+        ModelResolver resolver = getModelResolverInstance(unresolved.getClass());
+        if (resolver != null) {
+            return resolver.resolveModel(modelClass, unresolved);
+        } else {
+            //FIXME Remove this default resolver, this is currently used to resolve policy declarations
+            // but they should be handled by the contribution import/export mechanism instead of this
+            // defaultResolver hack.
+            if (defaultResolver != null) {
+                Object resolved = defaultResolver.resolveModel(modelClass, unresolved);
+                if (resolved != null && resolved != unresolved) {
+                    return modelClass.cast(resolved);
+                }
+            }
+            
+            Object resolved = map.get(unresolved);
+            if (resolved != null) {
+                // Return the resolved object
+                return modelClass.cast(resolved);
+            }
+        }
+
+        return unresolved;
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java Sat May  3 13:52:41 2008
@@ -0,0 +1,69 @@
+/*
+ * 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.resolver;
+
+/**
+ * A model resolver, responsible for resolving models in the scope of an
+ * SCA contribution. 
+ * 
+ * SCA Assemblies reference artifacts of a wide variety of types. These
+ * include:
+ * <ul>
+ * <li> Reference from one SCA composite to another SCA composite
+ * <li> Reference to PolicySet files
+ * <li> Reference to interface definition files, either WSDL or Java interfaces
+ * <li> Reference to XSD files
+ * <li> Reference to any of a wide variety of implementation artifact files,
+ * including Java classes, BPEL scripts, C++ DLLs and classes, PHP scripts
+ * </ul>
+ * 
+ * In the SCA assemblies, these various artifacts are referenced using either
+ * QNames or logical URIs. Model resolvers are used to resolve these references
+ * and get the in-memory models representing the referenced artifacts.
+ * 
+ * @version $Rev: 616114 $ $Date: 2008-01-28 16:05:37 -0800 (Mon, 28 Jan 2008) $
+ */
+public interface ModelResolver {
+
+    /**
+     * Resolve the model representing an artifact.
+     * 
+     * @param modelClass the type of artifact
+     * @param unresolved the unresolved model
+     * @return the resolved model
+     */
+    <T> T resolveModel(Class<T> modelClass, T unresolved);
+    
+    /**
+     * Add a resolved model.
+     * 
+     * @param resolved The model
+     */
+    void addModel(Object resolved);
+    
+    /**
+     * Remove a resolved model.
+     * 
+     * @param resolved
+     * @return The removed model, or null if the model was not removed
+     */
+    Object removeModel(Object resolved);
+    
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java Sat May  3 13:52:41 2008
@@ -0,0 +1,52 @@
+/*
+ * 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.resolver;
+
+
+/**
+ * An extension point for model resolvers
+ * 
+ * @version $Rev: 616114 $ $Date: 2008-01-28 16:05:37 -0800 (Mon, 28 Jan 2008) $
+ */
+public interface ModelResolverExtensionPoint {
+
+    /**
+     * Register a model resolver class using the model type as the key
+     * 
+     * @param modelType The model type
+     * @param resolver The model resolver Class
+     */
+    void addResolver(Class<?> modelType, Class <? extends ModelResolver> resolver);
+    
+    /**
+     * Remove the model resolver class for a specific model type
+     * 
+     * @param modelType The model type
+     */
+    void removeResolver(Class<?> modelType);
+    
+    /**
+     * Retrieve a model resolver class for a specific model type
+     * 
+     * @param modelType The model artifact type
+     * @return The model resolver Class
+     */
+    Class <? extends ModelResolver> getResolver(Class<?> modelType);
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java Sat May  3 13:52:41 2008
@@ -0,0 +1,101 @@
+/*
+ * 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.resolver;
+
+import java.net.URL;
+
+/**
+ * A resource URL, which should be used to register resources
+ * with an ArtifactResolver and resolve these resources later.
+ * 
+ * FIXME Don't use as its deprecated, use Artifact instead.
+ */
+@Deprecated
+public class ResourceReference {
+    
+    private URL resourceURL;
+    private String resourceName;
+
+    /**
+     * Constructs a new ResourceReference.
+     * 
+     * @param resourceName Name of resource
+     * @param resourceURL  The resource URL
+     */
+    public ResourceReference(String resourceName, URL resourceURL) {
+        this.resourceURL = resourceURL;
+        this.resourceName = resourceName;
+    }
+    
+    /**
+     * Constructs a new ResourceReference.
+     * 
+     * @param resourceName Name of resource
+     */
+    public ResourceReference(String resourceName) {
+        this.resourceName = resourceName;
+    }
+    
+    /**
+     * Get the resource URL.
+     * 
+     * @return The resource URL
+     */
+    public URL getResource() {
+        return resourceURL;
+    }
+    
+    /**
+     * Get the resource name.
+     * 
+     * @return The resource name
+     */
+    public String getResourceName() {
+        return resourceName;
+    }
+    
+    /**
+     * Returns true if the resource reference is unresolved.
+     * 
+     * @return Whether or not the resource has been resolved
+     */
+    public boolean isUnresolved() {
+        return resourceURL == null;
+    }
+
+    @Override
+    public int hashCode() {
+        return resourceName.hashCode();
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        } else {
+            if (obj instanceof ResourceReference) {
+                return resourceName.equals(((ResourceReference)obj).resourceName);
+            } else {
+                return false;
+            }
+        }
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java Sat May  3 13:52:41 2008
@@ -0,0 +1,66 @@
+/*
+ * 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.scanner;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * Interface for contribution package scanners
+ * 
+ * Contribution scanners understand the format of the contribution and how to get the
+ * artifacts in the contribution.
+ * 
+ * @version $Rev: 631891 $ $Date: 2008-02-28 00:34:05 -0800 (Thu, 28 Feb 2008) $
+ */
+public interface ContributionScanner {
+    
+    /**
+     * Returns the type of package supported by this package scanner.
+     * 
+     * @return the package type
+     */
+    String getContributionType();
+
+    /**
+     * Returns a list of artifacts in the contribution.
+     * 
+     * @param contributionURL Contribution URL
+     * @return List of artifact URIs
+     * @throws ContributionException
+     * @throws IOException
+     */
+    List<String> getArtifacts(URL contributionURL) throws ContributionReadException;
+
+    /**
+     * Return the URL for an artifact in the contribution.
+     * 
+     * This is needed for archives such as jar files that have specific URL schemes
+     * for the artifacts they contain.
+     * 
+     * @param contributionURL Contribution URL
+     * @param artifact The relative URI for the artifact
+     * @return The artifact URL
+     */
+    URL getArtifactURL(URL contributionURL, String artifact) throws ContributionReadException;
+
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java Sat May  3 13:52:41 2008
@@ -0,0 +1,50 @@
+/*
+ * 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.scanner;
+
+/**
+ * An extension point for contribution scanners
+ * 
+ * @version $Rev: 631271 $ $Date: 2008-02-26 08:11:36 -0800 (Tue, 26 Feb 2008) $
+ */
+public interface ContributionScannerExtensionPoint {
+    
+    /**
+     * Add a ContributionScanner using the contribution type as the key.
+     * 
+     * @param scanner The contribution scanner
+     */
+    void addContributionScanner(ContributionScanner scanner);
+    
+    /**
+     * Remove a ContributionScanner.
+     * 
+     * @param scanner The contribution scanner
+     */
+    void removeContributionScanner(ContributionScanner scanner);
+    
+    /**
+     * Returns the ContributionScanner for the given contribution type.
+     * 
+     * @param contributionType The contribution type
+     * @return The contribution scanner
+     */
+    ContributionScanner getContributionScanner(String contributionType);
+    
+}
\ No newline at end of file

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java Sat May  3 13:52:41 2008
@@ -0,0 +1,125 @@
+/*
+ * 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.scanner;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
+import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
+
+/**
+ * Default implementation of a contribution scanner extension point.
+ * 
+ * @version $Rev: 632642 $ $Date: 2008-03-01 10:16:44 -0800 (Sat, 01 Mar 2008) $
+ */
+public class DefaultContributionScannerExtensionPoint implements ContributionScannerExtensionPoint {
+
+    private Map<String, ContributionScanner> scanners = new HashMap<String, ContributionScanner>();
+    private boolean loaded;
+
+    public DefaultContributionScannerExtensionPoint() {
+    }
+
+    public void addContributionScanner(ContributionScanner scanner) {
+        scanners.put(scanner.getContributionType(), scanner);
+    }
+
+    public void removeContributionScanner(ContributionScanner scanner) {
+        scanners.remove(scanner.getContributionType());
+    }
+
+    public ContributionScanner getContributionScanner(String contentType) {
+        loadScanners();
+        return scanners.get(contentType);
+    }
+
+    private void loadScanners() {
+        if (loaded)
+            return;
+
+        // Get the scanner service declarations
+        Set<ServiceDeclaration> scannerDeclarations; 
+        try {
+            scannerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ContributionScanner.class);
+        } catch (IOException e) {
+            throw new IllegalStateException(e);
+        }
+        
+        for (ServiceDeclaration scannerDeclaration: scannerDeclarations) {
+            Map<String, String> attributes = scannerDeclaration.getAttributes();
+            
+            // Load a URL artifact scanner
+            String contributionType = attributes.get("type");
+            
+            // Create a scanner wrapper and register it
+            ContributionScanner scanner = new LazyContributionScanner(contributionType, scannerDeclaration);
+            addContributionScanner(scanner);
+        }
+        
+        loaded = true;
+    }
+
+    /**
+     * A facade for contribution scanners.
+     */
+    private static class LazyContributionScanner implements ContributionScanner {
+        
+        private ServiceDeclaration scannerDeclaration;
+        private String contributionType;
+        private ContributionScanner scanner;
+        
+        private LazyContributionScanner(String contributionType, ServiceDeclaration scannerDeclaration) {
+            this.scannerDeclaration = scannerDeclaration;
+            this.contributionType = contributionType;
+        }
+
+        public URL getArtifactURL(URL contributionSourceURL, String artifact) throws ContributionReadException {
+            return getScanner().getArtifactURL(contributionSourceURL, artifact);
+        }
+
+        public List<String> getArtifacts(URL contributionSourceURL) throws ContributionReadException {
+            return getScanner().getArtifacts(contributionSourceURL);
+        }
+
+        public String getContributionType() {
+            return contributionType;
+        }
+        
+        private ContributionScanner getScanner() {
+            if (scanner == null) {
+                try {
+                    Class<ContributionScanner> scannerClass = (Class<ContributionScanner>)scannerDeclaration.loadClass();
+                    Constructor<ContributionScanner> constructor = scannerClass.getConstructor();
+                    scanner = constructor.newInstance();
+                } catch (Exception e) {
+                    throw new IllegalStateException(e);
+                }
+            }
+            return scanner;
+        }
+    }
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java Sat May  3 13:52:41 2008
@@ -0,0 +1,45 @@
+/*
+ * 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.service;
+
+/**
+ * Base class for exceptions raised by contribution services.
+ *
+ * @version $Rev: 616149 $ $Date: 2008-01-28 19:10:32 -0800 (Mon, 28 Jan 2008) $
+ */
+public class ContributionException extends Exception {
+
+    private static final long serialVersionUID = 4432880414927652578L;
+
+    protected ContributionException() {
+        super();
+    }
+
+    protected ContributionException(String message) {
+        super(message);
+    }
+
+    protected ContributionException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ContributionException(Throwable cause) {
+        super(cause);
+    }
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java Sat May  3 13:52:41 2008
@@ -0,0 +1,58 @@
+/*
+ * 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.service;
+
+import java.util.EventListener;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * A listener interface used to listen to contribution repository events.
+ *
+ * @version $Rev: 561159 $ $Date: 2007-07-30 15:28:12 -0700 (Mon, 30 Jul 2007) $
+ */
+public interface ContributionListener extends EventListener {
+
+    /**
+     * Notifies the listener that a contribution has been added.
+     * 
+     * @param repository The contribution repository 
+     * @param contribution The new contribution
+     */
+    void contributionAdded(ContributionRepository repository, Contribution contribution);
+    
+    /**
+     * Notifies the listener that a contribution has been removed.
+     * 
+     * @param repository The contribution repository 
+     * @param contribution The removed contribution.
+     */
+    void contributionRemoved(ContributionRepository repository, Contribution contribution);
+    
+    /**
+     * Notifies the listener that a contribution has been updated.
+     * 
+     * @param repository The contribution repository 
+     * @param oldContribution The old contribution 
+     * @param contribution The new contribution
+     */
+    void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution);
+
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java Sat May  3 13:52:41 2008
@@ -0,0 +1,44 @@
+/*
+ * 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.service;
+
+import java.util.List;
+
+public interface ContributionListenerExtensionPoint {
+
+    /**
+     * Adds a contribution repository listener extension.
+     * @param listener The listener to add
+     */
+    void addContributionListener(ContributionListener listener);
+    
+    /**
+     * Removes a contribution repository listener extension.
+     * @param listener The listener to remove
+     */
+    void removeContributionListener(ContributionListener listener);
+    
+    /**
+     * Returns the contribution repository listeners.
+     * @return
+     */
+    List<ContributionListener> getContributionListeners();
+    
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java Sat May  3 13:52:41 2008
@@ -0,0 +1,94 @@
+/*
+ * 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.service;
+
+/**
+ * Denotes an exception while reading artifacts inside an SCA contribution.
+ *
+ * @version $Rev: 560434 $ $Date: 2007-07-27 18:23:02 -0700 (Fri, 27 Jul 2007) $
+ */
+public class ContributionReadException extends ContributionException {
+    public static final int UNDEFINED = -1;
+    private static final long serialVersionUID = -7459051598906813461L;
+    private String resourceURI;
+    private int line = UNDEFINED;
+    private int column = UNDEFINED;
+
+    public ContributionReadException(String message) {
+        super(message);
+    }
+
+    public ContributionReadException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ContributionReadException(Throwable cause) {
+        super(cause);
+    }
+    
+    /**
+     * Returns the location of the resource that was being read.
+     *
+     * @return the location of the resource that was being read
+     */
+    public String getResourceURI() {
+        return resourceURI;
+    }
+
+    /**
+     * Sets the location of the resource that was being read.
+     *
+     * @param resourceURI the location of the resource that was being read
+     */
+    public void setResourceURI(String resourceURI) {
+        this.resourceURI = resourceURI;
+    }
+
+    /**
+     * Returns the line inside the resource that was being read.
+     * @return the line inside the resource that was being read
+     */
+    public int getLine() {
+        return line;
+    }
+
+    /**
+     * Sets the line inside the resource that was being read.
+     * @param line the line inside the resource that was being read
+     */
+    public void setLine(int line) {
+        this.line = line;
+    }
+
+    /**
+     * Returns the column inside the resource that was being read.
+     * @return the column inside the resource that was being read
+     */
+    public int getColumn() {
+        return column;
+    }
+
+    /**
+     * Sets the column inside the resource that was being read.
+     * @param column the column inside the resource that was being read
+     */
+    public void setColumn(int column) {
+        this.column = column;
+    }
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java Sat May  3 13:52:41 2008
@@ -0,0 +1,128 @@
+/*
+ * 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.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * Contribution repository 
+ * 
+ * @version $Rev: 639257 $ $Date: 2008-03-20 05:12:00 -0700 (Thu, 20 Mar 2008) $
+ */
+public interface ContributionRepository {
+    
+    /**
+     * Get the URI of the SCA domain 
+     * 
+     * @return The domain URI
+     */
+    URI getDomain();
+    
+    /**
+     * Copies a contribution to the repository.
+     * 
+     * @param contribution A URl pointing to the contribution being copied to
+     *            the repository
+     * @param sourceURL URL of the source. this would be used to calculate the right
+     *            filename to be stored on the repository when a inputStream is being
+     *            provided
+     * @param contributionStream InputStream with the content of the
+     *            distribution
+     * @return A URL pointing to the content of the contribution in the
+     *         repository
+     * @throws IOException
+     */
+    URL store(String contribution, URL sourceURL, InputStream contributionStream) throws IOException;
+    /**
+     * Copy a contribution from the source URL to the repository
+     * 
+     * @param contribution A URl pointing to the contribution being copied to
+     *            the repository
+     * @param sourceURL URL of the source. this would be used to calculate the right
+     *            filename to be stored on the repository when a inputStream is being
+     *            provided
+     * @return A URL pointing to the content of the contribution in the
+     *         repository
+     * @throws IOException
+     */
+    URL store(String contribution, URL sourceURL) throws IOException;
+
+    /**
+     * Look up the contribution by URI
+     * 
+     * @param contribution The URI of the contribution
+     * @return A URL pointing to the content of the contribution in the
+     *         repository, it will be null if the contribution cannot be found
+     *         in the repository
+     */
+    URL find(String contribution);
+
+    /**
+     * Remove a contribution from the repository
+     * 
+     * @param contribution The URI of the contribution to be removed
+     */
+    void remove(String contribution);
+
+    /**
+     * Get list of URIs for all the contributions in the repository
+     * 
+     * @return A list of contribution URIs
+     */
+    List<String> list();
+    
+    /**
+     * Returns the contributions available in the repository.
+     * @return The list of contributions.
+     */
+    List<Contribution> getContributions();
+    
+    /**
+     * Adds a contribution to the repository.
+     * @param contribution The new contribution.
+     */
+    void addContribution(Contribution contribution);
+    
+    /**
+     * Removes a contribution from the repository.
+     * @param contribution The contribution to remove
+     */
+    void removeContribution(Contribution contribution);
+    
+    /**
+     * Updates a contribution in the repository
+     * @param contribution The contribution to update
+     */
+    void updateContribution(Contribution contribution);
+    
+    /**
+     * Returns the contribution with the given URI.
+     * @param uri the URI of the contribution
+     * @return The contribution
+     */
+    Contribution getContribution(String uri);
+
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java Sat May  3 13:52:41 2008
@@ -0,0 +1,41 @@
+/*
+ * 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.service;
+
+/**
+ * Denotes a problem while resolving models inside an SCA contribution.
+ *
+ * @version $Rev: 560434 $ $Date: 2007-07-27 18:23:02 -0700 (Fri, 27 Jul 2007) $
+ */
+public class ContributionResolveException extends ContributionException {
+    private static final long serialVersionUID = -7459051598906813461L;
+
+    public ContributionResolveException(String message) {
+        super(message);
+    }
+
+    public ContributionResolveException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ContributionResolveException(Throwable cause) {
+        super(cause);
+    }
+    
+}

Added: incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java (added)
+++ incubator/tuscany/sandbox/mobile-android/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java Sat May  3 13:52:41 2008
@@ -0,0 +1,44 @@
+/*
+ * 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.service;
+
+/**
+ * Base class for runtime exceptions raised by contribution services.
+ *
+ * @version $Rev: 560434 $ $Date: 2007-07-27 18:23:02 -0700 (Fri, 27 Jul 2007) $
+ */
+public class ContributionRuntimeException extends RuntimeException {
+    private static final long serialVersionUID = 7711215366287498896L;
+
+    protected ContributionRuntimeException() {
+        super();
+    }
+
+    protected ContributionRuntimeException(String message) {
+        super(message);
+    }
+
+    protected ContributionRuntimeException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public ContributionRuntimeException(Throwable cause) {
+        super(cause);
+    }
+}



Mime
View raw message