From 83edd957d8d7365847ec2a5bc6a7f24ed0bc60d0 Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 29 Sep 2010 15:44:25 +0000 Subject: Update to use all the contribution attributes, rename the test to use the correct attribute name, and make sure the xml file gets closed git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1002690 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/tuscany/sca/node2/NodeFactory.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sca-java-2.x/trunk/modules') diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java index a49668a6be..c7b8db235a 100644 --- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java +++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java @@ -116,8 +116,7 @@ public class NodeFactory { NodeConfiguration configuration = loadConfiguration(configURL); Node node = createNode(configuration.getDomainURI()); for ( ContributionConfiguration c : configuration.getContributions()) { -// node.installContribution(c.getURI(), c.getLocation(), c.getMetaDataURL(), c.getDependentContributionURIs(), c.getRunDeployables()); - node.installContribution(c.getURI(), c.getLocation(), null, null, true); + node.installContribution(c.getURI(), c.getLocation(), c.getMetaDataURL(), c.getDependentContributionURIs(), c.isStartDeployables()); } return node; } @@ -182,9 +181,10 @@ public class NodeFactory { } protected NodeConfiguration loadConfiguration(String configURL) { + InputStream xml =null; try { URL base = IOHelper.getLocationAsURL(configURL); - InputStream xml = IOHelper.openStream(base); + xml = IOHelper.openStream(base); InputStreamReader reader = new InputStreamReader(xml, "UTF-8"); ProcessorContext context = deployer.createProcessorContext(); NodeConfiguration config = deployer.loadXMLDocument(reader, context.getMonitor()); @@ -203,6 +203,12 @@ public class NodeFactory { return config; } catch (Throwable e) { throw new ServiceRuntimeException(e); + } finally { + try { + if (xml != null) xml.close(); + } catch (IOException e) { + throw new ServiceRuntimeException(e); + } } } -- cgit v1.2.3