tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r567588 [1/2] - in /incubator/tuscany/java/sca/samples: binding-echo-extension/ binding-echo-extension/src/main/java/echo/ binding-echo-extension/src/main/java/echo/impl/ binding-echo-extension/src/main/java/echo/module/ binding-echo-extens...
Date Mon, 20 Aug 2007 08:15:32 GMT
Author: jsdelfino
Date: Mon Aug 20 01:15:29 2007
New Revision: 567588

URL: http://svn.apache.org/viewvc?rev=567588&view=rev
Log:
Simplified and cleaned up a bit some of the extension samples.

Added:
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java   (with props)
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java
      - copied, changed from r567515, incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/CRUDImplementation.java
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java
      - copied, changed from r567515, incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/CRUDImplementationFactory.java
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java   (with props)
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java
      - copied, changed from r567515, incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDInvoker.java
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/README   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/build.xml   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementation.java   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementationFactory.java   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationImpl.java   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/POJOImplementationProvider.java   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java   (with props)
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory
Removed:
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/DefaultEchoBindingFactory.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/module/
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
    incubator/tuscany/java/sca/samples/databinding-echo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationProcessor.java
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/module/
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDInvoker.java
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo2/extension/
Modified:
    incubator/tuscany/java/sca/samples/binding-echo-extension/README
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
    incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java
    incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoBinding.java
    incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    incubator/tuscany/java/sca/samples/implementation-crud-extension/README
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java
    incubator/tuscany/java/sca/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java
    incubator/tuscany/java/sca/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java
    incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java
    incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java
    incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/pom.xml
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/README?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/README (original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/README Mon Aug 20 01:15:29 2007
@@ -22,15 +22,11 @@
       java/
         echo/                    - The binding interfaces
           impl/                  - The bindings model classes
-          module/                - The activator that loads the binding into the 
-                                   SCA runtime
           provider/              - The bindings runtime classes
           server/                - A dummy server that the binding is plugged into
       resources/
         META-INF/
-          services/
-            org.apache.sca.tuscany.sca.core.ModuleActivator - specifies the
-                                 module activation class to call
+          services/              - The extension declaration
     test/
       java/
         echo/                    - test code

Added: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java Mon Aug 20 01:15:29 2007
@@ -0,0 +1,34 @@
+/*
+ * 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 echo.impl;
+
+import echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public class EchoBindingFactoryImpl implements EchoBindingFactory {
+
+    public EchoBinding createEchoBinding() {
+        return new EchoBindingImpl();
+    }
+
+}

Propchange: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java (original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java Mon Aug 20 01:15:29 2007
@@ -22,19 +22,19 @@
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-
 import echo.EchoBinding;
 
 /**
  * Implementation of the Echo binding model.
  */
-public class EchoBindingImpl implements EchoBinding {
+class EchoBindingImpl implements EchoBinding {
     
     private String name;
     private String uri;
 
+    EchoBindingImpl() {
+    }
+    
     public String getName() {
         return name;
     }
@@ -51,25 +51,6 @@
         this.uri = uri;
     }
 
-    public List<PolicySet> getPolicySets() {
-        // The sample binding does not support policies
-        return Collections.emptyList();
-    }
-
-    public List<Intent> getRequiredIntents() {
-        // The sample binding does not support policies
-        return Collections.emptyList();
-    }
-
-    public List<Intent> getComputedIntents() {
-        // The sample binding does not support policies
-        return Collections.emptyList();
-    }
-
-    public List<PolicySet> getComputedPolicySets() {
-        // The sample binding does not support policies
-        return Collections.emptyList();    }
-    
     public List<Object> getExtensions() {
         // The sample binding does not support extensions
         return Collections.emptyList();

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java (original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java Mon Aug 20 01:15:29 2007
@@ -24,7 +24,10 @@
 /**
  * Invoker for the sample echo binding.
  */
-public class EchoBindingInvoker implements Invoker {
+class EchoBindingInvoker implements Invoker {
+    
+    EchoBindingInvoker() {
+    }
 
     public Message invoke(Message msg) {
         try {

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java (original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java Mon Aug 20 01:15:29 2007
@@ -19,6 +19,8 @@
 
 package echo.provider;
 
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.provider.BindingProviderFactory;
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
@@ -37,8 +39,9 @@
     
     private MessageFactory messageFactory;
     
-    public EchoBindingProviderFactory(MessageFactory messageFactory) {
-        this.messageFactory = messageFactory;
+    public EchoBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+        ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        this.messageFactory = factories.getFactory(MessageFactory.class);
     }
 
     public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EchoBinding binding) {

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java Mon Aug 20 01:15:29 2007
@@ -31,11 +31,11 @@
 /**
  * Implementation of the Echo binding provider.
  */
-public class EchoReferenceBindingProvider implements ReferenceBindingProvider {
+class EchoReferenceBindingProvider implements ReferenceBindingProvider {
 
     private RuntimeComponentReference reference;
 
-    public EchoReferenceBindingProvider(RuntimeComponent component,
+    EchoReferenceBindingProvider(RuntimeComponent component,
                                         RuntimeComponentReference reference,
                                         EchoBinding binding) {
         this.reference = reference;

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java Mon Aug 20 01:15:29 2007
@@ -34,14 +34,14 @@
 /**
  * Implementation of the Echo binding provider.
  */
-public class EchoServiceBindingProvider implements ServiceBindingProvider {
+class EchoServiceBindingProvider implements ServiceBindingProvider {
     
     private RuntimeComponent component;
     private RuntimeComponentService service;  
     private EchoBinding binding;
     private MessageFactory messageFactory;
     
-    public EchoServiceBindingProvider(RuntimeComponent component,
+    EchoServiceBindingProvider(RuntimeComponent component,
                                       RuntimeComponentService service, EchoBinding binding, MessageFactory messageFactory) {
         this.component = component;
         this.service = service;

Modified: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java (original)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java Mon Aug 20 01:15:29 2007
@@ -24,9 +24,6 @@
 import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 
-/**
- * The EchoService
- */
 public class EchoServiceListener {
     private Invoker invoker;
     private MessageFactory messageFactory;
@@ -39,9 +36,11 @@
 
     public String sendReceive(String input) throws InvocationTargetException {
 
+        // Create a request message
         Message request = messageFactory.createMessage();
         request.setBody(new Object[] {input});
-        // dispatch and get the response
+        
+        // Dispatch and get the response
         Message response = invoker.invoke(request);
         Object body = response.getBody();
         if (response.isFault()) {

Added: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory (added)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory Mon Aug 20 01:15:29 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 the binding model factory
+echo.impl.EchoBindingFactoryImpl

Added: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Mon Aug 20 01:15:29 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 the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://echo#binding.echo,model=echo.EchoBinding,factory=echo.EchoBindingFactory

Added: incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory (added)
+++ incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory Mon Aug 20 01:15:29 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 the binding provider extension
+echo.provider.EchoBindingProviderFactory;model=echo.EchoBinding

Modified: incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoBinding.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoBinding.java (original)
+++ incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoBinding.java Mon Aug 20 01:15:29 2007
@@ -23,8 +23,6 @@
 import java.util.List;
 
 import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
 
 /**
  * Implementation of the Echo binding model.
@@ -50,25 +48,6 @@
         this.uri = uri;
     }
 
-    public List<PolicySet> getPolicySets() {
-        // The sample binding does not support policies
-        return Collections.emptyList();
-    }
-
-    public List<Intent> getRequiredIntents() {
-        // The sample binding does not support policies
-        return Collections.emptyList();
-    }
-
-    public List<Intent> getComputedIntents() {
-        // The sample binding does not support policies
-        return Collections.emptyList();
-    }
-
-    public List<PolicySet> getComputedPolicySets() {
-        // The sample binding does not support policies
-        return Collections.emptyList();    }
-    
     public List<Object> getExtensions() {
         // The sample binding does not support extensions
         return Collections.emptyList();

Modified: incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (original)
+++ incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Mon Aug 20 01:15:29 2007
@@ -16,4 +16,4 @@
 # under the License. 
 
 # Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;type=http://echo2#binding.echo,model=echo2.extension.EchoBinding
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://echo2#binding.echo,model=echo2.extension.EchoBinding

Modified: incubator/tuscany/java/sca/samples/implementation-crud-extension/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/README?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/README (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/README Mon Aug 20 01:15:29 2007
@@ -26,14 +26,10 @@
         crud/                  - implementation model interfaces
           backend/             - fake component implementation
           impl/                - implementations of the model interfaces
-          module/              - gets the implementation-crud module registered
-                                 with the SCA runtime
           provider/            - runtime implementation
       resources/
         META-INF/
-          services/
-            org.apache.sca.tuscany.sca.core.ModuleActivator - specifies the
-                                 module activation class to call
+          services/            - declares the extension
     test/
       java/
         crud/

Copied: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java (from r567515, incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/CRUDImplementation.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java?p2=incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java&p1=incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/CRUDImplementation.java&r1=567515&r2=567588&rev=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/CRUDImplementation.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java Mon Aug 20 01:15:29 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package crud.model;
+package crud;
 
 import org.apache.tuscany.sca.assembly.Implementation;
 

Copied: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java (from r567515, incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/CRUDImplementationFactory.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java?p2=incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java&p1=incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/CRUDImplementationFactory.java&r1=567515&r2=567588&rev=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/CRUDImplementationFactory.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java Mon Aug 20 01:15:29 2007
@@ -17,7 +17,10 @@
  * under the License.    
  */
 
-package crud.model;
+package crud;
+
+import crud.CRUDImplementation;
+
 
 /**
  * A factory for the sample CRUD implementation model.

Added: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java Mon Aug 20 01:15:29 2007
@@ -0,0 +1,47 @@
+/*
+ * 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 crud.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+import crud.CRUDImplementation;
+import crud.CRUDImplementationFactory;
+
+
+/**
+ * A default factory for the CRUD implementation model.
+ */
+public class CRUDImplementationFactoryImpl implements CRUDImplementationFactory {
+    
+    private AssemblyFactory assemblyFactory;
+    private JavaInterfaceFactory javaFactory;
+    
+    public CRUDImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) {
+        this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+    }
+
+    public CRUDImplementation createCRUDImplementation() {
+        return new CRUDImplementationImpl(assemblyFactory, javaFactory);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java Mon Aug 20 01:15:29 2007
@@ -30,16 +30,15 @@
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
 
 import crud.CRUD;
-import crud.model.CRUDImplementation;
+import crud.CRUDImplementation;
+
 
 /**
  * The model representing a sample CRUD implementation in an SCA assembly model.
  */
-public class CRUDImplementationImpl implements CRUDImplementation {
+class CRUDImplementationImpl implements CRUDImplementation {
 
     private Service crudService;
     private String directory;
@@ -47,7 +46,7 @@
     /**
      * Constructs a new CRUD implementation.
      */
-    public CRUDImplementationImpl(AssemblyFactory assemblyFactory,
+    CRUDImplementationImpl(AssemblyFactory assemblyFactory,
                               JavaInterfaceFactory javaFactory) {
 
         // CRUD implementation always provide a single service exposing
@@ -104,26 +103,6 @@
 
     public void setURI(String uri) {
         // The sample CRUD implementation does not have a URI
-    }
-
-    public List<PolicySet> getPolicySets() {
-        // The sample CRUD implementation does not support policy sets
-        return Collections.emptyList();
-    }
-
-    public List<Intent> getRequiredIntents() {
-        // The sample CRUD implementation does not support intents
-        return Collections.emptyList();
-    }
-
-    public List<PolicySet> getComputedPolicySets() {
-        // The sample CRUD implementation does not support policy sets
-        return Collections.emptyList();
-    }
-
-    public List<Intent> getComputedIntents() {
-        // The sample CRUD implementation does not support intents
-        return Collections.emptyList();
     }
 
     public List<Object> getExtensions() {

Copied: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java (from r567515, incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDInvoker.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java?p2=incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java&p1=incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDInvoker.java&r1=567515&r2=567588&rev=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDInvoker.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java Mon Aug 20 01:15:29 2007
@@ -25,6 +25,7 @@
 
 import crud.backend.ResourceManager;
 
+
 /**
  * Implements a target invoker for CRUD component implementations.
  * 
@@ -33,11 +34,11 @@
  * CRUD operation invocations to the corresponding methods on our fake
  * resource manager.
  */
-public class CRUDInvoker implements Invoker {
+class CRUDImplementationInvoker implements Invoker {
     private Operation operation;
     private ResourceManager resourceManager;
     
-    public CRUDInvoker(Operation operation, ResourceManager resourceManager) {
+    CRUDImplementationInvoker(Operation operation, ResourceManager resourceManager) {
         this.operation = operation;
         this.resourceManager = resourceManager;
     }

Modified: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java Mon Aug 20 01:15:29 2007
@@ -24,8 +24,9 @@
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 
+import crud.CRUDImplementation;
 import crud.backend.ResourceManager;
-import crud.model.CRUDImplementation;
+
 
 /**
  * The model representing a sample CRUD implementation in an SCA assembly model.
@@ -36,7 +37,7 @@
  * going to persist resources - no references or properties - no policy intents
  * or policy sets
  */
-public class CRUDImplementationProvider implements ImplementationProvider {
+class CRUDImplementationProvider implements ImplementationProvider {
     
     private RuntimeComponent component;
     private CRUDImplementation implementation;
@@ -44,18 +45,18 @@
     /**
      * Constructs a new CRUD implementation.
      */
-    public CRUDImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+    CRUDImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
         this.component = component;
         this.implementation = implementation;
     }
 
     public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
-        CRUDInvoker invoker = new CRUDInvoker(operation, new ResourceManager(implementation.getDirectory()));
+        CRUDImplementationInvoker invoker = new CRUDImplementationInvoker(operation, new ResourceManager(implementation.getDirectory()));
         return invoker;
     }
 
     public Invoker createCallbackInvoker(Operation operation) {
-        CRUDInvoker invoker = new CRUDInvoker(operation, new ResourceManager(implementation.getDirectory()));
+        CRUDImplementationInvoker invoker = new CRUDImplementationInvoker(operation, new ResourceManager(implementation.getDirectory()));
         return invoker;
     }
 

Modified: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java Mon Aug 20 01:15:29 2007
@@ -18,21 +18,30 @@
  */
 package crud.provider;
 
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
 import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 
-import crud.model.CRUDImplementation;
+import crud.CRUDImplementation;
+import crud.provider.CRUDImplementationProvider;
+
 
 /**
  * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
  */
 public class CRUDImplementationProviderFactory implements ImplementationProviderFactory<CRUDImplementation> {
 
     /**
      * Constructs a new CRUD implementation.
      */
-    public CRUDImplementationProviderFactory() {
+    public CRUDImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
     }
 
     public ImplementationProvider createImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {

Added: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory (added)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory Mon Aug 20 01:15:29 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 the implementation model factory
+crud.impl.CRUDImplementationFactoryImpl

Added: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Mon Aug 20 01:15:29 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 the artifact processor extension
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://crud#implementation.crud,model=crud.CRUDImplementation,factory=crud.CRUDImplementationFactory

Added: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory (added)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory Mon Aug 20 01:15:29 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 the implementation extension
+crud.provider.CRUDImplementationProviderFactory;model=crud.CRUDImplementation

Modified: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java Mon Aug 20 01:15:29 2007
@@ -23,6 +23,8 @@
 
 import org.apache.tuscany.sca.host.embedded.SCADomain;
 
+import crud.CRUD;
+
 /**
  * Tests the CRUD service
  */
@@ -38,7 +40,6 @@
     protected void setUp() throws Exception {
         scaDomain = SCADomain.newInstance("crud.composite");
         crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
-
     }
 
     /**

Modified: incubator/tuscany/java/sca/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java Mon Aug 20 01:15:29 2007
@@ -19,9 +19,10 @@
 
 package crud.client;
 
-import crud.CRUD;
 
 import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import crud.CRUD;
 
 /**
  * @version $Rev$ $Date$

Modified: incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java Mon Aug 20 01:15:29 2007
@@ -25,6 +25,7 @@
 
 import crud.CRUD;
 
+
 public class CRUDTestCase extends TestCase {
     
     private SCADomain scaDomain;

Modified: incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java Mon Aug 20 01:15:29 2007
@@ -33,8 +33,6 @@
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
 
 import crud2.CRUD;
 
@@ -117,27 +115,6 @@
     public void setURI(String uri) {
         // The sample CRUD implementation does not have a URI
     }
-
-    public List<PolicySet> getPolicySets() {
-        // The sample CRUD implementation does not support policy sets
-        return Collections.emptyList();
-    }
-
-    public List<Intent> getRequiredIntents() {
-        // The sample CRUD implementation does not support intents
-        return Collections.emptyList();
-    }
-
-    public List<PolicySet> getComputedPolicySets() {
-        // The sample CRUD implementation does not support policy sets
-        return Collections.emptyList();
-    }
-
-    public List<Intent> getComputedIntents() {
-        // The sample CRUD implementation does not support intents
-        return Collections.emptyList();
-    }
-
 
     public List<Object> getExtensions() {
         // The sample CRUD implementation does not support extensions

Modified: incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Mon Aug 20 01:15:29 2007
@@ -16,4 +16,4 @@
 # under the License. 
 
 # Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;type=http://crud2#implementation.crud,model=crud2.extension.CRUDImplementation
+org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://crud2#implementation.crud,model=crud2.extension.CRUDImplementation

Added: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/README?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/README (added)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/README Mon Aug 20 01:15:29 2007
@@ -0,0 +1,70 @@
+Implementation POJO Sample
+==========================
+This sample demonstrates how new implementation types are constructed for 
+Apache Tuscany SCA. 
+
+The README in the samples directory (the directory above this) provides 
+general instructions about building and running samples. Take a look there 
+first. 
+
+Sample Overview
+---------------
+This sample contains a POJO implementation type as an example of how to create
+new implementation types.
+
+implementation-pojo-extension/
+  src/
+    main/
+      java/
+        pojo/                  - implementation model interfaces
+          impl/                - implementations of the model interfaces
+          provider/            - runtime implementation
+      resources/
+        META-INF/
+          services/            - declares the extension
+    test/
+      java/
+        helloworld/
+          HelloWorldTestCase.java - JUnit test case
+      resources/
+        helloworld.composite   - the SCA assembly used during unit testing
+
+  build.xml                    - the Ant build file
+  pom.xml                      - the Maven build file
+  
+Building The Sample Extension Using Ant
+-----------------------------------------
+With the binary distribution the sample extension can be built using Ant as 
+follows
+
+cd implementation-pojo-extension
+ant compile
+
+Building The Sample Using Maven 
+-------------------------------------------
+With either the binary or source distributions the sample can be built 
+using Maven as follows. 
+
+cd implementation-pojo-extension
+mvn
+
+Maven will also test that the sample extension built properly. You should see 
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldTestCase
+Initializing POJO
+Initializing POJO
+Executing POJO sayHello
+Initializing POJO
+Initializing POJO
+Executing POJO sayHello
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.616 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully. 

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/README
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/README
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/build.xml?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/build.xml (added)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/build.xml Mon Aug 20 01:15:29 2007
@@ -0,0 +1,51 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<project name="implementation-pojo-extension" default="compile">
+	<property name="test.jar"   value="sample-implementation-pojo-extension.jar" />
+	
+    <target name="init">
+        <mkdir dir="target/classes"/>
+    </target>
+	
+    <target name="compile" depends="init">
+        <javac srcdir="src/main/java"
+               destdir="target/classes"
+               debug="on"
+               source="1.5"
+               target="1.5">
+            <classpath>
+            	<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+            </classpath>
+        </javac> 
+        <copy todir="target/classes">
+            <fileset dir="src/main/resources"/>
+        </copy>
+        <jar destfile="target/${test.jar}" basedir="target/classes">
+            <manifest>
+                <attribute name="Main-Class" value="${test.class}" /> 
+            </manifest>
+        </jar>    	
+    </target>	
+		
+    <target name="clean">
+        <delete quiet="true" includeemptydirs="true">
+            <fileset dir="target"/>
+        </delete>
+    </target>
+</project>

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/build.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/pom.xml?rev=567588&r1=567587&r2=567588&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/pom.xml (original)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/pom.xml Mon Aug 20 01:15:29 2007
@@ -25,7 +25,7 @@
         <version>1.0-incubating-SNAPSHOT</version>
         <relativePath>../../pom.xml</relativePath>
     </parent>
-    <artifactId>sample-implementation-pojo2-extension</artifactId>
+    <artifactId>sample-implementation-pojo-extension</artifactId>
     <name>Apache Tuscany Java Implementation Extension Sample</name>
 
     <repositories>

Added: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementation.java?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementation.java (added)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementation.java Mon Aug 20 01:15:29 2007
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package pojo;
+
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+
+/**
+ * Represents a POJO implementation in an SCA assembly.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface POJOImplementation extends Implementation {
+    
+    /**
+     * Returns the POJO class name
+     * @return
+     */
+    public String getPOJOName();
+
+    /**
+     * Sets the POJO class name
+     * @param pojoName
+     */
+    public void setPOJOName(String pojoName);
+    
+    /**
+     * Returns the POJO class.
+     * @return
+     */
+    public Class<?> getPOJOClass();
+    
+    /**
+     * Sets the POJO class.
+     * @param pojoClass
+     */
+    public void setPOJOClass(Class<?> pojoClass);
+  
+    /**
+     * Returns the POJO's methods.
+     * @return
+     */
+    public Map<String, Method> getMethods();
+
+}

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementation.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementationFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementationFactory.java?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementationFactory.java (added)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementationFactory.java Mon Aug 20 01:15:29 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 pojo;
+
+
+/**
+ * Factory for the POJO implementation model. 
+ *
+ * @version $Rev$ $Date$
+ */
+public interface POJOImplementationFactory {
+
+    /**
+     * Creates a new POJO implementation model object.
+     * @return a new POJO implementation model object
+     */
+    POJOImplementation createPOJOImplementation();
+    
+}

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementationFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/POJOImplementationFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java Mon Aug 20 01:15:29 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 pojo.impl;
+
+import pojo.POJOImplementation;
+import pojo.POJOImplementationFactory;
+
+/**
+ * A factory for the POJO implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class POJOImplementationFactoryImpl implements POJOImplementationFactory {
+
+    public POJOImplementation createPOJOImplementation() {
+        return new POJOImplementationImpl();
+    }
+
+}

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationImpl.java?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationImpl.java (added)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationImpl.java Mon Aug 20 01:15:29 2007
@@ -0,0 +1,161 @@
+/*
+ * 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 pojo.impl;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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 pojo.POJOImplementation;
+
+
+/**
+ * Represents a POJO implementation in an SCA assembly.
+ *
+ * @version $Rev$ $Date$
+ */
+class POJOImplementationImpl implements POJOImplementation {
+    
+    private String pojoName;
+    private Class<?> pojoClass;
+    private String uri;
+    private Map<String, Method> methods;
+    private List<Service> services = new ArrayList<Service>();
+    private List<Reference> references = new ArrayList<Reference>();
+    private List<Property> properties = new ArrayList<Property>();
+    private boolean unresolved;
+
+    POJOImplementationImpl() {
+    }
+    
+    /**
+     * Returns the POJO class name
+     * @return
+     */
+    public String getPOJOName() {
+        return pojoName;
+    }
+
+    /**
+     * Sets the POJO class name
+     * @param pojoName
+     */
+    public void setPOJOName(String pojoName) {
+        this.pojoName = pojoName;
+        setURI(pojoName.replace('.', '/'));
+    }
+    
+    /**
+     * Returns the POJO class.
+     * @return
+     */
+    public Class<?> getPOJOClass() {
+        return pojoClass;
+    }
+    
+    /**
+     * Sets the POJO class.
+     * @param pojoClass
+     */
+    public void setPOJOClass(Class<?> pojoClass) {
+        this.pojoClass = pojoClass;
+        setPOJOName(pojoClass.getName());
+        
+        // Index the POJO's methods
+        methods = new HashMap<String, Method>();
+        Method[] m = pojoClass.getMethods();
+        for (int i = 0; i < m.length; i++) {
+            methods.put(m[i].getName(), m[i]);
+        }
+    }
+  
+    /**
+     * Returns the POJO's methods.
+     * @return
+     */
+    public Map<String, Method> getMethods() {
+        return methods;
+    }
+
+    public ConstrainingType getConstrainingType() {
+        // The sample POJO 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 getURI() {
+        return uri;
+    }
+
+    public void setConstrainingType(ConstrainingType constrainingType) {
+        // The sample POJO implementation does not support constrainingTypes
+    }
+
+    public void setURI(String uri) {
+        this.uri = uri;
+    }
+
+    public List<Object> getExtensions() {
+        // The sample POJO implementation does not support extensions
+        return Collections.emptyList();
+    }
+
+    public boolean isUnresolved() {
+        return unresolved;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        this.unresolved = unresolved;
+    }
+
+    @Override
+    public int hashCode() {
+        return uri.hashCode();
+    }
+    
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof POJOImplementationImpl) {
+            return ((POJOImplementationImpl)obj).getURI().equals(uri);
+        } else {
+            return false;
+        }
+    }
+
+}

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java (added)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java Mon Aug 20 01:15:29 2007
@@ -0,0 +1,155 @@
+/*
+ * 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 pojo.impl;
+
+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.Service;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+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.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+import pojo.POJOImplementation;
+import pojo.POJOImplementationFactory;
+
+/**
+ * Implements a STAX based artifact processor for POJO implementations.
+ * 
+ * The artifact processor is responsible for processing <implementation.pojo>
+ * elements in SCA assembly XML composite files and populating the POJO
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML. 
+ */
+public class POJOImplementationProcessor implements StAXArtifactProcessor<POJOImplementation> {
+    private static final QName IMPLEMENTATION_POJO = new QName("http://pojo", "implementation.pojo");
+    
+    private AssemblyFactory assemblyFactory;
+    private JavaInterfaceFactory javaFactory;
+    private POJOImplementationFactory pojoImplementationFactory;
+    
+    public POJOImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
+        
+        // Get the assembly and Java interface factories as we'll need them to
+        // create model objects 
+        assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+        javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+        pojoImplementationFactory = modelFactories.getFactory(POJOImplementationFactory.class);
+    }
+
+    public QName getArtifactType() {
+        // Returns the qname of the XML element processed by this processor
+        return IMPLEMENTATION_POJO;
+    }
+
+    public Class<POJOImplementation> getModelType() {
+        // Returns the type of model processed by this processor
+        return POJOImplementation.class;
+    }
+
+    public POJOImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+    
+        // Read an <implementation.pojo> element
+        
+        // Read the POJO class attribute.
+        String className = reader.getAttributeValue(null, "class");
+
+        // Create the POJO implementation model
+        POJOImplementation implementation = pojoImplementationFactory.createPOJOImplementation();
+        implementation.setPOJOName(className);
+        
+        // Mark the POJO model unresolved to track the fact that it's not
+        // completely initialized, its class is not loaded yet and services
+        // and references not initialized either
+        implementation.setUnresolved(true);
+        
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && IMPLEMENTATION_POJO.equals(reader.getName())) {
+                break;
+            }
+        }
+        
+        return implementation;
+    }
+
+    public void resolve(POJOImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+        
+        // Resolve the POJO implementation
+        
+        // First resolve its class
+        ClassReference classReference = new ClassReference(implementation.getPOJOName());
+        classReference = resolver.resolveModel(ClassReference.class, classReference);
+        Class pojoClass = classReference.getJavaClass();
+        if (pojoClass == null) {
+            throw new ContributionResolveException("Class could not be resolved: " + implementation.getPOJOName());
+        }
+        implementation.setPOJOClass(pojoClass);
+        
+        // Check to see if we have a .componentType file describing the POJO class
+        ComponentType componentType = assemblyFactory.createComponentType();
+        componentType.setUnresolved(true);
+        componentType.setURI(implementation.getURI() + ".componentType");
+        componentType = resolver.resolveModel(ComponentType.class, componentType);
+        if (!componentType.isUnresolved()) {
+            
+            // We have a component type description, merge it into the POJO model
+            implementation.getServices().addAll(componentType.getServices());
+            implementation.getReferences().addAll(componentType.getReferences());
+            implementation.getProperties().addAll(componentType.getProperties());
+            
+        } else {
+            
+            // We have no component type description, simply introspect the POJO and
+            // create a single Service for it
+            Service service = assemblyFactory.createService();
+            service.setName(pojoClass.getSimpleName());
+            JavaInterface javaInterface;
+            try {
+                javaInterface = javaFactory.createJavaInterface(pojoClass);
+            } catch (InvalidInterfaceException e) {
+                throw new ContributionResolveException(e);
+            }
+            JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+            interfaceContract.setInterface(javaInterface);
+            service.setInterfaceContract(interfaceContract);
+            implementation.getServices().add(service);
+        }
+        
+        // Mark the implementation resolved now
+        implementation.setUnresolved(false);
+    }
+
+    public void write(POJOImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+    }
+}

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java?rev=567588&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java (added)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java Mon Aug 20 01:15:29 2007
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package pojo.provider;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+class POJOImplementationInvoker implements Invoker {
+
+    private Object pojoInstance;
+    private Method method;
+    
+    POJOImplementationInvoker(Object pojoInstance, Operation operation, Method method) {
+        this.pojoInstance = pojoInstance;
+        this.method = method;
+    }
+    
+    public Message invoke(Message msg) {
+        try {
+            msg.setBody(method.invoke(pojoInstance, (Object[])msg.getBody()));
+        } catch (InvocationTargetException e) {
+            msg.setFaultBody(e);
+        } catch (Exception e) {
+            throw new ServiceRuntimeException(e);
+        }
+        return msg;
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
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