diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-23 22:48:13 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-23 22:48:13 +0000 |
commit | 90ba7b1a18706b434520d531358619438a43b4f0 (patch) | |
tree | 4c571d7829da8a0df07368ac51292bc07db5526e /java/sca/modules/assembly/src | |
parent | 40ddf83655bc926c1babc72ba36a1c658eadb516 (diff) |
Add a QName as the type for binding/implementation and use it to compare model types instead of class
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@787865 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly/src')
24 files changed, 332 insertions, 281 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java index 76511d351d..cb19ab5acb 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java @@ -6,36 +6,38 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly; /** * Base interface for all assembly model objects. - * + * * @version $Rev$ $Date$ */ public interface Base { + String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903"; + String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1"; /** * Returns true if the model element is unresolved. - * + * * @return true if the model element is unresolved. */ boolean isUnresolved(); /** * Sets whether the model element is unresolved. - * + * * @param unresolved whether the model element is unresolved */ void setUnresolved(boolean unresolved); diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java index 0423e0b128..069b4d4c5a 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java @@ -6,59 +6,64 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly; +import javax.xml.namespace.QName; + + /** * Represents a binding. - * + * * @version $Rev$ $Date$ */ public interface Binding extends Base, Cloneable { /** * Returns the binding URI. - * + * * @return the binding URI */ String getURI(); /** * Sets the binding URI. - * + * * @param uri the binding URI */ void setURI(String uri); /** * Returns the binding name. - * + * * @return the binding name */ String getName(); /** * Sets the binding name. - * + * * @param name the binding name */ void setName(String name); - + /** * Clone the binding - * + * * @return */ - Object clone() throws CloneNotSupportedException; + Object clone() throws CloneNotSupportedException; + + QName getType(); } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java index 12542297b3..27bc79788e 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly; @@ -27,56 +27,56 @@ import org.apache.tuscany.sca.policy.PolicySubject; /** * Represents a composite. - * + * * @version $Rev$ $Date$ */ public interface Composite extends Implementation, Extensible, Cloneable, PolicySubject { - + QName TYPE = new QName(SCA11_NS, "implementation.composite"); /** * Returns the spec version of the composite used to build this model - * + * * @return the spec version used to build this model */ String getSpecVersion(); /** * Sets the spec version of the composite used to build this model - * + * * @param specVersion the spec version used to build this model */ void setSpecVersion(String specVersion); - + /** * Returns the name of the composite. - * + * * @return the name of the composite */ QName getName(); /** * Sets the name of the composite. - * + * * @param name the name of the composite */ void setName(QName name); /** * Returns a list of composites included in this composite. - * + * * @return a list of composites included in this composite. */ List<Composite> getIncludes(); /** * Returns a list of components contained in this composite. - * + * * @return a list of components contained in this composite */ List<Component> getComponents(); /** * Returns a list of wires contained in this composite. - * + * * @return a list of wires contained in this composite */ List<Wire> getWires(); @@ -84,7 +84,7 @@ public interface Composite extends Implementation, Extensible, Cloneable, Policy /** * Returns true if all the components within the composite must run in the * same process. - * + * * @return true if all the components within the composite must run in the * same process */ @@ -93,7 +93,7 @@ public interface Composite extends Implementation, Extensible, Cloneable, Policy /** * Sets whether all the components within the composite must run in the same * process. - * + * * @param local whether all the components within the composite must run in * the same process */ @@ -107,7 +107,7 @@ public interface Composite extends Implementation, Extensible, Cloneable, Policy /** * Sets whether component references should be autowired. - * + * * @param autowire whether component references should be autowired */ void setAutowire(Boolean autowire); @@ -115,7 +115,7 @@ public interface Composite extends Implementation, Extensible, Cloneable, Policy /** * Returns a clone of the component type. - * + * * @return a clone of the component type * @throws CloneNotSupportedException */ 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 8fb4215e36..daa57caaea 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 @@ -6,37 +6,37 @@ * 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.
+ * under the License.
*/
package org.apache.tuscany.sca.assembly;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.SCABinding;
+import javax.xml.namespace.QName;
/**
* Represents an SCA binding used in the distributed runtime.
- * It provides us with a sensibly named type against which
+ * 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 {
-
- /**
- * Return the wrapped SCA binding
- * @return the SCA binding model element
- */
+ 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
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java index 720a6801a2..d15334000f 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java @@ -6,22 +6,25 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly; +import javax.xml.namespace.QName; + /** * Represents a component implementation. - * + * * @version $Rev$ $Date$ */ public interface Implementation extends ComponentType { + QName getType(); } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java index 2cf04277cd..aa356e3857 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java @@ -6,22 +6,25 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly; +import javax.xml.namespace.QName; + /** * Represents an SCA binding. - * + * * @version $Rev$ $Date$ */ public interface SCABinding extends Binding { + QName TYPE = new QName(SCA11_NS, "binding.sca"); } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java index 59dbc85d1f..84368b810f 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly.builder.impl; @@ -49,7 +49,7 @@ import org.apache.tuscany.sca.policy.ExtensionType; import org.apache.tuscany.sca.policy.PolicySubject; /** - * Base class for Builder implementations + * Base class for Builder implementations * * @version $Rev$ $Date$ */ @@ -76,10 +76,10 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { this.transformerFactory = transformerFactory; this.interfaceContractMapper = interfaceContractMapper; } - + /** * Report a warning. - * + * * @param monitor * @param problems * @param message @@ -91,10 +91,10 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { monitor.problem(problem); } } - + /** * Report a error. - * + * * @param monitor * @param problems * @param message @@ -105,11 +105,11 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { Problem problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters); monitor.problem(problem); } - } - + } + /** * Report a exception. - * + * * @param problems * @param message * @param model @@ -120,11 +120,11 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { problem = monitor.createProblem(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, ex); monitor.problem(problem); } - } - + } + /** * Index components inside a composite - * + * * @param composite * @param componentServices @@ -134,12 +134,12 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { for (Component component : composite.getComponents()) { // Index components by name components.put(component.getName(), component); - } + } } - + /** * Index services inside a composite - * + * * @param composite * @param componentServices */ @@ -147,18 +147,18 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { Map<String, ComponentService> componentServices) { for (Component component : composite.getComponents()) { - + ComponentService nonCallbackService = null; int nonCallbackServiceCount = 0; - - for (ComponentService componentService : component.getServices()) { + + for (ComponentService componentService : component.getServices()) { // Index component services by component name / service name String uri = component.getName() + '/' + componentService.getName(); componentServices.put(uri, componentService); - + // count how many non-callback there are - if (!componentService.isCallback()) { - + if (!componentService.isCallback()) { + if (nonCallbackServiceCount == 0) { nonCallbackService = componentService; } @@ -170,9 +170,9 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { // component name as well componentServices.put(component.getName(), nonCallbackService); } - } - } - + } + } + /** * Index components, services and references inside a composite. @@ -187,28 +187,28 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { Map<String, ComponentReference> componentReferences) { for (Component component : composite.getComponents()) { - + // Index components by name components.put(component.getName(), component); - + ComponentService nonCallbackService = null; int nonCallbackServices = 0; for (ComponentService componentService : component.getServices()) { - + // Index component services by component name / service name String uri = component.getName() + '/' + componentService.getName(); componentServices.put(uri, componentService); - + // TODO - EPR - $promoted$ no longer used but it doesn't do any harm here boolean promotedService = false; if (componentService.getName() != null && componentService.getName().indexOf("$promoted$") > -1) { promotedService = true; } - + // count how many non-callback, non-promoted services there are // if there is only one the component name also acts as the service name - if ((!componentService.isCallback()) && (!promotedService)) { - + if ((!componentService.isCallback()) && (!promotedService)) { + // Check how many non callback non-promoted services we have if (nonCallbackServices == 0) { nonCallbackService = componentService; @@ -217,13 +217,13 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { } } - + if (nonCallbackServices == 1) { // If we have a single non callback service, index it by // component name as well componentServices.put(component.getName(), nonCallbackService); } - + // Index references by component name / reference name for (ComponentReference componentReference : component.getReferences()) { String uri = component.getName() + '/' + componentReference.getName(); @@ -231,7 +231,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { } } } - + protected void indexComponentPropertiesServicesAndReferences( Component component, Map<String, ComponentService> componentServices, @@ -319,12 +319,12 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { } } - } - + } + /** * Reconcile component properties and the properties defined by the * component type. - * + * * @param component * @param properties * @param componentProperties @@ -379,7 +379,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { if (componentProperty.getValue() == null) { componentProperty.setValue(property.getValue()); } - + // Override the property value for the composite if(component.getImplementation() instanceof Composite) { property.setValue(componentProperty.getValue()); @@ -419,7 +419,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { /** * Reconcile component references with the references defined on the * component type. - * + * * @param component * @param references * @param componentReferences @@ -488,11 +488,11 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { componentReference.setInterfaceContract(interfaceContract); } - // Reconcile bindings + // Reconcile bindings if (componentReference.getBindings().isEmpty()) { componentReference.getBindings().addAll(reference.getBindings()); } - + // Reconcile callback bindings if (componentReference.getCallback() == null) { componentReference.setCallback(reference.getCallback()); @@ -506,7 +506,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { componentReference.getCallback().getBindings().addAll(reference.getCallback() .getBindings()); } - + // Propagate autowire setting from the component if (componentReference.getAutowire() == null) { componentReference.setAutowire(component.getAutowire()); @@ -522,7 +522,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { /** * Reconcile component services and services defined on the component type. - * + * * @param component * @param services * @param componentServices @@ -583,7 +583,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { if (componentService.getBindings().isEmpty()) { componentService.getBindings().addAll(service.getBindings()); } - + // Reconcile callback bindings if (componentService.getCallback() == null) { componentService.setCallback(service.getCallback()); @@ -598,25 +598,25 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { } } } - } - + } + protected SCABinding createSCABinding(Definitions definitions) { SCABinding scaBinding = scaBindingFactory.createSCABinding(); - - // mark the bindings that are added automatically so that they can + + // mark the bindings that are added automatically so that they can // be disregarded for overriding purposes if (scaBinding instanceof AutomaticBinding){ ((AutomaticBinding)scaBinding).setIsAutomatic(true); } - + if ( definitions != null ) { for ( ExtensionType attachPointType : definitions.getBindingTypes() ) { if ( attachPointType.getType().equals(BINDING_SCA_QNAME)) { - ((PolicySubject)scaBinding).setType(attachPointType); + ((PolicySubject)scaBinding).setExtensionType(attachPointType); } } } - + return scaBinding; - } + } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java index dea683e750..2daf8cbaf6 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java @@ -315,7 +315,7 @@ public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements C // Skip the current binding continue; } - if (binding.getClass() != otherBinding.getClass()) { + if (!binding.getType().equals(otherBinding.getType())) { // Look for a binding of the same type continue; } @@ -420,7 +420,7 @@ public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements C URI baseURI = null; if (defaultBindings != null) { for (Binding defaultBinding : defaultBindings){ - if (binding.getClass() == defaultBinding.getClass()){ + if (binding.getType().equals(defaultBinding.getType())){ baseURI = new URI(addSlashToPath(defaultBinding.getURI())); break; } 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 a7a40e62e6..37f4ae6672 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 @@ -6,15 +6,15 @@ * 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.
+ * under the License.
*/
package org.apache.tuscany.sca.assembly.builder.impl;
@@ -49,18 +49,18 @@ import org.apache.tuscany.sca.policy.util.PolicyValidationUtils; * @version $Rev$ $Date$
*/
abstract class PolicyConfigurationUtil {
-
- private static List<Intent> computeInheritableIntents(ExtensionType attachPointType,
+
+ 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
+ //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() ) {
+ if ( !intent.isUnresolved() ) {
for (ExtensionType constrained : intent.getConstrainedTypes()) {
if ( PolicyValidationUtils.isConstrained(constrained, attachPointType)) {
validInheritableIntents.add(intent);
@@ -71,10 +71,10 @@ abstract class PolicyConfigurationUtil { 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());
@@ -83,9 +83,9 @@ abstract class PolicyConfigurationUtil { //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
+ //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 ) {
@@ -94,33 +94,33 @@ abstract class PolicyConfigurationUtil { }
}
}
-
-
- private static List<PolicySet> computeInheritablePolicySets(List<PolicySet> inheritablePolicySets)
+
+
+ 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) {
@@ -134,7 +134,7 @@ abstract class PolicyConfigurationUtil { combinedTargetIntents.addAll(PolicyComputationUtils.findAndExpandProfileIntents(targetPolicySet.getProvidedIntents()));
}
- //since the set of applicable policysets for this attachpoint is known
+ //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
@@ -157,40 +157,40 @@ abstract class PolicyConfigurationUtil { if (prevSize != policySetAttachPoint.getRequiredIntents().size()) {
policySetAttachPoint.getPolicySets().add(policySet);
}
- }
+ }
}
}
-
+
private static boolean isProvidedInherently(ExtensionType attachPointType, Intent intent) {
- return ( attachPointType != null &&
+ return ( attachPointType != null &&
(( attachPointType.getAlwaysProvidedIntents() != null &&
- attachPointType.getAlwaysProvidedIntents().contains(intent) ) ||
+ 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
@@ -210,50 +210,50 @@ abstract class PolicyConfigurationUtil { if (binding instanceof PolicySubject) {
PolicySubject policiedBinding = (PolicySubject)binding;
computeIntents((PolicySubject)binding, contract.getRequiredIntents());
-
+
computePolicySets(policiedBinding, contract.getPolicySets());
-
+
PolicyComputationUtils.checkForMutuallyExclusiveIntents(
policiedBinding.getRequiredIntents(),
policiedBinding.getPolicySets(),
- policiedBinding.getType(),
+ 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.getType(),
+ policiedBinding.getExtensionType(),
contract.getName() + " callback");
-
+
}
}
}
}
- private static void computeIntents(PolicySubject policiedBinding, List<Intent> inheritedIntents)
+ 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.getType(),
+ 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);
@@ -264,9 +264,9 @@ abstract class PolicyConfigurationUtil { for (Binding aBinding : source.getBindings()) {
if (aBinding instanceof PolicySubject) {
PolicySubject policiedBinding = (PolicySubject)aBinding;
- ExtensionType bindingType = policiedBinding.getType();
-
-
+ ExtensionType bindingType = policiedBinding.getExtensionType();
+
+
intentsCopy = new ArrayList<Intent>(policiedBinding.getRequiredIntents());
// add the target component's intents to the reference binding
if (target != null) {
@@ -284,12 +284,12 @@ abstract class PolicyConfigurationUtil { }
}
}
-
- trimInherentlyProvidedIntents(policiedBinding.getType(),
+
+ 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
@@ -297,34 +297,34 @@ abstract class PolicyConfigurationUtil { // 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)
+ private static void determineApplicableDomainPolicySets(Contract contract,
+ PolicySubject policiedBinding)
throws PolicyConfigurationException {
// FIXME:
/*
//if ( domainPolicySets != null) {
- determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
+ determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
policiedBinding,
- policiedBinding.getType());
-
+ 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 = " +
+ "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 = " +
+ "binding in reference - " + contract.getName() + "\nUnfulfilled Intents = " +
policiedBinding.getRequiredIntents());
}
}
@@ -339,15 +339,15 @@ abstract class PolicyConfigurationUtil { 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(
@@ -356,7 +356,7 @@ abstract class PolicyConfigurationUtil { contract.getRequiredIntents(),
contract.getPolicySets());
}
-
+
// The contract's callback inherits default policies from the contract.
if (contract.getCallback() != null) {
PolicyComputationUtils.addDefaultPolicies(
@@ -365,35 +365,35 @@ abstract class PolicyConfigurationUtil { contract.getCallback().getRequiredIntents(),
contract.getCallback().getPolicySets());
}
-
+
}
}
- static void computeImplementationIntentsAndPolicySets(Implementation implementation, Component parent)
+ 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.getType(),
+ //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.getType(),
+ policiedImplementation.getExtensionType(),
parent.getName());
-
+
determineApplicableImplementationPolicySets(parent);
-
+
}
}
@@ -401,24 +401,24 @@ abstract class PolicyConfigurationUtil { List<Intent> intentsCopy = null;
if ( component.getImplementation() instanceof PolicySubject ) {
PolicySubject policiedImplementation = (PolicySubject)component.getImplementation();
-
+
intentsCopy = new ArrayList<Intent>(component.getRequiredIntents());
- trimInherentlyProvidedIntents(policiedImplementation.getType(),
+ 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();
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BindingImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BindingImpl.java index 1e69dfcc87..40ffb6a4b5 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BindingImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BindingImpl.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly.impl; @@ -22,21 +22,34 @@ package org.apache.tuscany.sca.assembly.impl; import java.util.ArrayList; import java.util.List; +import javax.xml.namespace.QName; + import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.policy.ExtensionType; import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.PolicySet; /** - * + * Base Binding implementation class */ public abstract class BindingImpl extends ExtensibleImpl implements Binding { private String name; - private ExtensionType type; + private ExtensionType extensionType; private String uri; private List<Intent> requiredIntents = new ArrayList<Intent>(); private List<PolicySet> policySets = new ArrayList<PolicySet>(); + protected QName type; + + protected BindingImpl(QName type) { + super(); + this.type = type; + } + + public QName getType() { + return type; + } + public List<Intent> getRequiredIntents() { return requiredIntents; } @@ -58,12 +71,12 @@ public abstract class BindingImpl extends ExtensibleImpl implements Binding { this.name = name; } - public ExtensionType getType() { - return type; + public ExtensionType getExtensionType() { + return extensionType; } - public void setType(ExtensionType type) { - this.type = type; + public void setExtensionType(ExtensionType type) { + this.extensionType = type; } public String getURI() { diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java index f8f856f1b4..2d8513309e 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java @@ -53,11 +53,11 @@ public class CallbackImpl extends ExtensibleImpl implements Callback { return bindings; } - public ExtensionType getType() { + public ExtensionType getExtensionType() { return null; } - public void setType(ExtensionType type) { + public void setExtensionType(ExtensionType type) { } public void setRequiredIntents(List<Intent> intents) { diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java index d751d59f83..8eee73b469 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java @@ -137,11 +137,11 @@ public class ComponentImpl extends ExtensibleImpl implements Component, Cloneabl return autowire; } - public ExtensionType getType() { + public ExtensionType getExtensionType() { return type; } - public void setType(ExtensionType type) { + public void setExtensionType(ExtensionType type) { this.type = type; } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java index c79aaf6b2e..5d55f76903 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java @@ -126,10 +126,10 @@ public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType, return policySets; } - public ExtensionType getType() { + public ExtensionType getExtensionType() { return null; } - public void setType(ExtensionType type) { + public void setExtensionType(ExtensionType type) { } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java index 4e14cf0e53..7ebd770935 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly.impl; @@ -51,6 +51,7 @@ public class CompositeImpl extends ImplementationImpl implements Composite, Clon * Constructs a new composite. */ protected CompositeImpl() { + super(TYPE); } @Override @@ -86,13 +87,13 @@ public class CompositeImpl extends ImplementationImpl implements Composite, Clon } return clone; } - + public String getSpecVersion() { return specVersion; } - + public void setSpecVersion(String specVersion) { - this.specVersion = specVersion; + this.specVersion = specVersion; } public List<Component> getComponents() { @@ -126,11 +127,11 @@ public class CompositeImpl extends ImplementationImpl implements Composite, Clon public void setAutowire(Boolean autowire) { this.autowire = autowire; } - + public Boolean getAutowire() { return autowire; } - + public void setName(QName name) { this.name = name; } @@ -154,7 +155,7 @@ public class CompositeImpl extends ImplementationImpl implements Composite, Clon return false; } } - + @Override public String toString(){ return ( this.name != null ) ? getName().toString() : "null"; diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java index 641e0f17df..b1e36ee60d 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java @@ -98,11 +98,11 @@ public class ConstrainingTypeImpl extends ExtensibleImpl implements Constraining } } - public ExtensionType getType() { + public ExtensionType getExtensionType() { return null; } - public void setType(ExtensionType type) { + public void setExtensionType(ExtensionType type) { } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java index a121635323..ab8d7dc19e 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java @@ -74,11 +74,11 @@ public class ContractImpl extends ExtensibleImpl implements AbstractContract { this.isCallback = isCallback; } - public ExtensionType getType() { + public ExtensionType getExtensionType() { return null; } - public void setType(ExtensionType type) { + public void setExtensionType(ExtensionType type) { } public List<PolicySet> getPolicySets() { 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 898aec0c42..d6bcbba797 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 @@ -6,40 +6,42 @@ * 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.
+ * under the License.
*/
package org.apache.tuscany.sca.assembly.impl;
-import org.apache.tuscany.sca.assembly.SCABinding;
+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;
}
@@ -54,7 +56,7 @@ public class DistributedSCABindingImpl implements DistributedSCABinding { public void setName(String name){
}
-
+
public boolean isUnresolved(){
return false;
}
@@ -62,9 +64,13 @@ public class DistributedSCABindingImpl implements DistributedSCABinding { public void setUnresolved(boolean unresolved){
}
-
+
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
- }
+ }
+
+ public QName getType() {
+ return TYPE;
+ }
}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java index 8e2f482f1e..2a7c010c11 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java @@ -131,14 +131,14 @@ public class EndpointImpl implements Endpoint { return requiredIntents; } - public ExtensionType getType() { + public ExtensionType getExtensionType() { if (binding instanceof PolicySubject) { - return ((PolicySubject)binding).getType(); + return ((PolicySubject)binding).getExtensionType(); } return null; } - public void setType(ExtensionType type) { + public void setExtensionType(ExtensionType type) { throw new UnsupportedOperationException(); } @@ -187,12 +187,12 @@ public class EndpointImpl implements Endpoint { public void setExtensionPointRegistry(ExtensionPointRegistry registry) { this.registry = registry; } - + public boolean isRemote() { return remote; } - + public void setRemote(boolean remote) { this.remote = remote; - } + } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java index b2e5b8b9cf..7ff0b45e97 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java @@ -141,14 +141,14 @@ public class EndpointReferenceImpl implements EndpointReference { return requiredIntents; } - public ExtensionType getType() { + public ExtensionType getExtensionType() { if (binding instanceof PolicySubject) { - return ((PolicySubject)binding).getType(); + return ((PolicySubject)binding).getExtensionType(); } return null; } - public void setType(ExtensionType type) { + public void setExtensionType(ExtensionType type) { throw new UnsupportedOperationException(); } @@ -200,11 +200,11 @@ public class EndpointReferenceImpl implements EndpointReference { public void setURI(String uri) { this.uri = uri; } - + public boolean isRemote() { return remote; } - + public void setRemote(boolean remote) { this.remote = remote; } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java index 1c28192b3a..181874039e 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly.impl; @@ -22,6 +22,8 @@ package org.apache.tuscany.sca.assembly.impl; import java.util.ArrayList; import java.util.List; +import javax.xml.namespace.QName; + import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.policy.ExtensionType; import org.apache.tuscany.sca.policy.Intent; @@ -34,12 +36,14 @@ import org.apache.tuscany.sca.policy.PolicySubject; * @version $Rev$ $Date$ */ public abstract class ImplementationImpl extends ComponentTypeImpl implements Implementation, PolicySubject { - private ExtensionType type; + private QName type; + private ExtensionType extensionType; private List<PolicySet> policySets = new ArrayList<PolicySet>(); private List<Intent> requiredIntents = new ArrayList<Intent>(); - protected ImplementationImpl() { + protected ImplementationImpl(QName type) { super(); + this.type = type; } public List<PolicySet> getPolicySets() { @@ -50,11 +54,15 @@ public abstract class ImplementationImpl extends ComponentTypeImpl implements Im return requiredIntents; } - public ExtensionType getType() { - return type; + public ExtensionType getExtensionType() { + return extensionType; } - public void setType(ExtensionType type) { - this.type = type; + public void setExtensionType(ExtensionType extensionType) { + this.extensionType = extensionType; + } + + public QName getType() { + return type; } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java index 4a962db005..3a24759cd3 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java @@ -6,21 +6,23 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.assembly.impl; import java.util.ArrayList; import java.util.List; +import javax.xml.namespace.QName; + import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentService; @@ -29,14 +31,14 @@ import org.apache.tuscany.sca.assembly.Extension; import org.apache.tuscany.sca.assembly.OptimizableBinding; import org.apache.tuscany.sca.assembly.SCABinding; import org.apache.tuscany.sca.assembly.builder.AutomaticBinding; -import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.ExtensionType; +import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.policy.PolicySubject; /** * The assembly mode object for an SCA binding. - * + * * @version $Rev$ $Date$ */ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject, OptimizableBinding, AutomaticBinding { @@ -46,15 +48,15 @@ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject, Op private List<Extension> attributeExtensions = new ArrayList<Extension>(); private List<Intent> requiredIntents = new ArrayList<Intent>(); private List<PolicySet> policySets = new ArrayList<PolicySet>(); - private ExtensionType intentAttachPointType; - + private ExtensionType extensionType; + private Component targetComponent; private ComponentService targetComponentService; private Binding targetBinding; private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>(); - + private boolean isAutomatic = false; - + public List<PolicySet> getApplicablePolicySets() { return applicablePolicySets; } @@ -64,21 +66,21 @@ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject, Op */ protected SCABindingImpl() { } - + public String getName() { return name; } - + public void setName(String name) { this.name = name; } /** - * Getters for the binding URI. The computed URI for the + * Getters for the binding URI. The computed URI for the * service that the reference is targeting or which the service represents * depending on whether the biding is associated with a reference or * service - * + * * @return the binding URI */ public String getURI() { @@ -88,15 +90,15 @@ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject, Op public void setURI(String uri) { this.uri = uri; } - + public List<Object> getExtensions() { return extensions; } - + public List<Extension> getAttributeExtensions() { return attributeExtensions; } - + public boolean isUnresolved() { if (targetComponentService == null){ return true; @@ -111,19 +113,19 @@ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject, Op public List<PolicySet> getPolicySets() { return policySets; } - + public List<Intent> getRequiredIntents() { return requiredIntents; } - public ExtensionType getType() { - return intentAttachPointType; + public ExtensionType getExtensionType() { + return extensionType; } - - public void setType(ExtensionType intentAttachPointType) { - this.intentAttachPointType = intentAttachPointType; + + public void setExtensionType(ExtensionType intentAttachPointType) { + this.extensionType = intentAttachPointType; } - + // Wireable binding operations public Component getTargetComponent() { @@ -149,9 +151,9 @@ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject, Op public void setTargetBinding(Binding targetBinding) { this.targetBinding = targetBinding; } - + public void setPolicySets(List<PolicySet> policySets) { - this.policySets = policySets; + this.policySets = policySets; } public void setRequiredIntents(List<Intent> intents) { @@ -161,7 +163,7 @@ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject, Op public void setIsAutomatic(boolean isAutomatic){ this.isAutomatic = isAutomatic; } - + public boolean getIsAutomatic(){ return this.isAutomatic; } @@ -169,5 +171,9 @@ public class SCABindingImpl implements SCABinding, Extensible, PolicySubject, Op @Override public Object clone() throws CloneNotSupportedException { return super.clone(); - } + } + + public QName getType() { + return TYPE; + } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java index 9f8af0907d..19e9b775d1 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java @@ -80,11 +80,11 @@ public class WireImpl extends ExtensibleImpl implements Wire, Cloneable { return policySets; } - public ExtensionType getType() { + public ExtensionType getExtensionType() { return null; } - public void setType(ExtensionType type) { + public void setExtensionType(ExtensionType type) { } public void setPolicySets(List<PolicySet> policySets) { diff --git a/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java b/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java index 3a75bbcc36..5380a319d5 100644 --- a/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java +++ b/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java @@ -18,16 +18,20 @@ */ package org.apache.tuscany.sca.assembly; -import org.apache.tuscany.sca.assembly.impl.BindingImpl; +import javax.xml.namespace.QName; +import org.apache.tuscany.sca.assembly.impl.BindingImpl; /** * A test interface model. - * + * * @version $Rev$ $Date$ */ public class TestBinding extends BindingImpl implements Binding { + private final static QName TYPE = new QName("http://test", "binding.test"); + public TestBinding(AssemblyFactory factory) { + super(TYPE); } public String getName() { @@ -37,7 +41,7 @@ public class TestBinding extends BindingImpl implements Binding { public String getURI() { return "http://test"; } - + public boolean isUnresolved() { return false; } diff --git a/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java b/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java index 19702954c9..6777c33ff1 100644 --- a/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java +++ b/java/sca/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java @@ -24,12 +24,12 @@ import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; /** * A test component implementation model. - * + * * @version $Rev$ $Date$ */ public class TestImplementation extends ImplementationImpl implements Implementation { public TestImplementation(AssemblyFactory factory) { - + super(new QName("http://test", "implementation.test")); Property p = factory.createProperty(); p.setName("currency"); p.setValue("USD"); |