summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/assembly
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-21 07:03:47 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-21 07:03:47 +0000
commitab6904bc2f622129bc548391745b08eb0c219e57 (patch)
tree5c7599119182bfa8e65c0d6605e933396aedffd2 /java/sca/modules/assembly
parent8d70ef6d556ad29b93d5d40e91c4c9304638c9e9 (diff)
Fix svn:eol-style and svn:keywords properties for java/xml files
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@796166 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly')
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DistributedSCABinding.java90
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java166
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java2
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java76
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java842
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/DistributedSCABindingImpl.java152
6 files changed, 664 insertions, 664 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DistributedSCABinding.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DistributedSCABinding.java
index f1e25a0867..5cc43d6333 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DistributedSCABinding.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DistributedSCABinding.java
@@ -1,45 +1,45 @@
-/*
- * 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.assembly;
-
-import javax.xml.namespace.QName;
-
-/**
- * Represents an SCA binding used in the distributed runtime.
- * It provides us with a sensibly named type against which
- * distributed sca binding providers can be registered
- *
- * @version $Rev: 556322 $ $Date: 2007-07-14 19:53:15 +0100 (Sat, 14 Jul 2007) $
- */
-public interface DistributedSCABinding extends Binding {
- QName TYPE = SCABinding.TYPE;
-
- /**
- * Return the wrapped SCA binding
- * @return the SCA binding model element
- */
- SCABinding getSCABinding();
-
- /**
- * Set the wrapped SCA binding
- * @param scaBinding the SCA binding model element
- */
- void setSCABinding(SCABinding scaBinding);
-
-}
+/*
+ * 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.assembly;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents an SCA binding used in the distributed runtime.
+ * It provides us with a sensibly named type against which
+ * distributed sca binding providers can be registered
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DistributedSCABinding extends Binding {
+ QName TYPE = SCABinding.TYPE;
+
+ /**
+ * Return the wrapped SCA binding
+ * @return the SCA binding model element
+ */
+ SCABinding getSCABinding();
+
+ /**
+ * Set the wrapped SCA binding
+ * @param scaBinding the SCA binding model element
+ */
+ void setSCABinding(SCABinding scaBinding);
+
+}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java
index 655e18ad08..6fa2d18037 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java
@@ -1,83 +1,83 @@
-/*
- * 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.assembly.builder;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Service;
-
-/**
- * A builder that handles the configuration of the components inside a
- * composite and the wiring of component references to component services.
- *
- * @version $Rev: 563358 $ $Date: 2007-08-07 01:26:27 +0100 (Tue, 07 Aug 2007) $
- */
-public interface DomainBuilder {
-
- /**
- * Wire up the references and service in a domain returning a list
- * of the composites that have changed
- *
- * @param domainLevelCompsite
- * @return a list of change composites
- * @throws CompositeBuilderException
- */
- List<Composite> wireDomain(Composite domainLevelComposite);
-
- /**
- * Locates the referenced service and updates the URI on the identified binding
- *
- * @param domainLevelComposite
- * @param referenceName
- * @param bindingClassName
- * @param URI
- */
- void updateDomainLevelServiceURI(Composite domainLevelComposite,
- String referenceName,
- String bindingClassName,
- String URI);
-
- /**
- * Get the component name out of the reference name that might look like Component/Service
- *
- * @param referenceName
- * @return
- */
- String getComponentNameFromReference(String referenceName);
-
- /**
- * Get the service name out of the reference name that might look like Component/Service
- *
- * @param referenceName
- * @return
- */
- String getServiceNameFromReference(String referenceName);
-
- /**
- * Find the service object given a reference name
- *
- * @param composite
- * @param referenceName
- * @return
- */
- Service findServiceForReference(Composite composite, String referenceName);
-
-}
+/*
+ * 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.assembly.builder;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Service;
+
+/**
+ * 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 interface DomainBuilder {
+
+ /**
+ * Wire up the references and service in a domain returning a list
+ * of the composites that have changed
+ *
+ * @param domainLevelCompsite
+ * @return a list of change composites
+ * @throws CompositeBuilderException
+ */
+ List<Composite> wireDomain(Composite domainLevelComposite);
+
+ /**
+ * Locates the referenced service and updates the URI on the identified binding
+ *
+ * @param domainLevelComposite
+ * @param referenceName
+ * @param bindingClassName
+ * @param URI
+ */
+ void updateDomainLevelServiceURI(Composite domainLevelComposite,
+ String referenceName,
+ String bindingClassName,
+ String URI);
+
+ /**
+ * Get the component name out of the reference name that might look like Component/Service
+ *
+ * @param referenceName
+ * @return
+ */
+ String getComponentNameFromReference(String referenceName);
+
+ /**
+ * Get the service name out of the reference name that might look like Component/Service
+ *
+ * @param referenceName
+ * @return
+ */
+ String getServiceNameFromReference(String referenceName);
+
+ /**
+ * Find the service object given a reference name
+ *
+ * @param composite
+ * @param referenceName
+ * @return
+ */
+ Service findServiceForReference(Composite composite, String referenceName);
+
+}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
index e5b7444bcf..992d1915a3 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
@@ -39,7 +39,7 @@ import org.apache.tuscany.sca.monitor.Monitor;
/**
* A composite builder that handles the configuration of composite references.
*
- * @version $Rev: 651179 $ $Date: 2008-04-24 08:21:13 +0100 (Thu, 24 Apr 2008) $
+ * @version $Rev$ $Date$
*/
public class CompositeReferenceConfigurationBuilderImpl implements CompositeBuilder {
private AssemblyFactory assemblyFactory;
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java
index b53f3641f5..27f768fc53 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java
@@ -1,38 +1,38 @@
-/*
- * 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.assembly.builder.impl;
-
-/**
- * Exception to be throw for invalid policy intents / policysets
- *
- * @version $Rev$ $Date$
- */
-public class PolicyConfigurationException extends Exception {
- private static final long serialVersionUID = 506979037642587755L;
-
- public PolicyConfigurationException(String message) {
- super(message);
- }
-
- public PolicyConfigurationException(Throwable e) {
- super(e);
- }
-
-}
+/*
+ * 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.assembly.builder.impl;
+
+/**
+ * Exception to be throw for invalid policy intents / policysets
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyConfigurationException extends Exception {
+ private static final long serialVersionUID = 506979037642587755L;
+
+ public PolicyConfigurationException(String message) {
+ super(message);
+ }
+
+ public PolicyConfigurationException(Throwable e) {
+ super(e);
+ }
+
+}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
index ca23948632..82c88a92a8 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
@@ -1,421 +1,421 @@
-/*
- * 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.assembly.builder.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.policy.ExtensionType;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentMap;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySubject;
-import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
-import org.apache.tuscany.sca.policy.util.PolicyValidationException;
-import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
-
-/**
- * This class contains policy computation methods common to computing implementation and binding policies
- *
- * @version $Rev$ $Date$
- */
-abstract class PolicyConfigurationUtil {
-
- private static List<Intent> computeInheritableIntents(ExtensionType attachPointType, List<Intent> inheritableIntents)
- throws PolicyValidationException {
- List<Intent> validInheritableIntents = new ArrayList<Intent>();
-
- //expand profile intents in inherited intents
- PolicyComputationUtils.expandProfileIntents(inheritableIntents);
-
- //validate if inherited intent applies to the attachpoint (binding / implementation) and
- //only add such intents to the attachpoint (binding / implementation)
- for (Intent intent : inheritableIntents) {
- if (!intent.isUnresolved()) {
- for (ExtensionType constrained : intent.getConstrainedTypes()) {
- if (PolicyValidationUtils.isConstrained(constrained, attachPointType)) {
- validInheritableIntents.add(intent);
- break;
- }
- }
- } else {
- throw new PolicyValidationException("Policy Intent '" + intent.getName()
- + "' is not defined in this domain");
- }
- }
-
- return validInheritableIntents;
- }
-
- private static void normalizeIntents(PolicySubject intentAttachPoint) {
- //expand profile intents specified in the attachpoint (binding / implementation)
- PolicyComputationUtils.expandProfileIntents(intentAttachPoint.getRequiredIntents());
-
- //remove duplicates and ...
- //where qualified form of intent exists retain it and remove the qualifiable intent
- filterDuplicatesAndQualifiableIntents(intentAttachPoint);
- }
-
- private static void trimInherentlyProvidedIntents(ExtensionType attachPointType, List<Intent> intents) {
- //exclude intents that are inherently supported by the
- //attachpoint-type (binding-type / implementation-type)
- List<Intent> requiredIntents = new ArrayList<Intent>(intents);
- for (Intent intent : requiredIntents) {
- if (isProvidedInherently(attachPointType, intent)) {
- intents.remove(intent);
- }
- }
- }
-
- private static List<PolicySet> computeInheritablePolicySets(List<PolicySet> inheritablePolicySets)
- throws PolicyValidationException {
- // FIXME:
- return inheritablePolicySets;
- }
-
- private static void normalizePolicySets(PolicySubject subject) {
- //get rid of duplicate entries
- Set<PolicySet> policySetTable = new HashSet<PolicySet>(subject.getPolicySets());
-
- subject.getPolicySets().clear();
- subject.getPolicySets().addAll(policySetTable);
-
- //expand profile intents
- for (PolicySet policySet : subject.getPolicySets()) {
- PolicyComputationUtils.expandProfileIntents(policySet.getProvidedIntents());
- }
- }
-
- private static void trimProvidedIntents(List<Intent> requiredIntents, List<PolicySet> policySets) {
- for (PolicySet policySet : policySets) {
- trimProvidedIntents(requiredIntents, policySet);
- }
- }
-
- private static void determineApplicableDomainPolicySets(List<PolicySet> applicablePolicySets,
- PolicySubject policySetAttachPoint,
- ExtensionType intentAttachPointType) {
-
- if (policySetAttachPoint.getRequiredIntents().size() > 0) {
-
- // form a list of all intents required by the attach point
- List<Intent> combinedTargetIntents = new ArrayList<Intent>();
- combinedTargetIntents.addAll(policySetAttachPoint.getRequiredIntents());
- for (PolicySet targetPolicySet : policySetAttachPoint.getPolicySets()) {
- combinedTargetIntents.addAll(PolicyComputationUtils.findAndExpandProfileIntents(targetPolicySet
- .getProvidedIntents()));
- }
-
- //since the set of applicable policysets for this attachpoint is known
- //we only need to check in that list if there is a policyset that matches
- for (PolicySet policySet : applicablePolicySets) {
- // do not use the policy set if it provides intents that conflict with required intents
- boolean conflict = false;
- List<Intent> providedIntents =
- PolicyComputationUtils.findAndExpandProfileIntents(policySet.getProvidedIntents());
- checkConflict: for (Intent intent : providedIntents) {
- for (Intent excluded : intent.getExcludedIntents()) {
- if (combinedTargetIntents.contains(excluded)) {
- conflict = true;
- break checkConflict;
- }
- }
- }
- if (conflict)
- continue;
- int prevSize = policySetAttachPoint.getRequiredIntents().size();
- trimProvidedIntents(policySetAttachPoint.getRequiredIntents(), policySet);
- // if any intent was trimmed off, then this policyset must
- // be attached to the intent attachpoint's policyset
- if (prevSize != policySetAttachPoint.getRequiredIntents().size()) {
- policySetAttachPoint.getPolicySets().add(policySet);
- }
- }
- }
- }
-
- private static boolean isProvidedInherently(ExtensionType attachPointType, Intent intent) {
- return (attachPointType != null && ((attachPointType.getAlwaysProvidedIntents() != null && attachPointType
- .getAlwaysProvidedIntents().contains(intent)) || (attachPointType.getMayProvidedIntents() != null && attachPointType
- .getMayProvidedIntents().contains(intent))));
- }
-
- private static void trimProvidedIntents(List<Intent> requiredIntents, PolicySet policySet) {
- for (Intent providedIntent : policySet.getProvidedIntents()) {
- if (requiredIntents.contains(providedIntent)) {
- requiredIntents.remove(providedIntent);
- }
- }
-
- for (IntentMap intentMap : policySet.getIntentMaps()) {
- if (requiredIntents.contains(intentMap.getProvidedIntent())) {
- requiredIntents.remove(intentMap.getProvidedIntent());
- }
- }
- }
-
- private static void filterDuplicatesAndQualifiableIntents(PolicySubject intentAttachPoint) {
- //remove duplicates
- Map<QName, Intent> intentsTable = new HashMap<QName, Intent>();
- for (Intent intent : intentAttachPoint.getRequiredIntents()) {
- intentsTable.put(intent.getName(), intent);
- }
-
- //where qualified form of intent exists retain it and remove the qualifiable intent
- Map<QName, Intent> intentsTableCopy = new HashMap<QName, Intent>(intentsTable);
- //if qualified form of intent exists remove the unqualified form
- for (Intent intent : intentsTableCopy.values()) {
- if (intent.getQualifiableIntent() != null) {
- if (intentsTable.get(intent.getQualifiableIntent().getName()) != null) {
- intentsTable.remove(intent.getQualifiableIntent().getName());
- }
- }
- }
- intentAttachPoint.getRequiredIntents().clear();
- intentAttachPoint.getRequiredIntents().addAll(intentsTable.values());
- }
-
- static void computeBindingIntentsAndPolicySets(Contract contract) throws PolicyValidationException {
- for (Binding binding : contract.getBindings()) {
- if (binding instanceof PolicySubject) {
- PolicySubject policiedBinding = (PolicySubject)binding;
- computeIntents((PolicySubject)binding, contract.getRequiredIntents());
-
- computePolicySets(policiedBinding, contract.getPolicySets());
-
- PolicyComputationUtils.checkForMutuallyExclusiveIntents(policiedBinding.getRequiredIntents(),
- policiedBinding.getPolicySets(),
- policiedBinding.getExtensionType(),
- contract.getName());
- }
- }
-
- if (contract.getCallback() != null) {
- for (Binding binding : contract.getCallback().getBindings()) {
- if (binding instanceof PolicySubject) {
- PolicySubject policiedBinding = (PolicySubject)binding;
- computeIntents((PolicySubject)binding, contract.getCallback().getRequiredIntents());
-
- computePolicySets(policiedBinding, contract.getCallback().getPolicySets());
-
- PolicyComputationUtils.checkForMutuallyExclusiveIntents(policiedBinding.getRequiredIntents(),
- policiedBinding.getPolicySets(),
- policiedBinding.getExtensionType(),
- contract.getName() + " callback");
-
- }
- }
- }
- }
-
- private static void computeIntents(PolicySubject policiedBinding, List<Intent> inheritedIntents)
- throws PolicyValidationException {
- //since the parent component could also contain intents that apply to implementation
- //and binding elements within, we filter out only those that apply to this binding type
- List<Intent> prunedIntents = computeInheritableIntents(policiedBinding.getExtensionType(), inheritedIntents);
- policiedBinding.getRequiredIntents().addAll(prunedIntents);
-
- normalizeIntents(policiedBinding);
- }
-
- private static void computePolicySets(PolicySubject policiedBinding, List<PolicySet> inheritedPolicySets)
- throws PolicyValidationException {
-
- List<PolicySet> prunedPolicySets = computeInheritablePolicySets(inheritedPolicySets);
- policiedBinding.getPolicySets().addAll(prunedPolicySets);
- normalizePolicySets(policiedBinding);
- }
-
- static void determineApplicableBindingPolicySets(Contract source, Contract target)
- throws PolicyConfigurationException {
- List<Intent> intentsCopy = null;
- for (Binding aBinding : source.getBindings()) {
- if (aBinding instanceof PolicySubject) {
- PolicySubject policiedBinding = (PolicySubject)aBinding;
- ExtensionType bindingType = policiedBinding.getExtensionType();
-
- intentsCopy = new ArrayList<Intent>(policiedBinding.getRequiredIntents());
- // add the target component's intents to the reference binding
- if (target != null) {
- for (Intent intent : target.getRequiredIntents()) {
- if (!policiedBinding.getRequiredIntents().contains(intent)) {
- for (ExtensionType constrained : intent.getConstrainedTypes()) {
- if (bindingType != null && bindingType.getType().getNamespaceURI().equals(constrained
- .getType().getNamespaceURI())
- && bindingType.getType().getLocalPart().startsWith(constrained.getType()
- .getLocalPart())) {
- policiedBinding.getRequiredIntents().add(intent);
- break;
- }
- }
- }
- }
- }
-
- trimInherentlyProvidedIntents(policiedBinding.getExtensionType(), policiedBinding.getRequiredIntents());
- trimProvidedIntents(policiedBinding.getRequiredIntents(), policiedBinding.getPolicySets());
-
- // determine additional policysets that match remaining intents
- // TODO: resolved to domain policy registry and attach suitable
- // policy sets to the binding
- // for now using the SCA Definitions instead of registry
- // if there are intents that are not provided by any policy set
- // throw a warning
- determineApplicableDomainPolicySets(source, policiedBinding);
-
- //the intents list could have been trimmed when matching for policysets
- //since the bindings may need the original set of intents we copy that back
- policiedBinding.getRequiredIntents().clear();
- policiedBinding.getRequiredIntents().addAll(intentsCopy);
-
- }
- }
- }
-
- private static void determineApplicableDomainPolicySets(Contract contract, PolicySubject policiedBinding)
- throws PolicyConfigurationException {
- // FIXME:
- /*
- //if ( domainPolicySets != null) {
- determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
- policiedBinding,
- policiedBinding.getExtensionType());
-
- if ( policiedBinding.getRequiredIntents().size() > 0 ) {
- if ( contract instanceof Service ) {
- throw new PolicyConfigurationException("The following are unfulfilled intents for " +
- "binding in service - " + contract.getName() + "\nUnfulfilled Intents = " +
- policiedBinding.getRequiredIntents());
- } else {
- throw new PolicyConfigurationException("The are unfulfilled intents for " +
- "binding in reference - " + contract.getName() + "\nUnfulfilled Intents = " +
- policiedBinding.getRequiredIntents());
- }
- }
- //}
- */
- }
-
- private static void aggregateAndPruneApplicablePolicySets(List<PolicySet> source, List<PolicySet> target) {
- target.addAll(source);
- //strip duplicates
- Hashtable<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
- for (PolicySet policySet : target) {
- policySetTable.put(policySet.getName(), policySet);
- }
-
- target.clear();
- target.addAll(policySetTable.values());
- }
-
- static <C extends Contract> void inheritDefaultPolicies(Base parent, List<C> contracts) {
-
- for (Contract contract : contracts) {
-
- // The contract inherits default policies from the parent composite/component.
- if (parent instanceof PolicySubject) {
- PolicyComputationUtils.addDefaultPolicies(((PolicySubject)parent).getRequiredIntents(),
- ((PolicySubject)parent).getPolicySets(),
- contract.getRequiredIntents(),
- contract.getPolicySets());
- }
-
- // The contract's callback inherits default policies from the contract.
- if (contract.getCallback() != null) {
- PolicyComputationUtils.addDefaultPolicies(contract.getRequiredIntents(),
- contract.getPolicySets(),
- contract.getCallback().getRequiredIntents(),
- contract.getCallback().getPolicySets());
- }
-
- }
- }
-
- static void computeImplementationIntentsAndPolicySets(Implementation implementation, Component parent)
- throws PolicyValidationException, PolicyConfigurationException {
- if (implementation instanceof PolicySubject) {
- PolicySubject policiedImplementation = (PolicySubject)implementation;
- //since for an implementation the component has its policy intents and policysets its possible
- //that there are some intents there that does not constrain the implementation.. so prune
- List<Intent> prunedIntents =
- computeInheritableIntents(policiedImplementation.getExtensionType(), parent.getRequiredIntents());
- parent.getRequiredIntents().clear();
- parent.getRequiredIntents().addAll(prunedIntents);
- normalizeIntents(parent);
-
- List<PolicySet> prunedPolicySets = computeInheritablePolicySets(parent.getPolicySets());
- parent.getPolicySets().clear();
- parent.getPolicySets().addAll(prunedPolicySets);
- normalizePolicySets(parent);
-
- PolicyComputationUtils.checkForMutuallyExclusiveIntents(parent.getRequiredIntents(),
- parent.getPolicySets(),
- policiedImplementation.getExtensionType(),
- parent.getName());
-
- determineApplicableImplementationPolicySets(parent);
-
- }
- }
-
- private static void determineApplicableImplementationPolicySets(Component component)
- throws PolicyConfigurationException {
- List<Intent> intentsCopy = null;
- if (component.getImplementation() instanceof PolicySubject) {
- PolicySubject policiedImplementation = (PolicySubject)component.getImplementation();
-
- intentsCopy = new ArrayList<Intent>(component.getRequiredIntents());
- trimInherentlyProvidedIntents(policiedImplementation.getExtensionType(), component.getRequiredIntents());
- trimProvidedIntents(component.getRequiredIntents(), component.getPolicySets());
-
- //determine additional policysets that match remaining intents
- //if there are intents that are not provided by any policy set throw a warning
- //TODO: resolved to domain policy registry and attach suitable policy sets to the implementation
- //...for now using the SCA Definitions instead of registry
- //if ( domainPolicySets != null) {
-
- if (component.getRequiredIntents().size() > 0) {
- throw new PolicyConfigurationException(
- "The following are unfulfilled intents for component implementation - " + component
- .getName()
- + "\nUnfulfilled Intents = "
- + component.getRequiredIntents());
- }
- //}
-
- //the intents list could have been trimmed when matching for policysets
- //since the bindings may need the original set of intents we copy that back
- component.getRequiredIntents().clear();
- component.getRequiredIntents().addAll(intentsCopy);
- }
- }
-}
+/*
+ * 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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.policy.ExtensionType;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentMap;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySubject;
+import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
+import org.apache.tuscany.sca.policy.util.PolicyValidationException;
+import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
+
+/**
+ * This class contains policy computation methods common to computing implementation and binding policies
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class PolicyConfigurationUtil {
+
+ private static List<Intent> computeInheritableIntents(ExtensionType attachPointType, List<Intent> inheritableIntents)
+ throws PolicyValidationException {
+ List<Intent> validInheritableIntents = new ArrayList<Intent>();
+
+ //expand profile intents in inherited intents
+ PolicyComputationUtils.expandProfileIntents(inheritableIntents);
+
+ //validate if inherited intent applies to the attachpoint (binding / implementation) and
+ //only add such intents to the attachpoint (binding / implementation)
+ for (Intent intent : inheritableIntents) {
+ if (!intent.isUnresolved()) {
+ for (ExtensionType constrained : intent.getConstrainedTypes()) {
+ if (PolicyValidationUtils.isConstrained(constrained, attachPointType)) {
+ validInheritableIntents.add(intent);
+ break;
+ }
+ }
+ } else {
+ throw new PolicyValidationException("Policy Intent '" + intent.getName()
+ + "' is not defined in this domain");
+ }
+ }
+
+ return validInheritableIntents;
+ }
+
+ private static void normalizeIntents(PolicySubject intentAttachPoint) {
+ //expand profile intents specified in the attachpoint (binding / implementation)
+ PolicyComputationUtils.expandProfileIntents(intentAttachPoint.getRequiredIntents());
+
+ //remove duplicates and ...
+ //where qualified form of intent exists retain it and remove the qualifiable intent
+ filterDuplicatesAndQualifiableIntents(intentAttachPoint);
+ }
+
+ private static void trimInherentlyProvidedIntents(ExtensionType attachPointType, List<Intent> intents) {
+ //exclude intents that are inherently supported by the
+ //attachpoint-type (binding-type / implementation-type)
+ List<Intent> requiredIntents = new ArrayList<Intent>(intents);
+ for (Intent intent : requiredIntents) {
+ if (isProvidedInherently(attachPointType, intent)) {
+ intents.remove(intent);
+ }
+ }
+ }
+
+ private static List<PolicySet> computeInheritablePolicySets(List<PolicySet> inheritablePolicySets)
+ throws PolicyValidationException {
+ // FIXME:
+ return inheritablePolicySets;
+ }
+
+ private static void normalizePolicySets(PolicySubject subject) {
+ //get rid of duplicate entries
+ Set<PolicySet> policySetTable = new HashSet<PolicySet>(subject.getPolicySets());
+
+ subject.getPolicySets().clear();
+ subject.getPolicySets().addAll(policySetTable);
+
+ //expand profile intents
+ for (PolicySet policySet : subject.getPolicySets()) {
+ PolicyComputationUtils.expandProfileIntents(policySet.getProvidedIntents());
+ }
+ }
+
+ private static void trimProvidedIntents(List<Intent> requiredIntents, List<PolicySet> policySets) {
+ for (PolicySet policySet : policySets) {
+ trimProvidedIntents(requiredIntents, policySet);
+ }
+ }
+
+ private static void determineApplicableDomainPolicySets(List<PolicySet> applicablePolicySets,
+ PolicySubject policySetAttachPoint,
+ ExtensionType intentAttachPointType) {
+
+ if (policySetAttachPoint.getRequiredIntents().size() > 0) {
+
+ // form a list of all intents required by the attach point
+ List<Intent> combinedTargetIntents = new ArrayList<Intent>();
+ combinedTargetIntents.addAll(policySetAttachPoint.getRequiredIntents());
+ for (PolicySet targetPolicySet : policySetAttachPoint.getPolicySets()) {
+ combinedTargetIntents.addAll(PolicyComputationUtils.findAndExpandProfileIntents(targetPolicySet
+ .getProvidedIntents()));
+ }
+
+ //since the set of applicable policysets for this attachpoint is known
+ //we only need to check in that list if there is a policyset that matches
+ for (PolicySet policySet : applicablePolicySets) {
+ // do not use the policy set if it provides intents that conflict with required intents
+ boolean conflict = false;
+ List<Intent> providedIntents =
+ PolicyComputationUtils.findAndExpandProfileIntents(policySet.getProvidedIntents());
+ checkConflict: for (Intent intent : providedIntents) {
+ for (Intent excluded : intent.getExcludedIntents()) {
+ if (combinedTargetIntents.contains(excluded)) {
+ conflict = true;
+ break checkConflict;
+ }
+ }
+ }
+ if (conflict)
+ continue;
+ int prevSize = policySetAttachPoint.getRequiredIntents().size();
+ trimProvidedIntents(policySetAttachPoint.getRequiredIntents(), policySet);
+ // if any intent was trimmed off, then this policyset must
+ // be attached to the intent attachpoint's policyset
+ if (prevSize != policySetAttachPoint.getRequiredIntents().size()) {
+ policySetAttachPoint.getPolicySets().add(policySet);
+ }
+ }
+ }
+ }
+
+ private static boolean isProvidedInherently(ExtensionType attachPointType, Intent intent) {
+ return (attachPointType != null && ((attachPointType.getAlwaysProvidedIntents() != null && attachPointType
+ .getAlwaysProvidedIntents().contains(intent)) || (attachPointType.getMayProvidedIntents() != null && attachPointType
+ .getMayProvidedIntents().contains(intent))));
+ }
+
+ private static void trimProvidedIntents(List<Intent> requiredIntents, PolicySet policySet) {
+ for (Intent providedIntent : policySet.getProvidedIntents()) {
+ if (requiredIntents.contains(providedIntent)) {
+ requiredIntents.remove(providedIntent);
+ }
+ }
+
+ for (IntentMap intentMap : policySet.getIntentMaps()) {
+ if (requiredIntents.contains(intentMap.getProvidedIntent())) {
+ requiredIntents.remove(intentMap.getProvidedIntent());
+ }
+ }
+ }
+
+ private static void filterDuplicatesAndQualifiableIntents(PolicySubject intentAttachPoint) {
+ //remove duplicates
+ Map<QName, Intent> intentsTable = new HashMap<QName, Intent>();
+ for (Intent intent : intentAttachPoint.getRequiredIntents()) {
+ intentsTable.put(intent.getName(), intent);
+ }
+
+ //where qualified form of intent exists retain it and remove the qualifiable intent
+ Map<QName, Intent> intentsTableCopy = new HashMap<QName, Intent>(intentsTable);
+ //if qualified form of intent exists remove the unqualified form
+ for (Intent intent : intentsTableCopy.values()) {
+ if (intent.getQualifiableIntent() != null) {
+ if (intentsTable.get(intent.getQualifiableIntent().getName()) != null) {
+ intentsTable.remove(intent.getQualifiableIntent().getName());
+ }
+ }
+ }
+ intentAttachPoint.getRequiredIntents().clear();
+ intentAttachPoint.getRequiredIntents().addAll(intentsTable.values());
+ }
+
+ static void computeBindingIntentsAndPolicySets(Contract contract) throws PolicyValidationException {
+ for (Binding binding : contract.getBindings()) {
+ if (binding instanceof PolicySubject) {
+ PolicySubject policiedBinding = (PolicySubject)binding;
+ computeIntents((PolicySubject)binding, contract.getRequiredIntents());
+
+ computePolicySets(policiedBinding, contract.getPolicySets());
+
+ PolicyComputationUtils.checkForMutuallyExclusiveIntents(policiedBinding.getRequiredIntents(),
+ policiedBinding.getPolicySets(),
+ policiedBinding.getExtensionType(),
+ contract.getName());
+ }
+ }
+
+ if (contract.getCallback() != null) {
+ for (Binding binding : contract.getCallback().getBindings()) {
+ if (binding instanceof PolicySubject) {
+ PolicySubject policiedBinding = (PolicySubject)binding;
+ computeIntents((PolicySubject)binding, contract.getCallback().getRequiredIntents());
+
+ computePolicySets(policiedBinding, contract.getCallback().getPolicySets());
+
+ PolicyComputationUtils.checkForMutuallyExclusiveIntents(policiedBinding.getRequiredIntents(),
+ policiedBinding.getPolicySets(),
+ policiedBinding.getExtensionType(),
+ contract.getName() + " callback");
+
+ }
+ }
+ }
+ }
+
+ private static void computeIntents(PolicySubject policiedBinding, List<Intent> inheritedIntents)
+ throws PolicyValidationException {
+ //since the parent component could also contain intents that apply to implementation
+ //and binding elements within, we filter out only those that apply to this binding type
+ List<Intent> prunedIntents = computeInheritableIntents(policiedBinding.getExtensionType(), inheritedIntents);
+ policiedBinding.getRequiredIntents().addAll(prunedIntents);
+
+ normalizeIntents(policiedBinding);
+ }
+
+ private static void computePolicySets(PolicySubject policiedBinding, List<PolicySet> inheritedPolicySets)
+ throws PolicyValidationException {
+
+ List<PolicySet> prunedPolicySets = computeInheritablePolicySets(inheritedPolicySets);
+ policiedBinding.getPolicySets().addAll(prunedPolicySets);
+ normalizePolicySets(policiedBinding);
+ }
+
+ static void determineApplicableBindingPolicySets(Contract source, Contract target)
+ throws PolicyConfigurationException {
+ List<Intent> intentsCopy = null;
+ for (Binding aBinding : source.getBindings()) {
+ if (aBinding instanceof PolicySubject) {
+ PolicySubject policiedBinding = (PolicySubject)aBinding;
+ ExtensionType bindingType = policiedBinding.getExtensionType();
+
+ intentsCopy = new ArrayList<Intent>(policiedBinding.getRequiredIntents());
+ // add the target component's intents to the reference binding
+ if (target != null) {
+ for (Intent intent : target.getRequiredIntents()) {
+ if (!policiedBinding.getRequiredIntents().contains(intent)) {
+ for (ExtensionType constrained : intent.getConstrainedTypes()) {
+ if (bindingType != null && bindingType.getType().getNamespaceURI().equals(constrained
+ .getType().getNamespaceURI())
+ && bindingType.getType().getLocalPart().startsWith(constrained.getType()
+ .getLocalPart())) {
+ policiedBinding.getRequiredIntents().add(intent);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ trimInherentlyProvidedIntents(policiedBinding.getExtensionType(), policiedBinding.getRequiredIntents());
+ trimProvidedIntents(policiedBinding.getRequiredIntents(), policiedBinding.getPolicySets());
+
+ // determine additional policysets that match remaining intents
+ // TODO: resolved to domain policy registry and attach suitable
+ // policy sets to the binding
+ // for now using the SCA Definitions instead of registry
+ // if there are intents that are not provided by any policy set
+ // throw a warning
+ determineApplicableDomainPolicySets(source, policiedBinding);
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the bindings may need the original set of intents we copy that back
+ policiedBinding.getRequiredIntents().clear();
+ policiedBinding.getRequiredIntents().addAll(intentsCopy);
+
+ }
+ }
+ }
+
+ private static void determineApplicableDomainPolicySets(Contract contract, PolicySubject policiedBinding)
+ throws PolicyConfigurationException {
+ // FIXME:
+ /*
+ //if ( domainPolicySets != null) {
+ determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
+ policiedBinding,
+ policiedBinding.getExtensionType());
+
+ if ( policiedBinding.getRequiredIntents().size() > 0 ) {
+ if ( contract instanceof Service ) {
+ throw new PolicyConfigurationException("The following are unfulfilled intents for " +
+ "binding in service - " + contract.getName() + "\nUnfulfilled Intents = " +
+ policiedBinding.getRequiredIntents());
+ } else {
+ throw new PolicyConfigurationException("The are unfulfilled intents for " +
+ "binding in reference - " + contract.getName() + "\nUnfulfilled Intents = " +
+ policiedBinding.getRequiredIntents());
+ }
+ }
+ //}
+ */
+ }
+
+ private static void aggregateAndPruneApplicablePolicySets(List<PolicySet> source, List<PolicySet> target) {
+ target.addAll(source);
+ //strip duplicates
+ Hashtable<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
+ for (PolicySet policySet : target) {
+ policySetTable.put(policySet.getName(), policySet);
+ }
+
+ target.clear();
+ target.addAll(policySetTable.values());
+ }
+
+ static <C extends Contract> void inheritDefaultPolicies(Base parent, List<C> contracts) {
+
+ for (Contract contract : contracts) {
+
+ // The contract inherits default policies from the parent composite/component.
+ if (parent instanceof PolicySubject) {
+ PolicyComputationUtils.addDefaultPolicies(((PolicySubject)parent).getRequiredIntents(),
+ ((PolicySubject)parent).getPolicySets(),
+ contract.getRequiredIntents(),
+ contract.getPolicySets());
+ }
+
+ // The contract's callback inherits default policies from the contract.
+ if (contract.getCallback() != null) {
+ PolicyComputationUtils.addDefaultPolicies(contract.getRequiredIntents(),
+ contract.getPolicySets(),
+ contract.getCallback().getRequiredIntents(),
+ contract.getCallback().getPolicySets());
+ }
+
+ }
+ }
+
+ static void computeImplementationIntentsAndPolicySets(Implementation implementation, Component parent)
+ throws PolicyValidationException, PolicyConfigurationException {
+ if (implementation instanceof PolicySubject) {
+ PolicySubject policiedImplementation = (PolicySubject)implementation;
+ //since for an implementation the component has its policy intents and policysets its possible
+ //that there are some intents there that does not constrain the implementation.. so prune
+ List<Intent> prunedIntents =
+ computeInheritableIntents(policiedImplementation.getExtensionType(), parent.getRequiredIntents());
+ parent.getRequiredIntents().clear();
+ parent.getRequiredIntents().addAll(prunedIntents);
+ normalizeIntents(parent);
+
+ List<PolicySet> prunedPolicySets = computeInheritablePolicySets(parent.getPolicySets());
+ parent.getPolicySets().clear();
+ parent.getPolicySets().addAll(prunedPolicySets);
+ normalizePolicySets(parent);
+
+ PolicyComputationUtils.checkForMutuallyExclusiveIntents(parent.getRequiredIntents(),
+ parent.getPolicySets(),
+ policiedImplementation.getExtensionType(),
+ parent.getName());
+
+ determineApplicableImplementationPolicySets(parent);
+
+ }
+ }
+
+ private static void determineApplicableImplementationPolicySets(Component component)
+ throws PolicyConfigurationException {
+ List<Intent> intentsCopy = null;
+ if (component.getImplementation() instanceof PolicySubject) {
+ PolicySubject policiedImplementation = (PolicySubject)component.getImplementation();
+
+ intentsCopy = new ArrayList<Intent>(component.getRequiredIntents());
+ trimInherentlyProvidedIntents(policiedImplementation.getExtensionType(), component.getRequiredIntents());
+ trimProvidedIntents(component.getRequiredIntents(), component.getPolicySets());
+
+ //determine additional policysets that match remaining intents
+ //if there are intents that are not provided by any policy set throw a warning
+ //TODO: resolved to domain policy registry and attach suitable policy sets to the implementation
+ //...for now using the SCA Definitions instead of registry
+ //if ( domainPolicySets != null) {
+
+ if (component.getRequiredIntents().size() > 0) {
+ throw new PolicyConfigurationException(
+ "The following are unfulfilled intents for component implementation - " + component
+ .getName()
+ + "\nUnfulfilled Intents = "
+ + component.getRequiredIntents());
+ }
+ //}
+
+ //the intents list could have been trimmed when matching for policysets
+ //since the bindings may need the original set of intents we copy that back
+ component.getRequiredIntents().clear();
+ component.getRequiredIntents().addAll(intentsCopy);
+ }
+ }
+}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/DistributedSCABindingImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/DistributedSCABindingImpl.java
index fd58b44d21..99d68a11bc 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/DistributedSCABindingImpl.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/DistributedSCABindingImpl.java
@@ -1,76 +1,76 @@
-/*
- * 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.assembly.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.DistributedSCABinding;
-import org.apache.tuscany.sca.assembly.SCABinding;
-
-/**
- * The Distributed SCA binding wrapper for the SCA binding model object. This is currently
- * just used to locate the remote binding extension and pass the SCA binding to the remote
- * extension. It isn't used in the model itself
- *
- * @version $Rev: 564307 $ $Date: 2007-08-09 18:48:29 +0100 (Thu, 09 Aug 2007) $
- */
-public class DistributedSCABindingImpl implements DistributedSCABinding {
-
- private SCABinding scaBinding;
-
- public SCABinding getSCABinding() {
- return scaBinding;
- }
-
- public void setSCABinding(SCABinding scaBinding) {
- this.scaBinding = scaBinding;
- }
-
- public String getURI() {
- return null;
- }
-
- public void setURI(String uri) {
- }
-
- public String getName() {
- return null;
- }
-
- public void setName(String name) {
-
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
-
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public QName getType() {
- return TYPE;
- }
-}
+/*
+ * 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.assembly.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.DistributedSCABinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+
+/**
+ * The Distributed SCA binding wrapper for the SCA binding model object. This is currently
+ * just used to locate the remote binding extension and pass the SCA binding to the remote
+ * extension. It isn't used in the model itself
+ *
+ * @version $Rev$ $Date$
+ */
+public class DistributedSCABindingImpl implements DistributedSCABinding {
+
+ private SCABinding scaBinding;
+
+ public SCABinding getSCABinding() {
+ return scaBinding;
+ }
+
+ public void setSCABinding(SCABinding scaBinding) {
+ this.scaBinding = scaBinding;
+ }
+
+ public String getURI() {
+ return null;
+ }
+
+ public void setURI(String uri) {
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public void setName(String name) {
+
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public QName getType() {
+ return TYPE;
+ }
+}