tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r572267 [4/6] - in /incubator/tuscany/java/sca: itest/ modules/ modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ modules/binding-jms/src/main/jav...
Date Mon, 03 Sep 2007 09:46:47 GMT
Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java Mon Sep  3 02:46:41 2007
@@ -35,24 +35,22 @@
 public interface StAXArtifactProcessor<M> extends ArtifactProcessor<M> {
 
     /**
-     * Reads a model from an input source. Examples of input sources are: a URI, a
-     * DOM node, an XML reader.
+     * Reads a model from an XMLStreamReader.
      * 
-     * @param inputSource The input source
+     * @param reader The XMLStreamReader
      * @return A model representation of the input.
      */
-    M read(XMLStreamReader inputSource) throws ContributionReadException, XMLStreamException;
+    M read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException;
     
     /**
-     * Writes a model to an ouput source. Examples of output sources are: a URI, a
-     * DOM node, an XML writer.
+     * Writes a model to an XMLStreamWriter.
      * 
      * @param model A model representing the source
-     * @param outputSource The output source
+     * @param writer The XML stream writer
      * @throws ContributionWriteException
      * @throws XMLStreamException
      */
-    void write(M model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException;
+    void write(M model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException;
     
     /**
      * Returns the type of artifact handled by this artifact processor.

Modified: incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java Mon Sep  3 02:46:41 2007
@@ -32,8 +32,7 @@
 public interface URLArtifactProcessor<M> extends ArtifactProcessor<M> {
 
     /**
-     * Reads a model from an input source. Examples of input 
-     * sources are: a URI, a DOM node, an XML reader.
+     * Reads a model from a URL.
      * 
      * @param contributionURL Contribution location URL
      * @param artifactURI Artifact URI

Modified: incubator/tuscany/java/sca/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/ConnectionInfoArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/ConnectionInfoArtifactProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/ConnectionInfoArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/ConnectionInfoArtifactProcessor.java Mon Sep  3 02:46:41 2007
@@ -46,7 +46,7 @@
  * @version $Rev$ $Date$
  */
 public class ConnectionInfoArtifactProcessor implements StAXArtifactProcessor<ConnectionInfo> {
-    private static final QName CONNECTION_INFO = new QName(Constants.SCA10_TUSCANY_NS, "connectionInfo");
+    public static final QName CONNECTION_INFO = new QName(Constants.SCA10_TUSCANY_NS, "connectionInfo");
     private static final QName CONNECTION_PROPERTIES = new QName(Constants.SCA10_TUSCANY_NS, "connectionProperties");
     
     public ConnectionInfoArtifactProcessor(ModelFactoryExtensionPoint modelFactories) {
@@ -116,7 +116,7 @@
             String databaseURL = reader.getAttributeValue(null, "databaseURL");
             String username = reader.getAttributeValue(null, "username");
             String password = reader.getAttributeValue(null, "password");
-            int loginTimeout = Integer.parseInt(reader.getAttributeValue(null, "loginTimeout"));
+            String loginTimeout = reader.getAttributeValue(null, "loginTimeout");
 
             // FIXME: validation sending info to monitor....
             ConnectionProperties connectionProperties = new ConnectionProperties();
@@ -124,7 +124,9 @@
             connectionProperties.setDatabaseURL(databaseURL);
             connectionProperties.setUsername(username);
             connectionProperties.setPassword(password);
-            connectionProperties.setLoginTimeout(loginTimeout);
+            if (loginTimeout != null) {
+                connectionProperties.setLoginTimeout(Integer.parseInt(loginTimeout));
+            }
 
             connectionInfo.setConnectionProperties(connectionProperties);
         }
@@ -133,8 +135,42 @@
     }
 
     public void resolve(ConnectionInfo impl, ModelResolver resolver) throws ContributionResolveException {
+
     }
 
-    public void write(ConnectionInfo model, XMLStreamWriter outputSource) throws ContributionWriteException {
+    public void write(ConnectionInfo connectionInfo, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+        writer.writeStartElement(CONNECTION_INFO.getNamespaceURI(), CONNECTION_INFO.getLocalPart());
+
+        if (connectionInfo.getDataSource() != null) {
+            writer.writeAttribute("dataSource", connectionInfo.getDataSource());
+        }
+        
+        ConnectionProperties connectionProperties = connectionInfo.getConnectionProperties();
+        if (connectionProperties != null) {
+            writer.writeStartElement(CONNECTION_PROPERTIES.getNamespaceURI(), CONNECTION_PROPERTIES.getLocalPart());
+            
+            if (connectionProperties.getDriverClass() != null) {
+                writer.writeAttribute("driverClass", connectionProperties.getDriverClass());
+            }
+            if (connectionProperties.getDatabaseURL() != null) {
+                writer.writeAttribute("databaseURL", connectionProperties.getDatabaseURL());
+            }
+            if (connectionProperties.getUsername() != null) {
+                writer.writeAttribute("username", connectionProperties.getUsername());
+            }
+            if (connectionProperties.getPassword() != null) {
+                writer.writeAttribute("password", connectionProperties.getPassword());
+            }
+            if (connectionProperties.getLoginTimeout() != null) {
+                writer.writeAttribute("loginTimeout", String.valueOf(connectionProperties.getLoginTimeout()));
+            }
+            
+            writer.writeEndElement();
+        }
+        
+        
+        writer.writeEndElement();
+        
     }
 }

Modified: incubator/tuscany/java/sca/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionProperties.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionProperties.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionProperties.java (original)
+++ incubator/tuscany/java/sca/modules/data-engine-helper/src/main/java/org/apache/tuscany/sca/data/engine/config/ConnectionProperties.java Mon Sep  3 02:46:41 2007
@@ -33,7 +33,7 @@
 
     private String password;
 
-    private int loginTimeOut;
+    private Integer loginTimeOut;
 
     public String getDriverClass() {
         return this.driverClass;
@@ -67,11 +67,11 @@
         this.password = password;
     }
 
-    public int getLoginTimeout() {
+    public Integer getLoginTimeout() {
         return this.loginTimeOut;
     }
 
-    public void setLoginTimeout(int loginTimeOut) {
+    public void setLoginTimeout(Integer loginTimeOut) {
         this.loginTimeOut = loginTimeOut;
     }
 

Modified: incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java Mon Sep  3 02:46:41 2007
@@ -47,7 +47,9 @@
  * Loader that handles &lt;import.sdo&gt; elements.
  * 
  * @version $Rev$ $Date$
+ * @deprecated
  */
+@Deprecated
 public class ImportSDOProcessor implements StAXArtifactProcessor<ImportSDO> {
 
     public ImportSDOProcessor(ModelFactoryExtensionPoint modelFactories) {
@@ -58,7 +60,7 @@
         return IMPORT_SDO;
     }
 
-    public ImportSDO read(XMLStreamReader reader) throws ContributionReadException {
+    public ImportSDO read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
         assert IMPORT_SDO.equals(reader.getName());
  
         // FIXME: How do we associate the application HelperContext with the one
@@ -74,14 +76,10 @@
         }
 
         // Skip to end element
-        try {
-            while (reader.hasNext()) {
-                if (reader.next() == END_ELEMENT && ImportSDO.IMPORT_SDO.equals(reader.getName())) {
-                    break;
-                }
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && ImportSDO.IMPORT_SDO.equals(reader.getName())) {
+                break;
             }
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
         }
         return importSDO;
     }
@@ -146,8 +144,7 @@
     }
 
     public void write(ImportSDO model, XMLStreamWriter outputSource) throws ContributionWriteException {
-        // TODO Auto-generated method stub
-
+        // Not implemented as <import.sdo> is deprecated
     }
 
     public Class<ImportSDO> getModelType() {

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/impl/CRUDImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/impl/CRUDImplementationProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/impl/CRUDImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/impl/CRUDImplementationProcessor.java Mon Sep  3 02:46:41 2007
@@ -64,35 +64,39 @@
         return CRUDImplementation.class;
     }
 
-    public CRUDImplementation read(XMLStreamReader reader) throws ContributionReadException {
-        assert IMPLEMENTATION_CRUD.equals(reader.getName());
+    public CRUDImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
         
         // Read an <implementation.crud> element
-        try {
-            // Read the directory attribute. This is where the sample
-            // CRUD implementation will persist resources.
-            String directory = reader.getAttributeValue(null, "directory");
 
-            // Create an initialize the CRUD implementation model
-            CRUDImplementation implementation = crudFactory.createCRUDImplementation();
-            implementation.setDirectory(directory);
-            
-            // Skip to end element
-            while (reader.hasNext()) {
-                if (reader.next() == END_ELEMENT && IMPLEMENTATION_CRUD.equals(reader.getName())) {
-                    break;
-                }
+        // Read the directory attribute. This is where the sample
+        // CRUD implementation will persist resources.
+        String directory = reader.getAttributeValue(null, "directory");
+
+        // Create an initialize the CRUD implementation model
+        CRUDImplementation implementation = crudFactory.createCRUDImplementation();
+        implementation.setDirectory(directory);
+        
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && IMPLEMENTATION_CRUD.equals(reader.getName())) {
+                break;
             }
-            
-            return implementation;
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
         }
+        
+        return implementation;
     }
 
     public void resolve(CRUDImplementation impl, ModelResolver resolver) throws ContributionResolveException {
     }
 
-    public void write(CRUDImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+    public void write(CRUDImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+        
+        writer.writeStartElement(IMPLEMENTATION_CRUD.getNamespaceURI(), IMPLEMENTATION_CRUD.getLocalPart());
+        
+        if (implementation != null) {
+            writer.writeAttribute("directory", implementation.getDirectory());
+        }
+        
+        writer.writeEndElement();
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELArtifactProcessor.java Mon Sep  3 02:46:41 2007
@@ -75,45 +75,42 @@
         return BPELImplementation.class;
     }
 
-    public BPELImplementation read(XMLStreamReader reader) throws ContributionReadException {
+    public BPELImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
         assert IMPLEMENTATION_BPEL.equals(reader.getName());
         
         // Read an <implementation.bpel> element
-        try {
-            // Read the process attribute. 
-            QName process = getAttributeValueNS(reader, "process");
-            String bpelFile = reader.getAttributeValue(null, "file");
 
-            // Resolving the BPEL file and compiling it
-            URL bpelURL = getClass().getClassLoader().getResource(bpelFile);
-            if (bpelURL == null)
-                throw new ODEProcessException("Couldn't find referenced bpel file " + bpelFile);
-            BpelC bpelc = BpelC.newBpelCompiler();
-            ByteArrayOutputStream compiledProcess = new ByteArrayOutputStream();
-            bpelc.setOutputStream(compiledProcess);
-            try {
-                bpelc.compile(new File(bpelURL.getFile()));
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
+        // Read the process attribute. 
+        QName process = getAttributeValueNS(reader, "process");
+        String bpelFile = reader.getAttributeValue(null, "file");
 
-            // Create an initialize the BPEL implementation model
-            BPELImplementation implementation = bpelFactory.createBPELImplementation();
-            implementation.setProcessName(process);
-            implementation.setCompiledProcess(compiledProcess.toByteArray());
-            implementation.setUnresolved(false);
-            
-            // Skip to end element
-            while (reader.hasNext()) {
-                if (reader.next() == END_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) {
-                    break;
-                }
+        // Resolving the BPEL file and compiling it
+        URL bpelURL = getClass().getClassLoader().getResource(bpelFile);
+        if (bpelURL == null)
+            throw new ODEProcessException("Couldn't find referenced bpel file " + bpelFile);
+        BpelC bpelc = BpelC.newBpelCompiler();
+        ByteArrayOutputStream compiledProcess = new ByteArrayOutputStream();
+        bpelc.setOutputStream(compiledProcess);
+        try {
+            bpelc.compile(new File(bpelURL.getFile()));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        // Create an initialize the BPEL implementation model
+        BPELImplementation implementation = bpelFactory.createBPELImplementation();
+        implementation.setProcessName(process);
+        implementation.setCompiledProcess(compiledProcess.toByteArray());
+        implementation.setUnresolved(false);
+        
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && IMPLEMENTATION_BPEL.equals(reader.getName())) {
+                break;
             }
-            
-            return implementation;
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
         }
+        
+        return implementation;
     }
 
     public void resolve(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
@@ -126,6 +123,7 @@
     }
 
     public void write(BPELImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+        //FIXME Implement
     }
 
     private QName getAttributeValueNS(XMLStreamReader reader, String attribute) {

Modified: incubator/tuscany/java/sca/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASArtifactProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-das/src/main/java/org/apache/tuscany/sca/implementation/das/DASArtifactProcessor.java Mon Sep  3 02:46:41 2007
@@ -54,7 +54,7 @@
     
     private DASImplementationFactory dasFactory;
     
-    private StAXArtifactProcessor connectionInfoProcessor;
+    private StAXArtifactProcessor<ConnectionInfo> connectionInfoProcessor;
     
     public DASArtifactProcessor(ModelFactoryExtensionPoint modelFactories) {
         AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
@@ -87,7 +87,7 @@
      *   </implementation.data>
      * </component>
      */
-    public DASImplementation read(XMLStreamReader reader) throws ContributionReadException {
+    public DASImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
         assert IMPLEMENTATION_DAS.equals(reader.getName());
 
         // Read an <implementation.das> element
@@ -105,36 +105,45 @@
         implementation.setConfig(config);
         implementation.setDataAccessType(dataAccessType);
 
-        try {
-            while (true) {
-                int event = reader.next();
-                switch (event) {
+        while (true) {
+            int event = reader.next();
+            switch (event) {
 
-                case START_ELEMENT:
-                    QName element = reader.getName();
+            case START_ELEMENT:
+                if (ConnectionInfoArtifactProcessor.CONNECTION_INFO.equals(reader.getName())) {
 
-                    // Read an extension element
+                    // Read connection info
                     ConnectionInfo connectionInfo = (ConnectionInfo) connectionInfoProcessor.read(reader);
-                    ;
                     implementation.setConnectionInfo(connectionInfo);
-
-                    break;
-                case XMLStreamConstants.END_ELEMENT:
-                    if (IMPLEMENTATION_DAS.equals(reader.getName())) {
-                        return implementation;
-                    }
-                    break;
                 }
+                break;
+            case XMLStreamConstants.END_ELEMENT:
+                if (IMPLEMENTATION_DAS.equals(reader.getName())) {
+                    return implementation;
+                }
+                break;
             }
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
         }
-
     }
 
     public void resolve(DASImplementation impl, ModelResolver resolver) throws ContributionResolveException {
     }
 
-    public void write(DASImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+    public void write(DASImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+        
+        writer.writeStartElement(IMPLEMENTATION_DAS.getNamespaceURI(), IMPLEMENTATION_DAS.getLocalPart());
+        
+        if (implementation.getConfig() != null) {
+            writer.writeAttribute("config", implementation.getConfig());
+        }
+        if (implementation.getDataAccessType() != null) {
+            writer.writeAttribute("dataAccessType", implementation.getDataAccessType());
+        }
+        
+        if (implementation.getConnectionInfo() != null) { 
+            connectionInfoProcessor.write(implementation.getConnectionInfo(), writer);
+        }
+        
+        writer.writeEndElement();
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASArtifactProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASArtifactProcessorTestCase.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASArtifactProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-das/src/test/java/org/apache/tuscany/sca/implementation/das/DASArtifactProcessorTestCase.java Mon Sep  3 02:46:41 2007
@@ -135,6 +135,6 @@
         assertNotNull(connProperties);
         assertEquals("driverClass",connProperties.getDriverClass());
         assertEquals("databaseURL",connProperties.getDatabaseURL());
-        assertEquals(1,connProperties.getLoginTimeout());
+        assertEquals(1,connProperties.getLoginTimeout().intValue());
     }    
 }

Modified: incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAArtifactProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/main/java/org/apache/tuscany/sca/implementation/data/DATAArtifactProcessor.java Mon Sep  3 02:46:41 2007
@@ -54,7 +54,7 @@
     
     private DATAImplementationFactory dataFactory;
     
-    private StAXArtifactProcessor connectionInfoProcessor;
+    private StAXArtifactProcessor<ConnectionInfo> connectionInfoProcessor;
     
     public DATAArtifactProcessor(ModelFactoryExtensionPoint modelFactories) {
         AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
@@ -87,40 +87,36 @@
      *   </implementation.data>
      * </component>
      */
-    public DATAImplementation read(XMLStreamReader reader) throws ContributionReadException {
+    public DATAImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
         assert IMPLEMENTATION_DATA.equals(reader.getName());
 
         // Read an <implementation.data> element
-        try {
 
-            // Create an initialize the DAS implementation model
-            DATAImplementation implementation = dataFactory.createDASImplementation();
+        // Create an initialize the DAS implementation model
+        DATAImplementation implementation = dataFactory.createDASImplementation();
 
-            //FIXME: validation sending info to monitor....
-            String table = reader.getAttributeValue(null, "table");
-            implementation.setTable(table); //required                        
+        //FIXME: validation sending info to monitor....
+        String table = reader.getAttributeValue(null, "table");
+        implementation.setTable(table); //required                        
+
+        while (true) {
+            int event = reader.next();
+            switch (event) {
 
-            while (true) {
-                int event = reader.next();
-                switch (event) {
-
-                case START_ELEMENT:
-                    QName element = reader.getName();
+            case START_ELEMENT:
+                if (ConnectionInfoArtifactProcessor.CONNECTION_INFO.equals(reader.getName())) {
                     
-                    // Read an extension element
+                    // Read connection info
                     ConnectionInfo connectionInfo = (ConnectionInfo) connectionInfoProcessor.read(reader);;
                     implementation.setConnectionInfo(connectionInfo);
-
-                    break;
-                case XMLStreamConstants.END_ELEMENT:
-                    if (IMPLEMENTATION_DATA.equals(reader.getName())) {
-                        return implementation;
-                    }                    
-                    break;
                 }
+                break;
+            case XMLStreamConstants.END_ELEMENT:
+                if (IMPLEMENTATION_DATA.equals(reader.getName())) {
+                    return implementation;
+                }                    
+                break;
             }
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
         }
 
     }
@@ -128,6 +124,17 @@
     public void resolve(DATAImplementation impl, ModelResolver resolver) throws ContributionResolveException {
     }
 
-    public void write(DATAImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+    public void write(DATAImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+        writer.writeStartElement(IMPLEMENTATION_DATA.getNamespaceURI(), IMPLEMENTATION_DATA.getLocalPart());
+        
+        if (implementation.getTable() != null) {
+            writer.writeAttribute("table", implementation.getTable());
+        }
+        
+        if (implementation.getConnectionInfo() != null) { 
+            connectionInfoProcessor.write(implementation.getConnectionInfo(), writer);
+        }
+        
+        writer.writeEndElement();
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/data/DATAArtifactProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/data/DATAArtifactProcessorTestCase.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/data/DATAArtifactProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-data/src/test/java/org/apache/tuscany/sca/implementation/data/DATAArtifactProcessorTestCase.java Mon Sep  3 02:46:41 2007
@@ -133,6 +133,6 @@
         assertNotNull(connProperties);
         assertEquals("driverClass",connProperties.getDriverClass());
         assertEquals("databaseURL",connProperties.getDatabaseURL());
-        assertEquals(1,connProperties.getLoginTimeout());
+        assertEquals(1,connProperties.getLoginTimeout().intValue());
     }    
 }

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java Mon Sep  3 02:46:41 2007
@@ -21,9 +21,6 @@
 
 import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
 
-import java.util.List;
-import java.util.StringTokenizer;
-
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -31,6 +28,7 @@
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ClassReference;
@@ -41,10 +39,7 @@
 import org.apache.tuscany.sca.implementation.java.IntrospectionException;
 import org.apache.tuscany.sca.implementation.java.JavaImplementation;
 import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
 
 public class JavaImplementationProcessor implements
     StAXArtifactProcessor<JavaImplementation>, JavaImplementationConstants {
@@ -52,52 +47,46 @@
     private JavaImplementationFactory javaFactory;
     private AssemblyFactory assemblyFactory;
     private PolicyFactory policyFactory;
+    private PolicyAttachPointProcessor policyProcessor;
 
     public JavaImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
         this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
         this.javaFactory = modelFactories.getFactory(JavaImplementationFactory.class);
+        this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
     }
 
-    public JavaImplementation read(XMLStreamReader reader) throws ContributionReadException {
+    public JavaImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
 
-        try {
+        // Read an <implementation.java>
+        JavaImplementation javaImplementation = javaFactory.createJavaImplementation();
+        javaImplementation.setUnresolved(true);
+        javaImplementation.setName(reader.getAttributeValue(null, CLASS));
 
-            // Read an <implementation.java>
-            JavaImplementation javaImplementation = javaFactory.createJavaImplementation();
-            javaImplementation.setUnresolved(true);
-            javaImplementation.setName(reader.getAttributeValue(null, CLASS));
-
-            // Read policies
-            if ( javaImplementation instanceof PolicySetAttachPoint ) {
-                readPolicies((PolicySetAttachPoint)javaImplementation, reader);
-            }
+        // Read policies
+        policyProcessor.readPolicies(javaImplementation, reader);
 
-            // Skip to end element
-            while (reader.hasNext()) {
-                if (reader.next() == END_ELEMENT && IMPLEMENTATION_JAVA_QNAME.equals(reader.getName())) {
-                    break;
-                }
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && IMPLEMENTATION_JAVA_QNAME.equals(reader.getName())) {
+                break;
             }
-            return javaImplementation;
-
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
         }
+        return javaImplementation;
     }
 
-    public void write(JavaImplementation javaImplementation, XMLStreamWriter writer) throws ContributionWriteException {
-        try {
-            // Write an <interface.java>
-            writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_JAVA);
-            if (javaImplementation.getName() != null) {
-                writer.writeAttribute(CLASS, javaImplementation.getName());
-            }
-            writer.writeEndElement();
+    public void write(JavaImplementation javaImplementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
 
-        } catch (XMLStreamException e) {
-            throw new ContributionWriteException(e);
+        // Write an <implementation.java>
+        policyProcessor.writePolicyPrefixes(javaImplementation, writer);
+        writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_JAVA);
+        policyProcessor.writePolicyAttributes(javaImplementation, writer);
+        
+        if (javaImplementation.getName() != null) {
+            writer.writeAttribute(CLASS, javaImplementation.getName());
         }
+        
+        writer.writeEndElement();
     }
 
     public void resolve(JavaImplementation javaImplementation, ModelResolver resolver)
@@ -130,56 +119,6 @@
 
     public Class<JavaImplementation> getModelType() {
         return JavaImplementation.class;
-    }
-
-    /**
-     * Reads policy intents and policy sets.
-     * @param attachPoint
-     * @param reader
-     */
-    private void readPolicies(PolicySetAttachPoint attachPoint, XMLStreamReader reader) {
-        String value = reader.getAttributeValue(null, Constants.REQUIRES);
-        if (value != null) {
-            List<Intent> requiredIntents = attachPoint.getRequiredIntents();
-            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
-                QName qname = getQNameValue(reader, tokens.nextToken());
-                Intent intent = policyFactory.createIntent();
-                intent.setName(qname);
-                requiredIntents.add(intent);
-            }
-        }
-
-        value = reader.getAttributeValue(null, Constants.POLICY_SETS);
-        if (value != null) {
-            List<PolicySet> policySets = attachPoint.getPolicySets();
-            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
-                QName qname = getQNameValue(reader, tokens.nextToken());
-                PolicySet policySet = policyFactory.createPolicySet();
-                policySet.setName(qname);
-                policySets.add(policySet);
-            }
-        }
-    }
-    
-    /**
-     * Returns a qname from a string.  
-     * @param reader
-     * @param value
-     * @return
-     */
-    private QName getQNameValue(XMLStreamReader reader, String value) {
-        if (value != null) {
-            int index = value.indexOf(':');
-            String prefix = index == -1 ? "" : value.substring(0, index);
-            String localName = index == -1 ? value : value.substring(index + 1);
-            String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
-            if (ns == null) {
-                ns = "";
-            }
-            return new QName(ns, localName, prefix);
-        } else {
-            return null;
-        }
     }
 
 }

Copied: incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java (from r572232, incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoader.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java?p2=incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java&p1=incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoader.java&r1=572232&r2=572267&rev=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoader.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java Mon Sep  3 02:46:41 2007
@@ -40,14 +40,14 @@
  * 
  * @version $Rev$ $Date$
  */
-public class NotificationImplementationLoader implements StAXArtifactProcessor<NotificationImplementationImpl> {
+public class NotificationImplementationProcessor implements StAXArtifactProcessor<NotificationImplementationImpl> {
 
     protected static final QName IMPLEMENTATION_NOTIFICATION =
         new QName(Constants.SCA10_TUSCANY_NS, "implementation.notification");
     
     private NotificationImplementationFactory implementationFactory;
 
-    public NotificationImplementationLoader(NotificationImplementationFactory implementationFactory) {
+    public NotificationImplementationProcessor(NotificationImplementationFactory implementationFactory) {
         this.implementationFactory = implementationFactory;
     }
 
@@ -97,5 +97,7 @@
         
     public void write(NotificationImplementationImpl model, XMLStreamWriter outputSource)
             throws ContributionWriteException, XMLStreamException {
+        
+        //FIXME Implement this method
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java Mon Sep  3 02:46:41 2007
@@ -28,12 +28,12 @@
  */
 public class NotificationModuleActivator implements ModuleActivator {
 
-    private NotificationImplementationLoader implementationLoader;
+    private NotificationImplementationProcessor implementationLoader;
     
     public void start(ExtensionPointRegistry registry) {
         StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
 
-        implementationLoader = new NotificationImplementationLoader(new DefaultNotificationImplementationFactory());
+        implementationLoader = new NotificationImplementationProcessor(new DefaultNotificationImplementationFactory());
         processors.addArtifactProcessor(implementationLoader);
 
         ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);

Modified: incubator/tuscany/java/sca/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator (original)
+++ incubator/tuscany/java/sca/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator Mon Sep  3 02:46:41 2007
@@ -14,5 +14,6 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+
 # Implementation class for the ExtensionActivator
 org.apache.tuscany.sca.implementation.notification.NotificationModuleActivator

Modified: incubator/tuscany/java/sca/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java Mon Sep  3 02:46:41 2007
@@ -26,7 +26,7 @@
 
 import org.apache.tuscany.sca.assembly.Implementation;
 import org.apache.tuscany.sca.implementation.notification.DefaultNotificationImplementationFactory;
-import org.apache.tuscany.sca.implementation.notification.NotificationImplementationLoader;
+import org.apache.tuscany.sca.implementation.notification.NotificationImplementationProcessor;
 import org.easymock.EasyMock;
 
 /**
@@ -38,11 +38,11 @@
 
     public void testRead() throws Exception {
         try {
-        NotificationImplementationLoader implementationLoader =
-            new NotificationImplementationLoader(new DefaultNotificationImplementationFactory());
+        NotificationImplementationProcessor implementationLoader =
+            new NotificationImplementationProcessor(new DefaultNotificationImplementationFactory());
 
         XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
-        EasyMock.expect(reader.getName()).andReturn(NotificationImplementationLoader.IMPLEMENTATION_NOTIFICATION).times(2);
+        EasyMock.expect(reader.getName()).andReturn(NotificationImplementationProcessor.IMPLEMENTATION_NOTIFICATION).times(2);
         EasyMock.expect(reader.getAttributeValue(null, "name")).andReturn("TrafficAdvisoryNotificationTestCase");
         EasyMock.expect(reader.getAttributeValue(null, "type")).andReturn(null);
         EasyMock.expect(reader.hasNext()).andReturn(true);

Modified: incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java Mon Sep  3 02:46:41 2007
@@ -116,89 +116,84 @@
         return tokens;
     }
     
-    public OSGiImplementation read(XMLStreamReader reader) throws ContributionReadException {
+    public OSGiImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
         assert IMPLEMENTATION_OSGI.equals(reader.getName());
         
-        try {
-            String bundleName = reader.getAttributeValue(null, BUNDLE);
-            String bundleLocation = reader.getAttributeValue(null, BUNDLE_LOCATION);
-            String imports = reader.getAttributeValue(null, IMPORTS);
-            String[] importList;
-            if (imports != null)
-                importList = tokenize(imports);
-            else
-                importList = new String[0];
-            String scope = reader.getAttributeValue(null, SCOPE);  
-            String allowsPassByRef = reader.getAttributeValue(null, ALLOWS_PASS_BY_REF);
-            String[] allowsPassByRefList;
-            if (allowsPassByRef != null)
-                allowsPassByRefList = tokenize(allowsPassByRef);
-            else
-                allowsPassByRefList = new String[0];
-            
-            boolean injectProperties = !"false".equalsIgnoreCase(reader.getAttributeValue(null, INJECT_PROPERTIES));
-            boolean eagerInit = "true".equalsIgnoreCase(reader.getAttributeValue(null, EAGER_INIT));
-            
-            
-            Hashtable<String, List<ComponentProperty>> refProperties = 
-                new Hashtable<String, List<ComponentProperty>>();
-            Hashtable<String, List<ComponentProperty>> serviceProperties = 
-                new Hashtable<String, List<ComponentProperty>>();
-            Hashtable<String, List<ComponentProperty>> refCallbackProperties = 
-                new Hashtable<String, List<ComponentProperty>>();
-            Hashtable<String, List<ComponentProperty>> serviceCallbackProperties = 
-                new Hashtable<String, List<ComponentProperty>>();
-            
-            while (reader.hasNext()) {
-                
-                int next = reader.next();
-                if (next == END_ELEMENT && IMPLEMENTATION_OSGI.equals(reader.getName())) {
-                    break;
-                }
-                else if (next == START_ELEMENT && PROPERTIES_QNAME.equals(reader.getName())) {
-                    
-                    // FIXME: This is temporary code which allows reference and service properties used
-                    //        for filtering OSGi services to be specified in <implementation.osgi/>
-                    //        This should really be provided in the component type file since these
-                    //        properties are associated with an implementation rather than a configured
-                    //        instance of an implementation.
-                    String refName = reader.getAttributeValue(null, "reference");
-                    String serviceName = reader.getAttributeValue(null, "service");
-                    String refCallbackName = reader.getAttributeValue(null, "referenceCallback");
-                    String serviceCallbackName = reader.getAttributeValue(null, "serviceCallback");
-                    List<ComponentProperty> props = readProperties(reader);
-                    if (refName != null)
-                        refProperties.put(refName, props);
-                    else if (serviceName != null)
-                        serviceProperties.put(serviceName, props);
-                    else if (refCallbackName != null)
-                        refCallbackProperties.put(refCallbackName, props);
-                    else if (serviceCallbackName != null)
-                        serviceCallbackProperties.put(serviceCallbackName, props);
-                    else
-                        throw new ContributionReadException("Properties in implementation.osgi should specify service or reference");                }
+        String bundleName = reader.getAttributeValue(null, BUNDLE);
+        String bundleLocation = reader.getAttributeValue(null, BUNDLE_LOCATION);
+        String imports = reader.getAttributeValue(null, IMPORTS);
+        String[] importList;
+        if (imports != null)
+            importList = tokenize(imports);
+        else
+            importList = new String[0];
+        String scope = reader.getAttributeValue(null, SCOPE);  
+        String allowsPassByRef = reader.getAttributeValue(null, ALLOWS_PASS_BY_REF);
+        String[] allowsPassByRefList;
+        if (allowsPassByRef != null)
+            allowsPassByRefList = tokenize(allowsPassByRef);
+        else
+            allowsPassByRefList = new String[0];
+        
+        boolean injectProperties = !"false".equalsIgnoreCase(reader.getAttributeValue(null, INJECT_PROPERTIES));
+        boolean eagerInit = "true".equalsIgnoreCase(reader.getAttributeValue(null, EAGER_INIT));
+        
+        
+        Hashtable<String, List<ComponentProperty>> refProperties = 
+            new Hashtable<String, List<ComponentProperty>>();
+        Hashtable<String, List<ComponentProperty>> serviceProperties = 
+            new Hashtable<String, List<ComponentProperty>>();
+        Hashtable<String, List<ComponentProperty>> refCallbackProperties = 
+            new Hashtable<String, List<ComponentProperty>>();
+        Hashtable<String, List<ComponentProperty>> serviceCallbackProperties = 
+            new Hashtable<String, List<ComponentProperty>>();
+        
+        while (reader.hasNext()) {
+            
+            int next = reader.next();
+            if (next == END_ELEMENT && IMPLEMENTATION_OSGI.equals(reader.getName())) {
+                break;
             }
+            else if (next == START_ELEMENT && PROPERTIES_QNAME.equals(reader.getName())) {
                 
-            OSGiImplementation implementation = new OSGiImplementation(
-                    bundleName, 
-                    bundleLocation,
-                    importList, 
-                    scope,
-                    eagerInit,
-                    allowsPassByRefList,
-                    refProperties,
-                    serviceProperties,
-                    injectProperties);
-            implementation.setCallbackProperties(refCallbackProperties, serviceCallbackProperties);
-            
-            
-            implementation.setUnresolved(true);
-            
-            return implementation;
-            
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
+                // FIXME: This is temporary code which allows reference and service properties used
+                //        for filtering OSGi services to be specified in <implementation.osgi/>
+                //        This should really be provided in the component type file since these
+                //        properties are associated with an implementation rather than a configured
+                //        instance of an implementation.
+                String refName = reader.getAttributeValue(null, "reference");
+                String serviceName = reader.getAttributeValue(null, "service");
+                String refCallbackName = reader.getAttributeValue(null, "referenceCallback");
+                String serviceCallbackName = reader.getAttributeValue(null, "serviceCallback");
+                List<ComponentProperty> props = readProperties(reader);
+                if (refName != null)
+                    refProperties.put(refName, props);
+                else if (serviceName != null)
+                    serviceProperties.put(serviceName, props);
+                else if (refCallbackName != null)
+                    refCallbackProperties.put(refCallbackName, props);
+                else if (serviceCallbackName != null)
+                    serviceCallbackProperties.put(serviceCallbackName, props);
+                else
+                    throw new ContributionReadException("Properties in implementation.osgi should specify service or reference");                }
         }
+            
+        OSGiImplementation implementation = new OSGiImplementation(
+                bundleName, 
+                bundleLocation,
+                importList, 
+                scope,
+                eagerInit,
+                allowsPassByRefList,
+                refProperties,
+                serviceProperties,
+                injectProperties);
+        implementation.setCallbackProperties(refCallbackProperties, serviceCallbackProperties);
+        
+        
+        implementation.setUnresolved(true);
+        
+        return implementation;
     }
 
     public void resolve(OSGiImplementation impl, ModelResolver resolver) throws ContributionResolveException {
@@ -313,7 +308,9 @@
         return reference;
     }
 
-    public void write(OSGiImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+    public void write(OSGiImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
+        
+        //FIXME Implement this method
     }
     
   

Modified: incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java Mon Sep  3 02:46:41 2007
@@ -65,49 +65,54 @@
         return ResourceImplementation.class;
     }
 
-    public ResourceImplementation read(XMLStreamReader reader) throws ContributionReadException {
-        assert IMPLEMENTATION_RESOURCE.equals(reader.getName());
+    public ResourceImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
         
         // Read an <implementation.resource> element
-        try {
-            // Read the directory attribute. This is where the sample
-            // CRUD implementation will persist resources.
-            String location = reader.getAttributeValue(null, "location");
 
-            // Create an initialize the resource implementationmodel
-            ResourceImplementation implementation = implementationFactory.createResourceImplementation();
-            implementation.setLocation(location);
-            implementation.setUnresolved(true);
-            
-            // Skip to end element
-            while (reader.hasNext()) {
-                if (reader.next() == END_ELEMENT && IMPLEMENTATION_RESOURCE.equals(reader.getName())) {
-                    break;
-                }
+        // Read the location attribute specifying the location of the
+        // resources
+        String location = reader.getAttributeValue(null, "location");
+
+        // Create an initialize the resource implementationmodel
+        ResourceImplementation implementation = implementationFactory.createResourceImplementation();
+        implementation.setLocation(location);
+        implementation.setUnresolved(true);
+        
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && IMPLEMENTATION_RESOURCE.equals(reader.getName())) {
+                break;
             }
-            
-            return implementation;
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
         }
+        
+        return implementation;
     }
 
-    public void resolve(ResourceImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+    public void resolve(ResourceImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
         
         // Resolve the resource directory location
         DeployedArtifact artifact = contributionFactory.createDeployedArtifact();
-        artifact.setURI(impl.getLocation());
+        artifact.setURI(implementation.getLocation());
         DeployedArtifact resolved = resolver.resolveModel(DeployedArtifact.class, artifact);
         if (resolved.getLocation() != null) {
             try {
-                impl.setLocationURL(new URL(resolved.getLocation()));
-                impl.setUnresolved(false);
+                implementation.setLocationURL(new URL(resolved.getLocation()));
+                implementation.setUnresolved(false);
             } catch (IOException e) {
                 throw new ContributionResolveException(e);
             }
         }
     }
 
-    public void write(ResourceImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+    public void write(ResourceImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+        
+        // Write <implementation.resource>
+        writer.writeStartElement(IMPLEMENTATION_RESOURCE.getNamespaceURI(), IMPLEMENTATION_RESOURCE.getLocalPart());
+        
+        if (implementation.getLocation() != null) {
+            writer.writeAttribute("location", implementation.getLocation());
+        }
+        
+        writer.writeEndElement();
     }
 }

Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java Mon Sep  3 02:46:41 2007
@@ -39,7 +39,7 @@
 public class SpringImplementation extends ComponentTypeImpl implements Implementation, Extensible {
 
     // The location attribute which points to the Spring application-context XML file
-    private String springLocation;
+    private String location;
     // The application-context file as a Spring Resource
     private Resource resource;
     private ComponentType componentType;
@@ -49,7 +49,7 @@
     private Hashtable<String, Class> propertyMap;
 
     protected SpringImplementation() {
-        this.springLocation = null;
+        this.location = null;
         this.resource = null;
         setUnresolved(true);
         serviceMap = new Hashtable<String, SpringBeanElement>();
@@ -57,16 +57,16 @@
     } // end method SpringImplementation
 
     /* Returns the location attribute for this Spring implementation */
-    public String getSpringLocation() {
-        return springLocation;
+    public String getLocation() {
+        return location;
     }
 
     /**
      * Sets the location attribute for this Spring implementation
      * location - a URI to the Spring application-context file
      */
-    public void setSpringLocation(String location) {
-        this.springLocation = location;
+    public void setLocation(String location) {
+        this.location = location;
         return;
     }
 

Copied: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java (from r572232, incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringArtifactProcessor.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java?p2=incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java&p1=incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringArtifactProcessor.java&r1=572232&r2=572267&rev=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java Mon Sep  3 02:46:41 2007
@@ -29,6 +29,7 @@
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.ComponentType;
 import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
@@ -46,7 +47,7 @@
  * 
  * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $ 
  */
-public class SpringArtifactProcessor implements StAXArtifactProcessor<SpringImplementation> {
+public class SpringImplementationProcessor implements StAXArtifactProcessor<SpringImplementation> {
 
     private static final String LOCATION = "location";
     private static final String IMPLEMENTATION_SPRING = "implementation.spring";
@@ -56,11 +57,13 @@
     private AssemblyFactory assemblyFactory;
     private JavaInterfaceFactory javaFactory;
     private PolicyFactory policyFactory;
+    private PolicyAttachPointProcessor policyProcessor;
     
-    public SpringArtifactProcessor(ModelFactoryExtensionPoint modelFactories) {
+    public SpringImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
         this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
         this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
         this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
+        this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
     }
 
     /*
@@ -82,32 +85,28 @@
      * then the default behaviour is to build an application context using all the *.xml files 
      * in the METAINF/spring directory.
      */
-    public SpringImplementation read(XMLStreamReader reader) throws ContributionReadException {
+    public SpringImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
 
-        try {
-            /* Read the location attribute for the spring implementation  */
-            String springLocation = reader.getAttributeValue(null, LOCATION);
-            if (springLocation == null) {
-                throw new ContributionReadException(MSG_LOCATION_MISSING);
-            }
-            /* Create the Spring implementation and set the location into it */
-            SpringImplementation springImplementation = new SpringImplementation();
-            springImplementation.setSpringLocation(springLocation);
-
-            // Skip to end element
-            while (reader.hasNext()) {
-                if (reader.next() == END_ELEMENT && IMPLEMENTATION_SPRING_QNAME.equals(reader.getName())) {
-                    break;
-                }
-            } // end while
+        // Create the Spring implementation
+        SpringImplementation springImplementation = new SpringImplementation();
 
-            processComponentType(springImplementation);
+        // Read the location attribute for the spring implementation
+        String springLocation = reader.getAttributeValue(null, LOCATION);
+        if (springLocation == null) {
+            throw new ContributionReadException(MSG_LOCATION_MISSING);
+        }
+        springImplementation.setLocation(springLocation);
 
-            return springImplementation;
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && IMPLEMENTATION_SPRING_QNAME.equals(reader.getName())) {
+                break;
+            }
+        } // end while
 
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
-        }
+        processComponentType(springImplementation);
+
+        return springImplementation;
     } // end read
 
     /*
@@ -128,19 +127,19 @@
      * Write out the XML representation of the Spring implementation
      * <implementation.spring location="..." />
      */
-    public void write(SpringImplementation springImplementation, XMLStreamWriter writer)
-        throws ContributionWriteException {
-        try {
-
-            writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
-            if (springImplementation.getSpringLocation() != null) {
-                writer.writeAttribute(LOCATION, springImplementation.getSpringLocation());
-            }
-            writer.writeEndElement();
+    public void write(SpringImplementation springImplementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
 
-        } catch (XMLStreamException e) {
-            throw new ContributionWriteException(e);
+        // Write <implementation.spring>
+        policyProcessor.writePolicyPrefixes(springImplementation, writer);
+        writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
+        policyProcessor.writePolicyAttributes(springImplementation, writer);
+        
+        if (springImplementation.getLocation() != null) {
+            writer.writeAttribute(LOCATION, springImplementation.getLocation());
         }
+
+        writer.writeEndElement();
+
     } // end write
 
     /**

Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java Mon Sep  3 02:46:41 2007
@@ -135,7 +135,7 @@
 
         Resource resource;
 
-        String location = implementation.getSpringLocation();
+        String location = implementation.getLocation();
 
         try {
             // FIXME - is the ContextClassLoader the right place to start the search?

Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Mon Sep  3 02:46:41 2007
@@ -16,4 +16,4 @@
 # under the License. 
 
 # Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.spring.SpringArtifactProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.spring,model=org.apache.tuscany.sca.implementation.spring.SpringImplementation
+org.apache.tuscany.sca.implementation.spring.SpringImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.spring,model=org.apache.tuscany.sca.implementation.spring.SpringImplementation

Modified: incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryModuleActivator.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryModuleActivator.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryModuleActivator.java Mon Sep  3 02:46:41 2007
@@ -27,7 +27,7 @@
 import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
 import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
 import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.xquery.xml.XQueryArtifactProcessor;
+import org.apache.tuscany.sca.implementation.xquery.xml.XQueryImplementationProcessor;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
 
@@ -38,7 +38,7 @@
  */
 public class XQueryModuleActivator implements ModuleActivator {
 
-    private XQueryArtifactProcessor xqueryArtifactProcessor;
+    private XQueryImplementationProcessor xqueryArtifactProcessor;
 
     public XQueryModuleActivator() {
     }
@@ -58,7 +58,7 @@
         AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
         JavaInterfaceFactory javaFactory = factories.getFactory(JavaInterfaceFactory.class);
         // Create the artifact processor for XQuery artifacts and add to artifact processors
-        xqueryArtifactProcessor = new XQueryArtifactProcessor(assemblyFactory, javaFactory);
+        xqueryArtifactProcessor = new XQueryImplementationProcessor(assemblyFactory, javaFactory);
 
         StAXArtifactProcessorExtensionPoint staxProcessors =
             registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);

Copied: incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java (from r572232, incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryArtifactProcessor.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java?p2=incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java&p1=incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryArtifactProcessor.java&r1=572232&r2=572267&rev=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java Mon Sep  3 02:46:41 2007
@@ -40,7 +40,7 @@
  * Processor for the xquery implementation type artifact
  * @version $Rev$ $Date$
  */
-public class XQueryArtifactProcessor implements StAXArtifactProcessor<XQueryImplementation> {
+public class XQueryImplementationProcessor implements StAXArtifactProcessor<XQueryImplementation> {
 
     private static final String LOCATION = "location";
     private static final String IMPLEMENTATION_XQUERY = "implementation.xquery";
@@ -51,7 +51,7 @@
     private AssemblyFactory assemblyFactory;
     private JavaInterfaceFactory javaFactory;
 
-    public XQueryArtifactProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
+    public XQueryImplementationProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
         this.assemblyFactory = assemblyFactory;
         this.javaFactory = javaFactory;
     }
@@ -63,47 +63,40 @@
     /**
      * Reads  from the stream and sets the location attribute of the implementation correspondingly
      */
-    public XQueryImplementation read(XMLStreamReader inputSource) throws ContributionReadException, XMLStreamException {
-        try {
-            /* Read the location attribute for the xquery implementation  */
-            String xqueryLocation = inputSource.getAttributeValue(null, LOCATION);
-            if (xqueryLocation == null) {
-                throw new ContributionReadException(MSG_LOCATION_MISSING);
-            }
-            /* Create the XQuery implementation and set the location into it */
-            XQueryImplementation xqueryImplementation =
-                XQueryImplementationFactory.INSTANCE.createXQueryImplementation();
-            xqueryImplementation.setLocation(xqueryLocation);
-
-            // Skip to end element
-            while (inputSource.hasNext()) {
-                if (inputSource.next() == END_ELEMENT && IMPLEMENTATION_XQUERY_QNAME.equals(inputSource.getName())) {
-                    break;
-                }
-            } // end while
+    public XQueryImplementation read(XMLStreamReader reader)
+        throws ContributionReadException, XMLStreamException {
 
-            xqueryImplementation.setUnresolved(true);
+        /* Read the location attribute for the xquery implementation  */
+        String xqueryLocation = reader.getAttributeValue(null, LOCATION);
+        if (xqueryLocation == null) {
+            throw new ContributionReadException(MSG_LOCATION_MISSING);
+        }
+        /* Create the XQuery implementation and set the location into it */
+        XQueryImplementation xqueryImplementation =
+            XQueryImplementationFactory.INSTANCE.createXQueryImplementation();
+        xqueryImplementation.setLocation(xqueryLocation);
+
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && IMPLEMENTATION_XQUERY_QNAME.equals(reader.getName())) {
+                break;
+            }
+        } // end while
 
-            return xqueryImplementation;
+        xqueryImplementation.setUnresolved(true);
 
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
-        }
+        return xqueryImplementation;
     }
 
-    public void write(XQueryImplementation xqueryImplementation, XMLStreamWriter outputSource)
+    public void write(XQueryImplementation xqueryImplementation, XMLStreamWriter writer)
         throws ContributionWriteException, XMLStreamException {
-        try {
-
-            outputSource.writeStartElement(Constants.SCA10_TUSCANY_NS, IMPLEMENTATION_XQUERY);
-            if (xqueryImplementation.getLocation() != null) {
-                outputSource.writeAttribute(LOCATION, xqueryImplementation.getLocation());
-            }
-            outputSource.writeEndElement();
-
-        } catch (XMLStreamException e) {
-            throw new ContributionWriteException(e);
+        
+        writer.writeStartElement(Constants.SCA10_TUSCANY_NS, IMPLEMENTATION_XQUERY);
+        if (xqueryImplementation.getLocation() != null) {
+            writer.writeAttribute(LOCATION, xqueryImplementation.getLocation());
         }
+        writer.writeEndElement();
+
     }
 
     public Class<XQueryImplementation> getModelType() {

Modified: incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java?rev=572267&r1=572266&r2=572267&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java Mon Sep  3 02:46:41 2007
@@ -54,52 +54,47 @@
         return javaInterface;
     }
 
-    public JavaInterfaceContract read(XMLStreamReader reader) throws ContributionReadException {
-        try {
-            // Read an <interface.java>
-            JavaInterfaceContract javaInterfaceContract = javaFactory.createJavaInterfaceContract();
-            String interfaceName = reader.getAttributeValue(null, INTERFACE);
-            if (interfaceName != null) {
-                JavaInterface javaInterface = createJavaInterface(interfaceName);
-                javaInterfaceContract.setInterface(javaInterface);
-            }
+    public JavaInterfaceContract read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+        
+        // Read an <interface.java>
+        JavaInterfaceContract javaInterfaceContract = javaFactory.createJavaInterfaceContract();
+        String interfaceName = reader.getAttributeValue(null, INTERFACE);
+        if (interfaceName != null) {
+            JavaInterface javaInterface = createJavaInterface(interfaceName);
+            javaInterfaceContract.setInterface(javaInterface);
+        }
 
-            String callbackInterfaceName = reader.getAttributeValue(null, CALLBACK_INTERFACE);
-            if (callbackInterfaceName != null) {
-                JavaInterface javaCallbackInterface = createJavaInterface(callbackInterfaceName);
-                javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
-            }
-    
-            // Skip to end element
-            while (reader.hasNext()) {
-                if (reader.next() == END_ELEMENT && INTERFACE_JAVA_QNAME.equals(reader.getName())) {
-                    break;
-                }
+        String callbackInterfaceName = reader.getAttributeValue(null, CALLBACK_INTERFACE);
+        if (callbackInterfaceName != null) {
+            JavaInterface javaCallbackInterface = createJavaInterface(callbackInterfaceName);
+            javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
+        }
+
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && INTERFACE_JAVA_QNAME.equals(reader.getName())) {
+                break;
             }
-            return javaInterfaceContract;
-            
-        } catch (XMLStreamException e) {
-            throw new ContributionReadException(e);
         }
+        return javaInterfaceContract;
     }
     
-    public void write(JavaInterfaceContract javaInterfaceContract, XMLStreamWriter writer) throws ContributionWriteException {
-        try {
-            // Write an <interface.java>
-            writer.writeStartElement(Constants.SCA10_NS, INTERFACE_JAVA);
-            JavaInterface javaInterface = (JavaInterface)javaInterfaceContract.getInterface();
-            if (javaInterface != null && javaInterface.getName() != null) {
-                writer.writeAttribute(INTERFACE, javaInterface.getName());
-            }
-            JavaInterface javaCallbackInterface = (JavaInterface)javaInterfaceContract.getCallbackInterface();
-            if (javaCallbackInterface != null && javaCallbackInterface.getName() != null) {
-                writer.writeAttribute(CALLBACK_INTERFACE, javaCallbackInterface.getName());
-            }
-            writer.writeEndElement();
-            
-        } catch (XMLStreamException e) {
-            throw new ContributionWriteException(e);
+    public void write(JavaInterfaceContract javaInterfaceContract, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+        
+        // Write an <interface.java>
+        writer.writeStartElement(Constants.SCA10_NS, INTERFACE_JAVA);
+        JavaInterface javaInterface = (JavaInterface)javaInterfaceContract.getInterface();
+        
+        if (javaInterface != null && javaInterface.getName() != null) {
+            writer.writeAttribute(INTERFACE, javaInterface.getName());
+        }
+        
+        JavaInterface javaCallbackInterface = (JavaInterface)javaInterfaceContract.getCallbackInterface();
+        if (javaCallbackInterface != null && javaCallbackInterface.getName() != null) {
+            writer.writeAttribute(CALLBACK_INTERFACE, javaCallbackInterface.getName());
         }
+        
+        writer.writeEndElement();
     }
     
     private JavaInterface resolveJavaInterface(JavaInterface javaInterface, ModelResolver resolver) throws ContributionResolveException {



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message