diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-25 21:08:37 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-25 21:08:37 +0000 |
commit | cfb7e9a18f0cfdc2ca01874902e95adb61b4c6b8 (patch) | |
tree | decd5b28667e04d467af0a2cabefee310dc1708f /java/sca/modules/assembly | |
parent | d64d402c3cf248b93abdc01c3187ca5227512952 (diff) |
Refactor CompositeActivator, ComponentContext and other related interfaces into core-spi module
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@819009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/assembly')
4 files changed, 28 insertions, 10 deletions
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 6b2f16732d..64a55f1b44 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 @@ -30,6 +30,10 @@ import org.apache.tuscany.sca.policy.PolicySubject; * @version $Rev$ $Date$ */ public interface Composite extends Implementation, Extensible, Cloneable, PolicySubject { + /** + * Special name for the domain composite + */ + QName DOMAIN_COMPOSITE = new QName(SCA11_NS, ""); QName TYPE = new QName(SCA11_NS, "implementation.composite"); /** 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 4e8159b70c..cb74572fa9 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 @@ -107,7 +107,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { * @param message * @param model */ - protected void warning(Monitor monitor, String message, Object model, String... messageParameters) { + protected void warning(Monitor monitor, String message, Object model, Object... messageParameters) { if (monitor != null) { Problem problem = monitor.createProblem(this.getClass().getName(), @@ -115,7 +115,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { Severity.WARNING, model, message, - (Object[])messageParameters); + messageParameters); monitor.problem(problem); } } @@ -128,7 +128,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { * @param message * @param model */ - protected void error(Monitor monitor, String message, Object model, String... messageParameters) { + protected void error(Monitor monitor, String message, Object model, Object... messageParameters) { if (monitor != null) { Problem problem = monitor.createProblem(this.getClass().getName(), @@ -136,7 +136,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { Severity.ERROR, model, message, - (Object[])messageParameters); + messageParameters); monitor.problem(problem); } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java index 808ecf1993..57a87a7a0f 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java @@ -42,7 +42,22 @@ public class CompositeCloneBuilderImpl implements CompositeBuilder { public Composite build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException { - // Clone the includes + + if (Composite.DOMAIN_COMPOSITE.equals(composite.getName())) { + // Try to avoid clone for top-level composites that are added to the domain composite + for (Composite included : composite.getIncludes()) { + cloneIncludes(included); + } + } else { + // Clone the includes + cloneIncludes(composite); + } + + cloneCompositeImplementations(composite); + return composite; + } + + private void cloneIncludes(Composite composite) { List<Composite> includes = new ArrayList<Composite>(); for (Composite included : composite.getIncludes()) { try { @@ -53,9 +68,6 @@ public class CompositeCloneBuilderImpl implements CompositeBuilder { } composite.getIncludes().clear(); composite.getIncludes().addAll(includes); - - cloneCompositeImplementations(composite); - return composite; } public String getID() { diff --git a/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties b/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties index 4ef4101c37..05b36005a6 100644 --- a/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties +++ b/java/sca/modules/assembly/src/main/resources/assembly-validation-messages.properties @@ -49,7 +49,6 @@ NoSCABindingAvailableForUnresolvedService = A local service cannot be found for NoMatchingBinding = Component reference {0} does not have a binding which matches the bindings of service {1} NoMatchingCallbackBinding = Component reference {0} does not have a callback binding which matches the callback bindings of service {1} ReferenceEndPointMixWithTarget = Composite {0} Component {1} Reference {2} must not specify endpoints using both target attribute and with binding uri attribute -PolicyRelatedException = Policy Related Exception occured due to : {0} CompositeAlreadyIncluded = Composite {0} has already been included. ComponentReferenceMoreWire = Component reference {0} has more than one wires WireTargetNotFound = Wire target not found : {0} @@ -66,4 +65,7 @@ IllegalCompositeIncusion = Local Composite {0} cannot include a non-local compos PropertySourceNotFound = The property source {0} for property {1} in component {2} cannot be resolved to a composite property PropertySourceValueInvalid = The property source {0} for property {1} in component {2} has an invalid value. It should start with $ followed by the name of a composite property PropertySourceXPathInvalid = The property source {0} for property {1} in component {2} has an invalid XPath expression. The following error was returned while processing the XPath expression: {3} -PropertySourceXPathInvalid = The property file {0} for property {1} in component {2} is an invalid value. The following error was returned while processing the file name: {3}
\ No newline at end of file +PropertySourceXPathInvalid = The property file {0} for property {1} in component {2} is an invalid value. The following error was returned while processing the file name: {3} +PolicyRelatedException = Policy Related Exception occured due to : {0} +IntentNotFound = Intent {0} is not defined in SCA definitions +MutuallyExclusiveIntents = Intent {0} and {1} are mutually exclusive [POL40009]
\ No newline at end of file |