You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sv...@apache.org on 2007/05/31 13:28:34 UTC
svn commit: r543114 - in /incubator/tuscany/java/sca/itest/properties: ./
src/main/java/com/ src/main/java/com/example/
src/main/java/com/example/customer/ src/main/java/com/example/customer/impl/
src/main/java/org/apache/tuscany/sca/itest/ src/main/re...
Author: svkrish
Date: Thu May 31 04:28:33 2007
New Revision: 543114
URL: http://svn.apache.org/viewvc?view=rev&rev=543114
Log:
included test for SDO type component property
Added:
incubator/tuscany/java/sca/itest/properties/src/main/java/com/
incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/
incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/
incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/Customer.java
incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/SdoFactory.java
incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/
incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/CustomerImpl.java
incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/SdoFactoryImpl.java
incubator/tuscany/java/sca/itest/properties/src/main/resources/customer.xsd
Modified:
incubator/tuscany/java/sca/itest/properties/pom.xml
incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite
incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
Modified: incubator/tuscany/java/sca/itest/properties/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/pom.xml?view=diff&rev=543114&r1=543113&r2=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/pom.xml (original)
+++ incubator/tuscany/java/sca/itest/properties/pom.xml Thu May 31 04:28:33 2007
@@ -47,6 +47,13 @@
<artifactId>tuscany-core-databinding</artifactId>
<version>1.0-incubating-SNAPSHOT</version>
<scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
</dependency>
</dependencies>
</project>
Added: incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/Customer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/Customer.java?view=auto&rev=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/Customer.java (added)
+++ incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/Customer.java Thu May 31 04:28:33 2007
@@ -0,0 +1,102 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package com.example.customer;
+
+import java.io.Serializable;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Customer</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link com.example.customer.Customer#getFirstName <em>First Name</em>}</li>
+ * <li>{@link com.example.customer.Customer#getMiddleName <em>Middle Name</em>}</li>
+ * <li>{@link com.example.customer.Customer#getLastName <em>Last Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @extends Serializable
+ * @generated
+ */
+public interface Customer extends Serializable
+{
+ /**
+ * Returns the value of the '<em><b>First Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>First Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>First Name</em>' attribute.
+ * @see #setFirstName(Object)
+ * @generated
+ */
+ Object getFirstName();
+
+ /**
+ * Sets the value of the '{@link com.example.customer.Customer#getFirstName <em>First Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>First Name</em>' attribute.
+ * @see #getFirstName()
+ * @generated
+ */
+ void setFirstName(Object value);
+
+ /**
+ * Returns the value of the '<em><b>Middle Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Middle Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Middle Name</em>' attribute.
+ * @see #setMiddleName(Object)
+ * @generated
+ */
+ Object getMiddleName();
+
+ /**
+ * Sets the value of the '{@link com.example.customer.Customer#getMiddleName <em>Middle Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Middle Name</em>' attribute.
+ * @see #getMiddleName()
+ * @generated
+ */
+ void setMiddleName(Object value);
+
+ /**
+ * Returns the value of the '<em><b>Last Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Last Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Last Name</em>' attribute.
+ * @see #setLastName(Object)
+ * @generated
+ */
+ Object getLastName();
+
+ /**
+ * Sets the value of the '{@link com.example.customer.Customer#getLastName <em>Last Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Last Name</em>' attribute.
+ * @see #getLastName()
+ * @generated
+ */
+ void setLastName(Object value);
+
+} // Customer
Added: incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/SdoFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/SdoFactory.java?view=auto&rev=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/SdoFactory.java (added)
+++ incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/SdoFactory.java Thu May 31 04:28:33 2007
@@ -0,0 +1,48 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package com.example.customer;
+
+import commonj.sdo.helper.HelperContext;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public interface SdoFactory
+{
+
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ SdoFactory INSTANCE = com.example.customer.impl.SdoFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Customer</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Customer</em>'.
+ * @generated
+ */
+ Customer createCustomer();
+
+ /**
+ * Registers the types supported by this Factory within the supplied scope.argument
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param scope an instance of HelperContext used to manage the scoping of types.
+ * @generated
+ */
+ public void register(HelperContext scope);
+
+} //SdoFactory
Added: incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/CustomerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/CustomerImpl.java?view=auto&rev=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/CustomerImpl.java (added)
+++ incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/CustomerImpl.java Thu May 31 04:28:33 2007
@@ -0,0 +1,332 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package com.example.customer.impl;
+
+import com.example.customer.Customer;
+import com.example.customer.SdoFactory;
+
+import commonj.sdo.Type;
+
+import org.apache.tuscany.sdo.impl.DataObjectBase;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Customer</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link com.example.customer.impl.CustomerImpl#getFirstName <em>First Name</em>}</li>
+ * <li>{@link com.example.customer.impl.CustomerImpl#getMiddleName <em>Middle Name</em>}</li>
+ * <li>{@link com.example.customer.impl.CustomerImpl#getLastName <em>Last Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class CustomerImpl extends DataObjectBase implements Customer
+{
+
+ public final static int FIRST_NAME = 0;
+
+ public final static int MIDDLE_NAME = 1;
+
+ public final static int LAST_NAME = 2;
+
+ public final static int SDO_PROPERTY_COUNT = 3;
+
+ public final static int EXTENDED_PROPERTY_COUNT = 0;
+
+
+ /**
+ * The internal feature id for the '<em><b>First Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_FIRST_NAME = 0;
+
+ /**
+ * The internal feature id for the '<em><b>Middle Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_MIDDLE_NAME = 1;
+
+ /**
+ * The internal feature id for the '<em><b>Last Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_LAST_NAME = 2;
+
+ /**
+ * The number of properties for this type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_PROPERTY_COUNT = 3;
+
+ protected int internalConvertIndex(int internalIndex)
+ {
+ switch (internalIndex)
+ {
+ case INTERNAL_FIRST_NAME: return FIRST_NAME;
+ case INTERNAL_MIDDLE_NAME: return MIDDLE_NAME;
+ case INTERNAL_LAST_NAME: return LAST_NAME;
+ }
+ return super.internalConvertIndex(internalIndex);
+ }
+
+
+ /**
+ * The default value of the '{@link #getFirstName() <em>First Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFirstName()
+ * @generated
+ * @ordered
+ */
+ protected static final Object FIRST_NAME_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getFirstName() <em>First Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFirstName()
+ * @generated
+ * @ordered
+ */
+ protected Object firstName = FIRST_NAME_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getMiddleName() <em>Middle Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMiddleName()
+ * @generated
+ * @ordered
+ */
+ protected static final Object MIDDLE_NAME_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getMiddleName() <em>Middle Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMiddleName()
+ * @generated
+ * @ordered
+ */
+ protected Object middleName = MIDDLE_NAME_DEFAULT_;
+
+ /**
+ * The default value of the '{@link #getLastName() <em>Last Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLastName()
+ * @generated
+ * @ordered
+ */
+ protected static final Object LAST_NAME_DEFAULT_ = null;
+
+ /**
+ * The cached value of the '{@link #getLastName() <em>Last Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLastName()
+ * @generated
+ * @ordered
+ */
+ protected Object lastName = LAST_NAME_DEFAULT_;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CustomerImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Type getType()
+ {
+ return ((SdoFactoryImpl)SdoFactory.INSTANCE).getCustomer();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object getFirstName()
+ {
+ return firstName;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setFirstName(Object newFirstName)
+ {
+ firstName = newFirstName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object getMiddleName()
+ {
+ return middleName;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setMiddleName(Object newMiddleName)
+ {
+ middleName = newMiddleName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object getLastName()
+ {
+ return lastName;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLastName(Object newLastName)
+ {
+ lastName = newLastName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object get(int propertyIndex, boolean resolve)
+ {
+ switch (propertyIndex)
+ {
+ case FIRST_NAME:
+ return getFirstName();
+ case MIDDLE_NAME:
+ return getMiddleName();
+ case LAST_NAME:
+ return getLastName();
+ }
+ return super.get(propertyIndex, resolve);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void set(int propertyIndex, Object newValue)
+ {
+ switch (propertyIndex)
+ {
+ case FIRST_NAME:
+ setFirstName((Object)newValue);
+ return;
+ case MIDDLE_NAME:
+ setMiddleName((Object)newValue);
+ return;
+ case LAST_NAME:
+ setLastName((Object)newValue);
+ return;
+ }
+ super.set(propertyIndex, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void unset(int propertyIndex)
+ {
+ switch (propertyIndex)
+ {
+ case FIRST_NAME:
+ setFirstName(FIRST_NAME_DEFAULT_);
+ return;
+ case MIDDLE_NAME:
+ setMiddleName(MIDDLE_NAME_DEFAULT_);
+ return;
+ case LAST_NAME:
+ setLastName(LAST_NAME_DEFAULT_);
+ return;
+ }
+ super.unset(propertyIndex);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isSet(int propertyIndex)
+ {
+ switch (propertyIndex)
+ {
+ case FIRST_NAME:
+ return FIRST_NAME_DEFAULT_ == null ? firstName != null : !FIRST_NAME_DEFAULT_.equals(firstName);
+ case MIDDLE_NAME:
+ return MIDDLE_NAME_DEFAULT_ == null ? middleName != null : !MIDDLE_NAME_DEFAULT_.equals(middleName);
+ case LAST_NAME:
+ return LAST_NAME_DEFAULT_ == null ? lastName != null : !LAST_NAME_DEFAULT_.equals(lastName);
+ }
+ return super.isSet(propertyIndex);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String toString()
+ {
+ if (isProxy(this)) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (firstName: ");
+ result.append(firstName);
+ result.append(", middleName: ");
+ result.append(middleName);
+ result.append(", lastName: ");
+ result.append(lastName);
+ result.append(')');
+ return result.toString();
+ }
+
+} //CustomerImpl
Added: incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/SdoFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/SdoFactoryImpl.java?view=auto&rev=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/SdoFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/itest/properties/src/main/java/com/example/customer/impl/SdoFactoryImpl.java Thu May 31 04:28:33 2007
@@ -0,0 +1,230 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package com.example.customer.impl;
+
+import org.apache.tuscany.sdo.SDOFactory;
+import org.apache.tuscany.sdo.helper.TypeHelperImpl;
+import org.apache.tuscany.sdo.impl.FactoryBase;
+import org.apache.tuscany.sdo.model.ModelFactory;
+import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
+import org.apache.tuscany.sdo.model.internal.InternalFactory;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import com.example.customer.Customer;
+import com.example.customer.SdoFactory;
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * Generator information:
+ * patternVersion=1.1; -prefix Sdo -noNotification -noUnsettable
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class SdoFactoryImpl extends FactoryBase implements SdoFactory
+{
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String NAMESPACE_URI = "http://www.example.com/Customer";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String NAMESPACE_PREFIX = "cust";
+
+ /**
+ * The version of the generator pattern used to generate this class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String PATTERN_VERSION = "1.1";
+
+ public static final int CUSTOMER = 1;
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SdoFactoryImpl()
+ {
+ super(NAMESPACE_URI, NAMESPACE_PREFIX, "com.example.customer");
+ }
+
+ /**
+ * Registers the Factory instance so that it is available within the supplied scope.
+ * @argument scope a HelperContext instance that will make the types supported by this Factory available.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void register(HelperContext scope) {
+ if(scope == null) {
+ throw new IllegalArgumentException("Scope can not be null");
+ }
+ TypeHelperImpl th = (TypeHelperImpl)scope.getTypeHelper();
+ th.getExtendedMetaData().putPackage(NAMESPACE_URI, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DataObject create(int typeNumber)
+ {
+ switch (typeNumber)
+ {
+ case CUSTOMER: return (DataObject)createCustomer();
+ default:
+ return super.create(typeNumber);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Customer createCustomer()
+ {
+ CustomerImpl customer = new CustomerImpl();
+ return customer;
+ }
+
+ // Following creates and initializes SDO metadata for the supported types.
+ protected Type customerType = null;
+
+ public Type getCustomer()
+ {
+ return customerType;
+ }
+
+
+ private static boolean isInited = false;
+
+ public static SdoFactoryImpl init()
+ {
+ if (isInited) return (SdoFactoryImpl)FactoryBase.getStaticFactory(SdoFactoryImpl.NAMESPACE_URI);
+ SdoFactoryImpl theSdoFactoryImpl = new SdoFactoryImpl();
+ isInited = true;
+
+ // Initialize simple dependencies
+ SDOUtil.registerStaticTypes(SDOFactory.class);
+ SDOUtil.registerStaticTypes(ModelFactory.class);
+ SDOUtil.registerStaticTypes(InternalFactory.class);
+
+ // Create package meta-data objects
+ theSdoFactoryImpl.createMetaData();
+
+ // Initialize created meta-data
+ theSdoFactoryImpl.initializeMetaData();
+
+ // Mark meta-data to indicate it can't be changed
+ //theSdoFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ????
+
+ return theSdoFactoryImpl;
+ }
+
+ private boolean isCreated = false;
+
+ public void createMetaData()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create types and their properties
+ customerType = createType(false, CUSTOMER);
+ createProperty(true, customerType,CustomerImpl.INTERNAL_FIRST_NAME);
+ createProperty(true, customerType,CustomerImpl.INTERNAL_MIDDLE_NAME);
+ createProperty(true, customerType,CustomerImpl.INTERNAL_LAST_NAME);
+ }
+
+ private boolean isInitialized = false;
+
+ public void initializeMetaData()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Obtain other dependent packages
+ ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)FactoryBase.getStaticFactory(ModelFactoryImpl.NAMESPACE_URI);
+ Property property = null;
+
+ // Add supertypes to types
+
+ // Initialize types and properties
+ initializeType(customerType, Customer.class, "Customer", false);
+ property = getProperty(customerType, CustomerImpl.INTERNAL_FIRST_NAME);
+ initializeProperty(property, theModelPackageImpl.getObject(), "firstName", null, 1, 1, Customer.class, false, false, false);
+
+ property = getProperty(customerType, CustomerImpl.INTERNAL_MIDDLE_NAME);
+ initializeProperty(property, theModelPackageImpl.getObject(), "middleName", null, 1, 1, Customer.class, false, false, false);
+
+ property = getProperty(customerType, CustomerImpl.INTERNAL_LAST_NAME);
+ initializeProperty(property, theModelPackageImpl.getObject(), "lastName", null, 1, 1, Customer.class, false, false, false);
+
+ createXSDMetaData(theModelPackageImpl);
+ }
+
+ protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl)
+ {
+ super.initXSD();
+
+ Property property = null;
+
+
+ addXSDMapping
+ (customerType,
+ new String[]
+ {
+ "name", "Customer",
+ "kind", "elementOnly"
+ });
+
+ addXSDMapping
+ (getProperty(customerType, CustomerImpl.INTERNAL_FIRST_NAME),
+ new String[]
+ {
+ "kind", "element",
+ "name", "firstName"
+ });
+
+ addXSDMapping
+ (getProperty(customerType, CustomerImpl.INTERNAL_MIDDLE_NAME),
+ new String[]
+ {
+ "kind", "element",
+ "name", "middleName"
+ });
+
+ addXSDMapping
+ (getProperty(customerType, CustomerImpl.INTERNAL_LAST_NAME),
+ new String[]
+ {
+ "kind", "element",
+ "name", "lastName",
+ "namespace", "http://www.w3.org/2001/XMLSchema"
+ });
+
+ }
+
+} //SdoFactoryImpl
Modified: incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java?view=diff&rev=543114&r1=543113&r2=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java (original)
+++ incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java Thu May 31 04:28:33 2007
@@ -21,6 +21,8 @@
import java.util.Collection;
+import commonj.sdo.DataObject;
+
public interface PropertyComponent {
public String getLocation();
@@ -29,4 +31,6 @@
public ComplexPropertyBean getComplexPropertyTwo();
public ComplexPropertyBean getComplexPropertyThree();
public Collection<ComplexPropertyBean> getComplexPropertyFour();
+ public DataObject getSdoProperty();
+ public DataObject getCustomerSdo();
}
Modified: incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java?view=diff&rev=543114&r1=543113&r2=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java (original)
+++ incubator/tuscany/java/sca/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java Thu May 31 04:28:33 2007
@@ -23,7 +23,17 @@
import org.osoa.sca.annotations.Property;
+import com.example.customer.impl.CustomerImpl;
+import commonj.sdo.DataObject;
+
public class PropertyComponentImpl implements PropertyComponent {
+
+ @Property
+ protected CustomerImpl customerSdo;
+
+ @Property
+ protected DataObject sdoProperty;
+
@Property
protected ComplexPropertyBean complexPropertyOne;
@@ -68,5 +78,22 @@
public Collection<ComplexPropertyBean> getComplexPropertyFour() {
//System.out.println(complexPropertyThree);
return complexPropertyFour;
+ }
+
+ public DataObject getSdoProperty() {
+ return sdoProperty;
+ }
+
+ public void setSdoProperty(DataObject sdoProperty) {
+ System.out.println("Reached here da machi");
+ this.sdoProperty = sdoProperty;
+ }
+
+ public CustomerImpl getCustomerSdo() {
+ return customerSdo;
+ }
+
+ public void setCustomerSdo(CustomerImpl customerSdo) {
+ this.customerSdo = customerSdo;
}
}
Modified: incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite?view=diff&rev=543114&r1=543113&r2=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite (original)
+++ incubator/tuscany/java/sca/itest/properties/src/main/resources/PropertyTest.composite Thu May 31 04:28:33 2007
@@ -16,8 +16,10 @@
* specific language governing permissions and limitations
* under the License.
-->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:foo="http://foo"
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ xmlns:cust="http://www.example.com/Customer"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
targetNamespace="http://foo"
name="PropertyTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
@@ -25,6 +27,9 @@
<interface.java interface="org.apache.tuscany.sca.itest.ABComponent"/>
</service>
+ <dbsdo:import.sdo location="customer.xsd" />
+ <!-- dbsdo:import.sdo factory="com.example.customer.SdoFactory" /-->
+
<property name="number" type="xsd:int">1</property>
<property name="complex" type="foo:MyComplexType" >
<foo:MyComplexValue xsi:type="foo:MyComplexType" >
@@ -188,6 +193,20 @@
</foo:numberSet>
</foo:PropertyFourElement>
</property>
+ <property name="sdoProperty" type="cust:Customer">
+ <cust:customer>
+ <cust:firstName>Firstly Name</cust:firstName>
+ <cust:middleName>Middler Name</cust:middleName>
+ <cust:lastName>Lasting Name</cust:lastName>
+ </cust:customer>
+ </property>
+ <!-- property name="customerSdo" type="cust:Customer">
+ <cust:Customer>
+ <cust:firstName>Sdo Firstly Name</cust:firstName>
+ <cust:middleName>Sdo Middler Name</cust:middleName>
+ <cust:lastName>Sdo Lasting Name</cust:lastName>
+ </cust:Customer>
+ </property-->
</component>
</composite>
Added: incubator/tuscany/java/sca/itest/properties/src/main/resources/customer.xsd
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/main/resources/customer.xsd?view=auto&rev=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/main/resources/customer.xsd (added)
+++ incubator/tuscany/java/sca/itest/properties/src/main/resources/customer.xsd Thu May 31 04:28:33 2007
@@ -0,0 +1,12 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://www.example.com/Customer" targetNamespace="http://www.example.com/Customer">
+
+ <xsd:element name="customer" type="Customer"/>
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string"/>
+ <xsd:element name="middleName" type="xsd:string"/>
+ <xsd:element ref="lastName" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
Modified: incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java?view=diff&rev=543114&r1=543113&r2=543114
==============================================================================
--- incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java Thu May 31 04:28:33 2007
@@ -29,6 +29,8 @@
import org.junit.BeforeClass;
import org.junit.Test;
+import commonj.sdo.DataObject;
+
public class PropertyTestCase {
private static SCADomain domain;
private static ABComponent abService;
@@ -168,10 +170,30 @@
assertEquals(222.222, ((ComplexPropertyBean)propBeanCollection[1]).getDoubleNumber());
assertEquals(33, ((ComplexPropertyBean)propBeanCollection[2]).getNumberSet().getIntegerNumber());
}
+
+ @Test
+ public void testSDOProperty1() {
+ DataObject dataObject = propertyService.getSdoProperty();
+ assertNotNull(dataObject);
+ assertEquals("Firstly Name", dataObject.get("firstName"));
+ assertEquals("Middler Name", dataObject.getString("middleName"));
+ assertEquals("Lasting Name", dataObject.getString("lastName"));
+ }
+
+ /*@Test
+ public void testSDOProperty2() {
+ DataObject dataObject = propertyService.getCustomerSdo();
+ assertNotNull(dataObject);
+ assertEquals("Customer Firstly Name", dataObject.get("firstName"));
+ assertEquals("Customer Middler Name", dataObject.getString("middleName"));
+ assertEquals("Customer Lasting Name", dataObject.getString("lastName"));
+ }*/
@BeforeClass
public static void init() throws Exception {
+ try {
domain = SCADomain.newInstance("PropertyTest.composite");
+ } catch ( Exception e ) { e.printStackTrace(); }
abService = domain.getService(ABComponent.class, "ABComponent");
cdService = domain.getService(CDComponent.class, "CDComponent");
abcdService = domain.getService(ABCDComponent.class, "ABCDComponent");
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org