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/08/07 04:01:51 UTC
svn commit: r429229 - in
/incubator/tuscany/java/sca/containers/container.groovy: ./
src/main/java/org/apache/tuscany/container/groovy/
src/test/java/org/apache/tuscany/container/groovy/
Author: jmarino
Date: Sun Aug 6 19:01:50 2006
New Revision: 429229
URL: http://svn.apache.org/viewvc?rev=429229&view=rev
Log:
more async invocation work; pmd cleanup
Added:
incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncMonitor.java (with props)
Modified:
incubator/tuscany/java/sca/containers/container.groovy/.ruleset
incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncGroovyInvoker.java
incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java
incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentBuilder.java
incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/AsyncInvokerTestCase.java
incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/PropertyTestCase.java
incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/ScriptInvokeTestCase.java
incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/WireTestCase.java
Modified: incubator/tuscany/java/sca/containers/container.groovy/.ruleset
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.groovy/.ruleset?rev=429229&r1=429228&r2=429229&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.groovy/.ruleset (original)
+++ incubator/tuscany/java/sca/containers/container.groovy/.ruleset Sun Aug 6 19:01:50 2006
@@ -41,7 +41,7 @@
<!--<rule ref="rulesets/codesize.xml/ExcessivePublicCount"/>-->
<!--<rule ref="rulesets/codesize.xml/TooManyFields"/>-->
-<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>
+<!--<rule ref="rulesets/controversial.xml/AssignmentInOperand"/>-->
<!--<rule ref="rulesets/controversial.xml/AtLeastOneConstructor"/>-->
<!--<rule ref="rulesets/controversial.xml/CallSuperInConstructor"/>-->
<!--<rule ref="rulesets/controversial.xml/DontImportSun"/>-->
Modified: incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncGroovyInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncGroovyInvoker.java?rev=429229&r1=429228&r2=429229&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncGroovyInvoker.java (original)
+++ incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncGroovyInvoker.java Sun Aug 6 19:01:50 2006
@@ -4,19 +4,17 @@
import org.osoa.sca.CompositeContext;
import org.osoa.sca.CurrentCompositeContext;
-import org.osoa.sca.ServiceRuntimeException;
import org.osoa.sca.SCA;
+import org.osoa.sca.ServiceRuntimeException;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageChannel;
import org.apache.tuscany.spi.wire.OutboundWire;
-import org.apache.tuscany.spi.wire.InvocationRuntimeException;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.MessageChannel;
-import org.apache.tuscany.spi.services.work.WorkScheduler;
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.component.TargetException;
-
-import org.apache.tuscany.core.policy.async.AsyncMonitor;
/**
* Responsible for performing a non-blocking dispatch on a Groovy component implementation instance
@@ -91,8 +89,7 @@
public Message invoke(Message msg) throws InvocationRuntimeException {
// can't just call overriden invoke because it would bypass async
try {
- Object resp = invokeTarget(msg.getBody());
- return (Message) resp;
+ return (Message) invokeTarget(msg.getBody());
} catch (InvocationTargetException e) {
// FIXME need to log exceptions
e.printStackTrace();
Added: incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncMonitor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncMonitor.java?rev=429229&view=auto
==============================================================================
--- incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncMonitor.java (added)
+++ incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncMonitor.java Sun Aug 6 19:01:50 2006
@@ -0,0 +1,16 @@
+package org.apache.tuscany.container.groovy;
+
+/**
+ * A monitor used to log events during non-blocking invocations
+ * <p/>
+ *
+ * @version $$Rev: 424672 $$ $$Date: 2006-07-22 21:46:01 -0700 (Sat, 22 Jul 2006) $$
+ */
+public interface AsyncMonitor {
+
+ /**
+ * Logs an exception thrown during an invocation
+ */
+ void executionError(Exception e);
+
+}
Propchange: incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncMonitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/AsyncMonitor.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Modified: incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java?rev=429229&r1=429228&r2=429229&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java Sun Aug 6 19:01:50 2006
@@ -40,8 +40,9 @@
private final List<Class<?>> services;
//FIXME properties should move up to AtomicComponentExtension
private final Map<String, ObjectFactory> properties;
+ private AsyncMonitor monitor;
- public GroovyAtomicComponent(GroovyConfiguration configuration) {
+ public GroovyAtomicComponent(GroovyConfiguration configuration, AsyncMonitor monitor) {
super(configuration.getName(),
configuration.getParent(),
configuration.getScopeContainer(),
@@ -53,6 +54,7 @@
this.services = Collections.unmodifiableList(configuration.getServices());
this.properties = new HashMap<String, ObjectFactory>();
assert groovyClass != null;
+ this.monitor = monitor;
}
public List<Class<?>> getServiceInterfaces() {
@@ -61,6 +63,10 @@
public TargetInvoker createTargetInvoker(String serviceName, Method method) {
return new GroovyInvoker(method.getName(), this);
+ }
+
+ public TargetInvoker createAsyncTargetInvoker(String serviceName, Method operation, OutboundWire wire) {
+ return new AsyncGroovyInvoker(operation.getName(), wire, this, workScheduler, monitor, workContext);
}
public Object createInstance() throws ObjectCreationException {
Modified: incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentBuilder.java?rev=429229&r1=429228&r2=429229&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentBuilder.java (original)
+++ incubator/tuscany/java/sca/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyComponentBuilder.java Sun Aug 6 19:01:50 2006
@@ -93,7 +93,7 @@
configuration.setWorkContext(workContext);
configuration.setInitLevel(initLevel);
configuration.setServices(services);
- GroovyAtomicComponent component = new GroovyAtomicComponent(configuration);
+ GroovyAtomicComponent component = new GroovyAtomicComponent(configuration, null);
// handle properties
for (Property<?> property : componentType.getProperties().values()) {
Modified: incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/AsyncInvokerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/AsyncInvokerTestCase.java?rev=429229&r1=429228&r2=429229&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/AsyncInvokerTestCase.java (original)
+++ incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/AsyncInvokerTestCase.java Sun Aug 6 19:01:50 2006
@@ -10,7 +10,6 @@
import groovy.lang.GroovyObject;
import junit.framework.TestCase;
import org.apache.tuscany.container.groovy.mock.AsyncTarget;
-import org.apache.tuscany.core.policy.async.AsyncMonitor;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
Modified: incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/PropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/PropertyTestCase.java?rev=429229&r1=429228&r2=429229&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/PropertyTestCase.java (original)
+++ incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/PropertyTestCase.java Sun Aug 6 19:01:50 2006
@@ -24,8 +24,6 @@
*/
public class PropertyTestCase extends TestCase {
- private ScopeContainer scopeContainer;
-
private static final String SCRIPT = "import org.apache.tuscany.container.groovy.mock.Greeting;"
+ "class Foo implements Greeting{"
+ " String property;"
@@ -34,6 +32,7 @@
+ " }"
+ "}";
+ private ScopeContainer scopeContainer;
private Class<? extends GroovyObject> implClass;
/**
@@ -48,7 +47,7 @@
configuration.setServices(services);
configuration.setScopeContainer(scopeContainer);
configuration.setWireService(createWireService());
- GroovyAtomicComponent<Greeting> component = new GroovyAtomicComponent<Greeting>(configuration);
+ GroovyAtomicComponent<Greeting> component = new GroovyAtomicComponent<Greeting>(configuration, null);
ObjectFactory<?> factory = createMock(ObjectFactory.class);
expect(factory.getInstance()).andReturn("bar");
replay(factory);
Modified: incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/ScriptInvokeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/ScriptInvokeTestCase.java?rev=429229&r1=429228&r2=429229&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/ScriptInvokeTestCase.java (original)
+++ incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/ScriptInvokeTestCase.java Sun Aug 6 19:01:50 2006
@@ -40,7 +40,7 @@
configuration.setServices(services);
configuration.setScopeContainer(scopeContainer);
configuration.setWireService(createWireService());
- GroovyAtomicComponent<GroovyObject> context = new GroovyAtomicComponent<GroovyObject>(configuration);
+ GroovyAtomicComponent<GroovyObject> context = new GroovyAtomicComponent<GroovyObject>(configuration, null);
GroovyObject object = context.getServiceInstance();
assertEquals("foo", object.invokeMethod("greet", "foo"));
}
Modified: incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/WireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/WireTestCase.java?rev=429229&r1=429228&r2=429229&view=diff
==============================================================================
--- incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/WireTestCase.java (original)
+++ incubator/tuscany/java/sca/containers/container.groovy/src/test/java/org/apache/tuscany/container/groovy/WireTestCase.java Sun Aug 6 19:01:50 2006
@@ -72,7 +72,7 @@
configuration.setServices(services);
configuration.setScopeContainer(scopeContainer);
configuration.setWireService(createWireService());
- GroovyAtomicComponent<Greeting> component = new GroovyAtomicComponent<Greeting>(configuration);
+ GroovyAtomicComponent<Greeting> component = new GroovyAtomicComponent<Greeting>(configuration, null);
OutboundWire<?> wire = createOutboundWire("wire", Greeting.class);
terminateWire(wire);
@@ -123,7 +123,7 @@
configuration.setServices(services);
configuration.setScopeContainer(scopeContainer);
configuration.setWireService(createWireService());
- GroovyAtomicComponent<Greeting> component = new GroovyAtomicComponent<Greeting>(configuration);
+ GroovyAtomicComponent<Greeting> component = new GroovyAtomicComponent<Greeting>(configuration, null);
TargetInvoker invoker =
component.createTargetInvoker("greeting", Greeting.class.getMethod("greet", String.class));
assertEquals("foo", invoker.invokeTarget(new String[]{"foo"}));
@@ -142,7 +142,7 @@
configuration.setServices(services);
configuration.setScopeContainer(scopeContainer);
configuration.setWireService(createWireService());
- GroovyAtomicComponent<Greeting> component = new GroovyAtomicComponent<Greeting>(configuration);
+ GroovyAtomicComponent<Greeting> component = new GroovyAtomicComponent<Greeting>(configuration, null);
InboundWire<?> wire = createInboundWire("Greeting", Greeting.class);
terminateWire(wire);
for (InboundInvocationChain chain : wire.getInvocationChains().values()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org