Author: jsdelfino
Date: Wed Nov 28 14:57:22 2007
New Revision: 599182

URL: http://svn.apache.org/viewvc?rev=599182&view=rev
Log:
Strawman implementation of the implementation.ejb described in the white paper 
at http://www.osoa.org/pages/viewpage.action?pageId=3980

Added:
    incubator/tuscany/java/sca/modules/implementation-ejb/
      - copied from r598683, 
incubator/tuscany/java/sca/modules/implementation-node/
    incubator/tuscany/java/sca/modules/implementation-ejb-xml/
      - copied from r598683, 
incubator/tuscany/java/sca/modules/implementation-node-xml/
    incubator/tuscany/java/sca/modules/implementation-ejb-xml/DISCLAIMER
      - copied unchanged from r599180, 
incubator/tuscany/java/sca/modules/implementation-node-xml/DISCLAIMER
    incubator/tuscany/java/sca/modules/implementation-ejb-xml/LICENSE
      - copied unchanged from r599180, 
incubator/tuscany/java/sca/modules/implementation-node-xml/LICENSE
    incubator/tuscany/java/sca/modules/implementation-ejb-xml/NOTICE
      - copied unchanged from r599180, 
incubator/tuscany/java/sca/modules/implementation-node-xml/NOTICE
    incubator/tuscany/java/sca/modules/implementation-ejb-xml/pom.xml
      - copied, changed from r599180, 
incubator/tuscany/java/sca/modules/implementation-node-xml/pom.xml
    incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/
      - copied from r599180, 
incubator/tuscany/java/sca/modules/implementation-node-xml/src/
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
   (with props)
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
   (with props)
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
   (with props)
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
   (with props)
    incubator/tuscany/java/sca/modules/implementation-ejb/DISCLAIMER
      - copied unchanged from r599180, 
incubator/tuscany/java/sca/modules/implementation-node/DISCLAIMER
    incubator/tuscany/java/sca/modules/implementation-ejb/LICENSE
      - copied unchanged from r599180, 
incubator/tuscany/java/sca/modules/implementation-node/LICENSE
    incubator/tuscany/java/sca/modules/implementation-ejb/NOTICE
      - copied unchanged from r599180, 
incubator/tuscany/java/sca/modules/implementation-node/NOTICE
    incubator/tuscany/java/sca/modules/implementation-ejb/pom.xml
      - copied, changed from r599180, 
incubator/tuscany/java/sca/modules/implementation-node/pom.xml
    incubator/tuscany/java/sca/modules/implementation-ejb/src/
      - copied from r599180, 
incubator/tuscany/java/sca/modules/implementation-node/src/
    
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/
    
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
   (with props)
    
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java
   (with props)
    
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/
    
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java
   (with props)
    
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
   (with props)
    
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
Removed:
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/node/
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/node/
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/node/
    
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/node/
    
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
Modified:
    
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    incubator/tuscany/java/sca/modules/pom.xml

Copied: incubator/tuscany/java/sca/modules/implementation-ejb-xml/pom.xml (from 
r599180, incubator/tuscany/java/sca/modules/implementation-node-xml/pom.xml)
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb-xml/pom.xml?p2=incubator/tuscany/java/sca/modules/implementation-ejb-xml/pom.xml&p1=incubator/tuscany/java/sca/modules/implementation-node-xml/pom.xml&r1=599180&r2=599182&rev=599182&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-node-xml/pom.xml 
(original)
+++ incubator/tuscany/java/sca/modules/implementation-ejb-xml/pom.xml Wed Nov 
28 14:57:22 2007
@@ -26,13 +26,13 @@
         <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <artifactId>tuscany-implementation-node-xml</artifactId>
-    <name>Apache Tuscany Node Implementation XML Model</name>
+    <artifactId>tuscany-implementation-ejb-xml</artifactId>
+    <name>Apache Tuscany EJB Session Bean Implementation XML Model</name>
 
     <dependencies>
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-implementation-node</artifactId>
+            <artifactId>tuscany-implementation-ejb</artifactId>
             <version>1.1-incubating-SNAPSHOT</version>
         </dependency>
 

Added: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java?rev=599182&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
 Wed Nov 28 14:57:22 2007
@@ -0,0 +1,118 @@
+/*
+ * 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.implementation.ejb.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import 
org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
+
+
+/**
+ * Implements a STAX artifact processor for EJB implementations.
+ */
+public class EJBImplementationProcessor extends BaseStAXArtifactProcessor 
implements StAXArtifactProcessor<EJBImplementation> {
+    private static final QName IMPLEMENTATION_EJB = new 
QName(Constants.SCA10_NS, "implementation.ejb");
+    
+    private AssemblyFactory assemblyFactory;
+    private EJBImplementationFactory implementationFactory;
+    
+    public EJBImplementationProcessor(ModelFactoryExtensionPoint 
modelFactories) {
+        assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        implementationFactory = 
modelFactories.getFactory(EJBImplementationFactory.class);
+    }
+
+    public QName getArtifactType() {
+        // Returns the qname of the XML element processed by this processor
+        return IMPLEMENTATION_EJB;
+    }
+
+    public Class<EJBImplementation> getModelType() {
+        // Returns the type of model processed by this processor
+        return EJBImplementation.class;
+    }
+
+    public EJBImplementation read(XMLStreamReader reader) throws 
ContributionReadException, XMLStreamException {
+        
+        // Read an <implementation.ejb> element
+        EJBImplementation implementation = 
implementationFactory.createEJBImplementation();
+        implementation.setUnresolved(true);
+
+        // Read the ejb-link attribute
+        String ejbLink = getString(reader, "ejb-link");
+        if (ejbLink != null) {
+            implementation.setEJBLink(ejbLink);
+            
+            // Set the URI of the component type 
+            implementation.setURI(ejbLink.replace('#', '/'));
+        }
+
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && 
IMPLEMENTATION_EJB.equals(reader.getName())) {
+                break;
+            }
+        }
+        
+        return implementation;
+    }
+
+    public void resolve(EJBImplementation implementation, ModelResolver 
resolver) throws ContributionResolveException {
+        
+        // Resolve the component type
+        String uri = implementation.getURI();
+        if (uri != null) {
+            ComponentType componentType = 
assemblyFactory.createComponentType();
+            componentType.setURI(uri + ".componentType");
+            componentType = resolver.resolveModel(ComponentType.class, 
componentType);
+            if (!componentType.isUnresolved()) {
+                
+                // Initialize the implementation's services, references and 
properties
+                
implementation.getServices().addAll(componentType.getServices());
+                
implementation.getReferences().addAll(componentType.getReferences());
+                
implementation.getProperties().addAll(componentType.getProperties());
+            }
+        }
+        implementation.setUnresolved(false);
+    }
+
+    public void write(EJBImplementation implementation, XMLStreamWriter 
writer) throws ContributionWriteException, XMLStreamException {
+        
+        // Write <implementation.ejb>
+        writeStart(writer, IMPLEMENTATION_EJB.getNamespaceURI(), 
IMPLEMENTATION_EJB.getLocalPart(),
+                                 new XAttr("ejb-link", 
implementation.getEJBLink()));
+        
+        writeEnd(writer);
+    }
+}

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/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-ejb-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=599182&r1=599180&r2=599182&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
 (original)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
 Wed Nov 28 14:57:22 2007
@@ -16,4 +16,4 @@
 # under the License. 
 
 # Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.node.xml.NodeImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.node,model=org.apache.tuscany.sca.implementation.node.NodeImplementation,factory=org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
+org.apache.tuscany.sca.implementation.ejb.xml.EJBImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.ejb,model=org.apache.tuscany.sca.implementation.ejb.EJBImplementation,factory=org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory

Added: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java?rev=599182&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
 Wed Nov 28 14:57:22 2007
@@ -0,0 +1,104 @@
+/*
+ * 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.implementation.ejb.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+import 
org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import 
org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
+import 
org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading Node implementations.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+    XMLInputFactory inputFactory;
+    DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    ExtensibleStAXArtifactProcessor staxProcessor;
+    private AssemblyFactory assemblyFactory;
+    private SCABindingFactory scaBindingFactory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
+
+    @Override
+    public void setUp() throws Exception {
+        ModelFactoryExtensionPoint factories = new 
DefaultModelFactoryExtensionPoint();
+        assemblyFactory = new DefaultAssemblyFactory();
+        factories.addFactory(assemblyFactory);
+        scaBindingFactory = new SCABindingFactoryImpl();
+        factories.addFactory(scaBindingFactory);
+        policyFactory = new DefaultPolicyFactory();
+        factories.addFactory(policyFactory);
+        mapper = new InterfaceContractMapperImpl();
+        inputFactory = XMLInputFactory.newInstance();
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new 
DefaultModelFactoryExtensionPoint());
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, 
XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+        
+        EJBImplementationFactory nodeFactory = new 
EJBImplementationFactoryImpl();
+        factories.addFactory(nodeFactory);
+        
+        EJBImplementationProcessor ejbProcessor = new 
EJBImplementationProcessor(factories);
+        staxProcessors.addArtifactProcessor(ejbProcessor);
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+    }
+
+    public void testReadComposite() throws Exception {
+        CompositeProcessor compositeProcessor = new CompositeProcessor(new 
ContributionFactoryImpl(), assemblyFactory, policyFactory, mapper, 
staxProcessor);
+        InputStream is = getClass().getResourceAsStream("TestEJB.composite");
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        Composite composite = compositeProcessor.read(reader);
+        assertNotNull(composite);
+
+        CompositeBuilderImpl compositeUtil = new 
CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new 
DefaultIntentAttachPointTypeFactory(), mapper, null, null);
+        compositeUtil.build(composite);
+        
+        
assertTrue(((EJBImplementation)composite.getComponents().get(0).getImplementation()).getEJBLink().equals("module.jar#TestEJB"));
+    }
+
+}

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java?rev=599182&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
 Wed Nov 28 14:57:22 2007
@@ -0,0 +1,102 @@
+/*
+ * 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.implementation.ejb.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+import 
org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import 
org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
+import 
org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading/write WSDL interfaces.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+    XMLInputFactory inputFactory;
+    DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    ExtensibleStAXArtifactProcessor staxProcessor;
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
+
+    @Override
+    public void setUp() throws Exception {
+        ModelFactoryExtensionPoint factories = new 
DefaultModelFactoryExtensionPoint();
+        factory = new DefaultAssemblyFactory();
+        factories.addFactory(factory);
+        policyFactory = new DefaultPolicyFactory();
+        factories.addFactory(policyFactory);
+        
+        mapper = new InterfaceContractMapperImpl();
+        inputFactory = XMLInputFactory.newInstance();
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new 
DefaultModelFactoryExtensionPoint());
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, 
XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+        
+        EJBImplementationFactory nodeFactory = new 
EJBImplementationFactoryImpl();
+        factories.addFactory(nodeFactory);
+        
+        staxProcessors.addArtifactProcessor(new CompositeProcessor(new 
ContributionFactoryImpl(), factory, policyFactory, mapper, staxProcessor));
+        staxProcessors.addArtifactProcessor(new 
ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new 
ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+        EJBImplementationProcessor ejbProcessor = new 
EJBImplementationProcessor(factories);
+        staxProcessors.addArtifactProcessor(ejbProcessor);
+
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+    }
+
+    public void testReadWriteComposite() throws Exception {
+        InputStream is = getClass().getResourceAsStream("TestEJB.composite");
+        Composite composite = staxProcessor.read(is, Composite.class);
+        assertNotNull(composite);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        staxProcessor.write(composite, bos);
+        
+        assertTrue(bos.toString().contains("module.jar#TestEJB"));
+
+    }
+
+}

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite?rev=599182&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
 Wed Nov 28 14:57:22 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * "License"); you may not use this file except in compliance
+    * with the License.  You may obtain a copy of the License at
+    * 
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    * 
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
+       targetNamespace="http://sample/ejb";
+       xmlns:sc="http://sample/composite";
+       name="TestEJB">
+
+    <component name="TestEJB">
+        <implementation.ejb ejb-link="module.jar#TestEJB"/>
+    </component>
+
+</composite>

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb-xml/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/java/sca/modules/implementation-ejb/pom.xml (from 
r599180, incubator/tuscany/java/sca/modules/implementation-node/pom.xml)
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb/pom.xml?p2=incubator/tuscany/java/sca/modules/implementation-ejb/pom.xml&p1=incubator/tuscany/java/sca/modules/implementation-node/pom.xml&r1=599180&r2=599182&rev=599182&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-node/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-ejb/pom.xml Wed Nov 28 
14:57:22 2007
@@ -26,10 +26,11 @@
         <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <artifactId>tuscany-implementation-node</artifactId>
-    <name>Apache Tuscany SCA Node Implementation Model</name>
+    <artifactId>tuscany-implementation-ejb</artifactId>
+    <name>Apache Tuscany SCA EJB Session Bean Implementation Model</name>
 
     <dependencies>
+
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-assembly</artifactId>

Added: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java?rev=599182&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
 Wed Nov 28 14:57:22 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.implementation.ejb;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+
+
+/**
+ * The model representing an EJB implementation in an SCA assembly model.
+ */
+public interface EJBImplementation extends Implementation {
+    
+    /**
+     * Returns the EJB link URI.
+     * @return the EJB link URI
+     */
+    String getEJBLink();
+    
+    /**
+     * Sets the EJB link URI.
+     * @param ejbLink the EJB link URI
+     */
+    void setEJBLink(String ejbLink);
+
+}

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java?rev=599182&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java
 Wed Nov 28 14:57:22 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.implementation.ejb;
+
+
+/**
+ * Factory for the EJB implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EJBImplementationFactory {
+    
+    /**
+     * Creates a new EJB implementation.
+     * @return a new EJB implementation
+     */
+    EJBImplementation createEJBImplementation();
+
+}

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java?rev=599182&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java
 Wed Nov 28 14:57:22 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.implementation.ejb.impl;
+
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
+
+/**
+ * Factory for the EJB implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EJBImplementationFactoryImpl implements EJBImplementationFactory {
+    
+    public EJBImplementationFactoryImpl() {
+    }
+
+    public EJBImplementation createEJBImplementation() {
+        return new EJBImplementationImpl();
+    }
+
+}

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java?rev=599182&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
 Wed Nov 28 14:57:22 2007
@@ -0,0 +1,93 @@
+/*
+ * 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.implementation.ejb.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
+
+
+/**
+ * The model representing an EJB implementation in an SCA assembly model.
+ */
+class EJBImplementationImpl implements EJBImplementation {
+
+    private List<Property> properties = new ArrayList<Property>(); 
+    private List<Service> services = new ArrayList<Service>(); 
+    private List<Reference> references = new ArrayList<Reference>(); 
+    private String ejbLink;
+    private String uri;
+    private boolean unresolved;
+
+    /**
+     * Constructs a new EJB implementation.
+     */
+    EJBImplementationImpl() {
+    }
+
+    public ConstrainingType getConstrainingType() {
+        // The EJB implementation does not support constrainingTypes
+        return null;
+    }
+
+    public List<Property> getProperties() {
+        return properties;
+    }
+
+    public List<Service> getServices() {
+        return services;
+    }
+    
+    public List<Reference> getReferences() {
+        return references;
+    }
+
+    public String getEJBLink() {
+        return ejbLink;
+    }
+    
+    public void setConstrainingType(ConstrainingType constrainingType) {
+        // The EJB implementation does not support constrainingTypes
+    }
+
+    public void setEJBLink(String ejbLink) {
+        this.ejbLink = ejbLink;
+    }
+    
+    public String getURI() {
+        return uri;
+    }
+    
+    public void setURI(String uri) {
+        this.uri = uri;
+    }
+    
+    public boolean isUnresolved() {
+        return unresolved;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        this.unresolved = unresolved;
+    }
+}

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory?rev=599182&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
 Wed Nov 28 14:57:22 2007
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License. 
+
+# Implementation class for model factory
+org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl

Modified: incubator/tuscany/java/sca/modules/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/pom.xml?rev=599182&r1=599181&r2=599182&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/pom.xml Wed Nov 28 14:57:22 2007
@@ -94,6 +94,8 @@
                 <module>implementation-bpel</module>
                 <module>implementation-das</module>
                 <module>implementation-data</module>
+                <module>implementation-ejb</module>
+                <module>implementation-ejb-xml</module>
                 <module>implementation-java</module>
                 <module>implementation-java-xml</module>
                 <module>implementation-java-runtime</module>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to