You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2007/02/03 04:16:22 UTC
svn commit: r502853 [6/7] - in /incubator/tuscany/java/sca/kernel:
core/src/main/java/org/apache/tuscany/core/binding/local/
core/src/main/java/org/apache/tuscany/core/bootstrap/
core/src/main/java/org/apache/tuscany/core/builder/ core/src/main/java/or...
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKCallbackInvocationHandlerTestCase.java Fri Feb 2 19:16:15 2007
@@ -19,11 +19,11 @@
package org.apache.tuscany.core.wire.jdk;
import java.lang.reflect.Proxy;
+import java.net.URI;
import org.apache.tuscany.spi.idl.java.JavaServiceContract;
import junit.framework.TestCase;
-
import org.apache.tuscany.core.component.WorkContextImpl;
import org.apache.tuscany.core.wire.InboundWireImpl;
@@ -34,6 +34,7 @@
public void testToString() {
InboundWireImpl wire = new InboundWireImpl();
+ wire.setUri(URI.create("#wire"));
wire.setServiceContract(new JavaServiceContract(Foo.class));
JDKCallbackInvocationHandler handler = new JDKCallbackInvocationHandler(wire, new WorkContextImpl());
Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
@@ -43,6 +44,7 @@
public void testHashCode() {
InboundWireImpl wire = new InboundWireImpl();
wire.setServiceContract(new JavaServiceContract(Foo.class));
+ wire.setUri(URI.create("#wire"));
JDKCallbackInvocationHandler handler = new JDKCallbackInvocationHandler(wire, new WorkContextImpl());
Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
assertNotNull(foo.hashCode());
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerSerializationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerSerializationTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerSerializationTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerSerializationTestCase.java Fri Feb 2 19:16:15 2007
@@ -24,6 +24,7 @@
import java.io.ObjectOutputStream;
import java.util.HashMap;
import java.util.Map;
+import java.net.URI;
import org.apache.tuscany.spi.component.AtomicComponent;
import org.apache.tuscany.spi.component.WorkContext;
@@ -74,7 +75,8 @@
Operation<Object> operation = new Operation<Object>("invoke", null, null, null, false, null, NO_CONVERSATION);
map.put(operation, createChain(operation));
- EasyMock.expect(wire.getServiceName()).andReturn("foo").atLeastOnce();
+ URI uri = URI.create("component#foo");
+ EasyMock.expect(wire.getUri()).andReturn(uri).atLeastOnce();
EasyMock.expect(wire.getInvocationChains()).andReturn(map).times(2);
EasyMock.replay(wire);
AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKInboundInvocationHandlerTestCase.java Fri Feb 2 19:16:15 2007
@@ -21,6 +21,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
+import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -109,6 +110,7 @@
InboundWireImpl wire = new InboundWireImpl();
wire.setServiceContract(new ServiceContract<Foo>(Foo.class) {
});
+ wire.setUri(URI.create("foo#bar"));
JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(SimpleTarget.class, wire, workContext);
Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
assertNotNull(foo.toString());
@@ -120,6 +122,7 @@
InboundWireImpl wire = new InboundWireImpl();
wire.setServiceContract(new ServiceContract<Foo>(Foo.class) {
});
+ wire.setUri(URI.create("foo#bar"));
JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(SimpleTarget.class, wire, workContext);
Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
assertNotNull(foo.hashCode());
@@ -152,6 +155,7 @@
wire.addInvocationChains(chains);
wire.setServiceContract(new ServiceContract<SimpleTarget>(SimpleTarget.class) {
});
+ wire.setUri(URI.create("foo#bar"));
return wire;
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java Fri Feb 2 19:16:15 2007
@@ -19,6 +19,7 @@
package org.apache.tuscany.core.wire.jdk;
import java.lang.reflect.Method;
+import java.net.URI;
import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
import org.apache.tuscany.spi.idl.java.JavaServiceContract;
@@ -65,6 +66,7 @@
chain.setTargetInvoker(targetInvoker);
}
wire.setServiceContract(contract);
+ wire.setUri(URI.create("foo#bar"));
clientHello = Client.class.getMethod("hello");
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java Fri Feb 2 19:16:15 2007
@@ -26,6 +26,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.net.URI;
import org.apache.tuscany.spi.component.AtomicComponent;
import org.apache.tuscany.spi.component.SCAObject;
@@ -92,7 +93,8 @@
map.put(operation, createChain(operation));
EasyMock.expect(wire.getContainer()).andReturn(container).atLeastOnce();
EasyMock.expect(wire.getServiceContract()).andReturn(contract).atLeastOnce();
- EasyMock.expect(wire.getReferenceName()).andReturn("foo").atLeastOnce();
+ URI uri = URI.create("#foo");
+ EasyMock.expect(wire.getUri()).andReturn(uri).atLeastOnce();
EasyMock.expect(wire.getInvocationChains()).andReturn(map).times(2);
EasyMock.replay(wire);
Map<String, List<OutboundWire>> wires = new HashMap<String, List<OutboundWire>>();
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java Fri Feb 2 19:16:15 2007
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import java.net.URI;
import org.apache.tuscany.spi.component.WorkContext;
import org.apache.tuscany.spi.idl.java.JavaServiceContract;
@@ -58,6 +59,7 @@
ServiceContract contract = new JavaServiceContract(Foo.class);
contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
wire.setServiceContract(contract);
+ wire.setUri(URI.create("foo#bar"));
JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Foo.class, wire, null);
Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
assertNotNull(foo.toString());
@@ -68,6 +70,7 @@
ServiceContract contract = new JavaServiceContract(Foo.class);
contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
wire.setServiceContract(contract);
+ wire.setUri(URI.create("foo#bar"));
JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Foo.class, wire, null);
Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
assertNotNull(foo.hashCode());
@@ -95,7 +98,8 @@
replay(outboundChain);
outboundChains.put(op1, outboundChain);
expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
- expect(outboundWire.getReferenceName()).andReturn("fooRef").atLeastOnce();
+ URI uri = URI.create("fooRef");
+ expect(outboundWire.getUri()).andReturn(uri).atLeastOnce();
expect(outboundWire.getContainer()).andReturn(null).anyTimes();
expect(outboundWire.getServiceContract()).andReturn(outboundContract).anyTimes();
replay(outboundWire);
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKProxyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKProxyTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKProxyTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKProxyTestCase.java Fri Feb 2 19:16:15 2007
@@ -21,6 +21,7 @@
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;
+import java.net.URI;
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.wire.InboundInvocationChain;
@@ -38,7 +39,8 @@
private Map<Operation<?>, InboundInvocationChain> chains;
public void testCreateProxy() {
- EasyMock.expect(inboundWire.getServiceName()).andReturn("service");
+ URI uri = URI.create("#service");
+ EasyMock.expect(inboundWire.getUri()).andReturn(uri).atLeastOnce();
EasyMock.expect(inboundWire.getInvocationChains()).andReturn(chains);
EasyMock.replay(inboundWire);
TestInterface intf = wireService.createProxy(TestInterface.class, inboundWire);
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/bootstrap/ComponentNames.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.spi.bootstrap;
+import java.net.URI;
+
/**
* Class that defines the names of well known component
*
@@ -27,22 +29,22 @@
/**
* The name of the component that forms the root of the runtime tree.
*/
- public static final String TUSCANY_RUNTIME = "tuscany.runtime";
+ public static final URI TUSCANY_RUNTIME = URI.create("tuscany.runtime");
/**
* The name of the component that is the root of the application composite tree.
*/
- public static final String TUSCANY_APPLICATION_ROOT = "tuscany.root.application";
+ public static final URI TUSCANY_APPLICATION_ROOT = URI.create("tuscany.root.application");
/**
* The name of the component that is the root of the system composite tree.
*/
- public static final String TUSCANY_SYSTEM_ROOT = "tuscany.root.system";
+ public static final URI TUSCANY_SYSTEM_ROOT = URI.create("tuscany.root.system");
/**
* The name of the top-level component in the system composite tree.
*/
- public static final String TUSCANY_SYSTEM = "tuscany.system";
+ public static final URI TUSCANY_SYSTEM = URI.create("tuscany.system");
/**
* The name of the component that contains the deployer.
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/MissingWireTargetException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/MissingWireTargetException.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/MissingWireTargetException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/MissingWireTargetException.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.spi.builder;
+import java.net.URI;
+
/**
* Denotes a missing wire target in an assembly
*
@@ -29,8 +31,7 @@
super(message);
}
- public MissingWireTargetException(String message, String identifier) {
- super(message, identifier);
+ public MissingWireTargetException(String message, URI sourceUri, URI targetUri) {
+ super(message, sourceUri, targetUri);
}
-
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WiringException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WiringException.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WiringException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WiringException.java Fri Feb 2 19:16:15 2007
@@ -18,35 +18,40 @@
*/
package org.apache.tuscany.spi.builder;
+import java.net.URI;
+
+
/**
* Denotes a general error raised during wiring
*
* @version $Rev$ $Date$
*/
public abstract class WiringException extends BuilderException {
- private String sourceName;
- private String referenceName;
- private String targetName;
- private String targetServiceName;
+ private final URI sourceUri;
+ private final URI targetUri;
protected WiringException(String message) {
super(message);
+ sourceUri = null;
+ targetUri = null;
}
- protected WiringException(String message, String identifier) {
- super(message, identifier);
+ protected WiringException(String message, URI sourceUri, URI targetUri) {
+ super(message);
+ this.sourceUri = sourceUri;
+ this.targetUri = targetUri;
}
- protected WiringException(String message, Throwable cause) {
+ protected WiringException(String message, URI sourceUri, URI targetUri, Throwable cause) {
super(message, cause);
+ this.sourceUri = sourceUri;
+ this.targetUri = targetUri;
}
- protected WiringException(String message, String identifier, Throwable cause) {
- super(message, identifier, cause);
- }
-
- protected WiringException(Throwable cause) {
- super(cause);
+ protected WiringException(String message, String identifier, URI sourceUri, URI targetUri) {
+ super(message, identifier);
+ this.sourceUri = sourceUri;
+ this.targetUri = targetUri;
}
/**
@@ -54,17 +59,8 @@
*
* @return the source name the source name for the wire
*/
- public String getSourceName() {
- return sourceName;
- }
-
- /**
- * Sets the source name for the wire
- *
- * @param sourceName the source name for the wire
- */
- public void setSourceName(String sourceName) {
- this.sourceName = sourceName;
+ public URI getSourceUri() {
+ return sourceUri;
}
/**
@@ -72,53 +68,8 @@
*
* @return the target name the source name for the wire
*/
- public String getTargetName() {
- return targetName;
+ public URI getTargetUri() {
+ return targetUri;
}
- /**
- * Sets the target name for the wire
- *
- * @param targetName the source name for the wire
- */
- public void setTargetName(String targetName) {
- this.targetName = targetName;
- }
-
-
- /**
- * Returns the source reference name for the wire
- *
- * @return the source reference name for the wire
- */
- public String getReferenceName() {
- return referenceName;
- }
-
- /**
- * Sets the source reference name for the wire
- *
- * @param referenceName the source reference name for the wire
- */
- public void setReferenceName(String referenceName) {
- this.referenceName = referenceName;
- }
-
- /**
- * Returns the target service name for the wire
- *
- * @return the target service name for the wire
- */
- public String getTargetServiceName() {
- return targetServiceName;
- }
-
- /**
- * Sets the target service name for the wire
- *
- * @param targetServiceName the target service name for the wire
- */
- public void setTargetServiceName(String targetServiceName) {
- this.targetServiceName = targetServiceName;
- }
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/AbstractSCAObject.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.spi.component;
+import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -29,6 +30,7 @@
import org.apache.tuscany.spi.event.EventFilter;
import org.apache.tuscany.spi.event.RuntimeEventListener;
import org.apache.tuscany.spi.event.TrueFilter;
+import org.apache.tuscany.spi.util.UriHelper;
/**
* Functionality common to all <code>SCAObject<code> implementations
@@ -40,12 +42,14 @@
protected Map<EventFilter, List<RuntimeEventListener>> listeners;
protected final CompositeComponent parent;
+ protected final URI uri;
private final String name;
private final Map<Object, Object> extensions = new HashMap<Object, Object>();
- private String canonicalName;
- public AbstractSCAObject(String name, CompositeComponent parent) {
- this.name = name;
+ public AbstractSCAObject(URI uri, CompositeComponent parent) {
+ assert uri != null;
+ this.uri = uri;
+ this.name = UriHelper.getBaseName(uri);
this.parent = parent;
}
@@ -53,15 +57,8 @@
return name;
}
- public String getCanonicalName() {
- if (canonicalName == null) {
- StringBuffer b = new StringBuffer(name);
- if (parent != null) {
- b.insert(0, parent.getCanonicalName() + "/");
- }
- canonicalName = b.toString();
- }
- return canonicalName;
+ public URI getUri() {
+ return uri;
}
public CompositeComponent getParent() {
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/MalformedNameException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/MalformedNameException.java?view=auto&rev=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/MalformedNameException.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/MalformedNameException.java Fri Feb 2 19:16:15 2007
@@ -0,0 +1,14 @@
+package org.apache.tuscany.spi.component;
+
+/**
+ * Denotes an attempt to add a child to a composite component with an illegal name
+ *
+ * @version $Rev$ $Date$
+ */
+public class MalformedNameException extends ComponentRegistrationException {
+
+ public MalformedNameException(Throwable e) {
+ super("Malformed name", e);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/MalformedNameException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/MalformedNameException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.spi.component;
+import java.net.URI;
import java.util.Map;
import org.apache.tuscany.spi.Lifecycle;
@@ -32,14 +33,16 @@
public interface SCAObject extends EventPublisher, Lifecycle {
/**
- * Returns the artifact name
+ * Returns the artifact URI
+ *
+ * @return the artifact URI
*/
- String getName();
+ URI getUri();
/**
- * Returns the canonical artifact name
+ * Returns the artifact name
*/
- String getCanonicalName();
+ String getName();
/**
* Returns the parent composite, or null if the artifact does not have one
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AbstractComponentExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AbstractComponentExtension.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AbstractComponentExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AbstractComponentExtension.java Fri Feb 2 19:16:15 2007
@@ -19,6 +19,7 @@
package org.apache.tuscany.spi.extension;
import java.util.Map;
+import java.net.URI;
import org.apache.tuscany.spi.component.AbstractSCAObject;
import org.apache.tuscany.spi.component.Component;
@@ -32,9 +33,6 @@
public abstract class AbstractComponentExtension extends AbstractSCAObject implements Component {
protected ScopeContainer scopeContainer;
- /**
- * Default property values.
- */
private Map<String, PropertyValue<?>> defaultPropertyValues;
/**
@@ -43,7 +41,7 @@
* @param name Name of the component.
* @param parent Parent of the component.
*/
- public AbstractComponentExtension(String name, CompositeComponent parent) {
+ public AbstractComponentExtension(URI name, CompositeComponent parent) {
super(name, parent);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/AtomicComponentExtension.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.spi.extension;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -63,7 +64,7 @@
private final long maxAge;
private boolean allowsPassByReference;
- protected AtomicComponentExtension(String name,
+ protected AtomicComponentExtension(URI name,
CompositeComponent parent,
WireService wireService,
WorkContext workContext,
@@ -74,7 +75,7 @@
}
- protected AtomicComponentExtension(String name,
+ protected AtomicComponentExtension(URI name,
CompositeComponent parent,
WireService wireService,
WorkContext workContext,
@@ -146,7 +147,7 @@
}
public void addInboundWire(InboundWire wire) {
- serviceWires.put(wire.getServiceName(), wire);
+ serviceWires.put(wire.getUri().getFragment(), wire);
onServiceWire(wire);
}
@@ -168,7 +169,7 @@
public void addOutboundWire(OutboundWire wire) {
List<OutboundWire> list = new ArrayList<OutboundWire>();
list.add(wire);
- referenceWires.put(wire.getReferenceName(), list);
+ referenceWires.put(wire.getUri().getFragment(), list);
onReferenceWire(wire);
}
@@ -178,7 +179,7 @@
public void addOutboundWires(List<OutboundWire> wires) {
assert wires != null && wires.size() > 0;
- referenceWires.put(wires.get(0).getReferenceName(), wires);
+ referenceWires.put(wires.get(0).getUri().getFragment(), wires);
onReferenceWires(wires);
}
@@ -201,7 +202,7 @@
for (InboundWire inboundWire : getInboundWires()) {
for (InboundInvocationChain chain : inboundWire.getInvocationChains().values()) {
Operation<?> operation = chain.getOperation();
- String serviceName = inboundWire.getServiceName();
+ String serviceName = inboundWire.getUri().getFragment();
TargetInvoker invoker;
try {
invoker = createTargetInvoker(serviceName, operation, null);
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.spi.extension;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -78,7 +79,7 @@
*/
private TuscanyManagementService managementService;
- protected CompositeComponentExtension(String name,
+ protected CompositeComponentExtension(URI name,
CompositeComponent parent,
Connector connector,
Map<String, Document> propertyValues) {
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceBindingExtension.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.spi.extension;
+import java.net.URI;
+
import org.apache.tuscany.spi.component.AbstractSCAObject;
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.Reference;
@@ -38,7 +40,7 @@
protected OutboundWire outboundWire;
protected ServiceContract<?> bindingServiceContract;
- protected ReferenceBindingExtension(String name, CompositeComponent parent) {
+ protected ReferenceBindingExtension(URI name, CompositeComponent parent) {
super(name, parent);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceBindingExtension.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.spi.extension;
+import java.net.URI;
+
import org.apache.tuscany.spi.CoreRuntimeException;
import org.apache.tuscany.spi.component.AbstractSCAObject;
import org.apache.tuscany.spi.component.CompositeComponent;
@@ -42,7 +44,7 @@
protected OutboundWire outboundWire;
protected ServiceContract<?> bindingServiceContract;
- public ServiceBindingExtension(String name, CompositeComponent parent) throws CoreRuntimeException {
+ public ServiceBindingExtension(URI name, CompositeComponent parent) throws CoreRuntimeException {
super(name, parent);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/SystemAtomicComponentExtension.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.spi.extension;
+import java.net.URI;
+
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.wire.InboundWire;
@@ -28,7 +30,7 @@
*/
public abstract class SystemAtomicComponentExtension extends AtomicComponentExtension {
- public SystemAtomicComponentExtension(String name,
+ public SystemAtomicComponentExtension(URI name,
CompositeComponent parent,
int initLevel) {
super(name, parent, null, null, null, null, initLevel);
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedReference.java Fri Feb 2 19:16:15 2007
@@ -19,6 +19,7 @@
package org.apache.tuscany.spi.implementation.java;
import java.lang.reflect.Member;
+import java.net.URI;
import org.apache.tuscany.spi.model.ReferenceDefinition;
import org.apache.tuscany.spi.model.ServiceContract;
@@ -35,7 +36,7 @@
public JavaMappedReference() {
}
- public JavaMappedReference(String name, ServiceContract serviceContract, Member member) {
+ public JavaMappedReference(URI name, ServiceContract serviceContract, Member member) {
super(name, serviceContract);
this.member = member;
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/JavaMappedService.java Fri Feb 2 19:16:15 2007
@@ -19,6 +19,7 @@
package org.apache.tuscany.spi.implementation.java;
import java.lang.reflect.Member;
+import java.net.URI;
import org.apache.tuscany.spi.model.ServiceContract;
import org.apache.tuscany.spi.model.ServiceDefinition;
@@ -42,22 +43,17 @@
this.serviceInterface = serviceInterface;
}
- public JavaMappedService(String name, ServiceContract contract, boolean remotable) {
+ public JavaMappedService(URI name, ServiceContract contract, boolean remotable) {
super(name, contract, remotable);
}
- public JavaMappedService(String name,
+ public JavaMappedService(URI name,
ServiceContract contract,
boolean remotable,
String callbackRefName,
Member callbackMember) {
super(name, contract, remotable, callbackRefName);
this.callbackMember = callbackMember;
- }
-
- public JavaMappedService(String name, ServiceContract contract, Class<?> serviceInterface, boolean remotable) {
- super(name, contract, remotable);
- this.serviceInterface = serviceInterface;
}
/**
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IllegalSCDLNameException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IllegalSCDLNameException.java?view=auto&rev=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IllegalSCDLNameException.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IllegalSCDLNameException.java Fri Feb 2 19:16:15 2007
@@ -0,0 +1,28 @@
+/*
+ * 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.spi.loader;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IllegalSCDLNameException extends LoaderException {
+ public IllegalSCDLNameException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IllegalSCDLNameException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/IllegalSCDLNameException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/loader/InvalidReferenceException.java Fri Feb 2 19:16:15 2007
@@ -32,7 +32,12 @@
super(message, identifier);
}
+ public InvalidReferenceException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
public InvalidReferenceException(Throwable cause) {
super(cause);
}
+
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentDefinition.java Fri Feb 2 19:16:15 2007
@@ -18,30 +18,28 @@
*/
package org.apache.tuscany.spi.model;
+import java.net.URI;
import java.util.HashMap;
import java.util.Map;
/**
- * Represents a component.
- * <p>A component is a configured instance of an implementation. The services provided and consumed
- * and the available configuration properties are defined by the implementation (represented by
- * its componentType).</p>
- * <p>Every component has a name which uniquely identifies it within the scope of the composite
- * that contains it; the name must be different from the names of all other components, services and references
- * immediately contained in the composite (directly or through an <include> element).</p>
- * <p>A component may define a {@link PropertyValue} that overrides the default value of a {@link Property}
- * defined in the componentType.</p>
- * <p>It may also define a {@link ReferenceTarget} for a {@link ReferenceDefinition} defined in the componentType.
- * The ReferenceTarget must resolve to another component or a reference in the enclosing composite.</p>
- * <p>Components may specify an initialization level that will determine the order in which it will be eagerly
- * initialized relative to other components from the enclosing composite that are in the same scope. This can be
- * used to define a startup sequence for components that are otherwise independent. Any initialization required
- * to resolve references between components will override this initialization order.</p>
+ * Represents a component. <p>A component is a configured instance of an implementation. The services provided and
+ * consumed and the available configuration properties are defined by the implementation (represented by its
+ * componentType).</p> <p>Every component has a name which uniquely identifies it within the scope of the composite that
+ * contains it; the name must be different from the names of all other components, services and references immediately
+ * contained in the composite (directly or through an <include> element).</p> <p>A component may define a {@link
+ * PropertyValue} that overrides the default value of a {@link Property} defined in the componentType.</p> <p>It may
+ * also define a {@link ReferenceTarget} for a {@link ReferenceDefinition} defined in the componentType. The
+ * ReferenceTarget must resolve to another component or a reference in the enclosing composite.</p> <p>Components may
+ * specify an initialization level that will determine the order in which it will be eagerly initialized relative to
+ * other components from the enclosing composite that are in the same scope. This can be used to define a startup
+ * sequence for components that are otherwise independent. Any initialization required to resolve references between
+ * components will override this initialization order.</p>
*
* @version $Rev$ $Date$
*/
public class ComponentDefinition<I extends Implementation<?>> extends ModelObject {
- private String name;
+ private URI name;
private Integer initLevel;
private final I implementation;
private final Map<String, ReferenceTarget> referenceTargets = new HashMap<String, ReferenceTarget>();
@@ -53,7 +51,7 @@
* @param name the name of this component
* @param implementation the implementation of this component
*/
- public ComponentDefinition(String name, I implementation) {
+ public ComponentDefinition(URI name, I implementation) {
this.name = name;
this.implementation = implementation;
}
@@ -81,7 +79,7 @@
*
* @return the name of this component
*/
- public String getName() {
+ public URI getName() {
return name;
}
@@ -90,7 +88,7 @@
*
* @param name the name of this component
*/
- public void setName(String name) {
+ public void setName(URI name) {
this.name = name;
}
@@ -104,9 +102,8 @@
}
/**
- * Sets the initialization level of this component.
- * If set to null then the level from the componentType is used.
- * If set to zero or a negative value then the component will not be eagerly initialized.
+ * Sets the initialization level of this component. If set to null then the level from the componentType is used. If
+ * set to zero or a negative value then the component will not be eagerly initialized.
*
* @param initLevel the initialization level of this component
*/
@@ -124,13 +121,13 @@
}
/**
- * Add a reference target configuration to this component.
- * Any existing configuration for the reference named in the target is replaced.
+ * Add a reference target configuration to this component. Any existing configuration for the reference named in the
+ * target is replaced.
*
* @param target the target to add
*/
public void add(ReferenceTarget target) {
- referenceTargets.put(target.getReferenceName(), target);
+ referenceTargets.put(target.getReferenceName().getFragment(), target);
}
/**
@@ -143,8 +140,8 @@
}
/**
- * Add a property value configuration to this component.
- * Any existing configuration for the property names in the property value is replaced.
+ * Add a property value configuration to this component. Any existing configuration for the property names in the
+ * property value is replaced.
*
* @param value the property value to add
*/
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ComponentType.java Fri Feb 2 19:16:15 2007
@@ -135,7 +135,7 @@
* @param service a service provided by the implementation
*/
public void add(S service) {
- services.put(service.getName(), service);
+ services.put(service.getUri().getFragment(), service);
}
/**
@@ -154,7 +154,7 @@
* @param reference a reference to a service consumed by the implementation
*/
public void add(R reference) {
- references.put(reference.getName(), reference);
+ references.put(reference.getUri().getFragment(), reference);
}
/**
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/CompositeComponentType.java Fri Feb 2 19:16:15 2007
@@ -24,6 +24,8 @@
import java.util.List;
import java.util.Map;
+import org.apache.tuscany.spi.util.UriHelper;
+
/**
* A specialization of component type for composite components.
*
@@ -161,7 +163,7 @@
public void add(ComponentDefinition<? extends Implementation<?>> componentDefinition) {
- components.put(componentDefinition.getName(), componentDefinition);
+ components.put(UriHelper.getBaseName(componentDefinition.getName()), componentDefinition);
}
public Map<String, Include> getIncludes() {
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceDefinition.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceDefinition.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceDefinition.java Fri Feb 2 19:16:15 2007
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.net.URI;
/**
* Represents a component reference
@@ -28,7 +29,7 @@
* @version $Rev$ $Date$
*/
public class ReferenceDefinition extends ModelObject {
- private String name;
+ private URI uri;
private ServiceContract serviceContract;
private Multiplicity multiplicity;
private boolean autowire;
@@ -40,26 +41,26 @@
bindings = new ArrayList<BindingDefinition>();
}
- public ReferenceDefinition(String name, ServiceContract serviceContract) {
- this.name = name;
+ public ReferenceDefinition(URI uri, ServiceContract serviceContract) {
+ this.uri = uri;
this.serviceContract = serviceContract;
bindings = new ArrayList<BindingDefinition>();
multiplicity = Multiplicity.ONE_ONE;
}
- public ReferenceDefinition(String name, ServiceContract serviceContract, Multiplicity multiplicity) {
- this.name = name;
+ public ReferenceDefinition(URI uri, ServiceContract serviceContract, Multiplicity multiplicity) {
+ this.uri = uri;
this.serviceContract = serviceContract;
this.multiplicity = multiplicity;
bindings = new ArrayList<BindingDefinition>();
}
- public String getName() {
- return name;
+ public URI getUri() {
+ return uri;
}
- public void setName(String name) {
- this.name = name;
+ public void setUri(URI uri) {
+ this.uri = uri;
}
public ServiceContract<?> getServiceContract() {
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ReferenceTarget.java Fri Feb 2 19:16:15 2007
@@ -28,14 +28,14 @@
* @version $Rev$ $Date$
*/
public class ReferenceTarget extends ModelObject {
- private String referenceName;
+ private URI referenceName;
private List<URI> targets = new ArrayList<URI>();
- public String getReferenceName() {
+ public URI getReferenceName() {
return referenceName;
}
- public void setReferenceName(String referenceName) {
+ public void setReferenceName(URI referenceName) {
this.referenceName = referenceName;
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceDefinition.java Fri Feb 2 19:16:15 2007
@@ -29,7 +29,7 @@
* @version $Rev$ $Date$
*/
public class ServiceDefinition extends ModelObject {
- private String name;
+ private URI uri;
private ServiceContract serviceContract;
private boolean remotable;
private String callbackRefName;
@@ -40,16 +40,16 @@
bindings = new ArrayList<BindingDefinition>();
}
- public ServiceDefinition(String name, ServiceContract serviceContract, boolean remotable) {
+ public ServiceDefinition(URI uri, ServiceContract serviceContract, boolean remotable) {
bindings = new ArrayList<BindingDefinition>();
- this.name = name;
+ this.uri = uri;
this.serviceContract = serviceContract;
this.remotable = remotable;
}
- public ServiceDefinition(String name, ServiceContract serviceContract, boolean remotable, String callbackRefName) {
+ public ServiceDefinition(URI uri, ServiceContract serviceContract, boolean remotable, String callbackRefName) {
bindings = new ArrayList<BindingDefinition>();
- this.name = name;
+ this.uri = uri;
this.serviceContract = serviceContract;
this.remotable = remotable;
this.callbackRefName = callbackRefName;
@@ -60,17 +60,17 @@
*
* @return the service name
*/
- public String getName() {
- return name;
+ public URI getUri() {
+ return uri;
}
/**
* Sets the service name
*
- * @param name the service name
+ * @param uri the service name
*/
- public void setName(String name) {
- this.name = name;
+ public void setUri(URI uri) {
+ this.uri = uri;
}
/**
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/Resolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/Resolver.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/Resolver.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/Resolver.java Fri Feb 2 19:16:15 2007
@@ -30,8 +30,9 @@
/**
* Processes a model object, resolving resources referenced by it
*
- * @param object the model object to process
+ * @param registry the resolver registry to callback when processing sub-elements
+ * @param object the model object to process
* @throws ResolutionException
*/
- void resolve(T object) throws ResolutionException;
+ void resolve(ResolverRegistry registry, T object) throws ResolutionException;
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolverRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolverRegistry.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolverRegistry.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/resolver/ResolverRegistry.java Fri Feb 2 19:16:15 2007
@@ -43,4 +43,10 @@
*/
<T extends ModelObject> void unregister(Class<T> modelClass);
+ /**
+ * Initiates the resolution process
+ *
+ * @param object the top-level element to resolve
+ */
+ <T extends ModelObject> void resolve(T object) throws ResolutionException;
}
Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java?view=auto&rev=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java Fri Feb 2 19:16:15 2007
@@ -0,0 +1,47 @@
+/*
+ * 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.spi.util;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public final class UriHelper {
+
+ private UriHelper() {
+ }
+
+ /**
+ * Returns the base name for a component URI, e.g. 'Bar' for 'sca://foo/Bar'
+ *
+ * @param uri the URI to parse
+ * @return the base name
+ */
+ public static String getBaseName(URI uri) {
+ String s = uri.toString();
+ int pos = s.lastIndexOf('/');
+ if (pos > -1) {
+ return s.substring(pos + 1);
+ } else {
+ return s;
+ }
+ }
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/UriHelper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/stax/StaxUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/stax/StaxUtil.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/stax/StaxUtil.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/util/stax/StaxUtil.java Fri Feb 2 19:16:15 2007
@@ -22,7 +22,6 @@
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
-
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
@@ -31,24 +30,26 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import org.apache.tuscany.spi.model.InteractionScope;
-import org.apache.tuscany.spi.model.Multiplicity;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.apache.tuscany.spi.model.InteractionScope;
+import org.apache.tuscany.spi.model.Multiplicity;
+
/**
* Utility for stax operations.
- *
- * @version $Revision$ $Date$
*
+ * @version $Revision$ $Date$
*/
public abstract class StaxUtil {
- /** XML input factory. */
+ /**
+ * XML input factory.
+ */
private static final XMLInputFactory xmlFactory =
- XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", StaxUtil.class.getClassLoader());;
+ XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", StaxUtil.class.getClassLoader());
private static final Map<String, Multiplicity> MULTIPLICITY = new HashMap<String, Multiplicity>(4);
@@ -64,9 +65,9 @@
/**
* Convert a "multiplicity" attribute to the equivalent enum value.
- *
+ *
* @param multiplicity the attribute to convert
- * @param def the default value
+ * @param def the default value
* @return the enum equivalent
*/
public static Multiplicity multiplicity(String multiplicity, Multiplicity def) {
@@ -74,10 +75,9 @@
}
/**
- * Convert a "scope" attribute to the equivalent enum value. Returns
- * CONVERSATIONAL if the value equals (ignoring case) "conversational",
- * otherwise returns NONCONVERSATIONAL.
- *
+ * Convert a "scope" attribute to the equivalent enum value. Returns CONVERSATIONAL if the value equals (ignoring
+ * case) "conversational", otherwise returns NONCONVERSATIONAL.
+ *
* @param scope the attribute to convert
* @return the enum equivalent
*/
@@ -119,12 +119,11 @@
}
/**
- * Load a property value specification from an StAX stream into a DOM
- * Document. Only elements, text and attributes are processed; all comments
- * and other whitespace are ignored.
- *
+ * Load a property value specification from an StAX stream into a DOM Document. Only elements, text and attributes
+ * are processed; all comments and other whitespace are ignored.
+ *
* @param reader the stream to read from
- * @param root the DOM node to load
+ * @param root the DOM node to load
*/
public static void loadPropertyValue(XMLStreamReader reader, Node root) throws XMLStreamException {
Document document = root.getOwnerDocument();
@@ -168,12 +167,12 @@
/**
* Serializes the infoset in the stream reader.
- *
+ *
* @param reader Stream reader.
* @return Serialized XML.
* @throws XMLStreamException In case of an xml stream error.
*/
- public static final String serialize(XMLStreamReader reader) throws XMLStreamException {
+ public static String serialize(XMLStreamReader reader) throws XMLStreamException {
try {
@@ -216,12 +215,12 @@
/**
* Creates a stream reader to the serialized XML.
- *
+ *
* @param xml Serialized XML to which reader is to be created.
* @return XML stream reader instance.
* @throws XMLStreamException In case of an xml stream error.
*/
- public static final XMLStreamReader createReader(String xml) throws XMLStreamException {
+ public static XMLStreamReader createReader(String xml) throws XMLStreamException {
InputStream in = new ByteArrayInputStream(xml.getBytes());
return xmlFactory.createXMLStreamReader(in);
@@ -230,12 +229,12 @@
/**
* Creates a stream reader to the serialized XML.
- *
+ *
* @param xml XML stream to which reader is to be created.
* @return XML stream reader instance.
* @throws XMLStreamException In case of an xml stream error.
*/
- public static final XMLStreamReader createReader(InputStream xml) throws XMLStreamException {
+ public static XMLStreamReader createReader(InputStream xml) throws XMLStreamException {
return xmlFactory.createXMLStreamReader(xml);
@@ -243,12 +242,12 @@
/**
* Returns the qualified name of the document element.
- *
+ *
* @param xml Serialized xml that needs to be checked.
* @return Qualified name of the document element.
* @throws XMLStreamException In case of an xml stream error.
*/
- public static final QName getDocumentElementQName(String xml) throws XMLStreamException {
+ public static QName getDocumentElementQName(String xml) throws XMLStreamException {
XMLStreamReader reader = null;
try {
@@ -278,8 +277,7 @@
QName qname = reader.getName();
String namePrefix = qname.getPrefix();
String localPart = qname.getLocalPart();
- String name = namePrefix == null || "".equals(namePrefix) ? localPart : namePrefix + ":" + localPart;
- return name;
+ return namePrefix == null || "".equals(namePrefix) ? localPart : namePrefix + ":" + localPart;
}
/*
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/InboundWire.java Fri Feb 2 19:16:15 2007
@@ -31,18 +31,7 @@
public interface InboundWire extends Wire {
/**
- * Returns the name of the target service of the wire
- */
- String getServiceName();
-
- /**
- * Sets the name of the target service of the wire
- */
- void setServiceName(String name);
-
- /**
- * Returns the invocation chain for each operation on a service specified by a reference or a target
- * service.
+ * Returns the invocation chain for each operation on a service specified by a reference or a target service.
*/
Map<Operation<?>, InboundInvocationChain> getInvocationChains();
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/OutboundWire.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.spi.wire;
+import java.net.URI;
import java.util.Map;
import org.apache.tuscany.spi.QualifiedName;
@@ -33,24 +34,28 @@
public interface OutboundWire extends Wire {
/**
- * Returns the name of the source reference
+ * Returns the name of the target
*/
- String getReferenceName();
+ QualifiedName getTargetName();
/**
- * Sets the name of the source reference
+ * Sets the name of the target
*/
- void setReferenceName(String name);
+ void setTargetName(QualifiedName name);
/**
- * Returns the name of the target
+ * Returns the URI of the wire target
+ *
+ * @return the URI of the wire target
*/
- QualifiedName getTargetName();
+ URI getTargetUri();
/**
- * Sets the name of the target
+ * Sets the URI of the wire target
+ *
+ * @param uri the URI of the wire target
*/
- void setTargetName(QualifiedName name);
+ void setTargetUri(URI uri);
boolean isAutowire();
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/Wire.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.spi.wire;
+import java.net.URI;
import javax.xml.namespace.QName;
import org.apache.tuscany.spi.component.SCAObject;
@@ -32,6 +33,25 @@
public interface Wire {
QName LOCAL_BINDING = new QName("http://tuscany.apache.org/xmlns/sca/binding/1.0", "binding.local");
+ /**
+ * Returns the wire URI
+ *
+ * @return the wire URI
+ */
+ URI getUri();
+
+ /**
+ * Sets the wire URI
+ *
+ * @param uri the uri
+ */
+ void setUri(URI uri);
+
+ /**
+ * Returns the wire binding type
+ *
+ * @return the wire binding type
+ */
QName getBindingType();
/**
@@ -52,11 +72,6 @@
* @param contract the contract associated with the wire
*/
void setServiceContract(ServiceContract contract);
-
- /**
- * Adds an interface type generated proxies implement
- */
- void addInterface(Class<?> claz);
/**
* Returns true if its invocation chains may be bypassed
Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/component/AbstractSCAObjectTestCase.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.spi.component;
+import java.net.URI;
+
import org.apache.tuscany.spi.event.Event;
import org.apache.tuscany.spi.event.EventFilter;
import org.apache.tuscany.spi.event.RuntimeEventListener;
@@ -32,8 +34,8 @@
*/
public class AbstractSCAObjectTestCase extends TestCase {
- public void testFireListener() {
- SCAObject object = new TestSCAObject("foo", null);
+ public void testFireListener() throws Exception {
+ SCAObject object = new TestSCAObject(new URI("foo"), null);
Event event = new TestEvent();
RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
listener.onEvent(EasyMock.same(event));
@@ -43,8 +45,8 @@
object.publish(event);
}
- public void testRemoveListener() {
- SCAObject object = new TestSCAObject("foo", null);
+ public void testRemoveListener() throws Exception {
+ SCAObject object = new TestSCAObject(new URI("foo"), null);
Event event = new TestEvent();
RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
EasyMock.replay(listener);
@@ -53,8 +55,8 @@
object.publish(event);
}
- public void testFalseFilterListener() {
- SCAObject object = new TestSCAObject("foo", null);
+ public void testFalseFilterListener() throws Exception {
+ SCAObject object = new TestSCAObject(new URI("foo"), null);
Event event = new TestEvent();
RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
EasyMock.replay(listener);
@@ -62,8 +64,8 @@
object.publish(event);
}
- public void testTrueFilterListener() {
- SCAObject object = new TestSCAObject("foo", null);
+ public void testTrueFilterListener() throws Exception {
+ SCAObject object = new TestSCAObject(new URI("foo"), null);
Event event = new TestEvent();
RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
listener.onEvent(EasyMock.same(event));
@@ -73,32 +75,24 @@
object.publish(event);
}
- public void testToString() {
- SCAObject object = new TestSCAObject("foo", null);
+ public void testToString() throws Exception {
+ SCAObject object = new TestSCAObject(new URI("foo"), null);
assertNotNull(object.toString());
}
- public void testGetName() {
- SCAObject object = new TestSCAObject("foo", null);
- assertEquals("foo", object.getName());
+ public void testGetName() throws Exception {
+ SCAObject object = new TestSCAObject(new URI("foo"), null);
+ assertEquals(new URI("foo"), object.getName());
}
public void testToPrepare() throws Exception {
- SCAObject object = new TestSCAObject("foo", null);
+ SCAObject object = new TestSCAObject(new URI("foo"), null);
object.prepare();
}
- public void testCanonicalName() {
- CompositeComponent parent = EasyMock.createMock(CompositeComponent.class);
- EasyMock.expect(parent.getCanonicalName()).andReturn("foo");
- EasyMock.replay(parent);
- TestSCAObject test = new TestSCAObject("bar", parent);
- assertEquals("foo/bar", test.getCanonicalName());
- }
-
private class TestSCAObject extends AbstractSCAObject {
- public TestSCAObject(String name, CompositeComponent parent) {
+ public TestSCAObject(URI name, CompositeComponent parent) {
super(name, parent);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/AtomicComponentExtensionTestCase.java Fri Feb 2 19:16:15 2007
@@ -22,6 +22,7 @@
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
+import java.net.URI;
import org.apache.tuscany.spi.ObjectCreationException;
import org.apache.tuscany.spi.component.ScopeContainer;
@@ -41,7 +42,7 @@
* @version $Rev$ $Date$
*/
public class AtomicComponentExtensionTestCase extends TestCase {
-
+
public void testIsEagerInit() throws Exception {
TestExtension ext = new TestExtension();
ext.isEagerInit();
@@ -60,7 +61,7 @@
chains.put(operation, chain);
InboundWire wire = EasyMock.createMock(InboundWire.class);
EasyMock.expect(wire.getInvocationChains()).andReturn(chains);
- EasyMock.expect(wire.getServiceName()).andReturn("Service").atLeastOnce();
+ EasyMock.expect(wire.getUri()).andReturn(URI.create("Service")).atLeastOnce();
EasyMock.replay(wire);
ext.addInboundWire(wire);
@@ -98,11 +99,11 @@
private class TestExtension extends AtomicComponentExtension {
public TestExtension() {
- super(null, null, null, null, null, null, 0);
+ super(URI.create("_foo"), null, null, null, null, null, 0);
}
public TestExtension(ScopeContainer scopeContainer) {
- super(null, null, null, null, null, null, 0);
+ super(URI.create("_foo"), null, null, null, null, null, 0);
setScopeContainer(scopeContainer);
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionAutowireTestCase.java Fri Feb 2 19:16:15 2007
@@ -20,6 +20,8 @@
import java.util.ArrayList;
import java.util.List;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.apache.tuscany.spi.component.AtomicComponent;
import org.apache.tuscany.spi.component.CompositeComponent;
@@ -277,12 +279,12 @@
private static class MockComposite extends CompositeComponentExtension {
private boolean system;
- public MockComposite() {
- super("foo", null, null, null);
+ public MockComposite() throws URISyntaxException {
+ super(new URI("foo"), null, null, null);
}
- public MockComposite(boolean system) {
- super("foo", null, null, null);
+ public MockComposite(boolean system) throws URISyntaxException {
+ super(new URI("foo"), null, null, null);
this.system = system;
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java Fri Feb 2 19:16:15 2007
@@ -22,6 +22,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.net.URI;
import javax.xml.namespace.QName;
import org.apache.tuscany.spi.component.CompositeComponent;
@@ -317,7 +318,7 @@
contract = new ServiceContract<Object>(Object.class) {
};
- composite = new CompositeComponentExtension("foo", null, null, null) {
+ composite = new CompositeComponentExtension(new URI("foo"), null, null, null) {
public TargetInvoker createTargetInvoker(String targetName, Operation operation, InboundWire callbackWire)
throws TargetInvokerCreationException {
Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceBindingExtensionTestCase.java Fri Feb 2 19:16:15 2007
@@ -1,5 +1,6 @@
package org.apache.tuscany.spi.extension;
+import java.net.URI;
import javax.xml.namespace.QName;
import org.apache.tuscany.spi.component.Reference;
@@ -52,7 +53,7 @@
private static class MockBindingExtension extends ReferenceBindingExtension {
public MockBindingExtension() {
- super(null, null);
+ super(URI.create("_foo"), null);
}
public QName getBindingType() {
Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java Fri Feb 2 19:16:15 2007
@@ -21,6 +21,7 @@
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
+import java.net.URI;
import javax.xml.namespace.QName;
@@ -78,7 +79,7 @@
private class TestReferenceBinding extends ReferenceBindingExtension {
public TestReferenceBinding() {
- super(null, null);
+ super(URI.create("_foo"), null);
}
public QName getBindingType() {
Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java?view=diff&rev=502853&r1=502852&r2=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceBindingExtensionTestCase.java Fri Feb 2 19:16:15 2007
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.spi.extension;
+import java.net.URI;
import javax.xml.namespace.QName;
import org.apache.tuscany.spi.component.Service;
@@ -30,9 +31,10 @@
* @version $Rev$ $Date$
*/
public class ServiceBindingExtensionTestCase extends TestCase {
+ private URI uri;
public void testScope() throws Exception {
- ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ ServiceBindingExtension binding = new ServiceBindingExtension(uri, null) {
public QName getBindingType() {
return null;
}
@@ -41,7 +43,7 @@
}
public void testPrepare() throws Exception {
- ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ ServiceBindingExtension binding = new ServiceBindingExtension(uri, null) {
public QName getBindingType() {
return null;
}
@@ -50,7 +52,7 @@
}
public void testIsSystemNoParent() throws Exception {
- ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ ServiceBindingExtension binding = new ServiceBindingExtension(uri, null) {
public QName getBindingType() {
return null;
}
@@ -62,7 +64,7 @@
Service service = EasyMock.createMock(Service.class);
EasyMock.expect(service.isSystem()).andReturn(true);
EasyMock.replay(service);
- ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ ServiceBindingExtension binding = new ServiceBindingExtension(uri, null) {
public QName getBindingType() {
return null;
}
@@ -75,7 +77,7 @@
Service service = EasyMock.createMock(Service.class);
EasyMock.expect(service.isSystem()).andReturn(false);
EasyMock.replay(service);
- ServiceBindingExtension binding = new ServiceBindingExtension(null, null) {
+ ServiceBindingExtension binding = new ServiceBindingExtension(uri, null) {
public QName getBindingType() {
return null;
}
@@ -84,4 +86,10 @@
assertFalse(binding.isSystem());
}
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ uri = URI.create("_foo");
+ }
}
+
Added: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ComponentTypeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ComponentTypeTestCase.java?view=auto&rev=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ComponentTypeTestCase.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ComponentTypeTestCase.java Fri Feb 2 19:16:15 2007
@@ -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.spi.model;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeTestCase extends TestCase {
+
+ /**
+ * Verifies fragments are used to retrieve service names
+ */
+ public void testSetServiceName() {
+ ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> type =
+ new ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>>();
+ ServiceDefinition definition = new ServiceDefinition();
+ definition.setUri(URI.create("foo#bar"));
+ type.add(definition);
+ assertEquals(definition, type.getServices().get("bar"));
+ }
+
+ /**
+ * Verifies fragments are used to retrieve service names
+ */
+ public void testSetReferenceName() {
+ ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> type =
+ new ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>>();
+ ReferenceDefinition definition = new ReferenceDefinition();
+ definition.setUri(URI.create("foo#bar"));
+ type.add(definition);
+ assertEquals(definition, type.getReferences().get("bar"));
+ }
+
+}
Propchange: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ComponentTypeTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/model/ComponentTypeTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/URIHelperTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/URIHelperTestCase.java?view=auto&rev=502853
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/URIHelperTestCase.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/util/URIHelperTestCase.java Fri Feb 2 19:16:15 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.spi.util;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class URIHelperTestCase extends TestCase {
+
+ public void testBaseName() throws Exception {
+ URI uri = new URI("foo");
+ assertEquals("foo", UriHelper.getBaseName(uri));
+ }
+
+ public void testBaseNameScheme() throws Exception {
+ URI uri = new URI("sca://foo");
+ assertEquals("foo", UriHelper.getBaseName(uri));
+ }
+
+ public void testBaseNameSchemePath() throws Exception {
+ URI uri = new URI("sca://bar/foo");
+ assertEquals("foo", UriHelper.getBaseName(uri));
+ }
+
+ public void testBaseNamePath() throws Exception {
+ URI uri = new URI("bar/foo");
+ assertEquals("foo", UriHelper.getBaseName(uri));
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org