You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ed...@apache.org on 2007/06/12 16:58:59 UTC
svn commit: r546517 - in
/incubator/tuscany/java/sca/modules/implementation-spring/src:
main/java/org/apache/tuscany/implementation/spring/
main/java/org/apache/tuscany/implementation/spring/xml/
test/java/org/apache/tuscany/implementation/spring/itest...
Author: edwardsmj
Date: Tue Jun 12 07:58:57 2007
New Revision: 546517
URL: http://svn.apache.org/viewvc?view=rev&rev=546517
Log:
Full support for Spring implementations with Services, References and Properties
Added:
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaPropertyBeanDefinitionParser.java (with props)
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringSCAPropertyElement.java (with props)
incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java (with props)
incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestSCAPropertyBean.java (with props)
incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml (with props)
incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAProperty.composite
Modified:
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SCAParentApplicationContext.java
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaNamespaceHandler.java
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringArtifactProcessor.java
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementation.java
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProvider.java
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProviderFactory.java
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringModuleActivator.java
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringBeanIntrospector.java
incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringXMLComponentTypeLoader.java
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SCAParentApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SCAParentApplicationContext.java?view=diff&rev=546517&r1=546516&r2=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SCAParentApplicationContext.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SCAParentApplicationContext.java Tue Jun 12 07:58:57 2007
@@ -6,13 +6,17 @@
import java.util.Map;
import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.factory.ObjectFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
@@ -27,7 +31,14 @@
/**
* A Spring ParentApplicationContext for a given Spring Implementation
- * TODO - incomplete at present
+ *
+ * The Parent application context is responsible for handling those entities within a Spring
+ * application context that actually belong to SCA rather than to Spring. The principal things
+ * are Properties and References. These may be present either through explicit <sca:property/>
+ * and <sca:reference/> elements in the application context or they may be implicit through
+ * unresolved Spring bean <property.../> elements. In either case, it is the Parent application
+ * context that must provide Spring beans that correspond to the property or reference, as derived
+ * from the SCA composite in which the Spring application context is an implementation.
* @author MikeEdwards
*
*/
@@ -37,15 +48,18 @@
private SpringImplementation implementation;
private RuntimeComponent component;
private ProxyFactory proxyService;
+ private JavaPropertyValueObjectFactory propertyFactory;
private static final String[] EMPTY_ARRAY = new String[0];
public SCAParentApplicationContext( RuntimeComponent component,
SpringImplementation implementation,
- ProxyFactory proxyService ) {
+ ProxyFactory proxyService,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory) {
this.implementation = implementation;
this.component = component;
this.proxyService = proxyService;
+ this.propertyFactory = propertyValueObjectFactory;
} // end constructor
public Object getBean(String name) throws BeansException {
@@ -53,33 +67,55 @@
}
/**
- * Get a Bean for a reference..
+ * Get a Bean for a reference or for a property..
+ * @param name - the name of the Bean required
+ * @param requiredtype - the required type of the Bean (either a Java class or a Java interface)
+ * @return Object - a Bean which matches the requested bean
*/
public Object getBean(String name, Class requiredType) throws BeansException {
- // TODO provide a real implementation of this
System.out.println("Spring parent context - getBean called for name: " + name );
- // The expectation is that the requested Bean is a reference from the Spring context
- Reference theReference = null;
+ // The expectation is that the requested Bean is either a reference or a property
+ // from the Spring context
for ( Reference reference : implementation.getReferences() ) {
if( reference.getName().equals(name) ) {
- theReference = reference;
- break;
- }
+ // Extract the Java interface for the reference (it can't be any other interface type
+ // for a Spring application context)
+ if( requiredType == null ) {
+ JavaInterface javaInterface =
+ (JavaInterface) reference.getInterfaceContract().getInterface();
+ requiredType = javaInterface.getJavaClass();
+ }
+ // Create and return eturn the proxy for the reference
+ return getService( requiredType, reference.getName() );
+ } // end if
} // end for
- if( theReference == null )
- throw new NoSuchBeanDefinitionException("Unable to find Bean with name " + name );
- // Extract the Java interface for the reference (it can't be any other interface type
- // for a Spring application context)
- if( requiredType == null ) {
- JavaInterface javaInterface =
- (JavaInterface) theReference.getInterfaceContract().getInterface();
- requiredType = javaInterface.getJavaClass();
- }
- // Create and return eturn the proxy for the reference
- return getService( requiredType, theReference.getName() );
+
+ // For a property, get the name and the required Java type and create a Bean
+ // of that type with the value inserted.
+ for ( Property property : implementation.getProperties() ) {
+ if( property.getName().equals(name) ) {
+ if( requiredType == null ) {
+ // The following code only deals with a subset of types and was superceded
+ // by the information from the implementation (which uses Classes as found
+ // in the Spring implementation itself.
+ //requiredType = JavaXMLMapper.getJavaType( property.getXSDType() );
+ requiredType = implementation.getPropertyClass( name );
+ }
+ return getPropertyBean( requiredType, property.getName() );
+ } // end if
+ } // end for
+ throw new NoSuchBeanDefinitionException("Unable to find Bean with name " + name );
+
} // end method getBean( String, Class )
+ /**
+ * Creates a proxy Bean for a reference
+ * @param <B> the Business interface type for the reference
+ * @param businessInterface - the business interface as a Class
+ * @param referenceName - the name of the Reference
+ * @return an Bean of the type defined by <B>
+ */
private <B> B getService(Class<B> businessInterface, String referenceName) {
List<ComponentReference> refs = component.getReferences();
for (ComponentReference ref : refs) {
@@ -90,6 +126,31 @@
}
}
return null;
+ }
+
+ /**
+ * Method to create a Java Bean for a Property value
+ * @param <B> the class type of the Bean
+ * @param requiredType - a Class object for the required type
+ * @param name - the Property name
+ * @return - a Bean of the specified property, with value set
+ */
+ private <B> B getPropertyBean( Class requiredType, String name) {
+ B propertyObject = null;
+ // Get the component's list of properties
+ List<ComponentProperty> props = component.getProperties();
+ for ( ComponentProperty prop : props ) {
+ if ( prop.getName().equals(name) ) {
+ // On finding the property, create a factory for it and create a Bean using
+ // the factory
+ ObjectFactory factory = propertyFactory.createValueFactory( prop,
+ prop.getValue(),
+ requiredType );
+ propertyObject = (B)factory.getInstance();
+ } // end if
+ } // end for
+
+ return propertyObject;
}
public boolean containsBean(String name) {
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaNamespaceHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaNamespaceHandler.java?view=diff&rev=546517&r1=546516&r2=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaNamespaceHandler.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaNamespaceHandler.java Tue Jun 12 07:58:57 2007
@@ -33,6 +33,7 @@
public final void init() {
registerBeanDefinitionParser("reference", new ScaReferenceBeanDefinitionParser());
registerBeanDefinitionParser("service", new ScaServiceBeanDefinitionParser());
+ registerBeanDefinitionParser("property", new ScaPropertyBeanDefinitionParser());
}
}
Added: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaPropertyBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaPropertyBeanDefinitionParser.java?view=auto&rev=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaPropertyBeanDefinitionParser.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaPropertyBeanDefinitionParser.java Tue Jun 12 07:58:57 2007
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2002-2006 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.tuscany.implementation.spring;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+
+/**
+ * Parser for the <sca:reference> element
+ *
+ */
+public class ScaPropertyBeanDefinitionParser implements BeanDefinitionParser {
+
+ public BeanDefinition parse(Element element, ParserContext parserContext) {
+ // do nothing, this is handled by Tuscany
+ return null;
+ }
+
+}
+
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaPropertyBeanDefinitionParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/ScaPropertyBeanDefinitionParser.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringArtifactProcessor.java?view=diff&rev=546517&r1=546516&r2=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringArtifactProcessor.java Tue Jun 12 07:58:57 2007
@@ -43,6 +43,7 @@
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.policy.PolicyFactory;
import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
/*
@@ -62,14 +63,14 @@
private JavaInterfaceIntrospector interfaceIntrospector;
private PolicyFactory policyFactory;
// TODO: runtime needs to provide a better way to get the PropertyValueObjectFactory
- private SpringPropertyValueObjectFactory propertyFactory;
+ private JavaPropertyValueObjectFactory propertyFactory;
public SpringArtifactProcessor( AssemblyFactory assemblyFactory,
JavaInterfaceFactory javaFactory,
JavaInterfaceIntrospector interfaceIntrospector,
PolicyFactory policyFactory,
- SpringPropertyValueObjectFactory propertyFactory ) {
+ JavaPropertyValueObjectFactory propertyFactory ) {
this.assemblyFactory = assemblyFactory;
this.javaFactory = javaFactory;
this.interfaceIntrospector = interfaceIntrospector;
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementation.java?view=diff&rev=546517&r1=546516&r2=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementation.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementation.java Tue Jun 12 07:58:57 2007
@@ -25,6 +25,7 @@
import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.assembly.impl.ComponentTypeImpl;
import org.springframework.core.io.Resource;
@@ -34,7 +35,7 @@
/**
* Represents a Spring implementation.
*
- * TBD: Incomplete and needs substantial work... MJE, 4th May 2007
+ *
*/
public class SpringImplementation extends ComponentTypeImpl implements Implementation {
@@ -45,13 +46,16 @@
private ComponentType componentType;
// Mapping of Services to Beans
private Hashtable<String,SpringBeanElement> serviceMap;
+ // Mapping of property names to Java class
+ private Hashtable<String, Class> propertyMap;
protected SpringImplementation() {
this.springLocation = null;
this.resource = null;
setUnresolved(true);
serviceMap = new Hashtable<String,SpringBeanElement>();
- }
+ propertyMap = new Hashtable<String, Class>();
+ } // end method SpringImplementation
/* Returns the location attribute for this Spring implementation */
public String getSpringLocation() {
@@ -97,6 +101,10 @@
return componentType.getReferences();
}
+ public List<Property> getProperties() {
+ return componentType.getProperties();
+ }
+
/**
* Returns the Spring Bean which implements a particular service
* @param service the service
@@ -115,4 +123,24 @@
public void setBeanForService( Service service, SpringBeanElement theBean ) {
serviceMap.put( service.getName(), theBean );
}
+
+ /**
+ * Add a mapping from a SCA property name to a Java class for the property
+ * @param propertyName
+ * @param propertyClass
+ */
+ public void setPropertyClass( String propertyName, Class propertyClass ){
+ if( propertyName == null || propertyClass == null ) return;
+ propertyMap.put( propertyName, propertyClass );
+ return;
+ } // end method setPropertyClass
+
+ /**
+ * Gets the Java Class for an SCA property
+ * @param propertyName - the property name
+ * @return - a Class object for the type of the property
+ */
+ public Class getPropertyClass( String propertyName ) {
+ return propertyMap.get( propertyName );
+ } // end method getPropertyClass
}
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProvider.java?view=diff&rev=546517&r1=546516&r2=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProvider.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProvider.java Tue Jun 12 07:58:57 2007
@@ -7,6 +7,7 @@
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -36,13 +37,15 @@
*/
public SpringImplementationProvider( RuntimeComponent component,
SpringImplementation implementation,
- ProxyFactory proxyService ) {
+ ProxyFactory proxyService,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory ) {
super();
this.implementation = implementation;
this.component = component;
this.proxyService = proxyService;
SCAParentApplicationContext scaParentContext =
- new SCAParentApplicationContext( component, implementation, proxyService );
+ new SCAParentApplicationContext( component, implementation,
+ proxyService, propertyValueObjectFactory );
springContext = new SCAApplicationContext(scaParentContext, implementation.getResource() );
} // end constructor
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProviderFactory.java?view=diff&rev=546517&r1=546516&r2=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringImplementationProviderFactory.java Tue Jun 12 07:58:57 2007
@@ -1,6 +1,7 @@
package org.apache.tuscany.implementation.spring;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
import org.apache.tuscany.sca.provider.ImplementationProvider;
import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
@@ -13,14 +14,17 @@
public class SpringImplementationProviderFactory implements ImplementationProviderFactory<SpringImplementation> {
private ProxyFactory proxyService;
+ private JavaPropertyValueObjectFactory propertyFactory;
/**
* Simple constructor
*
*/
- public SpringImplementationProviderFactory( ProxyFactory proxyService ) {
+ public SpringImplementationProviderFactory( ProxyFactory proxyService,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory) {
super();
- this.proxyService = proxyService;
+ this.proxyService = proxyService;
+ this.propertyFactory = propertyValueObjectFactory;
}
/**
@@ -32,7 +36,8 @@
*/
public ImplementationProvider createImplementationProvider(RuntimeComponent component,
SpringImplementation implementation) {
- return new SpringImplementationProvider( component, implementation, proxyService );
+ return new SpringImplementationProvider( component, implementation,
+ proxyService, propertyFactory );
}
/**
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringModuleActivator.java?view=diff&rev=546517&r1=546516&r2=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringModuleActivator.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/SpringModuleActivator.java Tue Jun 12 07:58:57 2007
@@ -88,8 +88,8 @@
DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
- SpringPropertyValueObjectFactory propertyFactory = new SpringPropertyValueObjectFactory(mediator);
-
+ JavaPropertyValueObjectFactory propertyFactory = new JavaPropertyValueObjectFactory(mediator);
+
// Tools for Java interface handling
JavaInterfaceIntrospectorExtensionPoint interfaceVisitors =
registry.getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
@@ -104,7 +104,7 @@
// Create SpringImplementationFactory and add to provider factories
SpringImplementationProviderFactory springImplementationProviderFactory =
- new SpringImplementationProviderFactory( proxyFactory );
+ new SpringImplementationProviderFactory( proxyFactory, propertyFactory );
ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
providerFactories.addProviderFactory(springImplementationProviderFactory);
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringBeanIntrospector.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringBeanIntrospector.java?view=diff&rev=546517&r1=546516&r2=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringBeanIntrospector.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringBeanIntrospector.java Tue Jun 12 07:58:57 2007
@@ -21,6 +21,7 @@
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.Map;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
@@ -28,6 +29,7 @@
import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
import org.apache.tuscany.sca.implementation.java.introspect.DefaultJavaClassIntrospectorExtensionPoint;
import org.apache.tuscany.sca.implementation.java.introspect.ExtensibleJavaClassIntrospector;
@@ -112,11 +114,12 @@
* @param beanClass the Spring Bean class to introspect
* @param componentType the componentType that is filled in through the introspection
* process (assumed empty on invocation, filled on return
+ * @return a Map of property names to JavaElementImpl
* @throws ContributionResolveException - if there was a problem resolving the
* Spring Bean or its componentType
*
*/
- public void introspectBean( Class<?> beanClass, ComponentType componentType )
+ public Map<String, JavaElementImpl> introspectBean( Class<?> beanClass, ComponentType componentType )
throws ContributionResolveException {
if( componentType == null ) throw new ContributionResolveException(
@@ -143,6 +146,8 @@
String name = service.getName();
//System.out.println("Spring Bean: found service with name: " + name);
} // end for
+
+ return javaImplementation.getPropertyMembers();
} // end method introspectBean
Added: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringSCAPropertyElement.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringSCAPropertyElement.java?view=auto&rev=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringSCAPropertyElement.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringSCAPropertyElement.java Tue Jun 12 07:58:57 2007
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.implementation.spring.xml;
+
+
+/**
+ * Represents an <sca:property> element in a Spring application-context
+ * - this has name and type attributes
+ *
+ */
+public class SpringSCAPropertyElement {
+
+ private String name;
+ private String type;
+
+ public SpringSCAPropertyElement( String name, String type ) {
+ this.name = name;
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+} // end class SpringPropertyElement
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringSCAPropertyElement.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringSCAPropertyElement.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringXMLComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringXMLComponentTypeLoader.java?view=diff&rev=546517&r1=546516&r2=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringXMLComponentTypeLoader.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/implementation/spring/xml/SpringXMLComponentTypeLoader.java Tue Jun 12 07:58:57 2007
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
@@ -43,6 +44,7 @@
import org.apache.tuscany.sca.assembly.ComponentType;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
@@ -55,8 +57,10 @@
import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
import org.apache.tuscany.sca.policy.PolicyFactory;
import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
/**
* Introspects a Spring XML application-context configuration file to create <implementation-spring../>
@@ -70,6 +74,7 @@
private static final String SPRING_NS = "http://www.springframework.org/schema/beans";
private static final QName SERVICE_ELEMENT = new QName(SCA_NS, "service");
private static final QName REFERENCE_ELEMENT = new QName(SCA_NS, "reference");
+ private static final QName SCAPROPERTY_ELEMENT = new QName(SCA_NS, "property");
private static final QName BEANS_ELEMENT = new QName(SPRING_NS, "beans");
private static final QName BEAN_ELEMENT = new QName(SPRING_NS, "bean");
private static final QName PROPERTY_ELEMENT = new QName(SPRING_NS, "property");
@@ -134,6 +139,7 @@
List<SpringBeanElement> beans = new ArrayList<SpringBeanElement>();
List<SpringSCAServiceElement> services = new ArrayList<SpringSCAServiceElement>();
List<SpringSCAReferenceElement> references = new ArrayList<SpringSCAReferenceElement>();
+ List<SpringSCAPropertyElement> scaproperties = new ArrayList<SpringSCAPropertyElement>();
SpringBeanElement bean = null;
Resource resource;
@@ -171,6 +177,11 @@
reader.getAttributeValue(null, "name"),
reader.getAttributeValue(null, "type") );
references.add( reference );
+ } else if (SCAPROPERTY_ELEMENT.equals(qname)) {
+ SpringSCAPropertyElement scaproperty = new SpringSCAPropertyElement(
+ reader.getAttributeValue(null, "name"),
+ reader.getAttributeValue(null, "type"));
+ scaproperties.add( scaproperty );
} else if (BEAN_ELEMENT.equals(qname)) {
// TODO FIX THIS !!
int count=reader.getAttributeCount();
@@ -203,27 +214,30 @@
/* At this point, the complete application-context.xml file has been read and its contents */
/* stored in the lists of beans, services, references. These are now used to generate */
/* the implied componentType for the application context */
- generateComponentType( implementation, beans, services, references );
+ generateComponentType( implementation, beans, services, references, scaproperties );
return;
} // end method loadFromXML
/**
* Generates the Spring implementation component type from the configuration contained in the
- * lists of beans, services and references derived from the application context
+ * lists of beans, services, references and scaproperties derived from the application context
*/
private void generateComponentType( SpringImplementation implementation,
List<SpringBeanElement> beans,
List<SpringSCAServiceElement> services,
- List<SpringSCAReferenceElement> references )
+ List<SpringSCAReferenceElement> references,
+ List<SpringSCAPropertyElement> scaproperties )
throws ContributionReadException {
/*
- * Each service becomes a service in the component type
- * Each reference becomes a reference in the component type
- * Each bean becomes a service, unless it is the target of a service element or unless it
- * is the target of a bean reference property
- * Each bean property which is a reference not pointing at another bean in the
- * application context becomes a reference unless it is pointing at one of the references
+ * 1. Each service becomes a service in the component type
+ * 2. Each reference becomes a reference in the component type
+ * 3. IF there are no explicit service elements, each bean becomes a service
+ * 4. Each bean property which is a reference not pointing at another bean in the
+ * application context becomes a reference unless it is pointing at one of the references
+ * 5. Each scaproperty becomes a property in the component type
+ * 6. Each bean property which is not a reference and which is not pointing
+ * at another bean in the application context becomes a property in the component type
*/
ComponentType componentType = implementation.getComponentType();
@@ -287,7 +301,8 @@
Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
while( itp.hasNext() ) {
SpringPropertyElement propertyElement = itp.next();
- if( propertyRefUnresolved( propertyElement.getRef(), beans, references ) ) {
+ if( propertyRefUnresolved( propertyElement.getRef(), beans,
+ references, scaproperties ) ) {
// This means an unresolved reference from the spring bean...
unresolvedProperties = true;
} // end if
@@ -297,14 +312,18 @@
Class<?> beanClass = cl.loadClass( beanElement.getClassName() );
// Introspect the bean
ComponentType beanComponentType = assemblyFactory.createComponentType();
- beanIntrospector.introspectBean( beanClass, beanComponentType );
+ Map<String, JavaElementImpl> propertyMap =
+ beanIntrospector.introspectBean( beanClass, beanComponentType );
// Get the references by this Spring Bean and add the unresolved ones to
// the component type of the Spring Assembly
List<Reference> beanReferences = beanComponentType.getReferences();
+ List<Property> beanProperties = beanComponentType.getProperties();
itp = beanElement.getProperties().iterator();
while( itp.hasNext() ) {
SpringPropertyElement propertyElement = itp.next();
- if( propertyRefUnresolved( propertyElement.getRef(), beans, references ) ) {
+ if( propertyRefUnresolved( propertyElement.getRef(), beans,
+ references, scaproperties ) ) {
+ boolean resolved = false;
// This means an unresolved reference from the spring bean...add it to
// the references for the Spring application context
for ( Reference reference : beanReferences ) {
@@ -314,17 +333,52 @@
// name of the field in the Spring bean....
reference.setName(propertyElement.getRef());
componentType.getReferences().add( reference );
+ resolved = true;
} // end if
} // end for
+ if( !resolved ) {
+ // If the bean property is not already resolved as a reference
+ // then it must be an SCA property...
+ for ( Property scaproperty : beanProperties ) {
+ if( propertyElement.getName().equals(scaproperty.getName()) ) {
+ // The name of the reference in this case is the string in
+ // the @ref attribute of the Spring property element, NOT the
+ // name of the field in the Spring bean....
+ scaproperty.setName(propertyElement.getRef());
+ componentType.getProperties().add( scaproperty );
+ // Fetch and store the type of the property
+ implementation.setPropertyClass( scaproperty.getName(),
+ propertyMap.get(scaproperty.getName()).getType() );
+ resolved = true;
+ } // end if
+ } // end for
+ } // end if
} // end if
} // end while
} // end if
} // end if
} // end while
+
+ Iterator<SpringSCAPropertyElement> itsp = scaproperties.iterator();
+ while( itsp.hasNext() ) {
+ SpringSCAPropertyElement scaproperty = itsp.next();
+ // Create a component type property if the SCA property element has a name
+ // and a type declared...
+ if( scaproperty.getType() != null && scaproperty.getName() != null ) {
+ Property theProperty = assemblyFactory.createProperty();
+ theProperty.setName( scaproperty.getName() );
+ // Get the Java class and then an XSD element type for the property
+ Class<?> propType = Class.forName( scaproperty.getType() );
+ theProperty.setXSDType( JavaXMLMapper.getXMLType(propType) );
+ componentType.getProperties().add( theProperty );
+ // Remember the Java Class (ie the type) for this property
+ implementation.setPropertyClass( theProperty.getName(), propType );
+ } // end if
+ } // end while
} catch ( ClassNotFoundException e ) {
- // Means that either an interface class or a bean was not found
+ // Means that either an interface class, property class or a bean was not found
throw new ContributionReadException( e );
} catch ( InvalidInterfaceException e ) {
throw new ContributionReadException( e );
@@ -340,7 +394,8 @@
/*
* Determines whether a reference attribute of a Spring property element is resolved either
- * by a bean in the application context or by an SCA reference element
+ * by a bean in the application context or by an SCA reference element or by an SCA property
+ * element
* @param ref - a String containing the name of the reference - may be null
* @param beans - a List of SpringBean elements
* @param references - a List of SCA reference elements
@@ -348,7 +403,8 @@
*/
private boolean propertyRefUnresolved( String ref,
List<SpringBeanElement> beans,
- List<SpringSCAReferenceElement> references ) {
+ List<SpringSCAReferenceElement> references,
+ List<SpringSCAPropertyElement> scaproperties ) {
boolean unresolved = true;
if( ref != null ) {
@@ -368,6 +424,17 @@
while( itr.hasNext() ) {
SpringSCAReferenceElement referenceElement = itr.next();
if( ref.equals(referenceElement.getName()) ) {
+ unresolved = false;
+ break;
+ } // end if
+ } // end while
+ } // end if
+ // Scan over the SCA property elements looking for a match
+ if( unresolved ) {
+ Iterator<SpringSCAPropertyElement> itsp = scaproperties.iterator();
+ while( itsp.hasNext() ) {
+ SpringSCAPropertyElement propertyElement = itsp.next();
+ if( ref.equals(propertyElement.getName()) ) {
unresolved = false;
break;
} // end if
Added: incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java?view=auto&rev=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java Tue Jun 12 07:58:57 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.implementation.spring.itests.helloworld;
+
+/**
+ * A test case designed to test the implementation of Properties from a Spring application
+ * context, where the properties are explicit, through the presence of an sca:property
+ * element within the Spring application context
+ *
+ * The artifacts involved in this test are:
+ *
+ * 1) A composite containing a component with a Spring implementation
+ * 2) The <implementation.spring.../> element references an application context that
+ * uses an explicit sca:property element which is used to compute the response to an invocation
+ * of the service of the implementation
+ *
+ * @author MikeEdwards
+ */
+public class SpringSCAPropertyTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
+
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestSCAPropertyBean.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestSCAPropertyBean.java?view=auto&rev=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestSCAPropertyBean.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestSCAPropertyBean.java Tue Jun 12 07:58:57 2007
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.implementation.spring.itests.mock;
+
+/**
+ * A test Spring bean which provides the HelloWorld service.
+ * This bean has a single String property called "hello" which must be set through
+ * external configuration to give the correct response message, otherwise an (incorrect)
+ * default message is generated
+ * @author MikeEdwards
+ *
+ */
+
+import org.apache.tuscany.implementation.spring.itests.helloworld.HelloWorld;
+
+public class TestSCAPropertyBean implements HelloWorld {
+
+ private String hello = "Go away";
+
+ /**
+ * Provides the operation of the "HelloWorld" interface - a simple string response
+ * to a string input message, where the response is a greeting followed by the original
+ * input message.
+ */
+ public String sayHello( String message ) {
+ System.out.println("TestHelloWorldBean - sayHello called");
+ return( hello + " " + message );
+ }
+
+ /**
+ * Public setter for the (unannotated) field "hello" which constitutes an SCA
+ * property
+ * @param message - the message to use for the response to "sayHello"
+ */
+ public void setHello( String message ) {
+ hello = message;
+ }
+
+} // end class TestSCAPropertyBean
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestSCAPropertyBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/test/java/org/apache/tuscany/implementation/spring/itests/mock/TestSCAPropertyBean.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml?view=auto&rev=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml (added)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml Tue Jun 12 07:58:57 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Application context for the SpringHelloWorld testcase -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="org.apache.tuscany.implementation.spring.itests.mock.TestSCAPropertyBean" lazy-init="true">
+ <property name="hello" ref="TestProperty"/>
+ </bean>
+
+ <sca:property id="foo" name="TestProperty" type="java.lang.String"/>
+
+</beans>
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/META-INF/sca/SpringSCAProperty-context.xml
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAProperty.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAProperty.composite?view=auto&rev=546517
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAProperty.composite (added)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/test/resources/org/apache/tuscany/implementation/spring/itests/helloworld/SpringSCAProperty.composite Tue Jun 12 07:58:57 2007
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!-- Composite for the SpringSCAPropertyTestCase
+ * This composite has the HelloWorldComponent implemented with a Spring implementation where
+ * the Spring application context uses an explicit SCA property. The value of the property
+ * is set in this composite and is used to compute the response to a service invocation from
+ * the ClientComponent.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ name="SpringSCAProperty">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.implementation.spring.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.spring location="META-INF/sca/SpringSCAProperty-context.xml"/>
+ <property name="TestProperty">Hello</property>
+ </component>
+
+</composite>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org