summaryrefslogtreecommitdiffstats
path: root/java/sca/modules
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-06-25 19:50:46 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-06-25 19:50:46 +0000
commit23c2714c6b6a895cc931edddfde54bc51768c20c (patch)
tree1166659a36b3e1ce6eb89a65f83d595b440a1ab7 /java/sca/modules
parent9e8fa7e0c7944554bf12fca6b26b91ffd7b24ba7 (diff)
Use the QName as the key for binding base URIs
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@788487 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderTmp.java4
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java6
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java29
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java5
-rw-r--r--java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java18
-rw-r--r--java/sca/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java9
6 files changed, 38 insertions, 33 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderTmp.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderTmp.java
index cf3e62ab38..c6bf6caac0 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderTmp.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderTmp.java
@@ -22,6 +22,8 @@ package org.apache.tuscany.sca.assembly.builder;
import java.util.List;
import java.util.Map;
+import javax.xml.namespace.QName;
+
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.definitions.Definitions;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -49,6 +51,6 @@ public interface CompositeBuilderTmp {
* @param monitor
* @throws CompositeBuilderException
*/
- void build(Composite composite, Definitions definitions, Map<Class<?>, List<String>> bindingMap, Monitor monitor) throws CompositeBuilderException;
+ void build(Composite composite, Definitions definitions, Map<QName, List<String>> bindingBaseURIs, Monitor monitor) throws CompositeBuilderException;
}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java
index 4d6612979f..035d620778 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultCompositeBuilderExtensionPoint.java
@@ -25,6 +25,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.xml.namespace.QName;
+
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
@@ -125,9 +127,9 @@ public class DefaultCompositeBuilderExtensionPoint implements CompositeBuilderEx
getBuilder().build(composite, definitions, monitor);
}
- public void build(Composite composite, Definitions definitions, Map<Class<?>, List<String>> bindingMap, Monitor monitor)
+ public void build(Composite composite, Definitions definitions, Map<QName, List<String>> bindingBaseURIs, Monitor monitor)
throws CompositeBuilderException {
- ((CompositeBuilderTmp)getBuilder()).build(composite, definitions, bindingMap, monitor);
+ ((CompositeBuilderTmp)getBuilder()).build(composite, definitions, bindingBaseURIs, monitor);
}
private CompositeBuilder getBuilder() {
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 896d6d3540..2ef6202a85 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
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.TransformerFactory;
@@ -81,10 +82,10 @@ public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements C
public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException {
configureBindingURIsAndNames(composite, definitions, monitor);
}
-
- public void build(Composite composite, Definitions definitions, Map<Class<?>, List<String>> bindingMap, Monitor monitor)
+
+ public void build(Composite composite, Definitions definitions, Map<QName, List<String>> bindingBaseURIs, Monitor monitor)
throws CompositeBuilderException {
- configureBindingURIs(composite, null, definitions, bindingMap, monitor);
+ configureBindingURIs(composite, null, definitions, bindingBaseURIs, monitor);
configureBindingNames(composite, monitor);
}
@@ -107,7 +108,7 @@ public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements C
* @param defaultBindings list of default binding configurations
*/
protected void configureBindingURIs(Composite composite,
- Definitions definitions, Map<Class<?>, List<String>> defaultBindings,
+ Definitions definitions, Map<QName, List<String>> defaultBindings,
Monitor monitor) throws CompositeBuilderException {
configureBindingURIs(composite, null, definitions, defaultBindings, monitor);
}
@@ -133,7 +134,7 @@ public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements C
* @param defaultBindings list of default binding configurations
*/
private void configureBindingURIs(Composite composite, String uri,
- Definitions definitions, Map<Class<?>, List<String>> defaultBindings,
+ Definitions definitions, Map<QName, List<String>> defaultBindings,
Monitor monitor) throws CompositeBuilderException {
String parentComponentURI = uri;
@@ -346,7 +347,7 @@ public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements C
* @param defaultBindings
*/
private void constructBindingURI(String parentComponentURI, Composite composite, Service service,
- Binding binding, Map<Class<?>, List<String>> defaultBindings, Monitor monitor)
+ Binding binding, Map<QName, List<String>> defaultBindings, Monitor monitor)
throws CompositeBuilderException{
// This is a composite service so there is no component to provide a component URI
// The path to this composite (through nested composites) is used.
@@ -365,7 +366,7 @@ public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements C
* @param defaultBindings the list of default binding configurations
*/
private void constructBindingURI(Component component, Service service,
- Binding binding, Map<Class<?>, List<String>> defaultBindings, Monitor monitor)
+ Binding binding, Map<QName, List<String>> defaultBindings, Monitor monitor)
throws CompositeBuilderException{
boolean includeBindingName = component.getServices().size() != 1;
constructBindingURI(component.getURI(), service, binding, includeBindingName, defaultBindings, monitor);
@@ -382,7 +383,7 @@ public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements C
* @throws CompositeBuilderException
*/
private void constructBindingURI(String componentURIString, Service service, Binding binding,
- boolean includeBindingName, Map<Class<?>, List<String>> defaultBindings, Monitor monitor)
+ boolean includeBindingName, Map<QName, List<String>> defaultBindings, Monitor monitor)
throws CompositeBuilderException{
try {
@@ -426,15 +427,9 @@ public class CompositeBindingURIBuilderImpl extends BaseBuilderImpl implements C
// calculate the base URI
URI baseURI = null;
if (defaultBindings != null) {
- for (Class<?> bindingClass : defaultBindings.keySet()){
- if (bindingClass.isInstance(binding)){
- List<String> uris = defaultBindings.get(bindingClass);
- if (uris.size() > 0){
- baseURI = new URI(addSlashToPath(uris.get(0)));
- }
-
- break;
- }
+ List<String> uris = defaultBindings.get(binding.getType());
+ if (uris != null && uris.size() > 0) {
+ baseURI = new URI(addSlashToPath(uris.get(0)));
}
}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
index e1598bb75f..bced0c807e 100644
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
+++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
+import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.TransformerFactory;
@@ -145,7 +146,7 @@ public class CompositeBuilderImpl implements CompositeBuilder, CompositeBuilderT
build(composite, definitions, null, monitor);
}
- public void build(Composite composite, Definitions definitions, Map<Class<?>, List<String>> bindingMap, Monitor monitor) throws CompositeBuilderException {
+ public void build(Composite composite, Definitions definitions, Map<QName, List<String>> bindingBaseURIs, Monitor monitor) throws CompositeBuilderException {
try {
// Collect and fuse includes
@@ -170,7 +171,7 @@ public class CompositeBuilderImpl implements CompositeBuilder, CompositeBuilderT
// Configure service binding URIs and names. Creates an SCA defined URI based
// on the scheme base URI, the component name and the binding name
- ((CompositeBuilderTmp)compositeBindingURIBuilder).build(composite, definitions, bindingMap, monitor);
+ ((CompositeBuilderTmp)compositeBindingURIBuilder).build(composite, definitions, bindingBaseURIs, monitor);
// Create $promoted$ component services on bottom level components
// to represent promoted services
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
index 66f6f0e090..d4de78c81a 100644
--- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
+++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
@@ -598,23 +598,21 @@ public class NodeFactoryImpl extends NodeFactory {
tempComposite.getIncludes().add(composite);
}
}
-
+
// TODO - EPR - create a binding map to pass down into the builders
- // for use during URI calculation.
- Map<Class<?>, List<String>> bindingMap = new HashMap<Class<?>, List<String>>();
- for (BindingConfiguration config : configuration.getBindings()){
- StAXArtifactProcessor<?> processor = xmlProcessors.getProcessor(config.getBindingType());
- Class<?> bindingClass = processor.getModelType();
- bindingMap.put(bindingClass, config.getBaseURIs());
+ // for use during URI calculation.
+ Map<QName, List<String>> bindingMap = new HashMap<QName, List<String>>();
+ for (BindingConfiguration config : configuration.getBindings()) {
+ bindingMap.put(config.getBindingType(), config.getBaseURIs());
}
-
+
// build the top level composite
((CompositeBuilderTmp)compositeBuilder).build(tempComposite, systemDefinitions, bindingMap, monitor);
analyzeProblems();
-
+
endpointReferenceBuilder.build(tempComposite, systemDefinitions, monitor);
analyzeProblems();
-
+
return tempComposite;
}
diff --git a/java/sca/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java b/java/sca/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
index 33cb50ca97..d616cb4f5c 100644
--- a/java/sca/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
+++ b/java/sca/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
@@ -371,9 +371,16 @@ final class NodeLauncherUtil {
Object node;
if (configurationURI != null) {
+ URL url = null;
+ URI uri = URI.create(configurationURI);
+ if (uri.getScheme() == null) {
+ uri = new File(configurationURI).toURI();
+ }
+ url = uri.toURL();
+
// NodeFactory.createNode(URL)
Method create = bootstrapClass.getMethod("createNode", URL.class);
- node = create.invoke(nodeFactory, new URL(configurationURI));
+ node = create.invoke(nodeFactory, url);
} else if (contributionClassLoader != null) {