You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/08/19 00:19:06 UTC

svn commit: r432747 [1/2] - in /incubator/tuscany/java/sca/containers/container.spring/src: main/java/org/apache/tuscany/container/spring/config/ main/java/org/apache/tuscany/container/spring/impl/ main/java/org/apache/tuscany/container/spring/model/ m...

Author: jmarino
Date: Fri Aug 18 15:19:01 2006
New Revision: 432747

URL: http://svn.apache.org/viewvc?rev=432747&view=rev
Log:
reformat to pass checkstyle

Modified:
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/DefaultScaAdapter.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapter.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterAware.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterPostProcessor.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaComposite.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPostProcessor.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPropertyProxyFactoryBean.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceExporter.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceProxyFactoryBean.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaCompositeBeanDefinitionParser.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaContextBuilder.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaNamespaceHandler.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaPropertyBeanDefinitionParser.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaReferenceBeanDefinitionParser.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaServiceBeanDefinitionParser.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/intercept/OneWayAdvisor.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/metadata/AnnotationServiceMetadata.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/metadata/BeanFactoryDeploymentMetadata.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/metadata/DeploymentMetadata.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/metadata/FieldInjection.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/metadata/Injection.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/metadata/MethodInjection.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/metadata/NoSuchServiceException.java
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/metadata/ServiceMetadata.java
    incubator/tuscany/java/sca/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringConfigSchemaTestCase.java
    incubator/tuscany/java/sca/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ReferenceInvocationTestCase.java
    incubator/tuscany/java/sca/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ServiceInvocationTestCase.java

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/config/ScaApplicationContext.java Fri Aug 18 15:19:01 2006
@@ -16,49 +16,50 @@
  */
 package org.apache.tuscany.container.spring.config;
 
-import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.apache.tuscany.spi.model.CompositeComponentType;
+
+import org.apache.tuscany.container.spring.impl.SpringScaAdapter;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
 import org.springframework.core.io.Resource;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.BeansException;
 import org.springframework.sca.ScaAdapterAware;
 import org.springframework.sca.ScaAdapterPostProcessor;
-import org.apache.tuscany.spi.model.CompositeComponentType;
-import org.apache.tuscany.container.spring.impl.SpringScaAdapter;
 
 /**
  * @author Andy Piper
  * @since 2.1
  */
-public class ScaApplicationContext extends AbstractXmlApplicationContext
-{
-  private Resource appXml;
-  private CompositeComponentType componentType;
-
-  public ScaApplicationContext(Resource appXml, CompositeComponentType componentType) {
-    this(null, appXml, componentType);
-  }
-
-  public ScaApplicationContext(ApplicationContext parent, Resource appXml, CompositeComponentType componentType) {
-    super(parent);
-    this.appXml = appXml;
-    this.componentType = componentType;
-    refresh();
-  }
-
-  protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
-    // beanDefinitionReader.setEntityResolver(null);
-    beanDefinitionReader.setNamespaceHandlerResolver(new SCANamespaceHandlerResolver(getClassLoader(), componentType));
-  }
-
-  protected Resource[] getConfigResources() {
-    return new Resource[] { appXml };
-  }
-
-  protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
-    super.postProcessBeanFactory(beanFactory);
-    beanFactory.addBeanPostProcessor(new ScaAdapterPostProcessor(new SpringScaAdapter(componentType)));
-    beanFactory.ignoreDependencyInterface(ScaAdapterAware.class);
-  }
+public class ScaApplicationContext extends AbstractXmlApplicationContext {
+    private Resource appXml;
+    private CompositeComponentType componentType;
+
+    public ScaApplicationContext(Resource appXml, CompositeComponentType componentType) {
+        this(null, appXml, componentType);
+    }
+
+    public ScaApplicationContext(ApplicationContext parent, Resource appXml, CompositeComponentType componentType) {
+        super(parent);
+        this.appXml = appXml;
+        this.componentType = componentType;
+        refresh();
+    }
+
+    protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) {
+        // beanDefinitionReader.setEntityResolver(null);
+        beanDefinitionReader
+            .setNamespaceHandlerResolver(new SCANamespaceHandlerResolver(getClassLoader(), componentType));
+    }
+
+    protected Resource[] getConfigResources() {
+        return new Resource[]{appXml};
+    }
+
+    protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+        super.postProcessBeanFactory(beanFactory);
+        beanFactory.addBeanPostProcessor(new ScaAdapterPostProcessor(new SpringScaAdapter(componentType)));
+        beanFactory.ignoreDependencyInterface(ScaAdapterAware.class);
+    }
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringComponentTypeLoader.java Fri Aug 18 15:19:01 2006
@@ -18,16 +18,18 @@
  */
 package org.apache.tuscany.container.spring.impl;
 
-import org.apache.tuscany.container.spring.config.ScaApplicationContext;
-import org.apache.tuscany.container.spring.model.SpringComponentType;
-import org.apache.tuscany.container.spring.model.SpringImplementation;
+import org.osoa.sca.annotations.Constructor;
+
 import org.apache.tuscany.spi.annotation.Autowire;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.extension.ComponentTypeLoaderExtension;
 import org.apache.tuscany.spi.loader.LoaderException;
 import org.apache.tuscany.spi.loader.LoaderRegistry;
-import org.osoa.sca.annotations.Constructor;
+
+import org.apache.tuscany.container.spring.config.ScaApplicationContext;
+import org.apache.tuscany.container.spring.model.SpringComponentType;
+import org.apache.tuscany.container.spring.model.SpringImplementation;
 import org.springframework.context.support.AbstractRefreshableApplicationContext;
 import org.springframework.core.io.Resource;
 import org.springframework.sca.ScaServiceExporter;
@@ -39,64 +41,63 @@
  * @version $$Rev$$ $$Date$$
  */
 
-public class SpringComponentTypeLoader extends ComponentTypeLoaderExtension<SpringImplementation>
-{
-  public static final String SERVICE_BEAN_SUFFIX = ".SCAService";
-
-  @Constructor
-  public SpringComponentTypeLoader(@Autowire LoaderRegistry loaderRegistry) {
-    super(loaderRegistry);
-  }
-
-  @Override
-  protected Class<SpringImplementation> getImplementationClass() {
-    return SpringImplementation.class;
-  }
-
-  /**
-   * Responsible for loading the Spring composite component type. The the application context is instantiated here as
-   * it is needed to derive component type information. Since the component type is loaded per SCDL entry (i.e.
-   * composite use) one application context instance will be created per Spring composite instance.
-   */
-  @SuppressWarnings("unchecked")
-  public void load(CompositeComponent<?> parent,
-                   SpringImplementation implementation,
-                   DeploymentContext deploymentContext) throws LoaderException {
-    if (implementation.getComponentType() != null) {
-      // FIXME hack since the builder registry loads the implementation type and the Spring implementation loader
-      // needs to as well. The second call is done by the builder registry and we just ignore it.
-      return;
+public class SpringComponentTypeLoader extends ComponentTypeLoaderExtension<SpringImplementation> {
+    public static final String SERVICE_BEAN_SUFFIX = ".SCAService";
+
+    @Constructor
+    public SpringComponentTypeLoader(@Autowire LoaderRegistry loaderRegistry) {
+        super(loaderRegistry);
     }
-    Resource resource = implementation.getApplicationResource();
-    SpringComponentType componentType = new SpringComponentType();
-    // REVIEW andyp -- pass in deploymentContext.getClassLoader()?
-    AbstractRefreshableApplicationContext ctx = new ScaApplicationContext(resource, componentType);
-    componentType.setApplicationContext(ctx); // FIXME andyp@bea.com -- don't do this!
-
-    // If there are <sca:service> elements, they define (and limit) the services exposed
-    // in the componentType.
-    String [] serviceBeanNames = ctx.getBeanNamesForType(ScaServiceExporter.class);
-    for (String serviceBeanName : serviceBeanNames) {
-      int nSuffix = serviceBeanName.indexOf(SERVICE_BEAN_SUFFIX);
-      if (nSuffix == -1) {
-        continue;
-      }
-
-      String serviceName = serviceBeanName.substring(0, nSuffix);
-      ScaServiceExporter serviceBean = (ScaServiceExporter) ctx.getBean(serviceName);
-      // REVIEW andyp -- use the class directly?
-      String serviceTypeName = serviceBean.getServiceType().getName();
-      try {
-        Class serviceInterface = Class.forName(serviceTypeName, true, deploymentContext.getClassLoader());
-        componentType.addServiceType(serviceName, serviceInterface);
-        //ServiceDefinition service = createService(serviceInterface);
-        //componentType.getServices().put(serviceName, service);
-      } catch (ClassNotFoundException e) {
-        throw new LoaderException(e);
-      }
+
+    @Override
+    protected Class<SpringImplementation> getImplementationClass() {
+        return SpringImplementation.class;
+    }
+
+    /**
+     * Responsible for loading the Spring composite component type. The the application context is instantiated here as
+     * it is needed to derive component type information. Since the component type is loaded per SCDL entry (i.e.
+     * composite use) one application context instance will be created per Spring composite instance.
+     */
+    @SuppressWarnings("unchecked")
+    public void load(CompositeComponent<?> parent,
+                     SpringImplementation implementation,
+                     DeploymentContext deploymentContext) throws LoaderException {
+        if (implementation.getComponentType() != null) {
+            // FIXME hack since the builder registry loads the implementation type and the Spring implementation loader
+            // needs to as well. The second call is done by the builder registry and we just ignore it.
+            return;
+        }
+        Resource resource = implementation.getApplicationResource();
+        SpringComponentType componentType = new SpringComponentType();
+        // REVIEW andyp -- pass in deploymentContext.getClassLoader()?
+        AbstractRefreshableApplicationContext ctx = new ScaApplicationContext(resource, componentType);
+        componentType.setApplicationContext(ctx); // FIXME andyp@bea.com -- don't do this!
+
+        // If there are <sca:service> elements, they define (and limit) the services exposed
+        // in the componentType.
+        String [] serviceBeanNames = ctx.getBeanNamesForType(ScaServiceExporter.class);
+        for (String serviceBeanName : serviceBeanNames) {
+            int nSuffix = serviceBeanName.indexOf(SERVICE_BEAN_SUFFIX);
+            if (nSuffix == -1) {
+                continue;
+            }
+
+            String serviceName = serviceBeanName.substring(0, nSuffix);
+            ScaServiceExporter serviceBean = (ScaServiceExporter) ctx.getBean(serviceName);
+            // REVIEW andyp -- use the class directly?
+            String serviceTypeName = serviceBean.getServiceType().getName();
+            try {
+                Class serviceInterface = Class.forName(serviceTypeName, true, deploymentContext.getClassLoader());
+                componentType.addServiceType(serviceName, serviceInterface);
+                //ServiceDefinition service = createService(serviceInterface);
+                //componentType.getServices().put(serviceName, service);
+            } catch (ClassNotFoundException e) {
+                throw new LoaderException(e);
+            }
+        }
+        // if no service tags are specified, expose all beans
+        componentType.setExposeAllBeans(componentType.getServiceTypes().isEmpty());
+        implementation.setComponentType(componentType);
     }
-    // if no service tags are specified, expose all beans
-    componentType.setExposeAllBeans(componentType.getServiceTypes().isEmpty());
-    implementation.setComponentType(componentType);
-  }
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilder.java Fri Aug 18 15:19:01 2006
@@ -37,8 +37,6 @@
 import org.apache.tuscany.spi.wire.InboundWire;
 
 import org.apache.tuscany.container.spring.model.SpringImplementation;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.AbstractApplicationContext;
 
 /**

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringScaAdapter.java Fri Aug 18 15:19:01 2006
@@ -16,30 +16,32 @@
  */
 package org.apache.tuscany.container.spring.impl;
 
-import org.springframework.sca.ScaAdapter;
 import org.apache.tuscany.spi.model.CompositeComponentType;
 
+import org.springframework.sca.ScaAdapter;
+
 /**
  * @author Andy Piper
  * @since 2.1
  */
-public class SpringScaAdapter implements ScaAdapter
-{
-  private final CompositeComponentType componentType;
-
-  public SpringScaAdapter(CompositeComponentType componentType) {
-    this.componentType = componentType;
-  }
-
-  public Object getServiceReference(String referenceName, Class referenceType, String moduleName, String defaultServiceName) {
-    return null;
-  }
-
-  public Object getPropertyReference(String propertyName, Class propertyType, String moduleName) {
-    return null;
-  }
-
-  public void publishAsService(Object serviceImplementation, Class serviceInterface, String serviceName, String moduleName) {
-    // componentType.getServices().put(serviceName, serviceImplementation);
-  }
+public class SpringScaAdapter implements ScaAdapter {
+    private final CompositeComponentType componentType;
+
+    public SpringScaAdapter(CompositeComponentType componentType) {
+        this.componentType = componentType;
+    }
+
+    public Object getServiceReference(String referenceName, Class referenceType, String moduleName,
+                                      String defaultServiceName) {
+        return null;
+    }
+
+    public Object getPropertyReference(String propertyName, Class propertyType, String moduleName) {
+        return null;
+    }
+
+    public void publishAsService(Object serviceImplementation, Class serviceInterface, String serviceName,
+                                 String moduleName) {
+        // componentType.getServices().put(serviceName, serviceImplementation);
+    }
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/model/SpringComponentType.java Fri Aug 18 15:19:01 2006
@@ -25,6 +25,7 @@
 import org.apache.tuscany.spi.model.Property;
 import org.apache.tuscany.spi.model.ReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceDefinition;
+
 import org.springframework.context.support.AbstractApplicationContext;
 
 /**
@@ -35,67 +36,66 @@
  */
 public class SpringComponentType<S extends ServiceDefinition,
     R extends ReferenceDefinition,
-    P extends Property<?>> extends CompositeComponentType<S, R, P>
-{
+    P extends Property<?>> extends CompositeComponentType<S, R, P> {
 
-  private AbstractApplicationContext applicationContext;
-  private Map<String, Class<?>> serviceTypes = new HashMap<String, Class<?>>();
-  private boolean exposeAllBeans;
-
-  public SpringComponentType(AbstractApplicationContext applicationContext) {
-    this.applicationContext = applicationContext;
-  }
-
-  public SpringComponentType() {
-  }
-
-  // FIXME andyp@bea.com -- this is a component type it should NOT contain bean instances!
-
-  /**
-   * Returns the application context for the component type
-   */
-  public AbstractApplicationContext getApplicationContext() {
-    return applicationContext;
-  }
-
-  public void setApplicationContext(AbstractApplicationContext applicationContext) {
-    this.applicationContext = applicationContext;
-  }
-
-  /**
-   * Returns a collection of service types defined by <code>sca:service</code> elements in a Spring configuration.
-   * Service types define beans that can be targets of services defined in the SCDL Spring composite declaration. For
-   * each service type, there must be a corresponding service definition as part of the Spring composite declaration
-   * per the SCA specification.
-   */
-  public Map<String, Class<?>> getServiceTypes() {
-    return serviceTypes;
-  }
-
-  /**
-   * Adds a service type to the component declaration defined by <code>sca:service</code> elements in a Spring
-   * configuration.
-   *
-   * @param name the name of the service
-   * @param type the interface type of the target bean
-   */
-  public void addServiceType(String name, Class<?> type) {
-    this.serviceTypes.put(name, type);
-  }
-
-  /**
-   * Returns true if all beans in the Spring application context may be service targets or false if service types are
-   * defined
-   */
-  public boolean isExposeAllBeans() {
-    return exposeAllBeans;
-  }
-
-  /**
-   * Sets if all beans in the Spring application context may be service targets or false if service types are defined
-   */
-  public void setExposeAllBeans(boolean exposeAllBeans) {
-    this.exposeAllBeans = exposeAllBeans;
-  }
+    private AbstractApplicationContext applicationContext;
+    private Map<String, Class<?>> serviceTypes = new HashMap<String, Class<?>>();
+    private boolean exposeAllBeans;
+
+    public SpringComponentType(AbstractApplicationContext applicationContext) {
+        this.applicationContext = applicationContext;
+    }
+
+    public SpringComponentType() {
+    }
+
+    // FIXME andyp@bea.com -- this is a component type it should NOT contain bean instances!
+
+    /**
+     * Returns the application context for the component type
+     */
+    public AbstractApplicationContext getApplicationContext() {
+        return applicationContext;
+    }
+
+    public void setApplicationContext(AbstractApplicationContext applicationContext) {
+        this.applicationContext = applicationContext;
+    }
+
+    /**
+     * Returns a collection of service types defined by <code>sca:service</code> elements in a Spring configuration.
+     * Service types define beans that can be targets of services defined in the SCDL Spring composite declaration. For
+     * each service type, there must be a corresponding service definition as part of the Spring composite declaration
+     * per the SCA specification.
+     */
+    public Map<String, Class<?>> getServiceTypes() {
+        return serviceTypes;
+    }
+
+    /**
+     * Adds a service type to the component declaration defined by <code>sca:service</code> elements in a Spring
+     * configuration.
+     *
+     * @param name the name of the service
+     * @param type the interface type of the target bean
+     */
+    public void addServiceType(String name, Class<?> type) {
+        this.serviceTypes.put(name, type);
+    }
+
+    /**
+     * Returns true if all beans in the Spring application context may be service targets or false if service types are
+     * defined
+     */
+    public boolean isExposeAllBeans() {
+        return exposeAllBeans;
+    }
+
+    /**
+     * Sets if all beans in the Spring application context may be service targets or false if service types are defined
+     */
+    public void setExposeAllBeans(boolean exposeAllBeans) {
+        this.exposeAllBeans = exposeAllBeans;
+    }
 
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/DefaultScaAdapter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/DefaultScaAdapter.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/DefaultScaAdapter.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/DefaultScaAdapter.java Fri Aug 18 15:19:01 2006
@@ -22,31 +22,25 @@
  * @since 2.0
  */
 public class DefaultScaAdapter implements ScaAdapter {
-	
-	/* (non-Javadoc)
-	 * @see org.springframework.sca.ScaAdapter#getServiceReference(java.lang.String, java.lang.Class, java.lang.String, java.lang.String)
-	 */
-	public Object getServiceReference(String referenceName,
-			Class referenceType, String moduleName, String defaultServiceName) {
-		// TODO
-		return new Object();
-	}
 
-	/* (non-Javadoc)
-	 * @see org.springframework.sca.ScaAdapter#getPropertyReference(java.lang.String, java.lang.Class, java.lang.String)
-	 */
-	public Object getPropertyReference(String propertyName, Class propertyType,
-			String moduleName) {
-		// TODO
-		return new Object();
-	}
+    public Object getServiceReference(String referenceName,
+                                      Class referenceType,
+                                      String moduleName,
+                                      String defaultServiceName) {
+        // TODO
+        return new Object();
+    }
 
-	/* (non-Javadoc)
-	 * @see org.springframework.sca.ScaAdapter#publishAsService(java.lang.Object, java.lang.Class, java.lang.String, java.lang.String)
-	 */
-	public void publishAsService(Object serviceImplementation,
-			Class serviceInterface, String serviceName, String moduleName) {
-		// TODO
-	}
+    public Object getPropertyReference(String propertyName, Class propertyType, String moduleName) {
+        // TODO
+        return new Object();
+    }
+
+    public void publishAsService(Object serviceImplementation,
+                                 Class serviceInterface,
+                                 String serviceName,
+                                 String moduleName) {
+        // TODO
+    }
 
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapter.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapter.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapter.java Fri Aug 18 15:19:01 2006
@@ -19,27 +19,27 @@
 
 /**
  * Encapsulates interaction with an SCA runtime
- * 
+ *
  * @author Adrian Colyer
  * @since 2.0
  */
 public interface ScaAdapter {
 
-	Object getServiceReference(
-			String referenceName, 
-			Class referenceType, 
-			String moduleName,
-			String defaultServiceName);
-	
-	Object getPropertyReference(
-			String propertyName,
-			Class propertyType,
-			String moduleName);
-	
-	void publishAsService(
-			Object serviceImplementation,
-			Class serviceInterface,
-			String serviceName,
-			String moduleName);
-	
+    Object getServiceReference(
+        String referenceName,
+        Class referenceType,
+        String moduleName,
+        String defaultServiceName);
+
+    Object getPropertyReference(
+        String propertyName,
+        Class propertyType,
+        String moduleName);
+
+    void publishAsService(
+        Object serviceImplementation,
+        Class serviceInterface,
+        String serviceName,
+        String moduleName);
+
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterAware.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterAware.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterAware.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterAware.java Fri Aug 18 15:19:01 2006
@@ -1,18 +1,13 @@
 package org.springframework.sca;
 
 /**
-
-/**
- * Interface that enables beans to find the ScaAdapter they are
- * defined with.
- *
- * Note that in most circumstances there is no need for a bean to
- * implement this interface.
+ * /** Interface that enables beans to find the ScaAdapter they are defined with.
+ * <p/>
+ * Note that in most circumstances there is no need for a bean to implement this interface.
  *
  * @author Andy Piper
  * @since 2.1
  */
-public interface ScaAdapterAware
-{
-  void setScaAdapter(ScaAdapter adapter);
+public interface ScaAdapterAware {
+    void setScaAdapter(ScaAdapter adapter);
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterPostProcessor.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterPostProcessor.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaAdapterPostProcessor.java Fri Aug 18 15:19:01 2006
@@ -23,31 +23,30 @@
  * @author Andy Piper
  * @since 2.1
  */
-public class ScaAdapterPostProcessor implements BeanPostProcessor
-{
-  private ScaAdapter scaAdapter;
+public class ScaAdapterPostProcessor implements BeanPostProcessor {
+    private ScaAdapter scaAdapter;
 
-  public ScaAdapterPostProcessor(ScaAdapter adapter) {
-    this.scaAdapter = adapter;
-  }
+    public ScaAdapterPostProcessor(ScaAdapter adapter) {
+        this.scaAdapter = adapter;
+    }
 
-  public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
-    if (bean instanceof ScaAdapterAware) {
-      if (this.scaAdapter == null) {
-        throw new IllegalStateException("Cannot satisfy ScaAdapterAware for bean '" +
-            beanName + "' without ScaAdapater");
-      }
-      ((ScaAdapterAware) bean).setScaAdapter(scaAdapter);
+    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
+        if (bean instanceof ScaAdapterAware) {
+            if (this.scaAdapter == null) {
+                throw new IllegalStateException("Cannot satisfy ScaAdapterAware for bean '"
+                    + beanName + "' without ScaAdapater");
+            }
+            ((ScaAdapterAware) bean).setScaAdapter(scaAdapter);
+        }
+        return bean;
     }
-    return bean;
-  }
 
-  public Object postProcessAfterInitialization(Object object, String string) throws BeansException {
-    return object;
-  }
+    public Object postProcessAfterInitialization(Object object, String string) throws BeansException {
+        return object;
+    }
 
-  public ScaAdapter getScaAdapter() {
-    return scaAdapter;
-  }
+    public ScaAdapter getScaAdapter() {
+        return scaAdapter;
+    }
 
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaComposite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaComposite.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaComposite.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaComposite.java Fri Aug 18 15:19:01 2006
@@ -20,61 +20,58 @@
 import org.springframework.beans.factory.InitializingBean;
 
 /**
- * Bean that represents an Sca composite component.
- * An instance of this bean is created when the
- * &lt;sca:composite module-id="xxx"/&gt; element
- * is declared.
+ * Bean that represents an Sca composite component. An instance of this bean is created when the &lt;sca:composite
+ * module-id="xxx"/&gt; element is declared.
  *
  * @author Adrian Colyer
  * @since 2.0
  */
 public class ScaComposite implements InitializingBean {
 
-	private String component;
-	private ScaAdapter scaAdapter = new DefaultScaAdapter();
+    private String component;
+    private ScaAdapter scaAdapter = new DefaultScaAdapter();
 
-	public String getComponent() {
-		return this.component;
-	}
-
-	public void setComponent(String component) {
-		this.component = component;
-	}
-
-	public void setScaAdapter(ScaAdapter scaAdapter) {
-	    this.scaAdapter = scaAdapter;
-	}
-
-	public void setScaAdapterClass(Class adapterClass) {
-		if (!ScaAdapter.class.isAssignableFrom(adapterClass)) {
-			throw new IllegalArgumentException(
-					"Adapter class '" + adapterClass + "' specified for ScaComposite bean " +
-					"does not implement the ScaApapter interface"
-					);
-		}
-		try {
-			this.scaAdapter = (ScaAdapter) adapterClass.newInstance();
-		}
-		catch(Exception ex) {
-			// many exceptions may be thrown by the above, we treat them all
-			// the same
-			throw new IllegalStateException("Unable to create instance of ScaAdapter class '" +
-					adapterClass.getName() + "'",ex);
-		}
-	}
-
-	public ScaAdapter getScaAdapter() {
-		return this.scaAdapter ;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
-	 */
-	public void afterPropertiesSet() throws Exception {
-		if (this.component == null) {
-			throw new IllegalArgumentException("Required property moduleId was not set");
-		}
-	}
+    public String getComponent() {
+        return this.component;
+    }
+
+    public void setComponent(String component) {
+        this.component = component;
+    }
+
+    public void setScaAdapter(ScaAdapter scaAdapter) {
+        this.scaAdapter = scaAdapter;
+    }
+
+    public void setScaAdapterClass(Class adapterClass) {
+        if (!ScaAdapter.class.isAssignableFrom(adapterClass)) {
+            throw new IllegalArgumentException(
+                "Adapter class '" + adapterClass + "' specified for ScaComposite bean "
+                    + "does not implement the ScaApapter interface"
+            );
+        }
+        try {
+            this.scaAdapter = (ScaAdapter) adapterClass.newInstance();
+        } catch (Exception ex) {
+            // many exceptions may be thrown by the above, we treat them all
+            // the same
+            throw new IllegalStateException("Unable to create instance of ScaAdapter class '"
+                + adapterClass.getName() + "'", ex);
+        }
+    }
+
+    public ScaAdapter getScaAdapter() {
+        return this.scaAdapter;
+    }
+
+    /* (non-Javadoc)
+      * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
+      */
+    public void afterPropertiesSet() throws Exception {
+        if (this.component == null) {
+            throw new IllegalArgumentException("Required property moduleId was not set");
+        }
+    }
 
 
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPostProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPostProcessor.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPostProcessor.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPostProcessor.java Fri Aug 18 15:19:01 2006
@@ -30,111 +30,111 @@
 import org.springframework.sca.metadata.ServiceMetadata;
 
 /**
- * Spring bean post processor that looks up service metadata by
- * name for each bean definition and performs SCA injection.
- * <p>
+ * Spring bean post processor that looks up service metadata by name for each bean definition and performs SCA
+ * injection.
+ * <p/>
  * Also performs proxying for OneWay.
+ *
  * @author Rod Johnson
  */
 public class ScaPostProcessor implements InstantiationAwareBeanPostProcessor, ApplicationContextAware {
-	
-	private DeploymentMetadata deploymentMetadata;
-	
-	private ApplicationContext applicationContext;
-	
-	private TaskExecutor taskExecutor;
-	
-	private ScaAdapter scaAdapter;
-	
-	
-	/**
-	 * @param taskExecutor The taskExecutor to set.
-	 */
-	public void setTaskExecutor(TaskExecutor taskExecutor) {
-		this.taskExecutor = taskExecutor;
-	}
-	
-	// TODO would process side files when container starts up
-
-	public void setDeploymentMetadata(DeploymentMetadata deploymentMetadata) {
-		this.deploymentMetadata = deploymentMetadata;
-	}
-	
-	/**
-	 * @param scaAdapter the ScaAdapter for use to export services if necessary
-	 */
-	public void setScaAdapter(ScaAdapter scaAdapter) {
-		this.scaAdapter = scaAdapter;
-	}
-	
-
-	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-		this.applicationContext = applicationContext;
-	}
-
-	public Object postProcessBeforeInstantiation(Class beanClass,
-			String beanName) throws BeansException {
-		return null;
-	}
-
-	public boolean postProcessAfterInstantiation(Object bean, String beanName)
-			throws BeansException {
-		try {
-			ServiceMetadata smd = deploymentMetadata.getServiceMetadata(beanName);
-			doScaInjection(bean, smd);
-		}
-		catch (NoSuchServiceException ex) {
-			//
-		}
-		return true;
-	}
-
-  public PropertyValues postProcessPropertyValues(PropertyValues propertyValues, Object object, String string) throws BeansException {
-    return propertyValues;
-  }
-
-  protected void doScaInjection(Object bean, ServiceMetadata smd) {
-    for (Injection injection : smd.getInjections()) {
-      injection.apply(applicationContext, bean);
-    }
-  }
-
-	public Object postProcessBeforeInitialization(Object bean, String beanName)
-			throws BeansException {
-		return bean;
-	}
-
-	public Object postProcessAfterInitialization(Object bean, String beanName)
-			throws BeansException {
-		try {
-			ServiceMetadata smd = deploymentMetadata.getServiceMetadata(beanName);
-			return createScaProxy(bean, smd);
-		}
-		catch (NoSuchServiceException ex) {
-			return bean;
-		}
-		
-		// TODO validate required injections here or earlier
-		
-		// TODO publish if necessary, using adapter
-	}
-	
-	protected Object createScaProxy(Object bean, ServiceMetadata smd) {
-		ProxyFactory pf = new ProxyFactory(bean);
-		for (Class intf : smd.getServiceInterfaces()) {
-			pf.addInterface(intf);
-		}
-		
-//		pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
-//		pf.addAdvisor(new ExposeBeanNameAdvisor(smd.getServiceName()));
-		// TODO enforce call by value
-		
-		if (!smd.getOneWayMethods().isEmpty()) {
-			pf.addAdvisor(new OneWayAdvisor(smd, this.taskExecutor));
-		}
-		
-		return pf.getProxy();
-	}
-	
+
+    private DeploymentMetadata deploymentMetadata;
+
+    private ApplicationContext applicationContext;
+
+    private TaskExecutor taskExecutor;
+
+    private ScaAdapter scaAdapter;
+
+
+    /**
+     * @param taskExecutor The taskExecutor to set.
+     */
+    public void setTaskExecutor(TaskExecutor taskExecutor) {
+        this.taskExecutor = taskExecutor;
+    }
+
+    // TODO would process side files when container starts up
+
+    public void setDeploymentMetadata(DeploymentMetadata deploymentMetadata) {
+        this.deploymentMetadata = deploymentMetadata;
+    }
+
+    /**
+     * @param scaAdapter the ScaAdapter for use to export services if necessary
+     */
+    public void setScaAdapter(ScaAdapter scaAdapter) {
+        this.scaAdapter = scaAdapter;
+    }
+
+
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        this.applicationContext = applicationContext;
+    }
+
+    public Object postProcessBeforeInstantiation(Class beanClass,
+                                                 String beanName) throws BeansException {
+        return null;
+    }
+
+    public boolean postProcessAfterInstantiation(Object bean, String beanName)
+        throws BeansException {
+        try {
+            ServiceMetadata smd = deploymentMetadata.getServiceMetadata(beanName);
+            doScaInjection(bean, smd);
+        } catch (NoSuchServiceException ex) {
+            //
+        }
+        return true;
+    }
+
+    public PropertyValues postProcessPropertyValues(PropertyValues propertyValues, Object object, String string)
+        throws BeansException {
+        return propertyValues;
+    }
+
+    protected void doScaInjection(Object bean, ServiceMetadata smd) {
+        for (Injection injection : smd.getInjections()) {
+            injection.apply(applicationContext, bean);
+        }
+    }
+
+    public Object postProcessBeforeInitialization(Object bean, String beanName)
+        throws BeansException {
+        return bean;
+    }
+
+    public Object postProcessAfterInitialization(Object bean, String beanName)
+        throws BeansException {
+        try {
+            ServiceMetadata smd = deploymentMetadata.getServiceMetadata(beanName);
+            return createScaProxy(bean, smd);
+        } catch (NoSuchServiceException ex) {
+            return bean;
+        }
+
+        // TODO validate required injections here or earlier
+
+        // TODO publish if necessary, using adapter
+    }
+
+    protected Object createScaProxy(Object bean, ServiceMetadata smd) {
+        ProxyFactory pf = new ProxyFactory(bean);
+        for (Class intf : smd.getServiceInterfaces()) {
+            pf.addInterface(intf);
+        }
+
+//pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
+//pf.addAdvisor(new ExposeBeanNameAdvisor(smd.getServiceName()));
+        // TODO enforce call by value
+
+        if (!smd.getOneWayMethods().isEmpty()) {
+            pf.addAdvisor(new OneWayAdvisor(smd, this.taskExecutor));
+        }
+
+        return pf.getProxy();
+    }
+
 
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPropertyProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPropertyProxyFactoryBean.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPropertyProxyFactoryBean.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaPropertyProxyFactoryBean.java Fri Aug 18 15:19:01 2006
@@ -21,100 +21,103 @@
 import org.springframework.beans.factory.InitializingBean;
 
 /**
- * Factory bean that returns a reference to an SCA property
- * obtained by asking the SCA runtime for the property with
- * the given name for the given component.
- * 
+ * Factory bean that returns a reference to an SCA property obtained by asking the SCA runtime for the property with the
+ * given name for the given component.
+ *
  * @author Adrian Colyer
  * @since 2.0
  */
 public class ScaPropertyProxyFactoryBean implements InitializingBean, FactoryBean {
 
-	/** the type of the property */
-	private Class propertyType;
-	
-	/** the name of the property to look up */
-	private String propertyName;
-	
-	/** 
-	 * the SCA component we should present ourselves as when asking for
-	 * a service reference
-	 */
-	private ScaComposite scaComposite;
-	
-	private Object resolvedPropertyVal;
-	
-	public void setPropertyType(Class serviceType) {
-		this.propertyType = serviceType;
-	}
-
-	public Class getPropertyType() {
-		return this.propertyType;
-	}
-	
-	public void setPropertyName(String name) {
-		this.propertyName = name;
-	}
-	
-	public String getPropertyName() {
-		return this.propertyName;
-	}
-	
-	public void setScaComposite(ScaComposite scaComposite) {
-		this.scaComposite = scaComposite;
-	}
-	
-	public ScaComposite getScaComposite() {
-		return this.scaComposite;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
-	 */
-	public void afterPropertiesSet() throws Exception {
-		if (this.propertyType == null) {
-			throw new IllegalArgumentException("Required property serviceType was not set");
-		}
-		if (this.scaComposite == null) {
-			throw new IllegalArgumentException("Required property scaComposite was not set");
-		}
-		if (this.propertyName == null) {
-			throw new IllegalArgumentException("Required property referenceName was not set");
-		}		
-	}
-
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.FactoryBean#getObject()
-	 */
-	public Object getObject() throws Exception {
-		if (this.resolvedPropertyVal != null) {
-			return this.resolvedPropertyVal;
-		}
-		
-		String moduleName = this.scaComposite.getComponent();
-		// TODO: AMC is there any merit in proxying this with a lazy target source?
-		Object propertyVal = this.scaComposite.getScaAdapter().getPropertyReference(this.propertyName, this.propertyType, moduleName);
-		if (!this.propertyType.isAssignableFrom(propertyVal.getClass())) {
-			throw new IllegalStateException("Property value '" + propertyVal.toString() + "'" + 
-					" of type '" + propertyVal.getClass().getName() + "' " + 
-					" is not of expected type '" + this.propertyType.getName() + "'");
-		}
-		this.resolvedPropertyVal = propertyVal;
-		return this.resolvedPropertyVal;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.FactoryBean#getObjectType()
-	 */
-	public Class getObjectType() {
-		return this.propertyType;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.FactoryBean#isSingleton()
-	 */
-	public boolean isSingleton() {
-		return true;
-	}
-	
+    /**
+     * the type of the property
+     */
+    private Class propertyType;
+
+    /**
+     * the name of the property to look up
+     */
+    private String propertyName;
+
+    /**
+     * the SCA component we should present ourselves as when asking for a service reference
+     */
+    private ScaComposite scaComposite;
+
+    private Object resolvedPropertyVal;
+
+    public void setPropertyType(Class serviceType) {
+        this.propertyType = serviceType;
+    }
+
+    public Class getPropertyType() {
+        return this.propertyType;
+    }
+
+    public void setPropertyName(String name) {
+        this.propertyName = name;
+    }
+
+    public String getPropertyName() {
+        return this.propertyName;
+    }
+
+    public void setScaComposite(ScaComposite scaComposite) {
+        this.scaComposite = scaComposite;
+    }
+
+    public ScaComposite getScaComposite() {
+        return this.scaComposite;
+    }
+
+    /* (non-Javadoc)
+      * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
+      */
+    public void afterPropertiesSet() throws Exception {
+        if (this.propertyType == null) {
+            throw new IllegalArgumentException("Required property serviceType was not set");
+        }
+        if (this.scaComposite == null) {
+            throw new IllegalArgumentException("Required property scaComposite was not set");
+        }
+        if (this.propertyName == null) {
+            throw new IllegalArgumentException("Required property referenceName was not set");
+        }
+    }
+
+    /* (non-Javadoc)
+      * @see org.springframework.beans.factory.FactoryBean#getObject()
+      */
+    public Object getObject() throws Exception {
+        if (this.resolvedPropertyVal != null) {
+            return this.resolvedPropertyVal;
+        }
+
+        String moduleName = this.scaComposite.getComponent();
+        // TODO: AMC is there any merit in proxying this with a lazy target source?
+        Object propertyVal =
+            this.scaComposite.getScaAdapter().getPropertyReference(this.propertyName, this.propertyType, moduleName);
+        if (!this.propertyType.isAssignableFrom(propertyVal.getClass())) {
+            throw new IllegalStateException("Property value '" + propertyVal.toString() + "'"
+                + " of type '" + propertyVal.getClass().getName() + "' "
+                + " is not of expected type '" + this.propertyType.getName() + "'");
+        }
+        this.resolvedPropertyVal = propertyVal;
+        return this.resolvedPropertyVal;
+    }
+
+    /* (non-Javadoc)
+      * @see org.springframework.beans.factory.FactoryBean#getObjectType()
+      */
+    public Class getObjectType() {
+        return this.propertyType;
+    }
+
+    /* (non-Javadoc)
+      * @see org.springframework.beans.factory.FactoryBean#isSingleton()
+      */
+    public boolean isSingleton() {
+        return true;
+    }
+
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceExporter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceExporter.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceExporter.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceExporter.java Fri Aug 18 15:19:01 2006
@@ -24,80 +24,82 @@
 
 /**
  * Exposes a bean instance to SCA to using the given service name.
- * 
+ *
  * @author Adrian Colyer
  * @since 2.0
  */
 public class ScaServiceExporter implements InitializingBean, BeanFactoryAware, ScaAdapterAware {
 
-	/** the name of the service we want to advertise */
-	private String serviceName;
-	
-	/** the type the service should be published with */
-	private Class serviceType;
-	
-	/** the bean to be published */
-	private Object target;
-
-	/** for resolving the bean name */
-	private BeanFactory beanFactory;
-  private ScaAdapter scaAdapter;
-
-  public void setServiceName(String serviceName) {
-    this.serviceName = serviceName;
-  }
-	
-	public String getServiceName() {
-		return this.serviceName;
-	}
-
-	public void setServiceType(Class serviceType) {
-		this.serviceType = serviceType;
-	}
-	
-	public Class getServiceType() {
-		return this.serviceType;
-	}
-	
-	public void setTarget(Object targetBean) {
-		this.target = targetBean;
-	}
-	
-	public Object getTarget() {
-		return this.target;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
-	 */
-	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
-		this.beanFactory = beanFactory;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
-	 */
-	public void afterPropertiesSet() throws Exception {
-		if (this.serviceType == null) {
-			throw new IllegalArgumentException("Required property serviceType was not set");
-		}
-		if (this.target == null) {
-			throw new IllegalArgumentException("Required property target was not set");
-		}
-		if (this.beanFactory == null) {
-			throw new IllegalArgumentException("Required property beanFactory was not set");
-		}
-		if (this.serviceName == null) {
-			throw new IllegalArgumentException("Required property serviceName was not set");
-		}
-		publishScaService();
-	}
-
-	private void publishScaService() {
-    scaAdapter.publishAsService(target, serviceType, serviceName, null);
-  }
-
-  public void setScaAdapter(ScaAdapter adapter) {
-    this.scaAdapter = adapter;
-  }
+    /**
+     * the name of the service we want to advertise
+     */
+    private String serviceName;
+
+    /**
+     * the type the service should be published with
+     */
+    private Class serviceType;
+
+    /**
+     * the bean to be published
+     */
+    private Object target;
+
+    /**
+     * for resolving the bean name
+     */
+    private BeanFactory beanFactory;
+    private ScaAdapter scaAdapter;
+
+    public void setServiceName(String serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public String getServiceName() {
+        return this.serviceName;
+    }
+
+    public void setServiceType(Class serviceType) {
+        this.serviceType = serviceType;
+    }
+
+    public Class getServiceType() {
+        return this.serviceType;
+    }
+
+    public void setTarget(Object targetBean) {
+        this.target = targetBean;
+    }
+
+    public Object getTarget() {
+        return this.target;
+    }
+
+    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
+        this.beanFactory = beanFactory;
+    }
+
+    public void afterPropertiesSet() throws Exception {
+        if (this.serviceType == null) {
+            throw new IllegalArgumentException("Required property serviceType was not set");
+        }
+        if (this.target == null) {
+            throw new IllegalArgumentException("Required property target was not set");
+        }
+        if (this.beanFactory == null) {
+            throw new IllegalArgumentException("Required property beanFactory was not set");
+        }
+        if (this.serviceName == null) {
+            throw new IllegalArgumentException("Required property serviceName was not set");
+        }
+        publishScaService();
+    }
+
+    private void publishScaService() {
+        scaAdapter.publishAsService(target, serviceType, serviceName, null);
+    }
+
+    public void setScaAdapter(ScaAdapter adapter) {
+        this.scaAdapter = adapter;
+    }
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceProxyFactoryBean.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceProxyFactoryBean.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/ScaServiceProxyFactoryBean.java Fri Aug 18 15:19:01 2006
@@ -17,122 +17,127 @@
  */
 package org.springframework.sca;
 
+import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContextAware;
 import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
 
 /**
- * Factory bean that returns a reference to an SCA service
- * obtained by asking the SCA runtime for the service with
- * the given name for the given component.
- * 
+ * Factory bean that returns a reference to an SCA service obtained by asking the SCA runtime for the service with the
+ * given name for the given component.
+ *
  * @author Adrian Colyer
  * @since 2.0
  */
 public class ScaServiceProxyFactoryBean
-    implements InitializingBean, FactoryBean, ApplicationContextAware, ScaAdapterAware
-{
+    implements InitializingBean, FactoryBean, ApplicationContextAware, ScaAdapterAware {
 
-  /** the public interface type of the service (may be a class...) */
-  private Class serviceType;
+    /**
+     * the public interface type of the service (may be a class...)
+     */
+    private Class serviceType;
 
-  /** the name of the reference to look up */
-  private String referenceName;
+    /**
+     * the name of the reference to look up
+     */
+    private String referenceName;
 
-  /** the default service name to resolve the reference too */
-  private String defaultServiceName;
+    /**
+     * the default service name to resolve the reference too
+     */
+    private String defaultServiceName;
 
-  private Object resolvedServiceReference;
-  private ApplicationContext applicationContext;
-  private ScaAdapter scaAdapter;
+    private Object resolvedServiceReference;
+    private ApplicationContext applicationContext;
+    private ScaAdapter scaAdapter;
 
-  public void setServiceType(Class serviceType) {
-    this.serviceType = serviceType;
-  }
+    public void setServiceType(Class serviceType) {
+        this.serviceType = serviceType;
+    }
 
-  public Class getServiceType() {
-    return this.serviceType;
-  }
+    public Class getServiceType() {
+        return this.serviceType;
+    }
 
-  public void setReferenceName(String name) {
-    this.referenceName = name;
-  }
+    public void setReferenceName(String name) {
+        this.referenceName = name;
+    }
 
-  public String getReferenceName() {
-    return this.referenceName;
-  }
+    public String getReferenceName() {
+        return this.referenceName;
+    }
 
-  public void setDefaultServiceName(String defaultService) {
-    this.defaultServiceName = defaultService;
-  }
+    public void setDefaultServiceName(String defaultService) {
+        this.defaultServiceName = defaultService;
+    }
 
-  public String getDefaultServiceName() {
-    return this.defaultServiceName;
-  }
+    public String getDefaultServiceName() {
+        return this.defaultServiceName;
+    }
 
-  /* (non-Javadoc)
+    /* (non-Javadoc)
     * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
     */
-  public void afterPropertiesSet() throws Exception {
-    if (this.serviceType == null) {
-      throw new IllegalArgumentException("Required property serviceType was not set");
-    }
-    if (this.referenceName == null) {
-      throw new IllegalArgumentException("Required property referenceName was not set");
+    public void afterPropertiesSet() throws Exception {
+        if (this.serviceType == null) {
+            throw new IllegalArgumentException("Required property serviceType was not set");
+        }
+        if (this.referenceName == null) {
+            throw new IllegalArgumentException("Required property referenceName was not set");
+        }
     }
-  }
 
-  /* (non-Javadoc)
+    /* (non-Javadoc)
     * @see org.springframework.beans.factory.FactoryBean#getObject()
     */
-  public Object getObject() throws Exception {
-    if (this.resolvedServiceReference != null) {
-      return this.resolvedServiceReference;
-    }
-
-    // TODO: AMC is there any merit in proxying this with a lazy target source?
-    //       should the returned service ref be proxied? Only seems to add value
-    //       if SCA gives us any lifecycle events we can subscribe to and take
-    //       meaningful action on...
-    //       See OsgiServiceProxyFactoryBean for an example of how to do the
-    //       proxying if needed.
-    Object scaServiceRef;
-    if (this.applicationContext.getParent() == null) return null;
-
-    if (!this.applicationContext.getParent().containsBean(this.referenceName)) {
-      scaServiceRef = this.applicationContext.getParent().getBean(this.defaultServiceName);
-    }
-    else {
-      scaServiceRef = this.applicationContext.getParent().getBean(this.referenceName);
-    }
-    if (!this.serviceType.isAssignableFrom(scaServiceRef.getClass())) {
-      throw new IllegalStateException("...");
-    }
-    this.resolvedServiceReference = scaServiceRef;
-    return this.resolvedServiceReference;
-  }
+    public Object getObject() throws Exception {
+        if (this.resolvedServiceReference != null) {
+            return this.resolvedServiceReference;
+        }
+
+        // TODO: AMC is there any merit in proxying this with a lazy target source?
+        //       should the returned service ref be proxied? Only seems to add value
+        //       if SCA gives us any lifecycle events we can subscribe to and take
+        //       meaningful action on...
+        //       See OsgiServiceProxyFactoryBean for an example of how to do the
+        //       proxying if needed.
+        Object scaServiceRef;
+        if (this.applicationContext.getParent() == null) {
+            return null;
+        }
+
+        if (!this.applicationContext.getParent().containsBean(this.referenceName)) {
+            scaServiceRef = this.applicationContext.getParent().getBean(this.defaultServiceName);
+        } else {
+            scaServiceRef = this.applicationContext.getParent().getBean(this.referenceName);
+        }
+        if (!this.serviceType.isAssignableFrom(scaServiceRef.getClass())) {
+            throw new IllegalStateException("...");
+        }
+        this.resolvedServiceReference = scaServiceRef;
+        return this.resolvedServiceReference;
+    }
 
-  /* (non-Javadoc)
+    /* (non-Javadoc)
     * @see org.springframework.beans.factory.FactoryBean#getObjectType()
     */
-  public Class getObjectType() {
-    return this.serviceType;
-  }
+    public Class getObjectType() {
+        return this.serviceType;
+    }
 
-  /* (non-Javadoc)
+    /* (non-Javadoc)
     * @see org.springframework.beans.factory.FactoryBean#isSingleton()
     */
-  public boolean isSingleton() {
-    return true;
-  }
-
-  public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-    this.applicationContext = applicationContext;
-  }
-
-  public void setScaAdapter(ScaAdapter adapter) {
-   this.scaAdapter = adapter;
-  }
+    public boolean isSingleton() {
+        return true;
+    }
+
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        this.applicationContext = applicationContext;
+    }
+
+    public void setScaAdapter(ScaAdapter adapter) {
+        this.scaAdapter = adapter;
+    }
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaCompositeBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaCompositeBeanDefinitionParser.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaCompositeBeanDefinitionParser.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaCompositeBeanDefinitionParser.java Fri Aug 18 15:19:01 2006
@@ -17,6 +17,8 @@
  */
 package org.springframework.sca.config;
 
+import org.w3c.dom.Element;
+
 import org.springframework.beans.MutablePropertyValues;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
@@ -24,46 +26,42 @@
 import org.springframework.beans.factory.xml.BeanDefinitionParser;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.springframework.sca.ScaComposite;
-import org.w3c.dom.Element;
 
 /**
  * Parser for &lt;sca:composite&gt; elements
- * 
+ *
  * @author Adrian Colyer
  * @since 2.0
  */
 public class ScaCompositeBeanDefinitionParser implements BeanDefinitionParser {
 
-	static final String SCA_COMPOSITE_BEAN_NAME = "scaComposite";
-	private static final String MODULE_ATTRIBUTE_NAME = "component";
-	private static final String MODULE_ID = "component";
-	private static final String ADAPTER_ATTRIBUTE = "sca-adapter-class";
-	private static final String ADAPTER_CLASS_PROPERTY = "scaAdapterClass";
-	
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.xml.BeanDefinitionParser#parse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)
-	 */
-	public BeanDefinition parse(Element element, ParserContext parserContext) {
-		BeanDefinitionRegistry registry = parserContext.getRegistry();
-		if (registry.containsBeanDefinition(SCA_COMPOSITE_BEAN_NAME)) {
-			throw new IllegalArgumentException(
-					"At most one <sca:composite> element can be declared in a bean factory");
-		}
-		BeanDefinition beanDef = createScaCompositeBeanDefinition(element);
-		registry.registerBeanDefinition(SCA_COMPOSITE_BEAN_NAME, beanDef);
-		return beanDef;
-	}
+    static final String SCA_COMPOSITE_BEAN_NAME = "scaComposite";
+    private static final String MODULE_ATTRIBUTE_NAME = "component";
+    private static final String MODULE_ID = "component";
+    private static final String ADAPTER_ATTRIBUTE = "sca-adapter-class";
+    private static final String ADAPTER_CLASS_PROPERTY = "scaAdapterClass";
+
+    public BeanDefinition parse(Element element, ParserContext parserContext) {
+        BeanDefinitionRegistry registry = parserContext.getRegistry();
+        if (registry.containsBeanDefinition(SCA_COMPOSITE_BEAN_NAME)) {
+            throw new IllegalArgumentException(
+                "At most one <sca:composite> element can be declared in a bean factory");
+        }
+        BeanDefinition beanDef = createScaCompositeBeanDefinition(element);
+        registry.registerBeanDefinition(SCA_COMPOSITE_BEAN_NAME, beanDef);
+        return beanDef;
+    }
 
-	private BeanDefinition createScaCompositeBeanDefinition(Element element) {
-		RootBeanDefinition beanDefinition = new RootBeanDefinition();
-		beanDefinition.setBeanClass(ScaComposite.class);
-		MutablePropertyValues props = new MutablePropertyValues();
-		props.addPropertyValue(MODULE_ID, element.getAttribute(MODULE_ATTRIBUTE_NAME));
-		if (element.hasAttribute(ADAPTER_ATTRIBUTE)) {
-			props.addPropertyValue(ADAPTER_CLASS_PROPERTY,element.getAttribute(ADAPTER_ATTRIBUTE));
-		}
-		beanDefinition.setPropertyValues(props);
-		return beanDefinition;
-	}
+    private BeanDefinition createScaCompositeBeanDefinition(Element element) {
+        RootBeanDefinition beanDefinition = new RootBeanDefinition();
+        beanDefinition.setBeanClass(ScaComposite.class);
+        MutablePropertyValues props = new MutablePropertyValues();
+        props.addPropertyValue(MODULE_ID, element.getAttribute(MODULE_ATTRIBUTE_NAME));
+        if (element.hasAttribute(ADAPTER_ATTRIBUTE)) {
+            props.addPropertyValue(ADAPTER_CLASS_PROPERTY, element.getAttribute(ADAPTER_ATTRIBUTE));
+        }
+        beanDefinition.setPropertyValues(props);
+        return beanDefinition;
+    }
 
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaContextBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaContextBuilder.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaContextBuilder.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaContextBuilder.java Fri Aug 18 15:19:01 2006
@@ -21,27 +21,23 @@
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.context.ApplicationContext;
-import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.context.support.GenericApplicationContext;
 import org.springframework.sca.ScaAdapter;
 import org.springframework.sca.ScaComposite;
 
 /**
- * @author Hal Hildebrand
- *         Date: Apr 11, 2006
- *         Time: 4:33:33 PM
+ * @author Hal Hildebrand Date: Apr 11, 2006 Time: 4:33:33 PM
  */
 public class ScaContextBuilder {
-
-    private String moduleId;
-
-    private ScaAdapter scaAdapter;
-
     private static final String MODULE_ID = "moduleId";
 
     private static final String SCA_ADAPTER = "scaAdapter";
 
     private static final String SCA_COMPOSITE_BEAN_NAME = "scaComposite";
+
+    private String moduleId;
+
+    private ScaAdapter scaAdapter;
 
     public String getModuleId() {
         return this.moduleId;

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaNamespaceHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaNamespaceHandler.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaNamespaceHandler.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaNamespaceHandler.java Fri Aug 18 15:19:01 2006
@@ -20,13 +20,9 @@
 import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
 
 /**
- * Handler for the &lt;sca:&gt; namespace. Handles:
- * <ul>
- * <li>&lt;sca:composite module="xxxxx"/&gt;</li>
- * <li>&lt;sca:reference name="xxx" type="yyy" default-service="zzz"/&gt;</li>
- * <li>&lt;sca:property name="xxx" type="yyy"/&gt;</li>
- * <li>&lt;sca:service name="xxx" type="yyyy" target="zzz"/&gt;
- * </ul>
+ * Handler for the &lt;sca:&gt; namespace. Handles: <ul> <li>&lt;sca:composite module="xxxxx"/&gt;</li>
+ * <li>&lt;sca:reference name="xxx" type="yyy" default-service="zzz"/&gt;</li> <li>&lt;sca:property name="xxx"
+ * type="yyy"/&gt;</li> <li>&lt;sca:service name="xxx" type="yyyy" target="zzz"/&gt; </ul>
  *
  * @author Adrian Colyer
  * @since 2.0
@@ -34,17 +30,15 @@
 public class ScaNamespaceHandler extends NamespaceHandlerSupport {
 
     public ScaNamespaceHandler() {
+        // FIXME JFM
         init();
     }
 
-    /* (non-Javadoc)
-	 * @see org.springframework.beans.factory.xml.NamespaceHandler#init()
-	 */
-	public void init() {
-		registerBeanDefinitionParser("composite", new ScaCompositeBeanDefinitionParser());
-		registerBeanDefinitionParser("reference", new ScaReferenceBeanDefinitionParser());
-		registerBeanDefinitionParser("property", new ScaPropertyBeanDefinitionParser());
-		registerBeanDefinitionParser("service", new ScaServiceBeanDefinitionParser());
-	}
+    public void init() {
+        registerBeanDefinitionParser("composite", new ScaCompositeBeanDefinitionParser());
+        registerBeanDefinitionParser("reference", new ScaReferenceBeanDefinitionParser());
+        registerBeanDefinitionParser("property", new ScaPropertyBeanDefinitionParser());
+        registerBeanDefinitionParser("service", new ScaServiceBeanDefinitionParser());
+    }
 
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaPropertyBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaPropertyBeanDefinitionParser.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaPropertyBeanDefinitionParser.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaPropertyBeanDefinitionParser.java Fri Aug 18 15:19:01 2006
@@ -17,50 +17,47 @@
  */
 package org.springframework.sca.config;
 
+import org.w3c.dom.Element;
+
 import org.springframework.beans.MutablePropertyValues;
 import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.beans.factory.xml.BeanDefinitionParser;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.springframework.sca.ScaPropertyProxyFactoryBean;
-import org.w3c.dom.Element;
 
 /**
  * Parser for the &lt;sca:property/&gt; element
- * 
+ *
  * @author Adrian Colyer
  * @since 2.0
  */
 public class ScaPropertyBeanDefinitionParser implements BeanDefinitionParser {
 
-	private static final String PROPERTY_NAME_ATTRIBUTE = "name";
-	private static final String PROPERTY_NAME_PROPERTY = "propertyName";
-	private static final String PROPERTY_TYPE_PROPERTY = "propertyType";
-	private static final String TYPE_ATTRIBUTE = "type";
-	private static final String ID_ATTRIBUTE = "id";
+    private static final String PROPERTY_NAME_ATTRIBUTE = "name";
+    private static final String PROPERTY_NAME_PROPERTY = "propertyName";
+    private static final String PROPERTY_TYPE_PROPERTY = "propertyType";
+    private static final String TYPE_ATTRIBUTE = "type";
+    private static final String ID_ATTRIBUTE = "id";
 
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.xml.BeanDefinitionParser#parse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)
-	 */
-	public BeanDefinition parse(Element element, ParserContext parserContext) {
-		// needs service type, reference name, sca component, and optionally default service name
-		BeanDefinitionRegistry registry = parserContext.getRegistry();
-		String beanName = element.getAttribute(ID_ATTRIBUTE);
-		BeanDefinition beanDef = createBeanDefinition(element);
-		registry.registerBeanDefinition(beanName, beanDef);
-		return beanDef;
-	}
+    public BeanDefinition parse(Element element, ParserContext parserContext) {
+        // needs service type, reference name, sca component, and optionally default service name
+        BeanDefinitionRegistry registry = parserContext.getRegistry();
+        String beanName = element.getAttribute(ID_ATTRIBUTE);
+        BeanDefinition beanDef = createBeanDefinition(element);
+        registry.registerBeanDefinition(beanName, beanDef);
+        return beanDef;
+    }
 
-	private BeanDefinition createBeanDefinition(Element element) {
-		RootBeanDefinition beanDefinition = new RootBeanDefinition();
-		beanDefinition.setBeanClass(ScaPropertyProxyFactoryBean.class);
-		MutablePropertyValues props = new MutablePropertyValues();
-		props.addPropertyValue(PROPERTY_NAME_PROPERTY, element.getAttribute(PROPERTY_NAME_ATTRIBUTE));
-		props.addPropertyValue(PROPERTY_TYPE_PROPERTY, element.getAttribute(TYPE_ATTRIBUTE));
-		beanDefinition.setPropertyValues(props);
-		return beanDefinition;
-	}
+    private BeanDefinition createBeanDefinition(Element element) {
+        RootBeanDefinition beanDefinition = new RootBeanDefinition();
+        beanDefinition.setBeanClass(ScaPropertyProxyFactoryBean.class);
+        MutablePropertyValues props = new MutablePropertyValues();
+        props.addPropertyValue(PROPERTY_NAME_PROPERTY, element.getAttribute(PROPERTY_NAME_ATTRIBUTE));
+        props.addPropertyValue(PROPERTY_TYPE_PROPERTY, element.getAttribute(TYPE_ATTRIBUTE));
+        beanDefinition.setPropertyValues(props);
+        return beanDefinition;
+    }
 
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaReferenceBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaReferenceBeanDefinitionParser.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaReferenceBeanDefinitionParser.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaReferenceBeanDefinitionParser.java Fri Aug 18 15:19:01 2006
@@ -17,53 +17,50 @@
  */
 package org.springframework.sca.config;
 
+import org.w3c.dom.Element;
+
 import org.springframework.beans.MutablePropertyValues;
 import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.RuntimeBeanReference;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 import org.springframework.beans.factory.support.RootBeanDefinition;
 import org.springframework.beans.factory.xml.BeanDefinitionParser;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.springframework.sca.ScaServiceProxyFactoryBean;
-import org.w3c.dom.Element;
 
 /**
  * Parser for the &lt;sca:reference&gt; element
- * 
+ *
  * @author Adrian Colyer
  * @since 2.0
  */
 public class ScaReferenceBeanDefinitionParser implements BeanDefinitionParser {
 
-	private static final String REFERENCE_NAME_ATTRIBUTE = "name";
-	private static final String REFERENCE_NAME_PROPERTY = "referenceName";
-	private static final String TYPE_ATTRIBUTE = "type";
-	private static final String SERVICE_TYPE_PROPERTY = "serviceType";
-	private static final String DEFAULT_SERVICE_ATTRIBUTE = "default";
-	private static final String DEFAULT_SERVICE_PROPERTY = "defaultServiceName";
-	
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.xml.BeanDefinitionParser#parse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)
-	 */
-	public BeanDefinition parse(Element element, ParserContext parserContext) {
-		// needs service type, reference name, sca component, and optionally default service name
-		BeanDefinitionRegistry registry = parserContext.getRegistry();
-		String referenceName = element.getAttribute(REFERENCE_NAME_ATTRIBUTE);
-		BeanDefinition beanDef = createBeanDefinition(element);
-		registry.registerBeanDefinition(referenceName, beanDef);
-		return beanDef;
-	}
+    private static final String REFERENCE_NAME_ATTRIBUTE = "name";
+    private static final String REFERENCE_NAME_PROPERTY = "referenceName";
+    private static final String TYPE_ATTRIBUTE = "type";
+    private static final String SERVICE_TYPE_PROPERTY = "serviceType";
+    private static final String DEFAULT_SERVICE_ATTRIBUTE = "default";
+    private static final String DEFAULT_SERVICE_PROPERTY = "defaultServiceName";
+
+    public BeanDefinition parse(Element element, ParserContext parserContext) {
+        // needs service type, reference name, sca component, and optionally default service name
+        BeanDefinitionRegistry registry = parserContext.getRegistry();
+        String referenceName = element.getAttribute(REFERENCE_NAME_ATTRIBUTE);
+        BeanDefinition beanDef = createBeanDefinition(element);
+        registry.registerBeanDefinition(referenceName, beanDef);
+        return beanDef;
+    }
 
-	private BeanDefinition createBeanDefinition(Element element) {
-		RootBeanDefinition beanDefinition = new RootBeanDefinition();
-		beanDefinition.setBeanClass(ScaServiceProxyFactoryBean.class);
-		MutablePropertyValues props = new MutablePropertyValues();
-		props.addPropertyValue(REFERENCE_NAME_PROPERTY, element.getAttribute(REFERENCE_NAME_ATTRIBUTE));
-		props.addPropertyValue(SERVICE_TYPE_PROPERTY, element.getAttribute(TYPE_ATTRIBUTE));
-		if (element.hasAttribute(DEFAULT_SERVICE_ATTRIBUTE)) {
-			props.addPropertyValue(DEFAULT_SERVICE_PROPERTY,element.getAttribute(DEFAULT_SERVICE_ATTRIBUTE));
-		}
-		beanDefinition.setPropertyValues(props);
-		return beanDefinition;
-	}
+    private BeanDefinition createBeanDefinition(Element element) {
+        RootBeanDefinition beanDefinition = new RootBeanDefinition();
+        beanDefinition.setBeanClass(ScaServiceProxyFactoryBean.class);
+        MutablePropertyValues props = new MutablePropertyValues();
+        props.addPropertyValue(REFERENCE_NAME_PROPERTY, element.getAttribute(REFERENCE_NAME_ATTRIBUTE));
+        props.addPropertyValue(SERVICE_TYPE_PROPERTY, element.getAttribute(TYPE_ATTRIBUTE));
+        if (element.hasAttribute(DEFAULT_SERVICE_ATTRIBUTE)) {
+            props.addPropertyValue(DEFAULT_SERVICE_PROPERTY, element.getAttribute(DEFAULT_SERVICE_ATTRIBUTE));
+        }
+        beanDefinition.setPropertyValues(props);
+        return beanDefinition;
+    }
 }

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaServiceBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaServiceBeanDefinitionParser.java?rev=432747&r1=432746&r2=432747&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaServiceBeanDefinitionParser.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/springframework/sca/config/ScaServiceBeanDefinitionParser.java Fri Aug 18 15:19:01 2006
@@ -17,6 +17,8 @@
  */
 package org.springframework.sca.config;
 
+import org.w3c.dom.Element;
+
 import org.springframework.beans.MutablePropertyValues;
 import org.springframework.beans.factory.config.BeanDefinition;
 import org.springframework.beans.factory.config.RuntimeBeanReference;
@@ -25,43 +27,39 @@
 import org.springframework.beans.factory.xml.BeanDefinitionParser;
 import org.springframework.beans.factory.xml.ParserContext;
 import org.springframework.sca.ScaServiceExporter;
-import org.w3c.dom.Element;
 
 /**
- * Parser for the &lt;sca:service/&gt; element 
- * 
+ * Parser for the &lt;sca:service/&gt; element
+ *
  * @author Adrian Colyer
  * @since 2.0
  */
 public class ScaServiceBeanDefinitionParser implements BeanDefinitionParser {
 
-	private static final String SERVICE_NAME_ATTRIBUTE = "name";
-	private static final String TYPE_ATTRIBUTE = "type";
-	private static final String TARGET_ATTRIBUTE = "target";
-	private static final String SERVICE_NAME_PROPERTY = "serviceName";
-	private static final String SERVICE_TYPE_PROPERTY = "serviceType";
-	private static final String TARGET_PROPERTY = "target";
-	
-	/* (non-Javadoc)
-	 * @see org.springframework.beans.factory.xml.BeanDefinitionParser#parse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)
-	 */
-	public BeanDefinition parse(Element element, ParserContext parserContext) {
-		BeanDefinitionRegistry registry = parserContext.getRegistry();
-		String serviceName = element.getAttribute(SERVICE_NAME_ATTRIBUTE);
-		BeanDefinition beanDef = createBeanDefinition(element);
-		registry.registerBeanDefinition(serviceName, beanDef);
-		return beanDef;
-	}
-	
-	private BeanDefinition createBeanDefinition(Element element) {
-		RootBeanDefinition beanDefinition = new RootBeanDefinition();
-		beanDefinition.setBeanClass(ScaServiceExporter.class);
-		MutablePropertyValues props = new MutablePropertyValues();
-		props.addPropertyValue(SERVICE_TYPE_PROPERTY, element.getAttribute(TYPE_ATTRIBUTE));
-		props.addPropertyValue(TARGET_PROPERTY,new RuntimeBeanReference(element.getAttribute(TARGET_ATTRIBUTE)));
-		props.addPropertyValue(SERVICE_NAME_PROPERTY,element.getAttribute(SERVICE_NAME_ATTRIBUTE));
-		beanDefinition.setPropertyValues(props);
-		return beanDefinition;
-	}
+    private static final String SERVICE_NAME_ATTRIBUTE = "name";
+    private static final String TYPE_ATTRIBUTE = "type";
+    private static final String TARGET_ATTRIBUTE = "target";
+    private static final String SERVICE_NAME_PROPERTY = "serviceName";
+    private static final String SERVICE_TYPE_PROPERTY = "serviceType";
+    private static final String TARGET_PROPERTY = "target";
+
+    public BeanDefinition parse(Element element, ParserContext parserContext) {
+        BeanDefinitionRegistry registry = parserContext.getRegistry();
+        String serviceName = element.getAttribute(SERVICE_NAME_ATTRIBUTE);
+        BeanDefinition beanDef = createBeanDefinition(element);
+        registry.registerBeanDefinition(serviceName, beanDef);
+        return beanDef;
+    }
+
+    private BeanDefinition createBeanDefinition(Element element) {
+        RootBeanDefinition beanDefinition = new RootBeanDefinition();
+        beanDefinition.setBeanClass(ScaServiceExporter.class);
+        MutablePropertyValues props = new MutablePropertyValues();
+        props.addPropertyValue(SERVICE_TYPE_PROPERTY, element.getAttribute(TYPE_ATTRIBUTE));
+        props.addPropertyValue(TARGET_PROPERTY, new RuntimeBeanReference(element.getAttribute(TARGET_ATTRIBUTE)));
+        props.addPropertyValue(SERVICE_NAME_PROPERTY, element.getAttribute(SERVICE_NAME_ATTRIBUTE));
+        beanDefinition.setPropertyValues(props);
+        return beanDefinition;
+    }
 
 }



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