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/02/13 16:48:50 UTC

svn commit: r507068 - in /incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi: implementation/java/AbstractPropertyProcessor.java loader/MissingPropertyValueException.java model/Property.java

Author: svkrish
Date: Tue Feb 13 07:48:49 2007
New Revision: 507068

URL: http://svn.apache.org/viewvc?view=rev&rev=507068
Log:
'Updates for supporting Complex Properties and to bring in sync with current specs'

Added:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.java
Modified:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java
    incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java?view=diff&rev=507068&r1=507067&r2=507068
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/AbstractPropertyProcessor.java Tue Feb 13 07:48:49 2007
@@ -138,29 +138,44 @@
         Class[] params = constructor.getParameterTypes();
         Map<String, JavaMappedProperty<?>> properties = type.getProperties();
         Annotation[][] annotations = constructor.getParameterAnnotations();
+        
         for (int i = 0; i < params.length; i++) {
             Class<?> param = params[i];
             Annotation[] paramAnnotations = annotations[i];
+            JavaMappedProperty<?> property = null;
+            DataType propertyDataBinding = null;
+            A monitorAnnot = null;
+            String name = null;
             for (Annotation annotation : paramAnnotations) {
                 if (annotation.annotationType().equals(annotationClass)) {
                     if (definition == null) {
                         definition = new ConstructorDefinition<T>(constructor);
                         type.setConstructorDefinition(definition);
                     }
-                    A monitorAnnot = annotationClass.cast(annotation);
-                    String name = getName(monitorAnnot);
+                    monitorAnnot = annotationClass.cast(annotation);
+                    name = getName(monitorAnnot);
                     if (name == null || name.length() == 0) {
                         name = param.getName();
                     }
                     
                     Class<?> baseType = getBaseType(param, constructor.getGenericParameterTypes()[i]);
-                    JavaMappedProperty<?> property = createProperty(name, baseType, constructor);
+                    //JavaMappedProperty<?> property = createProperty(name, baseType, constructor);
+                    property = createProperty(name, baseType, constructor);
                     if (param.isArray() || Collection.class.isAssignableFrom(param)) {
                         property.setMany(true);
                     }
-                    initProperty(property, monitorAnnot, parent, context);
-                    properties.put(name, property);
-                    service.addName(definition.getInjectionNames(), i, name);
+                } else if (annotation.annotationType().equals(DataType.class)) {
+                	//if there is databinding information capture it
+                	propertyDataBinding = DataType.class.cast(annotation);
+                }
+            }
+            //if there has been a property annotation then a property would have been created
+            if (property != null) {
+            	initProperty(property, monitorAnnot, parent, context);
+                properties.put(name, property);
+                service.addName(definition.getInjectionNames(), i, name);
+                if (propertyDataBinding != null) {
+                    property.getExtensions().put(DataBinding.class.getName(), propertyDataBinding.name());
                 }
             }
         }

Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.java?view=auto&rev=507068
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/MissingPropertyValueException.java Tue Feb 13 07:48:49 2007
@@ -0,0 +1,30 @@
+/*
+ * 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.spi.loader;
+
+/**
+ * @version $Rev: 486986 $ $Date: 2006-12-14 11:48:28 +0530 (Thu, 14 Dec 2006) $
+ */
+public class MissingPropertyValueException extends LoaderException {
+
+    public MissingPropertyValueException(String name) {
+        super(name);
+    }
+
+}

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java?view=diff&rev=507068&r1=507067&r2=507068
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Property.java Tue Feb 13 07:48:49 2007
@@ -35,7 +35,7 @@
     private QName xmlType;
     private Class<T> javaType;
     private boolean many;
-    private OverrideOptions override;
+    private boolean noDefault;
     private Document defaultValue;
 
     public Property() {
@@ -87,12 +87,12 @@
         this.many = many;
     }
 
-    public OverrideOptions getOverride() {
-        return override;
+    public boolean isNoDefault() {
+        return noDefault;
     }
 
-    public void setOverride(OverrideOptions override) {
-        this.override = override;
+    public void setNoDefault(boolean noDefault) {
+        this.noDefault = noDefault;
     }
 
     public Document getDefaultValue() {



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