diff options
Diffstat (limited to '')
52 files changed, 488 insertions, 277 deletions
diff --git a/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java b/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java index b1d1977334..a52f4de71b 100644 --- a/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java +++ b/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java @@ -26,9 +26,9 @@ import java.io.File; import junit.framework.Assert;
import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java index 7854975d40..d05e4712a1 100644 --- a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java +++ b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/ConversationWSDLTestCase.java @@ -25,9 +25,9 @@ import java.io.File; import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStatelessImpl;
import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
diff --git a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java index d0f9692e2e..7eec461476 100644 --- a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java +++ b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/NonConversationalCallbackTestCase.java @@ -30,9 +30,9 @@ import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceSta import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulNonConversationalCallbackImpl;
import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java index 2ce6394b58..39ab4319f7 100644 --- a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java +++ b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/RequestScopeTestCase.java @@ -31,9 +31,9 @@ import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceReq import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java index bae7d4cbd8..28df937283 100644 --- a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java +++ b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatefulTestCase.java @@ -30,9 +30,9 @@ import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStat import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java index 0df71474da..02295b0ca6 100644 --- a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java +++ b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatefulStatelessTestCase.java @@ -30,9 +30,9 @@ import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStat import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java index fc43064999..fce6ee0d50 100644 --- a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java +++ b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatefulTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStat import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java index 871f806c36..6df7767823 100644 --- a/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java +++ b/java/sca/itest/conversations-ws/src/test/java/org/apache/tuscany/sca/itest/conversational/StatelessStatelessTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.itest.conversational.impl.ConversationalClientStat import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatefulImpl;
import org.apache.tuscany.sca.itest.conversational.impl.ConversationalServiceStatelessImpl;
import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/DatabindingTestCase.java b/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/DatabindingTestCase.java index 0348adbe5f..709bb02a28 100644 --- a/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/DatabindingTestCase.java +++ b/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/DatabindingTestCase.java @@ -19,19 +19,12 @@ package org.apache.tuscany.sca.itest.databindings.jaxb.topdown; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import junit.framework.Assert; import org.apache.tuscany.sca.itest.databindings.jaxb.HelloServiceClient; import org.apache.tuscany.sca.node.SCAClient; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Ignore; @@ -51,8 +44,7 @@ public class DatabindingTestCase { @BeforeClass public static void setUp() throws Exception { SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); - node = nodeFactory.createSCANode(new File("src/main/resources/wsdl/wrapped/helloservice.composite").toURL().toString(), - new SCAContribution("TestContribution", new File("src/main/resources/wsdl/wrapped").toURL().toString())); + node = nodeFactory.createSCANodeFromClassLoader("wsdl/wrapped/helloservice.composite", null); node.start(); client = (SCAClient)node; } diff --git a/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/PrimitivesDatabindingTestCase.java b/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/PrimitivesDatabindingTestCase.java index 228b01cc75..41a8f3cadd 100644 --- a/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/PrimitivesDatabindingTestCase.java +++ b/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/PrimitivesDatabindingTestCase.java @@ -19,15 +19,12 @@ package org.apache.tuscany.sca.itest.databindings.jaxb.topdown; -import java.io.File; - import junit.framework.Assert; import org.apache.tuscany.sca.itest.databindings.jaxb.PrimitivesServiceClient; import org.apache.tuscany.sca.node.SCAClient; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -46,8 +43,7 @@ public class PrimitivesDatabindingTestCase { @BeforeClass public static void setUp() throws Exception { SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); - node = nodeFactory.createSCANode(new File("src/main/resources/wsdl/wrapped/primitivesservice.composite").toURL().toString(), - new SCAContribution("TestContribution", new File("src/main/resources/wsdl/wrapped").toURL().toString())); + node = nodeFactory.createSCANodeFromClassLoader("wsdl/wrapped/primitivesservice.composite", null); node.start(); domain = (SCAClient)node; } diff --git a/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/StandardTypesDatabindingTestCase.java b/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/StandardTypesDatabindingTestCase.java index 2408cf8196..5c47cf3ad6 100644 --- a/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/StandardTypesDatabindingTestCase.java +++ b/java/sca/itest/databindings/jaxb-top-down/src/test/java/org/apache/tuscany/sca/itest/databindings/jaxb/topdown/StandardTypesDatabindingTestCase.java @@ -22,7 +22,6 @@ package org.apache.tuscany.sca.itest.databindings.jaxb.topdown; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.image.PixelGrabber; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.StringReader; @@ -59,7 +58,6 @@ import org.apache.tuscany.sca.itest.databindings.jaxb.impl.StandardTypesTransfor import org.apache.tuscany.sca.node.SCAClient; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Ignore; @@ -80,8 +78,7 @@ public class StandardTypesDatabindingTestCase { @BeforeClass public static void setUp() throws Exception { SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); - node = nodeFactory.createSCANode(new File("src/main/resources/wsdl/wrapped/standard-types-service.composite").toURL().toString(), - new SCAContribution("TestContribution", new File("src/main/resources/wsdl/wrapped").toURL().toString())); + node = nodeFactory.createSCANodeFromClassLoader("wsdl/wrapped/standard-types-service.composite", null); node.start(); domain = (SCAClient)node; } diff --git a/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java b/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java index abc4e815b3..7761b0bf69 100644 --- a/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java +++ b/java/sca/itest/domain/src/test/java/org/apache/tuscany/sca/itest/domain/ContributionSPIsTestCase.java @@ -49,9 +49,9 @@ import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.workspace.Workspace; import org.apache.tuscany.sca.workspace.WorkspaceFactory; import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; diff --git a/java/sca/itest/late-reference-resolution/src/test/java/calculator/LateReferenceResolutionTestCase.java b/java/sca/itest/late-reference-resolution/src/test/java/calculator/LateReferenceResolutionTestCase.java index 94270edd91..d3fe027e60 100644 --- a/java/sca/itest/late-reference-resolution/src/test/java/calculator/LateReferenceResolutionTestCase.java +++ b/java/sca/itest/late-reference-resolution/src/test/java/calculator/LateReferenceResolutionTestCase.java @@ -24,9 +24,9 @@ import java.io.File; import junit.framework.Assert; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher; import org.junit.AfterClass; import org.junit.BeforeClass; diff --git a/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java b/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java index 77629c9905..b21042c06b 100644 --- a/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java +++ b/java/sca/itest/oneway/src/test/java/org/apache/tuscany/sca/itest/oneway/OneWayTestCase.java @@ -19,7 +19,6 @@ package org.apache.tuscany.sca.itest.oneway;
-import java.io.File;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Handler;
import java.util.logging.Level;
@@ -34,11 +33,8 @@ import org.apache.tuscany.sca.itest.oneway.impl.OneWayServiceImpl; import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.After;
-import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -64,11 +60,7 @@ public class OneWayTestCase { public void setUp() throws Exception {
SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
- node = nodeFactory.createSCANode(new File("src/main/resources/OneWayContribution/META-INF/sca-deployables/oneWay.composite").toURL().toString(),
- new SCAContribution("TestContribution",
- new File("src/main/resources/OneWayContribution").toURL().toString()));
-
-
+ node = nodeFactory.createSCANodeFromClassLoader("OneWayContribution/META-INF/sca-deployables/oneWay.composite", null);
node.start();
}
diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java index 910284572b..84c77ae297 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/ComponentReferenceTargetNotFoundTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java index fa81f6e277..ff1bd6cb09 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateComponentNameTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java index 1a61cec239..65dab38ee3 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateImplementationPropertyNameTestCase.java @@ -28,9 +28,9 @@ import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java index 5e445ba732..6c10d1279c 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateImplementationReferenceNameTestCase.java @@ -28,9 +28,9 @@ import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java index e3a145d01a..4531564ccb 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicatePropertyNameTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java index 586ff2c48a..3b024c58c7 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/DuplicateReferenceNameTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java index 284b657035..4f54b023f4 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/MultipleBindingsForServiceTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java index 3529bc2bf4..14af754860 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/NoComponentImplementationTestCase.java @@ -28,9 +28,9 @@ import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java index b19f26eb77..2f2e87f9af 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/NoCompositeNamespaceTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java index 1cdfa0ae80..eb1f514240 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/NoMatchingBindingTestCase.java @@ -24,9 +24,9 @@ import junit.framework.Assert; import junit.framework.TestCase; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; /** * This shows how to test the Calculator service component. diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java index ca2cd0b6c8..07c75decbc 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/PromotedReferenceNotFoundTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java index a79e902b2b..26c988c1c1 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/PromotedServiceNotFoundTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java index 06d4f4c3e0..3753fc278c 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/PropertyAttributeMustSupplyNullTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java index 49f6868159..08e5a9861b 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/PropertyAttributeTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java index f0123787ae..4af2675c09 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/PropertyNotFoundTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java index 53a99ce8ab..11fde0a73d 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/PropertyOverrideManyAttributeTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java index c2111faef3..19b04e6940 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleComponentInterfaceTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java index c700768fba..3180539898 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleInterfaceTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java index 8c9e0b2ffb..87ae0f0e3c 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceIncompatibleMultiplicityTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java index 4692cae18f..4856ba507f 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java index 15294e04a6..f456ae40af 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/ReferenceWithoutTargetsTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java index 7876354ae1..51adc22848 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/ServiceNotFoundForComponentServiceTestCase.java @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java index e72c6842df..918108c275 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/UnresolvedComponentImplementationTestCase.java @@ -28,9 +28,9 @@ import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.node.impl.NodeImpl; /** diff --git a/java/sca/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java b/java/sca/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java index 0e7ad31597..93edfa2e21 100644 --- a/java/sca/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java +++ b/java/sca/itest/validation/src/test/java/calculator/warning/XSDValidationTestCase.java @@ -23,9 +23,9 @@ import java.io.File; import junit.framework.TestCase; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; /** * This shows how to test the Calculator service component. diff --git a/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java b/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java index 397dcba433..f997d26cac 100644 --- a/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java +++ b/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java @@ -20,9 +20,9 @@ package org.apache.tuscany.sca.implementation.node.launcher; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.osoa.sca.CallableReference; import org.osoa.sca.ServiceReference; @@ -91,7 +91,7 @@ public class NodeImplementationLauncherBootstrap { */ public NodeImplementationLauncherBootstrap(String configurationURI) throws Exception { SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); - node = new NodeFacade(nodeFactory.createSCANode(configurationURI)); + node = new NodeFacade(nodeFactory.createSCANodeFromURL(configurationURI)); } /** diff --git a/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java b/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java index 7902866aa0..47b42c9224 100644 --- a/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java +++ b/java/sca/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java @@ -113,7 +113,7 @@ public class NodeWebAppServletHost implements ServletHost, Filter { // Create the SCA node SCANode2Factory nodeFactory = SCANode2Factory.newInstance(); - node = nodeFactory.createSCANode(nodeConfiguration); + node = nodeFactory.createSCANodeFromURL(nodeConfiguration); // Register the Servlet host ServletHostExtensionPoint servletHosts = servletHosts(node); diff --git a/java/sca/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java b/java/sca/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java new file mode 100644 index 0000000000..de7f352122 --- /dev/null +++ b/java/sca/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * 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. + */ +package org.apache.tuscany.sca.node; + +/** + * Represents an SCA contribution uri + location. + */ +public final class SCAContribution { + private String uri; + private String location; + + /** + * Constructs a new SCA contribution. + * + * @param uri The URI that uniquely identifies the contribution in the SCA domain + * @param location The URL of the contribution archive + */ + public SCAContribution(String uri, String location) { + this.uri = uri; + this.location = location; + } + + /** + * Get the URI of the contribution + * @return The URI that uniquely identifies the contribution in the SCA domain + */ + public String getURI() { + return uri; + } + + /** + * The location of the contribution + * @return The URL of the contribution archive + */ + public String getLocation() { + return location; + } +}
\ No newline at end of file diff --git a/java/sca/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java b/java/sca/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java index 77d37fd921..35ffbc4024 100644 --- a/java/sca/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java +++ b/java/sca/modules/node2-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java @@ -66,18 +66,38 @@ public abstract class SCANode2Factory { } /** - * Creates a new SCA node. + * Create a SCA node based on the discovery of the contribution on the classpath for the + * given classloader. This method should be treated a convinient shortcut with the following + * assumptions: + * <ul> + * <li>This is a standalone application and there is a deployable composite file on the classpath. + * <li>There is only one contribution which contains the deployable composite file physically in its packaging hierarchy. + * </ul> + * @param compositeURI The URI of the composite file relative to the root of the enclosing contribution + * @param classLoader The ClassLoader used to load the composite file as a resource. If the value is null, + * then thread context classloader will be used + * @return A newly created SCA node + */ + public abstract SCANode2 createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader); + + /** + * Creates a new SCA node from the configuration URL * - * @param configurationURI the URI of the node configuration + * @param configurationURL the URL of the node configuration which is the ATOM feed + * that contains the URI of the composite and a collection of URLs for the contributions + * * @return a new SCA node. */ - public abstract SCANode2 createSCANode(String configurationURI); + public abstract SCANode2 createSCANodeFromURL(String configurationURL); /** * Creates a new SCA node. * * @param compositeURI the URI of the composite to use - * @param contributions the URI of the contributions that provides the composites and related artifacts + * @param contributions the URI of the contributions that provides the composites and related + * artifacts. If the list is empty, then we will use the thread context classloader to discover + * the contribution on the classpath + * * @return a new SCA node. */ public abstract SCANode2 createSCANode(String compositeURI, SCAContribution... contributions); @@ -91,32 +111,5 @@ public abstract class SCANode2Factory { * @return a new SCA node. */ public abstract SCANode2 createSCANode(String compositeURI, String compositeContent, SCAContribution... contributions); - - /** - * Represents an SCA contribution uri + location. - */ - public static final class SCAContribution { - private String uri; - private String location; - - /** - * Constructs a new SCA contribution. - * - * @param uri - * @param location - */ - public SCAContribution(String uri, String location) { - this.uri = uri; - this.location = location; - } - - public String getURI() { - return uri; - } - - public String getLocation() { - return location; - } - } } diff --git a/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java index a37009895c..b032a4fb9a 100644 --- a/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java +++ b/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java @@ -19,6 +19,7 @@ package org.apache.tuscany.sca.node.impl; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; @@ -28,12 +29,16 @@ import org.apache.tuscany.sca.node.SCANode2Factory; * @version $Rev$ $Date$ */ public class NodeFactoryImpl extends SCANode2Factory { - public NodeFactoryImpl() { } + + @Override + public SCANode2 createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader) { + return new NodeImpl(classLoader, compositeURI); + } @Override - public SCANode2 createSCANode(String configurationURI) { + public SCANode2 createSCANodeFromURL(String configurationURI) { return new NodeImpl(configurationURI); } diff --git a/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index 201229b370..17aad5b106 100644 --- a/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/java/sca/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -1,31 +1,36 @@ - /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * 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. - */ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* 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. +*/ package org.apache.tuscany.sca.node.impl; -import java.io.ByteArrayInputStream; import java.io.File; +import java.io.IOException; import java.io.InputStream; import java.io.StringReader; +import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.net.URLClassLoader; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -44,10 +49,12 @@ import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.CompositeService; import org.apache.tuscany.sca.contribution.Contribution; import org.apache.tuscany.sca.contribution.ContributionFactory; +import org.apache.tuscany.sca.contribution.ContributionMetadata; import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; import org.apache.tuscany.sca.contribution.service.ContributionService; +import org.apache.tuscany.sca.contribution.service.util.FileHelper; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.core.assembly.ActivationException; @@ -60,8 +67,8 @@ import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.monitor.Problem.Severity; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentContext; import org.osoa.sca.CallableReference; @@ -74,12 +81,12 @@ import org.osoa.sca.ServiceRuntimeException; * @version $Rev$ $Date$ */ public class NodeImpl implements SCANode2, SCAClient { - + private static final Logger logger = Logger.getLogger(NodeImpl.class.getName()); - + // The node configuration name, used for logging private String configurationName; - + // The Tuscany runtime that does the hard work private ReallySmallRuntime runtime; private CompositeActivator compositeActivator; @@ -88,9 +95,11 @@ public class NodeImpl implements SCANode2, SCAClient { private StAXArtifactProcessorExtensionPoint artifactProcessors; private Monitor monitor; + private ContributionMetadata metadata; + // The composite loaded into this node - private Composite composite; - + private Composite composite; + /** * Constructs a new SCA node. * @@ -98,20 +107,20 @@ public class NodeImpl implements SCANode2, SCAClient { */ NodeImpl(ConfiguredNodeImplementation configuration) { configurationName = configuration.getURI(); - logger.log(Level.INFO, "Creating node: " + configuration.getURI()); + logger.log(Level.INFO, "Creating node: " + configuration.getURI()); try { // Initialize the runtime initRuntime(); - + URL configurationURL = new URL(configuration.getURI()); // Resolve contribution URLs - for (Contribution contribution: configuration.getContributions()) { + for (Contribution contribution : configuration.getContributions()) { URL contributionURL = new URL(configurationURL, contribution.getLocation()); contribution.setLocation(contributionURL.toString()); } - + // Resolve composite URL URL compositeURL = new URL(configurationURL, configuration.getComposite().getURI()); configuration.getComposite().setURI(compositeURL.toString()); @@ -121,7 +130,7 @@ public class NodeImpl implements SCANode2, SCAClient { } catch (Exception e) { throw new ServiceRuntimeException(e); - } + } } /** @@ -131,27 +140,28 @@ public class NodeImpl implements SCANode2, SCAClient { */ NodeImpl(String configurationURI) { configurationName = configurationURI; - logger.log(Level.INFO, "Creating node: " + configurationName); + logger.log(Level.INFO, "Creating node: " + configurationName); try { // Initialize the runtime initRuntime(); - + // Read the node configuration feed - StAXArtifactProcessor<ConfiguredNodeImplementation> configurationProcessor = artifactProcessors.getProcessor(ConfiguredNodeImplementation.class); + StAXArtifactProcessor<ConfiguredNodeImplementation> configurationProcessor = + artifactProcessors.getProcessor(ConfiguredNodeImplementation.class); URL configurationURL = new URL(configurationURI); InputStream is = configurationURL.openStream(); XMLStreamReader reader = inputFactory.createXMLStreamReader(is); reader.nextTag(); ConfiguredNodeImplementation configuration = configurationProcessor.read(reader); is.close(); - + // Resolve contribution URLs - for (Contribution contribution: configuration.getContributions()) { + for (Contribution contribution : configuration.getContributions()) { URL contributionURL = new URL(configurationURL, contribution.getLocation()); contribution.setLocation(contributionURL.toString()); } - + // Resolve composite URL URL compositeURL = new URL(configurationURL, configuration.getComposite().getURI()); configuration.getComposite().setURI(compositeURL.toString()); @@ -161,9 +171,152 @@ public class NodeImpl implements SCANode2, SCAClient { } catch (Exception e) { throw new ServiceRuntimeException(e); - } + } + } + + NodeImpl(ClassLoader classLoader, String compositeURI) { + configurationName = compositeURI; + logger.log(Level.INFO, "Creating node: " + configurationName); + + try { + // Initialize the runtime + initRuntime(); + + ConfiguredNodeImplementation config = findNodeConfiguration(compositeURI, classLoader); + configureNode(config); + } catch (Throwable e) { + throw new ServiceRuntimeException(e); + } } - + + private ConfiguredNodeImplementation findNodeConfiguration(final String compositeURI, ClassLoader classLoader) + throws Exception { + NodeImplementationFactory nodeImplementationFactory = + modelFactories.getFactory(NodeImplementationFactory.class); + ConfiguredNodeImplementation config = nodeImplementationFactory.createConfiguredNodeImplementation(); + + if (classLoader == null) { + classLoader = Thread.currentThread().getContextClassLoader(); + } + String contributionArtifactPath = compositeURI; + URL contributionArtifactURL = null; + if (compositeURI != null) { + contributionArtifactURL = getResource(classLoader, compositeURI); + if (contributionArtifactURL == null) { + throw new IllegalArgumentException("Composite not found: " + contributionArtifactPath); + } + composite = createComposite(contributionArtifactURL.toString()); + config.setComposite(composite); + } else { + + // Here the SCADomain was started without any reference to a composite file + // We are going to look for an sca-contribution.xml or sca-contribution-generated.xml + + // Look for META-INF/sca-contribution.xml + contributionArtifactPath = Contribution.SCA_CONTRIBUTION_META; + contributionArtifactURL = getResource(classLoader, contributionArtifactPath); + + // Look for META-INF/sca-contribution-generated.xml + if (contributionArtifactURL == null) { + contributionArtifactPath = Contribution.SCA_CONTRIBUTION_GENERATED_META; + contributionArtifactURL = getResource(classLoader, contributionArtifactPath); + } + + // Look for META-INF/sca-deployables directory + if (contributionArtifactURL == null) { + contributionArtifactPath = Contribution.SCA_CONTRIBUTION_DEPLOYABLES; + contributionArtifactURL = getResource(classLoader, contributionArtifactPath); + } else { + StAXArtifactProcessor<ContributionMetadata> processor = + artifactProcessors.getProcessor(ContributionMetadata.class); + XMLStreamReader reader = inputFactory.createXMLStreamReader(contributionArtifactURL.openStream()); + metadata = processor.read(reader); + reader.close(); + if (metadata.getDeployables().isEmpty()) { + throw new IllegalArgumentException( + "No deployable composite is declared in " + contributionArtifactPath); + } + } + } + + if (contributionArtifactURL == null) { + throw new IllegalArgumentException( + "Can't determine contribution deployables. Either specify a composite file, or use an sca-contribution.xml file to specify the deployables."); + } + + Contribution c = getContribution(contributionArtifactURL, contributionArtifactPath); + config.getContributions().add(c); + + return config; + } + + private Contribution getContribution(URL contributionArtifactURL, String contributionArtifactPath) { + URL contributionURL = getContributionURL(contributionArtifactURL, contributionArtifactPath); + + ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class); + + SCAContribution contribution = new SCAContribution(contributionURL.toString(), contributionURL.toString()); + Contribution c = createContribution(contributionFactory, contribution); + return c; + } + + private URL getContributionURL(URL contributionArtifactURL, String contributionArtifactPath) { + URL contributionURL = null; + // "jar:file://....../something.jar!/a/b/c/app.composite" + try { + String url = contributionArtifactURL.toExternalForm(); + String protocol = contributionArtifactURL.getProtocol(); + if ("file".equals(protocol)) { + // directory contribution + if (url.endsWith(contributionArtifactPath)) { + final String location = url.substring(0, url.lastIndexOf(contributionArtifactPath)); + // workaround from evil URL/URI form Maven + // contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL(); + // Allow privileged access to open URL stream. Add FilePermission to added to + // security policy file. + try { + contributionURL = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() { + public URL run() throws IOException { + return FileHelper.toFile(new URL(location)).toURI().toURL(); + } + }); + } catch (PrivilegedActionException e) { + throw (MalformedURLException)e.getException(); + } + } + + } else if ("jar".equals(protocol)) { + // jar contribution + String location = url.substring(4, url.lastIndexOf("!/")); + // workaround for evil URL/URI from Maven + contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL(); + + } else if ("wsjar".equals(protocol)) { + // See https://issues.apache.org/jira/browse/TUSCANY-2219 + // wsjar contribution + String location = url.substring(6, url.lastIndexOf("!/")); + // workaround for evil url/uri from maven + contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL(); + + } else if (protocol != null && (protocol.equals("bundle") || protocol.equals("bundleresource"))) { + contributionURL = + new URL(contributionArtifactURL.getProtocol(), contributionArtifactURL.getHost(), + contributionArtifactURL.getPort(), "/"); + } + } catch (MalformedURLException mfe) { + throw new IllegalArgumentException(mfe); + } + return contributionURL; + } + + private static URL getResource(final ClassLoader classLoader, final String compositeURI) { + return AccessController.doPrivileged(new PrivilegedAction<URL>() { + public URL run() { + return classLoader.getResource(compositeURI); + } + }); + } + /** * Constructs a new SCA node. * @@ -172,31 +325,31 @@ public class NodeImpl implements SCANode2, SCAClient { */ NodeImpl(String compositeURI, SCAContribution[] contributions) { configurationName = compositeURI; - logger.log(Level.INFO, "Creating node: " + configurationName); + logger.log(Level.INFO, "Creating node: " + configurationName); try { // Initialize the runtime initRuntime(); - - // Create a node configuration - NodeImplementationFactory nodeImplementationFactory = modelFactories.getFactory(NodeImplementationFactory.class); - ConfiguredNodeImplementation configuration = nodeImplementationFactory.createConfiguredNodeImplementation(); - - // Create composite model - AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - Composite composite = assemblyFactory.createComposite(); - composite.setURI(compositeURI); - composite.setUnresolved(true); - configuration.setComposite(composite); - - // Create contribution models - ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class); - for (SCAContribution c: contributions) { - Contribution contribution = contributionFactory.createContribution(); - contribution.setURI(c.getURI()); - contribution.setLocation(c.getLocation()); - contribution.setUnresolved(true); - configuration.getContributions().add(contribution); + + ConfiguredNodeImplementation configuration = null; + if (contributions == null || contributions.length == 0) { + configuration = findNodeConfiguration(compositeURI, null); + } else { + + // Create a node configuration + NodeImplementationFactory nodeImplementationFactory = + modelFactories.getFactory(NodeImplementationFactory.class); + configuration = nodeImplementationFactory.createConfiguredNodeImplementation(); + + Composite composite = createComposite(compositeURI); + configuration.setComposite(composite); + + // Create contribution models + ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class); + for (SCAContribution c : contributions) { + Contribution contribution = createContribution(contributionFactory, c); + configuration.getContributions().add(contribution); + } } // Configure the node @@ -204,9 +357,18 @@ public class NodeImpl implements SCANode2, SCAClient { } catch (Exception e) { throw new ServiceRuntimeException(e); - } + } + } + + private Composite createComposite(String compositeURI) { + // Create composite model + AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + Composite composite = assemblyFactory.createComposite(); + composite.setURI(compositeURI); + composite.setUnresolved(true); + return composite; } - + /** * Constructs a new SCA node. * @@ -216,33 +378,36 @@ public class NodeImpl implements SCANode2, SCAClient { */ NodeImpl(String compositeURI, String compositeContent, SCAContribution[] contributions) { configurationName = compositeURI; - logger.log(Level.INFO, "Creating node: " + configurationName); + logger.log(Level.INFO, "Creating node: " + configurationName); try { // Initialize the runtime initRuntime(); - - // Create a node configuration - NodeImplementationFactory nodeImplementationFactory = modelFactories.getFactory(NodeImplementationFactory.class); - ConfiguredNodeImplementation configuration = nodeImplementationFactory.createConfiguredNodeImplementation(); - - // Read the composite model - StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class); - URL compositeURL = new URL(compositeURI); - logger.log(Level.INFO, "Loading composite: " + compositeURL); - InputStream is = new ByteArrayInputStream(compositeContent.getBytes()); - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(compositeContent)); - Composite composite = compositeProcessor.read(reader); - configuration.setComposite(composite); - - // Create contribution models - ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class); - for (SCAContribution c: contributions) { - Contribution contribution = contributionFactory.createContribution(); - contribution.setURI(c.getURI()); - contribution.setLocation(c.getLocation()); - contribution.setUnresolved(true); - configuration.getContributions().add(contribution); + + ConfiguredNodeImplementation configuration = null; + if (contributions == null || contributions.length == 0) { + configuration = findNodeConfiguration(compositeURI, null); + } else { + // Create a node configuration + NodeImplementationFactory nodeImplementationFactory = + modelFactories.getFactory(NodeImplementationFactory.class); + configuration = nodeImplementationFactory.createConfiguredNodeImplementation(); + + // Read the composite model + StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class); + URL compositeURL = new URL(compositeURI); + logger.log(Level.INFO, "Loading composite: " + compositeURL); + XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(compositeContent)); + Composite composite = compositeProcessor.read(reader); + reader.close(); + configuration.setComposite(composite); + + // Create contribution models + ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class); + for (SCAContribution c : contributions) { + Contribution contribution = createContribution(contributionFactory, c); + configuration.getContributions().add(contribution); + } } // Configure the node @@ -250,9 +415,17 @@ public class NodeImpl implements SCANode2, SCAClient { } catch (Exception e) { throw new ServiceRuntimeException(e); - } + } } - + + private static Contribution createContribution(ContributionFactory contributionFactory, SCAContribution c) { + Contribution contribution = contributionFactory.createContribution(); + contribution.setURI(c.getURI()); + contribution.setLocation(c.getLocation()); + contribution.setUnresolved(true); + return contribution; + } + /** * Initialize the Tuscany runtime. * @@ -263,7 +436,7 @@ public class NodeImpl implements SCANode2, SCAClient { // Create a node runtime runtime = new ReallySmallRuntime(Thread.currentThread().getContextClassLoader()); runtime.start(); - + // Get the various factories we need ExtensionPointRegistry registry = runtime.getExtensionPointRegistry(); modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class); @@ -271,16 +444,16 @@ public class NodeImpl implements SCANode2, SCAClient { // Create the required artifact processors artifactProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - + // Save the composite activator compositeActivator = runtime.getCompositeActivator(); - + // save the monitor UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); monitor = monitorFactory.createMonitor(); } - + private void configureNode(ConfiguredNodeImplementation configuration) throws Exception { // Find if any contribution JARs already available locally on the classpath @@ -289,7 +462,7 @@ public class NodeImpl implements SCANode2, SCAClient { // Load the specified contributions ContributionService contributionService = runtime.getContributionService(); List<Contribution> contributions = new ArrayList<Contribution>(); - for (Contribution contribution: configuration.getContributions()) { + for (Contribution contribution : configuration.getContributions()) { URI uri = URI.create(contribution.getLocation()); if (uri.getScheme() == null) { uri = new File(contribution.getLocation()).toURI(); @@ -297,11 +470,11 @@ public class NodeImpl implements SCANode2, SCAClient { URL contributionURL = uri.toURL(); // Extract contribution file name - String file =contributionURL.getPath(); + String file = contributionURL.getPath(); int i = file.lastIndexOf('/'); - if (i != -1 && i < file.length() -1 ) { - file = file.substring(i +1); - + if (i != -1 && i < file.length() - 1) { + file = file.substring(i + 1); + // If we find the local contribution file on the classpath, use it in // place of the original contribution URL URL localContributionURL = localContributions.get(file); @@ -309,13 +482,24 @@ public class NodeImpl implements SCANode2, SCAClient { contributionURL = localContributionURL; } } - + // Load the contribution logger.log(Level.INFO, "Loading contribution: " + contributionURL); contributions.add(contributionService.contribute(contribution.getURI(), contributionURL, false)); analyseProblems(); } + // Resolve the metadata within the context of the first contribution + Contribution mainContribution = contributions.get(contributions.size() - 1); + if (metadata != null) { + StAXArtifactProcessor<ContributionMetadata> processor = + artifactProcessors.getProcessor(ContributionMetadata.class); + processor.resolve(metadata, mainContribution.getModelResolver()); + List<Composite> composites = metadata.getDeployables(); + configuration.setComposite(composites.get(0)); + } + + // Load the specified composite StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class); if (configuration.getComposite().getName() == null) { @@ -331,88 +515,86 @@ public class NodeImpl implements SCANode2, SCAClient { } else { composite = configuration.getComposite(); } - + analyseProblems(); - + // Resolve it within the context of the first contribution - Contribution mainContribution = contributions.get(contributions.size()-1); compositeProcessor.resolve(composite, mainContribution.getModelResolver()); - + analyseProblems(); - + // Create a top level composite to host our composite // This is temporary to make the activator happy AssemblyFactory assemblyFactory = runtime.getAssemblyFactory(); Composite tempComposite = assemblyFactory.createComposite(); tempComposite.setName(new QName("http://tempuri.org", "temp")); tempComposite.setURI("http://tempuri.org"); - + // Include the node composite in the top-level composite tempComposite.getIncludes().add(composite); - + // set the top level composite on the composite activator as // logic in callable reference resolution relies on this being // available compositeActivator.setDomainComposite(tempComposite); - + // Build the composite runtime.buildComposite(composite); - + analyseProblems(); } - + private void analyseProblems() throws Exception { - - for (Problem problem : monitor.getProblems()){ - if ((problem.getSeverity() == Severity.ERROR) && - (!problem.getMessageId().equals("SchemaError"))){ - if (problem.getCause() != null){ + + for (Problem problem : monitor.getProblems()) { + if ((problem.getSeverity() == Severity.ERROR) && (!problem.getMessageId().equals("SchemaError"))) { + if (problem.getCause() != null) { throw problem.getCause(); } else { throw new ServiceRuntimeException(problem.toString()); - } + } } } } - + public void start() { - logger.log(Level.INFO, "Starting node: " + configurationName); - + logger.log(Level.INFO, "Starting node: " + configurationName); + try { - + // Activate the composite compositeActivator.activate(composite); - + // Start the composite compositeActivator.start(composite); - + } catch (ActivationException e) { throw new ServiceRuntimeException(e); } } - + public void stop() { - logger.log(Level.INFO, "Stopping node: " + configurationName); - + logger.log(Level.INFO, "Stopping node: " + configurationName); + try { - + // Stop the composite compositeActivator.stop(composite); - + // Deactivate the composite compositeActivator.deactivate(composite); - + } catch (ActivationException e) { throw new ServiceRuntimeException(e); } } - + public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException { return (R)runtime.getProxyFactory().cast(target); } - + public <B> B getService(Class<B> businessInterface, String serviceName) { - + ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName); if (serviceReference == null) { throw new ServiceRuntimeException("Service not found: " + serviceName); @@ -421,7 +603,7 @@ public class NodeImpl implements SCANode2, SCAClient { } public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) { - + // Extract the component name String componentName; String serviceName; @@ -437,13 +619,13 @@ public class NodeImpl implements SCANode2, SCAClient { // Lookup the component Component component = null; - - for (Component compositeComponent: composite.getComponents()) { + + for (Component compositeComponent : composite.getComponents()) { if (compositeComponent.getName().equals(componentName)) { component = compositeComponent; } } - + if (component == null) { throw new ServiceRuntimeException("The service " + name + " has not been contributed to the domain"); } @@ -461,7 +643,8 @@ public class NodeImpl implements SCANode2, SCAClient { } componentContext = ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext(); - return componentContext.createSelfReference(businessInterface, compositeService.getPromotedService()); + return componentContext.createSelfReference(businessInterface, compositeService + .getPromotedService()); } break; } @@ -476,7 +659,7 @@ public class NodeImpl implements SCANode2, SCAClient { return componentContext.createSelfReference(businessInterface); } } - } + } /** * Returns the extension point registry used by this node. @@ -486,7 +669,7 @@ public class NodeImpl implements SCANode2, SCAClient { public ExtensionPointRegistry getExtensionPointRegistry() { return runtime.getExtensionPointRegistry(); } - + /** * Returns the composite being run by this node. * @@ -494,19 +677,19 @@ public class NodeImpl implements SCANode2, SCAClient { */ public Composite getComposite() { return composite; - } + } /** * Returns contribution JARs available on the classpath. * * @return */ - private static Map<String, URL> localContributions () { + private static Map<String, URL> localContributions() { Map<String, URL> localContributions = new HashMap<String, URL>(); collectJARs(localContributions, Thread.currentThread().getContextClassLoader()); return localContributions; } - + /** * Collect JARs on the classpath of a URLClassLoader * @param urls @@ -516,22 +699,22 @@ public class NodeImpl implements SCANode2, SCAClient { if (cl == null) { return; } - + // Collect JARs from the URLClassLoader's classpath if (cl instanceof URLClassLoader) { URL[] jarURLs = ((URLClassLoader)cl).getURLs(); if (jarURLs != null) { - for (URL jarURL: jarURLs) { - String file =jarURL.getPath(); + for (URL jarURL : jarURLs) { + String file = jarURL.getPath(); int i = file.lastIndexOf('/'); - if (i != -1 && i < file.length() -1 ) { - file = file.substring(i +1); + if (i != -1 && i < file.length() - 1) { + file = file.substring(i + 1); urls.put(file, jarURL); } } } } - + // Collect JARs from the parent ClassLoader collectJARs(urls, cl.getParent()); } diff --git a/java/sca/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java b/java/sca/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java index 03826da49f..9c3f06ee53 100644 --- a/java/sca/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java +++ b/java/sca/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java @@ -54,9 +54,9 @@ public class CalculatorDistributedTestCase { manager.start();
SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
- nodeC = nodeFactory.createSCANode("http://localhost:9990/node-config/NodeC");
- nodeB = nodeFactory.createSCANode("http://localhost:9990/node-config/NodeB");
- nodeA = nodeFactory.createSCANode("http://localhost:9990/node-config/NodeA");
+ nodeC = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeC");
+ nodeB = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeB");
+ nodeA = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeA");
nodeC.start();
nodeB.start();
diff --git a/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java b/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java index 5b1e4961ed..3d94973880 100644 --- a/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java +++ b/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java @@ -21,11 +21,9 @@ package myapp; import myserver.MyService;
import myserver.MyServiceCallback;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
@@ -51,12 +49,16 @@ public class MyClientImpl implements MyClient, MyServiceCallback { }
public static void main(String[] args) throws Exception {
- SCANode2 node = SCANode2Factory.newInstance().createSCANode("target/classes/myapp.composite", new SCAContribution("test", "target/classes"));
+ SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("myapp.composite", MyClientImpl.class.getClassLoader());
node.start();
+ run(node);
+ System.out.println("Closing the domain");
+ node.stop();
+ }
+
+ public static void run(SCANode2 node) throws InterruptedException {
MyClient myClient = ((SCAClient)node).getService(MyClient.class, "MyClientComponent");
myClient.aClientMethod();
Thread.sleep(5000); // don't exit before callback arrives
- System.out.println("Closing the domain");
- node.stop();
}
}
diff --git a/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java b/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java index b0ed72e664..f11b0adfe4 100644 --- a/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java +++ b/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java @@ -20,7 +20,6 @@ package myapp; import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -33,22 +32,22 @@ public class CallbackClientTestCase { private SCANode2 node;
@Before
- public void startServer() throws Exception {
+ public void startServer() throws Exception {
try {
- node = SCANode2Factory.newInstance().createSCANode("jar:file:../callback-ws-service/target/sample-callback-ws-service.jar!/callbackws.composite", new SCAContribution("server", "../callback-ws-service/target/sample-callback-ws-service.jar"));
+ node = SCANode2Factory.newInstance().createSCANodeFromClassLoader(null, getClass().getClassLoader());
node.start();
} catch (Exception ex) {
System.out.println(ex.toString());
}
- }
+ }
- @Test
- public void testClient() throws Exception {
- MyClientImpl.main(null);
- }
-
- @After
- public void stopServer() throws Exception {
+ @Test
+ public void testClient() throws Exception {
+ MyClientImpl.run(node);
+ }
+
+ @After
+ public void stopServer() throws Exception {
node.stop();
- }
+ }
}
diff --git a/java/sca/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java b/java/sca/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java index b201777e69..9dfead61db 100644 --- a/java/sca/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java +++ b/java/sca/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java @@ -22,7 +22,6 @@ import java.io.IOException; import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
/**
* This server program shows how to create and start an SCA runtime that
@@ -32,7 +31,7 @@ public class CallbackServer { public static void main(String[] args) throws Exception {
- SCANode2 node = SCANode2Factory.newInstance().createSCANode("target/classes/callbackws.composite", new SCAContribution("test", "target/classes"));
+ SCANode2 node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null);
node.start();
try {
diff --git a/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java b/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java index c04365d01f..4208f7f6b5 100644 --- a/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java +++ b/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java @@ -23,7 +23,6 @@ import java.net.Socket; import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -36,18 +35,18 @@ public class CallbackServerTestCase { private SCANode2 node;
@Before
- public void startServer() throws Exception {
- node = SCANode2Factory.newInstance().createSCANode("target/classes/callbackws.composite", new SCAContribution("test", "target/classes"));
+ public void startServer() throws Exception {
+ node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null);
node.start();
- }
+ }
- @Test
- public void testPing() throws IOException {
- new Socket("127.0.0.1", 8086);
- }
-
- @After
- public void stopServer() throws Exception {
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8086);
+ }
+
+ @After
+ public void stopServer() throws Exception {
node.stop();
- }
+ }
}
diff --git a/java/sca/tools/runtime-inspector/src/test/java/org/apache/tuscany/sca/tools/inspector/RegistryInspectorTestCase.java b/java/sca/tools/runtime-inspector/src/test/java/org/apache/tuscany/sca/tools/inspector/RegistryInspectorTestCase.java index 31fccfe38b..0f7e6bce43 100644 --- a/java/sca/tools/runtime-inspector/src/test/java/org/apache/tuscany/sca/tools/inspector/RegistryInspectorTestCase.java +++ b/java/sca/tools/runtime-inspector/src/test/java/org/apache/tuscany/sca/tools/inspector/RegistryInspectorTestCase.java @@ -32,9 +32,9 @@ import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory;
import org.apache.tuscany.sca.monitor.Problem;
import org.apache.tuscany.sca.node.SCAClient;
+import org.apache.tuscany.sca.node.SCAContribution;
import org.apache.tuscany.sca.node.SCANode2;
import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution;
import org.apache.tuscany.sca.node.impl.NodeImpl;
import org.apache.tuscany.sca.tools.inspector.RegistryInspector;
diff --git a/java/sca/vtest/java-api/annotations/destroy/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/DestroyAnnotationTestCase.java b/java/sca/vtest/java-api/annotations/destroy/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/DestroyAnnotationTestCase.java index 6731b226e4..1d10679a8c 100644 --- a/java/sca/vtest/java-api/annotations/destroy/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/DestroyAnnotationTestCase.java +++ b/java/sca/vtest/java-api/annotations/destroy/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/destroy/DestroyAnnotationTestCase.java @@ -24,9 +24,9 @@ import java.io.File; import junit.framework.Assert; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.junit.Test; import org.osoa.sca.ServiceRuntimeException; diff --git a/java/sca/vtest/java-api/annotations/init/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/InitAnnotationTestCase.java b/java/sca/vtest/java-api/annotations/init/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/InitAnnotationTestCase.java index 6f9eeb0f63..65ccc9838d 100644 --- a/java/sca/vtest/java-api/annotations/init/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/InitAnnotationTestCase.java +++ b/java/sca/vtest/java-api/annotations/init/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/init/InitAnnotationTestCase.java @@ -24,9 +24,9 @@ import java.io.File; import junit.framework.Assert; import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; import org.apache.tuscany.sca.node.SCANode2; import org.apache.tuscany.sca.node.SCANode2Factory; -import org.apache.tuscany.sca.node.SCANode2Factory.SCAContribution; import org.junit.Test; import org.osoa.sca.ServiceRuntimeException; |