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 2006/06/02 01:10:46 UTC
svn commit: r410990 - in /incubator/tuscany/sandbox/jboynes/sca:
core2/src/main/java/org/apache/tuscany/core/host/
core2/src/main/java/org/apache/tuscany/core/system/wire/
core2/src/main/java/org/apache/tuscany/core/wire/
spi/src/main/java/org/apache/t...
Author: jmarino
Date: Thu Jun 1 16:10:45 2006
New Revision: 410990
URL: http://svn.apache.org/viewvc?rev=410990&view=rev
Log:
add getTargetService to wires to return optimized target; add ServletHost
Added:
incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/host/
incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/host/ServletHost.java
Modified:
incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemInboundWire.java
incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundWire.java
incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java
incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java
incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/wire/RuntimeWire.java
Added: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/host/ServletHost.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/host/ServletHost.java?rev=410990&view=auto
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/host/ServletHost.java (added)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/host/ServletHost.java Thu Jun 1 16:10:45 2006
@@ -0,0 +1,34 @@
+package org.apache.tuscany.core.host;
+
+import javax.servlet.Servlet;
+
+/**
+ * Service interface implemented by host environments that allow Servlets
+ * to be registered.
+ * <p/>
+ * This interface allows an SCA system component to register a servlet to handle
+ * inbound requests.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServletHost {
+ /**
+ * Register a mapping for an instance of a Servlet.
+ * This requests that the servlet container direct all requests to the
+ * designated mapping to the supplied Servlet instance.
+ *
+ * @param mapping the uri-mapping for the Servlet
+ * @param servlet the Servlet that should be invoked
+ */
+ void registerMapping(String mapping, Servlet servlet);
+
+ /**
+ * Unregister a servlet mapping.
+ * This directs the servlet contain not to direct any more requests to
+ * a previously registered Servlet.
+ *
+ * @param mapping the uri-mapping for the Servlet
+ */
+ void unregisterMapping(String mapping);
+
+}
Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemInboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemInboundWire.java?rev=410990&r1=410989&r2=410990&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemInboundWire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemInboundWire.java Thu Jun 1 16:10:45 2006
@@ -8,9 +8,5 @@
*/
public interface SystemInboundWire<T> extends InboundWire<T> {
- /**
- * Returns the target instance for this wire
- */
- T getTargetService() throws TargetException;
}
Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundWire.java?rev=410990&r1=410989&r2=410990&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundWire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/system/wire/SystemOutboundWire.java Thu Jun 1 16:10:45 2006
@@ -9,9 +9,4 @@
*/
public interface SystemOutboundWire<T> extends OutboundWire<T> {
- /**
- * Returns the target instance for this wire
- */
- T getTargetService() throws TargetException;
-
}
Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java?rev=410990&r1=410989&r2=410990&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/InboundWireImpl.java Thu Jun 1 16:10:45 2006
@@ -21,12 +21,15 @@
private String serviceName;
private Class[] businessInterfaces;
private Map<Method, InboundInvocationChain> invocationChains = new MethodHashMap<InboundInvocationChain>();
+ private OutboundWire<T> targetWire;
@SuppressWarnings("unchecked")
public T getTargetService() throws TargetException {
- throw new UnsupportedOperationException();
-// JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(invocationChains);
-// return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), businessInterfaces, handler);
+ if (targetWire != null) {
+ // optimized, no interceptors or handlers on either end
+ return targetWire.getTargetService();
+ }
+ throw new TargetException("Target wire not optimized");
}
public void setBusinessInterface(Class interfaze) {
@@ -67,7 +70,7 @@
}
public void setTargetWire(OutboundWire<T> wire) {
- throw new UnsupportedOperationException("not yet implemented"); // FIXME
+ targetWire = wire;
}
public boolean isOptimizable() {
Modified: incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java?rev=410990&r1=410989&r2=410990&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/core2/src/main/java/org/apache/tuscany/core/wire/OutboundWireImpl.java Thu Jun 1 16:10:45 2006
@@ -40,13 +40,11 @@
@SuppressWarnings("unchecked")
public T getTargetService() throws TargetException {
-// if (targetWire != null) {
-// // optimized, no interceptors or handlers on either end
-// return targetWire.getTargetService();
-// }
-// JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(invocationChains);
-// return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), businessInterfaces, handler);
- throw new UnsupportedOperationException();
+ if (targetWire != null) {
+ // optimized, no interceptors or handlers on either end
+ return targetWire.getTargetService();
+ }
+ throw new TargetException("Target wire not optimized");
}
@SuppressWarnings("unchecked")
Modified: incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/wire/RuntimeWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/wire/RuntimeWire.java?rev=410990&r1=410989&r2=410990&view=diff
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/wire/RuntimeWire.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca/spi/src/main/java/org/apache/tuscany/spi/wire/RuntimeWire.java Thu Jun 1 16:10:45 2006
@@ -1,10 +1,17 @@
package org.apache.tuscany.spi.wire;
+import org.apache.tuscany.spi.context.TargetException;
+
/**
* @version $$Rev$$ $$Date$$
*/
public interface RuntimeWire<T> {
+ /**
+ * Returns the non-proxied target instance for this wire
+ */
+ T getTargetService() throws TargetException;
+
/**
* Sets the primary interface type generated proxies implement
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org