diff options
Diffstat (limited to '')
-rw-r--r-- | sandbox/wjaniszewski/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ErlangBindingProviderFactory.java | 84 |
1 files changed, 57 insertions, 27 deletions
diff --git a/sandbox/wjaniszewski/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ErlangBindingProviderFactory.java b/sandbox/wjaniszewski/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ErlangBindingProviderFactory.java index 8953112aaa..f823be2d8f 100644 --- a/sandbox/wjaniszewski/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ErlangBindingProviderFactory.java +++ b/sandbox/wjaniszewski/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/ErlangBindingProviderFactory.java @@ -19,6 +19,9 @@ package org.apache.tuscany.sca.binding.erlang.impl;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.tuscany.sca.binding.erlang.ErlangBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
@@ -31,34 +34,61 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService; /**
* @version $Rev: $ $Date: $
*/
-public class ErlangBindingProviderFactory implements BindingProviderFactory<ErlangBinding> {
-
- public ErlangBindingProviderFactory(ExtensionPointRegistry registry) {
-
- }
- /**
- * @see org.apache.tuscany.sca.provider.BindingProviderFactory#createReferenceBindingProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- ErlangBinding binding) {
- return new ErlangReferenceBindingProvider(binding, reference);
- }
+public class ErlangBindingProviderFactory implements
+ BindingProviderFactory<ErlangBinding> {
+
+ private Map<String, ErlangNode> nodes = new HashMap<String, ErlangNode>();
+
+ public ErlangBindingProviderFactory(ExtensionPointRegistry registry) {
+
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.BindingProviderFactory#createReferenceBindingProvider(org.apache.tuscany.sca.runtime.RuntimeComponent,
+ * org.apache.tuscany.sca.runtime.RuntimeComponentReference,
+ * org.apache.tuscany.sca.assembly.Binding)
+ */
+ public ReferenceBindingProvider createReferenceBindingProvider(
+ RuntimeComponent component, RuntimeComponentReference reference,
+ ErlangBinding binding) {
+ return new ErlangReferenceBindingProvider(binding, reference);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.provider.BindingProviderFactory#createServiceBindingProvider(org.apache.tuscany.sca.runtime.RuntimeComponent,
+ * org.apache.tuscany.sca.runtime.RuntimeComponentService,
+ * org.apache.tuscany.sca.assembly.Binding)
+ */
+ public ServiceBindingProvider createServiceBindingProvider(
+ RuntimeComponent component, RuntimeComponentService service,
+ ErlangBinding binding) {
+ ServiceBindingProvider provider = null;
+ try {
+ provider = new ErlangServiceBindingProvider(getErlangNode(binding
+ .getNode()), binding, service);
+ } catch (Exception e) {
+ // TODO: log, throw, do something with this error
+ e.printStackTrace();
+ }
+ return provider;
+ }
- /**
- * @see org.apache.tuscany.sca.provider.BindingProviderFactory#createServiceBindingProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- ErlangBinding binding) {
- return new ErlangServiceBindingProvider(binding, service);
- }
+ /**
+ * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+ */
+ public Class<ErlangBinding> getModelType() {
+ return ErlangBinding.class;
+ }
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class<ErlangBinding> getModelType() {
- return ErlangBinding.class;
- }
+ private ErlangNode getErlangNode(String name) throws Exception {
+ ErlangNode result = null;
+ if (nodes.containsKey(name)) {
+ result = nodes.get(name);
+ } else {
+ result = new ErlangNode(name);
+ nodes.put(name, result);
+ }
+ return result;
+ }
}
|