();
- for (int i = 0; i < components.length; i++) {
- final Component c = components[i];
- final ActiveObjectProxy activeObjectProxy = new ActiveObjectProxy(c.intf(), c.target(), c.timeout());
- workers.add(c.newWorker(activeObjectProxy));
- activeObjectRegistry.put(c.intf(), activeObjectProxy);
- }
- supervisor = activeObjectFactory.supervise(restartStrategy.transform(), workers);
- return this;
- }
-
-
- /**
- * Add additional services to be wired in.
- *
- * ActiveObjectGuiceConfigurator.addExternalGuiceModule(new AbstractModule {
- * protected void configure() {
- * bind(Foo.class).to(FooImpl.class).in(Scopes.SINGLETON);
- * bind(BarImpl.class);
- * link(Bar.class).to(BarImpl.class);
- * bindConstant(named("port")).to(8080);
- * }})
- *
- */
- public synchronized ActiveObjectGuiceConfigurator addExternalGuiceModule(Module module) {
- modules.add(module);
- return this;
- }
-
- public List getGuiceModules() {
- return modules;
- }
-
- public synchronized void reset() {
- modules = new ArrayList();
- configRegistry = new HashMap();
- activeObjectRegistry = new HashMap();
- injector = null;
- restartStrategy = null;
- }
-
- public synchronized void stop() {
- supervisor.stop();
- }
-}
diff --git a/api-java/src/test/java/se/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java b/api-java/src/test/java/se/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java
index 4bbec35a7e..478b76d28f 100755
--- a/api-java/src/test/java/se/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java
+++ b/api-java/src/test/java/se/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java
@@ -5,7 +5,13 @@
package se.scalablesolutions.akka.api;
import se.scalablesolutions.akka.annotation.*;
-import se.scalablesolutions.akka.kernel.configuration.*;
+import se.scalablesolutions.akka.kernel.config.ActiveObjectGuiceConfiguratorForJava;
+
+import se.scalablesolutions.akka.annotation.*;
+import se.scalablesolutions.akka.kernel.config.*;
+import static se.scalablesolutions.akka.kernel.config.JavaConfig.*;
+import se.scalablesolutions.akka.kernel.TransactionalMap;
+import se.scalablesolutions.akka.kernel.InMemoryTransactionalMap;
import com.google.inject.Inject;
import com.google.inject.AbstractModule;
@@ -16,7 +22,7 @@ import junit.framework.TestCase;
public class ActiveObjectGuiceConfiguratorTest extends TestCase {
static String messageLog = "";
- final private ActiveObjectGuiceConfigurator conf = new ActiveObjectGuiceConfigurator();
+ final private ActiveObjectGuiceConfiguratorForJava conf = new ActiveObjectGuiceConfiguratorForJava();
protected void setUp() {
conf.addExternalGuiceModule(new AbstractModule() {
@@ -26,11 +32,13 @@ public class ActiveObjectGuiceConfiguratorTest extends TestCase {
}).configureActiveObjects(
new RestartStrategy(new AllForOne(), 3, 5000), new Component[]{
new Component(
+ "foo",
Foo.class,
FooImpl.class,
new LifeCycle(new Permanent(), 1000),
1000),
new Component(
+ "bar",
Bar.class,
BarImpl.class,
new LifeCycle(new Permanent(), 1000),
@@ -41,21 +49,21 @@ public class ActiveObjectGuiceConfiguratorTest extends TestCase {
public void testGuiceActiveObjectInjection() {
messageLog = "";
- Foo foo = conf.getActiveObject(Foo.class);
- Bar bar = conf.getActiveObject(Bar.class);
+ Foo foo = conf.getActiveObject("foo");
+ Bar bar = conf.getActiveObject("bar");
assertTrue(foo.getBar().toString().equals(bar.toString()));
}
public void testGuiceExternalDependencyInjection() {
messageLog = "";
- Bar bar = conf.getActiveObject(Bar.class);
+ Bar bar = conf.getActiveObject("bar");
Ext ext = conf.getExternalDependency(Ext.class);
assertTrue(bar.getExt().toString().equals(ext.toString()));
}
public void testLookupNonSupervisedInstance() {
try {
- String str = conf.getActiveObject(String.class);
+ String str = conf.getActiveObject("string");
fail("exception should have been thrown");
} catch (Exception e) {
assertEquals("Class java.lang.String has not been put under supervision (by passing in the config to the supervise() method", e.getMessage());
@@ -64,7 +72,7 @@ public class ActiveObjectGuiceConfiguratorTest extends TestCase {
public void testActiveObjectInvocation() throws InterruptedException {
messageLog = "";
- Foo foo = conf.getActiveObject(Foo.class);
+ Foo foo = conf.getActiveObject("foo");
messageLog += foo.foo("foo ");
foo.bar("bar ");
messageLog += "before_bar ";
@@ -74,8 +82,8 @@ public class ActiveObjectGuiceConfiguratorTest extends TestCase {
public void testActiveObjectInvocationsInvocation() throws InterruptedException {
messageLog = "";
- Foo foo = conf.getActiveObject(Foo.class);
- Bar bar = conf.getActiveObject(Bar.class);
+ Foo foo = conf.getActiveObject("foo");
+ Bar bar = conf.getActiveObject("bar");
messageLog += foo.foo("foo ");
foo.bar("bar ");
messageLog += "before_bar ";
@@ -86,7 +94,7 @@ public class ActiveObjectGuiceConfiguratorTest extends TestCase {
public void testForcedTimeout() {
messageLog = "";
- Foo foo = conf.getActiveObject(Foo.class);
+ Foo foo = conf.getActiveObject("foo");
try {
foo.longRunning();
fail("exception should have been thrown");
@@ -96,7 +104,7 @@ public class ActiveObjectGuiceConfiguratorTest extends TestCase {
public void testForcedException() {
messageLog = "";
- Foo foo = conf.getActiveObject(Foo.class);
+ Foo foo = conf.getActiveObject("foo");
try {
foo.throwsException();
fail("exception should have been thrown");
diff --git a/api-java/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java b/api-java/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java
index 8d2c3a04d3..0e2816a2fa 100755
--- a/api-java/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java
+++ b/api-java/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java
@@ -5,31 +5,25 @@
package se.scalablesolutions.akka.api;
import se.scalablesolutions.akka.annotation.*;
-import se.scalablesolutions.akka.kernel.*;
-import se.scalablesolutions.akka.kernel.configuration.LifeCycle;
-import se.scalablesolutions.akka.kernel.configuration.Permanent;
-import se.scalablesolutions.akka.kernel.configuration.Component;
-import se.scalablesolutions.akka.kernel.configuration.AllForOne;
-import se.scalablesolutions.akka.kernel.configuration.RestartStrategy;
-
-import com.google.inject.Inject;
-import com.google.inject.AbstractModule;
-import com.google.inject.Scopes;
+import se.scalablesolutions.akka.kernel.config.*;
+import static se.scalablesolutions.akka.kernel.config.JavaConfig.*;
+import se.scalablesolutions.akka.kernel.TransactionalMap;
+import se.scalablesolutions.akka.kernel.InMemoryTransactionalMap;
import junit.framework.TestCase;
public class InMemoryStateTest extends TestCase {
static String messageLog = "";
- final private ActiveObjectGuiceConfigurator conf = new ActiveObjectGuiceConfigurator();
+ final private ActiveObjectGuiceConfiguratorForJava conf = new ActiveObjectGuiceConfiguratorForJava();
protected void setUp() {
conf.configureActiveObjects(
new RestartStrategy(new AllForOne(), 3, 5000),
new Component[] {
- new Component(InMemStateful.class, InMemStatefulImpl.class, new LifeCycle(new Permanent(), 1000), 10000000),
- new Component(InMemFailer.class, InMemFailerImpl.class, new LifeCycle(new Permanent(), 1000), 1000),
- new Component(InMemClasher.class, InMemClasherImpl.class, new LifeCycle(new Permanent(), 1000), 100000)
+ new Component("inmem-stateful", InMemStateful.class, InMemStatefulImpl.class, new LifeCycle(new Permanent(), 1000), 10000000),
+ new Component("inmem-failer", InMemFailer.class, InMemFailerImpl.class, new LifeCycle(new Permanent(), 1000), 1000),
+ new Component("inmem-clasher", InMemClasher.class, InMemClasherImpl.class, new LifeCycle(new Permanent(), 1000), 100000)
}).inject().supervise();
}
@@ -39,17 +33,17 @@ public class InMemoryStateTest extends TestCase {
public void testShouldNotRollbackStateForStatefulServerInCaseOfSuccess() {
- InMemStateful stateful = conf.getActiveObject(InMemStateful.class);
+ InMemStateful stateful = conf.getActiveObject("inmem-stateful");
stateful.setState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init"); // set init state
stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state"); // transactional
assertEquals("new state", stateful.getState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess"));
}
public void testShouldRollbackStateForStatefulServerInCaseOfFailure() {
- InMemStateful stateful = conf.getActiveObject(InMemStateful.class);
+ InMemStateful stateful = conf.getActiveObject("inmem-stateful");
stateful.setState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init"); // set init state
- InMemFailer failer = conf.getActiveObject(InMemFailer.class);
+ InMemFailer failer = conf.getActiveObject("inmem-failer");
try {
stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer); // call failing transactional method
fail("should have thrown an exception");
diff --git a/api-java/src/test/java/se/scalablesolutions/akka/api/PersistentStateTest.java b/api-java/src/test/java/se/scalablesolutions/akka/api/PersistentStateTest.java
index 891799bdcf..2a28304202 100755
--- a/api-java/src/test/java/se/scalablesolutions/akka/api/PersistentStateTest.java
+++ b/api-java/src/test/java/se/scalablesolutions/akka/api/PersistentStateTest.java
@@ -5,31 +5,25 @@
package se.scalablesolutions.akka.api;
import se.scalablesolutions.akka.annotation.*;
-import se.scalablesolutions.akka.kernel.*;
-import se.scalablesolutions.akka.kernel.configuration.LifeCycle;
-import se.scalablesolutions.akka.kernel.configuration.Permanent;
-import se.scalablesolutions.akka.kernel.configuration.Component;
-import se.scalablesolutions.akka.kernel.configuration.AllForOne;
-import se.scalablesolutions.akka.kernel.configuration.RestartStrategy;
-
-import com.google.inject.Inject;
-import com.google.inject.AbstractModule;
-import com.google.inject.Scopes;
+import se.scalablesolutions.akka.kernel.config.*;
+import static se.scalablesolutions.akka.kernel.config.JavaConfig.*;
+import se.scalablesolutions.akka.kernel.TransactionalMap;
+import se.scalablesolutions.akka.kernel.CassandraPersistentTransactionalMap;
import junit.framework.TestCase;
public class PersistentStateTest extends TestCase {
static String messageLog = "";
- final private ActiveObjectGuiceConfigurator conf = new ActiveObjectGuiceConfigurator();
+ final private ActiveObjectGuiceConfiguratorForJava conf = new ActiveObjectGuiceConfiguratorForJava();
protected void setUp() {
conf.configureActiveObjects(
- new RestartStrategy(new AllForOne(), 3, 5000),
+ new JavaConfig.RestartStrategy(new JavaConfig.AllForOne(), 3, 5000),
new Component[] {
- new Component(PersistentStateful.class, PersistentStatefulImpl.class, new LifeCycle(new Permanent(), 1000), 10000000),
- new Component(PersistentFailer.class, PersistentFailerImpl.class, new LifeCycle(new Permanent(), 1000), 1000),
- new Component(PersistentClasher.class, PersistentClasherImpl.class, new LifeCycle(new Permanent(), 1000), 100000)
+ new Component("persistent-stateful", PersistentStateful.class, PersistentStatefulImpl.class, new LifeCycle(new Permanent(), 1000), 10000000),
+ new Component("persistent-failer", PersistentFailer.class, PersistentFailerImpl.class, new LifeCycle(new Permanent(), 1000), 1000),
+ new Component("persistent-clasher", PersistentClasher.class, PersistentClasherImpl.class, new LifeCycle(new Permanent(), 1000), 100000)
}).inject().supervise();
}
@@ -63,10 +57,10 @@ interface PersistentStateful {
}
class PersistentStatefulImpl implements PersistentStateful {
- private TransactionalMap state = new CassandraPersistentTransactionalMap(this);
+ private TransactionalMap state = new CassandraPersistentTransactionalMap(this);
public String getState(String key) {
- return state.get(key);
+ return (String)state.get(key);
}
public void setState(String key, String msg) {
@@ -113,10 +107,10 @@ interface PersistentClasher {
}
class PersistentClasherImpl implements PersistentClasher {
- private TransactionalMap state = new CassandraPersistentTransactionalMap(this);
+ private TransactionalMap state = new CassandraPersistentTransactionalMap(this);
public String getState(String key) {
- return state.get(key);
+ return (String)state.get(key);
}
public void setState(String key, String msg) {
diff --git a/buildfile b/buildfile
index 48257134c0..77604cb51e 100644
--- a/buildfile
+++ b/buildfile
@@ -25,6 +25,7 @@ JERSEY = ['com.sun.jersey:jersey-core:jar:1.0.1',
GRIZZLY = 'com.sun.grizzly:grizzly-servlet-webserver:jar:1.8.6.3'
NETTY = 'org.jboss.netty:netty:jar:3.1.0.BETA2'
CASSANDRA = 'org.apache.cassandra:cassandra:jar:0.3.0-dev'
+CAMEL = 'org.apache.camel:camel-core:jar:2.0-SNAPSHOT'
THRIFT = 'com.facebook:thrift:jar:1.0'
FB303 = 'com.facebook:fb303:jar:1.0'
CONFIGGY = 'net.lag:configgy:jar:1.2'
@@ -34,6 +35,7 @@ JSR_250 = 'javax.annotation:jsr250-api:jar:1.0'
SLF4J = ['org.slf4j:slf4j-log4j12:jar:1.4.3',
'org.slf4j:slf4j-api:jar:1.4.3',
'log4j:log4j:jar:1.2.13']
+COMMONS_LOGGING = 'commons-logging:commons-logging:jar:1.1.1'
JDOM = 'jdom:jdom:jar:1.0'
CGLIB = 'cglib:cglib-nodep:jar:2.1_3'
AOPALLIANCE = 'aopalliance:aopalliance:jar:1.0'
@@ -57,22 +59,22 @@ define 'akka' do
manifest['Copyright'] = 'Scalable Solutions (C) 2009'
compile.options.target = '1.5'
- desc 'Akka Java Utilities (annotations)'
+ desc 'Akka Java Utilities (annotations and guice module)'
define 'util-java' do
- compile
+ compile.with(GUICEYFRUIT, AOPALLIANCE)
package :jar
end
desc 'Akka Actor Kernel core implementation'
define 'kernel' do
- compile.with(AKKA_UTIL_JAVA, GUICEYFRUIT, NETTY, JERSEY, GRIZZLY, CASSANDRA, THRIFT, FB303, SLF4J, CONFIGGY, JUNIT4RUNNER, JUNIT4, SCALATEST)
+ compile.with(AKKA_UTIL_JAVA, GUICEYFRUIT, AOPALLIANCE, NETTY, JERSEY, GRIZZLY, CASSANDRA, THRIFT, FB303, CAMEL, SLF4J, COMMONS_LOGGING, CONFIGGY, JUNIT4RUNNER, JUNIT4, SCALATEST)
test.using :junit
package :jar
end
desc 'Akka Java API'
define 'api-java' do
- compile.with(AKKA_KERNEL, AKKA_UTIL_JAVA, NETTY, JERSEY, GRIZZLY, CASSANDRA, THRIFT, FB303, SLF4J, CONFIGGY, GUICEYFRUIT, SCALA, GOOGLE_COLLECT, AOPALLIANCE, CGLIB, JSR_250)
+ compile.with(AKKA_KERNEL, AKKA_UTIL_JAVA, NETTY, JERSEY, GRIZZLY, CASSANDRA, THRIFT, FB303, CAMEL, SLF4J, CONFIGGY, GUICEYFRUIT, SCALA, GOOGLE_COLLECT, AOPALLIANCE, CGLIB, JSR_250)
test.using :junit
package :jar
end
diff --git a/kernel/.classpath b/kernel/.classpath
index be86ec7a49..a1febe2f78 100644
--- a/kernel/.classpath
+++ b/kernel/.classpath
@@ -51,7 +51,6 @@
-
@@ -64,7 +63,6 @@
-
@@ -77,5 +75,6 @@
+
diff --git a/kernel/akka-kernel.iml b/kernel/akka-kernel.iml
index 57185ba999..7a863e61b1 100644
--- a/kernel/akka-kernel.iml
+++ b/kernel/akka-kernel.iml
@@ -1,5 +1,10 @@
+
+
+
+
+
@@ -11,19 +16,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -31,6 +24,8 @@
+
+
@@ -56,12 +51,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kernel/pom.xml b/kernel/pom.xml
index 41725cbc6e..fe6c0cd835 100755
--- a/kernel/pom.xml
+++ b/kernel/pom.xml
@@ -70,7 +70,8 @@
cassandra
0.3.0-dev
-
+
+
com.facebook
thrift
1.0
@@ -79,6 +80,11 @@
com.facebook
fb303
1.0
+
+
+ org.apache.camel
+ camel-core
+ 2.0-SNAPSHOT