Permalink
Browse files

Initial killbill proto

  • Loading branch information...
0 parents commit 45ca67ce69c17976158c9de0d38ac4cccfe8bcf8 @sbrossie sbrossie committed Oct 28, 2011
Showing with 20,181 additions and 0 deletions.
  1. +19 −0 .gitignore
  2. +202 −0 LICENSE-2.0.txt
  3. 0 README.md
  4. +33 −0 account/pom.xml
  5. +80 −0 analytics/pom.xml
  6. +58 −0 analytics/src/main/java/com/ning/billing/analytics/AnalyticsListener.java
  7. +333 −0 analytics/src/main/java/com/ning/billing/analytics/BusinessSubscription.java
  8. +174 −0 analytics/src/main/java/com/ning/billing/analytics/BusinessSubscriptionEvent.java
  9. +133 −0 analytics/src/main/java/com/ning/billing/analytics/BusinessSubscriptionTransition.java
  10. +163 −0 analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionBinder.java
  11. +89 −0 analytics/src/main/java/com/ning/billing/analytics/dao/BusinessSubscriptionTransitionMapper.java
  12. +40 −0 analytics/src/main/java/com/ning/billing/analytics/dao/EventDao.java
  13. +38 −0 analytics/src/main/java/com/ning/billing/analytics/dao/EventDaoProvider.java
  14. +33 −0 analytics/src/main/java/com/ning/billing/analytics/setup/AnalyticsModule.java
  15. +100 −0 analytics/src/main/resources/com/ning/billing/analytics/dao/EventDao.sql.stg
  16. +32 −0 analytics/src/main/resources/ddl.sql
  17. +77 −0 analytics/src/test/java/com/ning/billing/analytics/MockDuration.java
  18. +112 −0 analytics/src/test/java/com/ning/billing/analytics/MockPhase.java
  19. +92 −0 analytics/src/test/java/com/ning/billing/analytics/MockPlan.java
  20. +72 −0 analytics/src/test/java/com/ning/billing/analytics/MockProduct.java
  21. +135 −0 analytics/src/test/java/com/ning/billing/analytics/MockSubscription.java
  22. +102 −0 analytics/src/test/java/com/ning/billing/analytics/TestBusinessSubscription.java
  23. +122 −0 analytics/src/test/java/com/ning/billing/analytics/TestBusinessSubscriptionEvent.java
  24. +121 −0 analytics/src/test/java/com/ning/billing/analytics/TestBusinessSubscriptionTransition.java
  25. +129 −0 analytics/src/test/java/com/ning/billing/analytics/dao/MysqlTestingHelper.java
  26. +102 −0 analytics/src/test/java/com/ning/billing/analytics/dao/TestEventDao.java
  27. +30 −0 analytics/src/test/resources/log4j.xml
  28. +55 −0 api/pom.xml
  29. +64 −0 api/src/main/java/com/ning/billing/BillingExceptionBase.java
  30. +63 −0 api/src/main/java/com/ning/billing/ErrorCode.java
  31. +34 −0 api/src/main/java/com/ning/billing/account/api/IAccount.java
  32. +28 −0 api/src/main/java/com/ning/billing/account/api/IAccountData.java
  33. +31 −0 api/src/main/java/com/ning/billing/account/api/IUserApi.java
  34. +22 −0 api/src/main/java/com/ning/billing/catalog/api/ActionPolicy.java
  35. +23 −0 api/src/main/java/com/ning/billing/catalog/api/BillingAlignment.java
  36. +35 −0 api/src/main/java/com/ning/billing/catalog/api/BillingPeriod.java
  37. +35 −0 api/src/main/java/com/ning/billing/catalog/api/Currency.java
  38. +58 −0 api/src/main/java/com/ning/billing/catalog/api/ICatalog.java
  39. +22 −0 api/src/main/java/com/ning/billing/catalog/api/ICatalogUserApi.java
  40. +25 −0 api/src/main/java/com/ning/billing/catalog/api/IDuration.java
  41. +28 −0 api/src/main/java/com/ning/billing/catalog/api/IInternationalPrice.java
  42. +39 −0 api/src/main/java/com/ning/billing/catalog/api/IPlan.java
  43. +39 −0 api/src/main/java/com/ning/billing/catalog/api/IPlanPhase.java
  44. +28 −0 api/src/main/java/com/ning/billing/catalog/api/IPrice.java
  45. +30 −0 api/src/main/java/com/ning/billing/catalog/api/IPriceList.java
  46. +32 −0 api/src/main/java/com/ning/billing/catalog/api/IProduct.java
  47. +23 −0 api/src/main/java/com/ning/billing/catalog/api/IProductTier.java
  48. +23 −0 api/src/main/java/com/ning/billing/catalog/api/IProductType.java
  49. +30 −0 api/src/main/java/com/ning/billing/catalog/api/InvalidConfigException.java
  50. +24 −0 api/src/main/java/com/ning/billing/catalog/api/PhaseType.java
  51. +24 −0 api/src/main/java/com/ning/billing/catalog/api/PlanAlignment.java
  52. +33 −0 api/src/main/java/com/ning/billing/catalog/api/PlanPhaseSpecifier.java
  53. +41 −0 api/src/main/java/com/ning/billing/catalog/api/PlanSpecifier.java
  54. +22 −0 api/src/main/java/com/ning/billing/catalog/api/ProductCategory.java
  55. +27 −0 api/src/main/java/com/ning/billing/catalog/api/TimeUnit.java
  56. +21 −0 api/src/main/java/com/ning/billing/entitlement/api/billing/BillingMode.java
  57. +40 −0 api/src/main/java/com/ning/billing/entitlement/api/billing/EntitlementBillingApiException.java
  58. +47 −0 api/src/main/java/com/ning/billing/entitlement/api/billing/IBillingApi.java
  59. +87 −0 api/src/main/java/com/ning/billing/entitlement/api/billing/IBillingEvent.java
  60. +32 −0 api/src/main/java/com/ning/billing/entitlement/api/user/EntitlementUserApiException.java
  61. +33 −0 api/src/main/java/com/ning/billing/entitlement/api/user/IApiListener.java
  62. +24 −0 api/src/main/java/com/ning/billing/entitlement/api/user/IPrivateFields.java
  63. +70 −0 api/src/main/java/com/ning/billing/entitlement/api/user/ISubscription.java
  64. +34 −0 api/src/main/java/com/ning/billing/entitlement/api/user/ISubscriptionBundle.java
  65. +48 −0 api/src/main/java/com/ning/billing/entitlement/api/user/ISubscriptionTransition.java
  66. +43 −0 api/src/main/java/com/ning/billing/entitlement/api/user/IUserApi.java
  67. +109 −0 api/src/main/java/com/ning/billing/invoice/api/BillingEvent.java
  68. +52 −0 api/src/main/java/com/ning/billing/invoice/api/BillingEventSet.java
  69. +57 −0 catalog/pom.xml
  70. +303 −0 catalog/src/main/java/com/ning/billing/catalog/Catalog.java
  71. +38 −0 catalog/src/main/java/com/ning/billing/catalog/CatalogUserApi.java
  72. +65 −0 catalog/src/main/java/com/ning/billing/catalog/Duration.java
  73. +98 −0 catalog/src/main/java/com/ning/billing/catalog/InternationalPrice.java
  74. +178 −0 catalog/src/main/java/com/ning/billing/catalog/Plan.java
  75. +117 −0 catalog/src/main/java/com/ning/billing/catalog/PlanAlignmentCase.java
  76. +117 −0 catalog/src/main/java/com/ning/billing/catalog/PlanCancelCase.java
  77. +130 −0 catalog/src/main/java/com/ning/billing/catalog/PlanChangeCase.java
  78. +95 −0 catalog/src/main/java/com/ning/billing/catalog/PlanChangeRule.java
  79. +156 −0 catalog/src/main/java/com/ning/billing/catalog/PlanPhase.java
  80. +158 −0 catalog/src/main/java/com/ning/billing/catalog/PlanRules.java
  81. +61 −0 catalog/src/main/java/com/ning/billing/catalog/Price.java
  82. +99 −0 catalog/src/main/java/com/ning/billing/catalog/PriceList.java
  83. +121 −0 catalog/src/main/java/com/ning/billing/catalog/Product.java
  84. +49 −0 catalog/src/main/java/com/ning/billing/catalog/ProductTier.java
  85. +58 −0 catalog/src/main/java/com/ning/billing/catalog/ProductType.java
  86. +60 −0 catalog/src/main/java/com/ning/billing/catalog/ValidatingConfig.java
  87. +47 −0 catalog/src/main/java/com/ning/billing/catalog/ValidationError.java
  88. +210 −0 catalog/src/main/java/com/ning/billing/catalog/VersionedCatalog.java
  89. +134 −0 catalog/src/main/java/com/ning/billing/catalog/io/VersionedCatalogLoader.java
  90. +84 −0 catalog/src/main/java/com/ning/billing/catalog/io/XMLReader.java
  91. +89 −0 catalog/src/main/java/com/ning/billing/catalog/io/XMLSchemaGenerator.java
  92. 0 catalog/src/main/resources/.dont-let-git-remove-this-directory
  93. +123 −0 catalog/src/test/java/com/ning/billing/catalog/TestCancelCase.java
  94. +265 −0 catalog/src/test/java/com/ning/billing/catalog/TestPlanChangeCase.java
  95. +226 −0 catalog/src/test/java/com/ning/billing/catalog/TestPlanChangeRules.java
  96. +69 −0 catalog/src/test/java/com/ning/billing/catalog/TestPlanRules.java
  97. +67 −0 catalog/src/test/java/com/ning/billing/catalog/TestVersionedCatalog.java
  98. +146 −0 catalog/src/test/java/com/ning/billing/catalog/io/TestVersionedCatalogLoader.java
  99. +608 −0 catalog/src/test/resources/WeaponsHire.xml
  100. +174 −0 catalog/src/test/resources/WeaponsHireSmall.xml
  101. +174 −0 catalog/src/test/resources/versionedCatalog/WeaponsHireSmall-1.xml
  102. +175 −0 catalog/src/test/resources/versionedCatalog/WeaponsHireSmall-2.xml
  103. +174 −0 catalog/src/test/resources/versionedCatalog/WeaponsHireSmall-3.xml
  104. +110 −0 entitlement/pom.xml
  105. +148 −0 entitlement/src/main/java/com/ning/billing/entitlement/alignment/EntitlementAlignment.java
  106. +81 −0 entitlement/src/main/java/com/ning/billing/entitlement/api/billing/BillingApi.java
  107. +36 −0 entitlement/src/main/java/com/ning/billing/entitlement/api/user/PrivateFields.java
  108. +521 −0 entitlement/src/main/java/com/ning/billing/entitlement/api/user/Subscription.java
  109. +66 −0 entitlement/src/main/java/com/ning/billing/entitlement/api/user/SubscriptionBundle.java
  110. +67 −0 entitlement/src/main/java/com/ning/billing/entitlement/api/user/SubscriptionEvents.java
  111. +138 −0 entitlement/src/main/java/com/ning/billing/entitlement/api/user/SubscriptionTransition.java
  112. +161 −0 entitlement/src/main/java/com/ning/billing/entitlement/api/user/UserApi.java
  113. +56 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/core/ApiEventProcessor.java
  114. +170 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/core/ApiEventProcessorBase.java
  115. +166 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/core/Engine.java
  116. +22 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/core/IApiEventProcessor.java
  117. +25 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/core/IEventListener.java
  118. +25 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/core/IEventNotifier.java
  119. +316 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/dao/EntitlementDao.java
  120. +92 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/dao/IBundleSqlDao.java
  121. +68 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/dao/IEntitlementDao.java
  122. +180 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/dao/IEventSqlDao.java
  123. +109 −0 entitlement/src/main/java/com/ning/billing/entitlement/engine/dao/ISubscriptionSqlDao.java
  124. +235 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/EventBase.java
  125. +45 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/IEvent.java
  126. +54 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/IEventLyfecycle.java
  127. +24 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/phase/IPhaseEvent.java
  128. +74 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/phase/PhaseEvent.java
  129. +111 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/user/ApiEventBase.java
  130. +38 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/user/ApiEventCancel.java
  131. +40 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/user/ApiEventChange.java
  132. +42 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/user/ApiEventCreate.java
  133. +39 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/user/ApiEventPause.java
  134. +41 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/user/ApiEventResume.java
  135. +31 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/user/ApiEventType.java
  136. +36 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/user/ApiEventUncancel.java
  137. +32 −0 entitlement/src/main/java/com/ning/billing/entitlement/events/user/IUserEvent.java
  138. +38 −0 entitlement/src/main/java/com/ning/billing/entitlement/exceptions/EntitlementError.java
  139. +98 −0 entitlement/src/main/java/com/ning/billing/entitlement/glue/EngineModule.java
  140. +34 −0 entitlement/src/main/java/com/ning/billing/entitlement/glue/IEngineConfig.java
  141. +59 −0 entitlement/src/main/resources/ddl.sql
  142. +143 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/ApiTestListener.java
  143. +321 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiBase.java
  144. +237 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiCancel.java
  145. +54 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiCancelMemory.java
  146. +71 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiCancelSql.java
  147. +413 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiChangePlan.java
  148. +77 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiChangePlanMemory.java
  149. +85 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiChangePlanSql.java
  150. +180 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiCreate.java
  151. +49 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiCreateMemory.java
  152. +48 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiCreateSql.java
  153. +193 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiError.java
  154. +36 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiPriceList.java
  155. +99 −0 entitlement/src/test/java/com/ning/billing/entitlement/api/user/TestUserApiScenarios.java
  156. +50 −0 entitlement/src/test/java/com/ning/billing/entitlement/engine/core/ApiEventProcessorMemoryMock.java
  157. +333 −0 entitlement/src/test/java/com/ning/billing/entitlement/engine/dao/EntitlementDaoMemoryMock.java
  158. +71 −0 entitlement/src/test/java/com/ning/billing/entitlement/engine/dao/EntitlementDaoSqlMock.java
  159. +21 −0 entitlement/src/test/java/com/ning/billing/entitlement/engine/dao/IEntitlementDaoMock.java
  160. +130 −0 entitlement/src/test/java/com/ning/billing/entitlement/engine/dao/TestEntitlementDao.java
  161. +49 −0 entitlement/src/test/java/com/ning/billing/entitlement/glue/EngineModuleMemoryMock.java
  162. +35 −0 entitlement/src/test/java/com/ning/billing/entitlement/glue/EngineModuleSqlMock.java
  163. +6 −0 entitlement/src/test/resources/entitlement.properties
  164. +36 −0 entitlement/src/test/resources/log4j.xml
  165. +612 −0 entitlement/src/test/resources/testInput.xml
  166. +43 −0 invoice/pom.xml
  167. +84 −0 invoice/src/main/java/com/ning/billing/invoice/model/BillingModeBase.java
  168. +119 −0 invoice/src/main/java/com/ning/billing/invoice/model/DefaultInvoiceGenerator.java
  169. +28 −0 invoice/src/main/java/com/ning/billing/invoice/model/IBillingMode.java
  170. +24 −0 invoice/src/main/java/com/ning/billing/invoice/model/IInvoiceGenerator.java
  171. +148 −0 invoice/src/main/java/com/ning/billing/invoice/model/InAdvanceBillingMode.java
  172. +21 −0 invoice/src/main/java/com/ning/billing/invoice/model/InvalidDateSequenceException.java
  173. +60 −0 invoice/src/main/java/com/ning/billing/invoice/model/Invoice.java
  174. +41 −0 invoice/src/main/java/com/ning/billing/invoice/model/InvoiceItem.java
  175. +32 −0 invoice/src/main/java/com/ning/billing/invoice/model/InvoicingConfiguration.java
  176. +145 −0 invoice/src/main/java/com/ning/billing/invoice/model/TestConsole.java
  177. +136 −0 invoice/src/test/java/com/ning/billing/invoice/tests/DefaultInvoiceGeneratorTests.java
  178. +45 −0 invoice/src/test/java/com/ning/billing/invoice/tests/InternationalPriceMock.java
  179. +71 −0 invoice/src/test/java/com/ning/billing/invoice/tests/InvoicingTestBase.java
  180. +58 −0 invoice/src/test/java/com/ning/billing/invoice/tests/ProRationTestBase.java
  181. +183 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/GenericProRationTestBase.java
  182. +30 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/ProRationInAdvanceTestBase.java
  183. +102 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/ValidationProRationTests.java
  184. +145 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/annual/DoubleProRationTests.java
  185. +36 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/annual/GenericProRationTests.java
  186. +149 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/annual/LeadingProRationTests.java
  187. +61 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/annual/ProRationTests.java
  188. +90 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/annual/TrailingProRationTests.java
  189. +145 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/monthly/DoubleProRationTests.java
  190. +36 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/monthly/GenericProRationTests.java
  191. +149 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/monthly/LeadingProRationTests.java
  192. +235 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/monthly/ProRationTests.java
  193. +90 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/monthly/TrailingProRationTests.java
  194. +145 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/quarterly/DoubleProRationTests.java
  195. +36 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/quarterly/GenericProRationTests.java
  196. +149 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/quarterly/LeadingProRationTests.java
  197. +253 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/quarterly/ProRationTests.java
  198. +90 −0 invoice/src/test/java/com/ning/billing/invoice/tests/inAdvance/quarterly/TrailingProRationTests.java
  199. +33 −0 payment/pom.xml
  200. +459 −0 pom.xml
  201. +67 −0 util/pom.xml
  202. +71 −0 util/src/main/java/com/ning/billing/dbi/DBIProvider.java
  203. +55 −0 util/src/main/java/com/ning/billing/dbi/DbiConfig.java
  204. +33 −0 util/src/main/java/com/ning/billing/util/Hostname.java
  205. +70 −0 util/src/main/java/com/ning/billing/util/clock/Clock.java
  206. +134 −0 util/src/main/java/com/ning/billing/util/clock/ClockMock.java
  207. +30 −0 util/src/main/java/com/ning/billing/util/clock/IClock.java
  208. +21 −0 util/src/main/java/com/ning/billing/util/notification/INotification.java
  209. +22 −0 util/src/main/java/com/ning/billing/util/notification/INotificationHandler.java
  210. +51 −0 util/src/main/java/com/ning/billing/util/notification/NotificationSystem.java
  211. +55 −0 util/src/test/java/com/ning/billing/util/notification/TestNotificationSystem.java
@@ -0,0 +1,19 @@
+*.idea
+*.iml
+*.ipr
+*.iws
+*.DS_Store
+target
+staging
+overlays
+examples
+pom.xml.releaseBackup
+release.properties
+logs/
+.diskspool
+*.classpath
+*.settings
+*.project
+*/bin/
+catalog/src/main/resources/CatalogSchema.xsd
+*/test-output/
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2010-2011 Ning, Inc.
+
+ Licensed 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.
No changes.
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.ning.billing</groupId>
+ <artifactId>killbill</artifactId>
+ <version>0.0.3-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>killbill-account</artifactId>
+ <name>killbill-account</name>
+ <packaging>jar</packaging>
+ <dependencies>
+ </dependencies>
+ <build>
+ </build>
+</project>
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.ning.billing</groupId>
+ <artifactId>killbill</artifactId>
+ <version>0.0.3-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>killbill-analytics</artifactId>
+ <name>killbill-analytics</name>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.inject</groupId>
+ <artifactId>guice</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.mysql</groupId>
+ <artifactId>management</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.mysql</groupId>
+ <artifactId>management-dbfiles</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.ning.billing</groupId>
+ <artifactId>killbill-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.ning.jetty</groupId>
+ <artifactId>ning-service-skeleton-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.antlr</groupId>
+ <artifactId>stringtemplate</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ </build>
+</project>
@@ -0,0 +1,58 @@
+/*
+ * 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.analytics;
+
+import com.google.inject.Inject;
+import com.ning.billing.analytics.dao.EventDao;
+import com.ning.billing.entitlement.api.user.ISubscription;
+import org.joda.time.DateTime;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AnalyticsListener// implements IApiListener
+{
+ private static final Logger log = LoggerFactory.getLogger(AnalyticsListener.class);
+
+ private final EventDao dao;
+
+ @Inject
+ public AnalyticsListener(final EventDao dao)
+ {
+ this.dao = dao;
+ }
+
+ public void recordTransition(final String key, final DateTime requestedDateTime, final BusinessSubscriptionEvent event, final ISubscription prev, final ISubscription next)
+ {
+ final BusinessSubscription prevSubscription = new BusinessSubscription(prev);
+ final BusinessSubscription nextSubscription = new BusinessSubscription(next);
+ recordTransition(key, requestedDateTime, event, prevSubscription, nextSubscription);
+ }
+
+ public void recordTransition(final String key, final DateTime requestedDateTime, final BusinessSubscriptionEvent event, final BusinessSubscription prevSubscription, final BusinessSubscription nextSubscription)
+ {
+ final BusinessSubscriptionTransition transition = new BusinessSubscriptionTransition(
+ key,
+ requestedDateTime,
+ event,
+ prevSubscription,
+ nextSubscription
+ );
+
+ log.info(transition.getEvent() + " " + transition);
+ dao.createTransition(transition);
+ }
+}
Oops, something went wrong.

0 comments on commit 45ca67c

Please sign in to comment.