summaryrefslogtreecommitdiffstats
path: root/java/sca/itest/builder
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-07-04 23:20:36 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-07-04 23:20:36 +0000
commit7d30e4d1c5eeef8a326d076b962c925d54ad33ad (patch)
treea509709f7d6294492e49ef624fb87a643c17874f /java/sca/itest/builder
parent8ef57fdf120e8c1fe5e802e412961831ce70b1f7 (diff)
TUSCANY-2352 - upgrade the fix for promoted binding overriding as the automatically created sca bindings were causing the top level to always override.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@674139 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/itest/builder')
-rw-r--r--java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java149
-rw-r--r--java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java1
2 files changed, 150 insertions, 0 deletions
diff --git a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java b/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java
new file mode 100644
index 0000000000..d39df250ca
--- /dev/null
+++ b/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java
@@ -0,0 +1,149 @@
+/*
+ * 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.sca.itest.builder;
+
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultEndpointFactory;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * A builder that handles the configuration of the components inside a composite
+ * and the wiring of component references to component services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBuilderNonWiringImpl implements CompositeBuilder {
+ private static final Logger logger = Logger.getLogger(CompositeBuilderNonWiringImpl.class.getName());
+ private CompositeBuilder compositeIncludeBuilder;
+ private CompositeBuilder componentWireBuilder;
+ private CompositeBuilder compositeReferenceWireBuilder;
+ private CompositeBuilder compositeCloneBuilder;
+ private CompositeBuilder componentConfigurationBuilder;
+ private CompositeBuilder compositeServiceConfigurationBuilder;
+ private CompositeBuilder compositePromotionBuilder;
+ private CompositeBuilder compositePolicyBuilder;
+ private CompositeBuilder componentServiceBindingBuilder;
+ private CompositeBuilder compositeServiceBindingBuilder;
+ private CompositeBuilder componentReferenceBindingBuilder;
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param intentAttachPointTypeFactory
+ * @param interfaceContractMapper
+ * @param monitor
+ */
+ public CompositeBuilderNonWiringImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ Monitor monitor) {
+ this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, null, monitor);
+ }
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param endpointFactory
+ * @param intentAttachPointTypeFactory
+ * @param interfaceContractMapper
+ * @param policyDefinitions
+ * @param monitor
+ */
+ public CompositeBuilderNonWiringImpl(AssemblyFactory assemblyFactory,
+ EndpointFactory endpointFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+
+ if (endpointFactory == null){
+ endpointFactory = new DefaultEndpointFactory();
+ }
+
+ compositeIncludeBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeIncludeBuilderImpl(monitor);
+ componentWireBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ compositeReferenceWireBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ compositeCloneBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeCloneBuilderImpl(monitor);
+ componentConfigurationBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+ compositeServiceConfigurationBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeServiceConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+ compositePromotionBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ compositePolicyBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ componentServiceBindingBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentServiceBindingBuilderImpl(monitor);
+ compositeServiceBindingBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeServiceBindingBuilderImpl(monitor);
+ componentReferenceBindingBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentReferenceBindingBuilderImpl(monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Collect and fuse includes
+ compositeIncludeBuilder.build(composite);
+
+ // Expand nested composites
+ compositeCloneBuilder.build(composite);
+
+ // Configure all components
+ componentConfigurationBuilder.build(composite);
+
+ // Connect composite services/references to promoted services/references
+ compositePromotionBuilder.build(composite);
+
+ // Compute the policies across the model hierarchy
+ compositePolicyBuilder.build(composite);
+
+ // Build component service binding-related information
+ componentServiceBindingBuilder.build(composite);
+
+ // Build composite service binding-related information
+// compositeServiceBindingBuilder.build(composite);
+
+ // Configure composite services
+// compositeServiceConfigurationBuilder.build(composite);
+
+ // Wire the components
+// componentWireBuilder.build(composite);
+
+ // Wire the composite references
+// compositeReferenceWireBuilder.build(composite);
+
+ // Build component reference binding-related information
+ componentReferenceBindingBuilder.build(composite);
+
+ // Fuse nested composites
+ //FIXME do this later
+ //cloneBuilder.fuseCompositeImplementations(composite);
+ }
+
+}
diff --git a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java b/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java
index 07abe2b4a9..e77cd81d2e 100644
--- a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java
+++ b/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java
@@ -121,6 +121,7 @@ public class CustomCompositeBuilder {
IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
+ //domainCompositeBuilder = new CompositeBuilderNonWiringImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
}
public void loadContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {