killbill-aplcache

Details

diff --git a/api/src/main/java/com/ning/billing/beatrix/bus/api/BeatrixService.java b/api/src/main/java/com/ning/billing/beatrix/bus/api/BeatrixService.java
new file mode 100644
index 0000000..d8b5dfa
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/beatrix/bus/api/BeatrixService.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2010-2011 Ning, Inc.
+ *
+ * Ning 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 com.ning.billing.beatrix.bus.api;
+
+import com.ning.billing.lifecycle.KillbillService;
+
+public interface BeatrixService extends KillbillService {
+
+}
diff --git a/api/src/main/java/com/ning/billing/beatrix/bus/api/BusEvent.java b/api/src/main/java/com/ning/billing/beatrix/bus/api/BusEvent.java
new file mode 100644
index 0000000..ebfd62e
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/beatrix/bus/api/BusEvent.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2010-2011 Ning, Inc.
+ *
+ * Ning 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 com.ning.billing.beatrix.bus.api;
+
+import java.util.UUID;
+
+import com.ning.billing.util.dao.ObjectType;
+
+public interface BusEvent {
+
+    public ExtBusEventType getEventType();
+
+    public ObjectType getObjectType();
+
+    public UUID getObjectId();
+
+    public UUID getAccountId();
+
+    public UUID getTenantId();
+
+    /*
+    public UUID getUserToken();
+     */
+}
diff --git a/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEventType.java b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEventType.java
new file mode 100644
index 0000000..037cbd5
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExtBusEventType.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2010-2011 Ning, Inc.
+ *
+ * Ning 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 com.ning.billing.beatrix.bus.api;
+
+public enum ExtBusEventType {
+    ACCOUNT_CREATION,
+    ACCOUNT_CHANGE,
+    SUBSCRIPTION_CREATION,
+    SUBSCRIPTION_CHANGE,
+    SUBSCRIPTION_CANCEL,
+    OVERDUE_CHANGE,
+    INVOICE_CREATION,
+    PAYMENT_SUCCESS,
+    PAYMENT_FAILED
+}
diff --git a/api/src/main/java/com/ning/billing/beatrix/bus/api/ExternalBus.java b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExternalBus.java
new file mode 100644
index 0000000..7e5b814
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/beatrix/bus/api/ExternalBus.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2010-2011 Ning, Inc.
+ *
+ * Ning 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 com.ning.billing.beatrix.bus.api;
+
+
+public interface ExternalBus {
+
+    public void register(final Object handlerInstance); /* throws EventBusException */
+
+    public void unregister(final Object handlerInstance); /* throws EventBusException */
+}
diff --git a/beatrix/src/test/java/com/ning/billing/beatrix/lifecycle/TestLifecycle.java b/beatrix/src/test/java/com/ning/billing/beatrix/lifecycle/TestLifecycle.java
index 649297c..c236edd 100644
--- a/beatrix/src/test/java/com/ning/billing/beatrix/lifecycle/TestLifecycle.java
+++ b/beatrix/src/test/java/com/ning/billing/beatrix/lifecycle/TestLifecycle.java
@@ -22,15 +22,16 @@ import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+import com.ning.billing.beatrix.BeatrixTestSuite;
+import com.ning.billing.lifecycle.KillbillService;
+import com.ning.billing.lifecycle.LifecycleHandlerType;
+import com.ning.billing.lifecycle.LifecycleHandlerType.LifecycleLevel;
+
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
 import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.google.inject.Stage;
-import com.ning.billing.beatrix.BeatrixTestSuite;
-import com.ning.billing.lifecycle.KillbillService;
-import com.ning.billing.lifecycle.LifecycleHandlerType;
-import com.ning.billing.lifecycle.LifecycleHandlerType.LifecycleLevel;
 
 public class TestLifecycle extends BeatrixTestSuite {
     private static final Logger log = LoggerFactory.getLogger(TestLifecycle.class);
@@ -60,7 +61,11 @@ public class TestLifecycle extends BeatrixTestSuite {
         }
     }
 
-    public static class Service1 extends ServiceBase implements KillbillService {
+    public interface Service1Interface extends KillbillService {
+
+    }
+
+    public static class Service1 extends ServiceBase implements Service1Interface {
         @LifecycleHandlerType(LifecycleLevel.INIT_BUS)
         public void initBus() {
             log.info("Service1 : got INIT_BUS");
@@ -85,7 +90,11 @@ public class TestLifecycle extends BeatrixTestSuite {
         }
     }
 
-    public static class Service2 extends ServiceBase implements KillbillService {
+    public interface Service2Interface extends KillbillService {
+
+    }
+
+    public static class Service2 extends ServiceBase implements Service2Interface {
         @LifecycleHandlerType(LifecycleLevel.LOAD_CATALOG)
         public void loadCatalog() {
             log.info("Service2 : got LOAD_CATALOG");
@@ -162,8 +171,10 @@ public class TestLifecycle extends BeatrixTestSuite {
         @Override
         protected void configure() {
             bind(DefaultLifecycle.class).to(LifecycleNoWarn.class).asEagerSingleton();
+            bind(Service1Interface.class).to(Service1.class);
             bind(Service1.class).asEagerSingleton();
             bind(Service2.class).asEagerSingleton();
+            bind(Service2Interface.class).to(Service2.class);
         }
     }
 }