summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly-xml
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-12-16 10:17:13 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-12-16 10:17:13 +0000
commit0498e9dd768e270b74045acd96075306c29a9b4a (patch)
tree7fd81df2fa3dc77bb987d198ede41543833eabd7 /sca-java-2.x/trunk/modules/assembly-xml
parent33b1a014e2744c8a64100900665c5ca5875c570c (diff)
TUSCANY-3998: Apply patch from Greg Dritschler to provide a way to override Tuscany system definition.xml documents
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1215081 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/assembly-xml')
-rw-r--r--sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefaultDefinitionsExtensionPoint.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefaultDefinitionsExtensionPoint.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefaultDefinitionsExtensionPoint.java
index af59324c7c..99f66b1d78 100644
--- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefaultDefinitionsExtensionPoint.java
+++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/DefaultDefinitionsExtensionPoint.java
@@ -80,18 +80,26 @@ public class DefaultDefinitionsExtensionPoint implements DefinitionsExtensionPoi
// Get the definitions declarations
Collection<ServiceDeclaration> definitionsDeclarations;
try {
- definitionsDeclarations = registry.getServiceDiscovery().getServiceDeclarations(DEFINITIONS_FILE);
+ // Get definitions declarations in ranking order.
+ definitionsDeclarations = registry.getServiceDiscovery().getServiceDeclarations(DEFINITIONS_FILE, true);
} catch (IOException e) {
throw new IllegalStateException(e);
}
// Find each definitions
+ Set<String> definitionResources = new HashSet<String>();
for (ServiceDeclaration definitionsDeclaration : definitionsDeclarations) {
- URL url = definitionsDeclaration.getResource(definitionsDeclaration.getClassName());
- if (url == null) {
- throw new IllegalArgumentException(definitionsDeclaration.getClassName() + " cannot be found");
+ // Only process the first instance of a given resource name.
+ // This allows definitions files to be overridden by an embedder.
+ String resourceName = definitionsDeclaration.getClassName();
+ if (!definitionResources.contains(resourceName)) {
+ definitionResources.add(resourceName);
+ URL url = definitionsDeclaration.getResource(resourceName);
+ if (url == null) {
+ throw new IllegalArgumentException(definitionsDeclaration.getClassName() + " cannot be found");
+ }
+ documents.add(url);
}
- documents.add(url);
}
documentsLoaded = true;