Meeraj asked me offline what I meant by using ElementType so I added this strawman for a mapping from something in SCA land (a callback, reference or property value) to a Java injection site (field, method, ctrArg). In the end it doesn't use ElementType at all...

Meeraj, I hope this makes sense :-)
--
Jeremy


On Mar 13, 2007, at 2:50 PM, [EMAIL PROTECTED] wrote:

Author: jboynes
Date: Tue Mar 13 14:50:31 2007
New Revision: 517891

URL: http://svn.apache.org/viewvc?view=rev&rev=517891
Log:
strawman for mapping values to injection sites for the injection provider

Added:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/ tuscany/core/model/physical/instancefactory/ InjectionSiteMapping.java (with props)

Added: incubator/tuscany/java/sca/kernel/core/src/main/java/org/ apache/tuscany/core/model/physical/instancefactory/ InjectionSiteMapping.java URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/ core/src/main/java/org/apache/tuscany/core/model/physical/ instancefactory/InjectionSiteMapping.java?view=auto&rev=517891 ====================================================================== ======== --- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/ tuscany/core/model/physical/instancefactory/ InjectionSiteMapping.java (added) +++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/ tuscany/core/model/physical/instancefactory/ InjectionSiteMapping.java Tue Mar 13 14:50:31 2007
@@ -0,0 +1,115 @@
+/*
+ * 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.core.model.physical.instancefactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InjectionSiteMapping {
+    /**
+ * Identifier in SCA terms of the source of the value that will be injected.
+     */
+    public static class ValueSource {
+        public static enum ValueSourceType {
+            CALLBACK,
+            REFERENCE,
+            PROPERTY
+        }
+
+        private ValueSourceType valueType;
+        private String name;
+
+        public ValueSourceType getValueType() {
+            return valueType;
+        }
+
+        public void setValueType(ValueSourceType valueType) {
+            this.valueType = valueType;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+    }
+
+    /**
+     * Abstraction for a site where a value can be injected.
+     */
+    public static abstract class Site {
+    }
+
+    public static class FieldSite extends Site {
+        private String name;
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+    }
+
+    public static class MethodSite {
+        private String name;
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+    }
+
+    public static class ConstructorSite extends Site {
+        private int paramIndex;
+
+        public int getParamIndex() {
+            return paramIndex;
+        }
+
+        public void setParamIndex(int paramIndex) {
+            this.paramIndex = paramIndex;
+        }
+    }
+
+    private ValueSource source;
+    private Site site;
+
+    public ValueSource getSource() {
+        return source;
+    }
+
+    public void setSource(ValueSource source) {
+        this.source = source;
+    }
+
+    public Site getSite() {
+        return site;
+    }
+
+    public void setSite(Site site) {
+        this.site = site;
+    }
+}

Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/ org/apache/tuscany/core/model/physical/instancefactory/ InjectionSiteMapping.java ---------------------------------------------------------------------- --------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/core/src/main/java/ org/apache/tuscany/core/model/physical/instancefactory/ InjectionSiteMapping.java ---------------------------------------------------------------------- --------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to