IGNITE-3172 Refactoring Ignite-Cassandra serializers. - Fixes #956. Signed-off-by: Alexey Kuznetsov <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/231ead01 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/231ead01 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/231ead01 Branch: refs/heads/ignite-3443 Commit: 231ead01d186c75ebb48f1d19e5a95fc9c459202 Parents: d155af3 Author: Igor <[email protected]> Authored: Wed Sep 14 08:09:36 2016 +0700 Committer: Alexey Kuznetsov <[email protected]> Committed: Wed Sep 14 08:09:36 2016 +0700 ---------------------------------------------------------------------- modules/cassandra/README.txt | 8 +- modules/cassandra/licenses/apache-2.0.txt | 202 --- modules/cassandra/pom.xml | 319 +--- modules/cassandra/serializers/README.txt | 33 + .../serializers/licenses/apache-2.0.txt | 202 +++ modules/cassandra/serializers/pom.xml | 129 ++ .../cassandra/serializer/KryoSerializer.java | 93 ++ .../apache/ignite/tests/KryoSerializerTest.java | 41 + .../java/org/apache/ignite/tests/MyPojo.java | 48 + .../store/cassandra/CassandraCacheStore.java | 409 ----- .../cassandra/CassandraCacheStoreFactory.java | 200 --- .../store/cassandra/common/CassandraHelper.java | 133 -- .../cassandra/common/PropertyMappingHelper.java | 220 --- .../store/cassandra/common/RandomSleeper.java | 104 -- .../store/cassandra/common/SystemHelper.java | 46 - .../store/cassandra/common/package-info.java | 21 - .../store/cassandra/datasource/Credentials.java | 39 - .../store/cassandra/datasource/DataSource.java | 647 -------- .../cassandra/datasource/PlainCredentials.java | 53 - .../cassandra/datasource/package-info.java | 21 - .../cache/store/cassandra/package-info.java | 21 - .../persistence/KeyPersistenceSettings.java | 274 ---- .../KeyValuePersistenceSettings.java | 478 ------ .../persistence/PersistenceController.java | 421 ----- .../persistence/PersistenceSettings.java | 335 ---- .../persistence/PersistenceStrategy.java | 62 - .../store/cassandra/persistence/PojoField.java | 219 --- .../cassandra/persistence/PojoKeyField.java | 91 -- .../cassandra/persistence/PojoValueField.java | 152 -- .../persistence/ValuePersistenceSettings.java | 107 -- .../cassandra/persistence/package-info.java | 21 - .../cassandra/serializer/JavaSerializer.java | 81 - .../cassandra/serializer/KryoSerializer.java | 93 -- .../store/cassandra/serializer/Serializer.java | 43 - .../cassandra/serializer/package-info.java | 21 - .../session/BatchExecutionAssistant.java | 95 -- .../cassandra/session/BatchLoaderAssistant.java | 47 - .../cassandra/session/CassandraSession.java | 60 - .../cassandra/session/CassandraSessionImpl.java | 832 ---------- .../cassandra/session/ExecutionAssistant.java | 77 - .../session/GenericBatchExecutionAssistant.java | 71 - .../session/LoadCacheCustomQueryWorker.java | 105 -- .../store/cassandra/session/package-info.java | 21 - .../cassandra/session/pool/SessionPool.java | 173 -- .../cassandra/session/pool/SessionWrapper.java | 71 - .../cassandra/session/pool/package-info.java | 21 - .../store/cassandra/utils/DDLGenerator.java | 64 - .../store/cassandra/utils/package-info.java | 21 - .../cassandra/src/test/bootstrap/aws/README.txt | 13 - .../aws/cassandra/cassandra-bootstrap.sh | 336 ---- .../bootstrap/aws/cassandra/cassandra-env.sh | 287 ---- .../bootstrap/aws/cassandra/cassandra-start.sh | 217 --- .../aws/cassandra/cassandra-template.yaml | 888 ----------- .../cassandra/src/test/bootstrap/aws/common.sh | 1481 ------------------ modules/cassandra/src/test/bootstrap/aws/env.sh | 113 -- .../test/bootstrap/aws/ganglia/agent-start.sh | 75 - .../bootstrap/aws/ganglia/ganglia-bootstrap.sh | 417 ----- .../bootstrap/aws/ignite/ignite-bootstrap.sh | 336 ---- .../ignite/ignite-cassandra-server-template.xml | 190 --- .../src/test/bootstrap/aws/ignite/ignite-env.sh | 29 - .../test/bootstrap/aws/ignite/ignite-start.sh | 266 ---- .../src/test/bootstrap/aws/logs-collector.sh | 173 -- .../tests/ignite-cassandra-client-template.xml | 192 --- .../test/bootstrap/aws/tests/tests-bootstrap.sh | 317 ---- .../test/bootstrap/aws/tests/tests-manager.sh | 458 ------ .../test/bootstrap/aws/tests/tests-report.sh | 499 ------ .../CassandraDirectPersistenceLoadTest.java | 107 -- .../tests/CassandraDirectPersistenceTest.java | 371 ----- .../apache/ignite/tests/DDLGeneratorTest.java | 43 - .../tests/IgnitePersistentStoreLoadTest.java | 111 -- .../ignite/tests/IgnitePersistentStoreTest.java | 369 ----- .../LoadTestsCassandraArtifactsCreator.java | 104 -- .../org/apache/ignite/tests/load/Generator.java | 27 - .../apache/ignite/tests/load/IntGenerator.java | 33 - .../ignite/tests/load/LoadTestDriver.java | 238 --- .../apache/ignite/tests/load/LongGenerator.java | 28 - .../ignite/tests/load/PersonGenerator.java | 43 - .../ignite/tests/load/PersonIdGenerator.java | 31 - .../ignite/tests/load/StringGenerator.java | 28 - .../org/apache/ignite/tests/load/Worker.java | 429 ----- .../tests/load/cassandra/BulkReadWorker.java | 63 - .../tests/load/cassandra/BulkWriteWorker.java | 52 - .../ignite/tests/load/cassandra/ReadWorker.java | 51 - .../tests/load/cassandra/WriteWorker.java | 51 - .../tests/load/cassandra/package-info.java | 21 - .../tests/load/ignite/BulkReadWorker.java | 52 - .../tests/load/ignite/BulkWriteWorker.java | 52 - .../ignite/tests/load/ignite/ReadWorker.java | 51 - .../ignite/tests/load/ignite/WriteWorker.java | 51 - .../ignite/tests/load/ignite/package-info.java | 21 - .../apache/ignite/tests/load/package-info.java | 21 - .../org/apache/ignite/tests/package-info.java | 21 - .../org/apache/ignite/tests/pojos/Person.java | 246 --- .../org/apache/ignite/tests/pojos/PersonId.java | 110 -- .../apache/ignite/tests/pojos/package-info.java | 21 - .../ignite/tests/utils/CacheStoreHelper.java | 64 - .../tests/utils/CassandraAdminCredentials.java | 38 - .../ignite/tests/utils/CassandraHelper.java | 358 ----- .../tests/utils/CassandraLifeCycleBean.java | 149 -- .../utils/CassandraRegularCredentials.java | 38 - .../ignite/tests/utils/TestCacheSession.java | 91 -- .../apache/ignite/tests/utils/TestsHelper.java | 375 ----- .../apache/ignite/tests/utils/package-info.java | 21 - .../src/test/resources/log4j.properties | 119 -- .../tests/cassandra/connection-settings.xml | 52 - .../tests/cassandra/connection.properties | 17 - .../tests/cassandra/credentials.properties | 22 - .../tests/cassandra/embedded-cassandra.yaml | 119 -- .../ignite/tests/cassandra/keyspaces.properties | 17 - .../tests/persistence/blob/ignite-config.xml | 94 -- .../persistence/blob/persistence-settings-1.xml | 21 - .../persistence/blob/persistence-settings-2.xml | 21 - .../persistence/blob/persistence-settings-3.xml | 29 - .../tests/persistence/pojo/ignite-config.xml | 113 -- .../persistence/pojo/persistence-settings-1.xml | 21 - .../persistence/pojo/persistence-settings-2.xml | 21 - .../persistence/pojo/persistence-settings-3.xml | 173 -- .../persistence/primitive/ignite-config.xml | 94 -- .../primitive/ignite-remote-client-config.xml | 99 -- .../primitive/ignite-remote-server-config.xml | 110 -- .../primitive/persistence-settings-1.xml | 21 - .../primitive/persistence-settings-2.xml | 21 - .../src/test/resources/tests.properties | 50 - .../src/test/scripts/cassandra-load-tests.bat | 41 - .../src/test/scripts/cassandra-load-tests.sh | 39 - .../src/test/scripts/ignite-load-tests.bat | 41 - .../src/test/scripts/ignite-load-tests.sh | 39 - modules/cassandra/src/test/scripts/jvm-opt.sh | 21 - modules/cassandra/src/test/scripts/jvm-opts.bat | 24 - .../scripts/recreate-cassandra-artifacts.bat | 41 - .../scripts/recreate-cassandra-artifacts.sh | 39 - modules/cassandra/store/README.txt | 32 + modules/cassandra/store/licenses/apache-2.0.txt | 202 +++ modules/cassandra/store/pom.xml | 305 ++++ .../store/cassandra/CassandraCacheStore.java | 409 +++++ .../cassandra/CassandraCacheStoreFactory.java | 200 +++ .../store/cassandra/common/CassandraHelper.java | 133 ++ .../cassandra/common/PropertyMappingHelper.java | 220 +++ .../store/cassandra/common/RandomSleeper.java | 104 ++ .../store/cassandra/common/SystemHelper.java | 46 + .../store/cassandra/common/package-info.java | 21 + .../store/cassandra/datasource/Credentials.java | 39 + .../store/cassandra/datasource/DataSource.java | 647 ++++++++ .../cassandra/datasource/PlainCredentials.java | 53 + .../cassandra/datasource/package-info.java | 21 + .../cache/store/cassandra/package-info.java | 21 + .../persistence/KeyPersistenceSettings.java | 274 ++++ .../KeyValuePersistenceSettings.java | 478 ++++++ .../persistence/PersistenceController.java | 421 +++++ .../persistence/PersistenceSettings.java | 335 ++++ .../persistence/PersistenceStrategy.java | 62 + .../store/cassandra/persistence/PojoField.java | 219 +++ .../cassandra/persistence/PojoKeyField.java | 91 ++ .../cassandra/persistence/PojoValueField.java | 152 ++ .../persistence/ValuePersistenceSettings.java | 107 ++ .../cassandra/persistence/package-info.java | 21 + .../cassandra/serializer/JavaSerializer.java | 80 + .../store/cassandra/serializer/Serializer.java | 43 + .../cassandra/serializer/package-info.java | 21 + .../session/BatchExecutionAssistant.java | 95 ++ .../cassandra/session/BatchLoaderAssistant.java | 47 + .../cassandra/session/CassandraSession.java | 60 + .../cassandra/session/CassandraSessionImpl.java | 832 ++++++++++ .../cassandra/session/ExecutionAssistant.java | 77 + .../session/GenericBatchExecutionAssistant.java | 71 + .../session/LoadCacheCustomQueryWorker.java | 105 ++ .../store/cassandra/session/package-info.java | 21 + .../cassandra/session/pool/SessionPool.java | 173 ++ .../cassandra/session/pool/SessionWrapper.java | 71 + .../cassandra/session/pool/package-info.java | 21 + .../store/cassandra/utils/DDLGenerator.java | 64 + .../store/cassandra/utils/package-info.java | 21 + .../store/src/test/bootstrap/aws/README.txt | 13 + .../aws/cassandra/cassandra-bootstrap.sh | 336 ++++ .../bootstrap/aws/cassandra/cassandra-env.sh | 287 ++++ .../bootstrap/aws/cassandra/cassandra-start.sh | 217 +++ .../aws/cassandra/cassandra-template.yaml | 888 +++++++++++ .../store/src/test/bootstrap/aws/common.sh | 1481 ++++++++++++++++++ .../store/src/test/bootstrap/aws/env.sh | 113 ++ .../test/bootstrap/aws/ganglia/agent-start.sh | 75 + .../bootstrap/aws/ganglia/ganglia-bootstrap.sh | 417 +++++ .../bootstrap/aws/ignite/ignite-bootstrap.sh | 336 ++++ .../ignite/ignite-cassandra-server-template.xml | 190 +++ .../src/test/bootstrap/aws/ignite/ignite-env.sh | 29 + .../test/bootstrap/aws/ignite/ignite-start.sh | 266 ++++ .../src/test/bootstrap/aws/logs-collector.sh | 173 ++ .../tests/ignite-cassandra-client-template.xml | 192 +++ .../test/bootstrap/aws/tests/tests-bootstrap.sh | 317 ++++ .../test/bootstrap/aws/tests/tests-manager.sh | 458 ++++++ .../test/bootstrap/aws/tests/tests-report.sh | 499 ++++++ .../CassandraDirectPersistenceLoadTest.java | 107 ++ .../tests/CassandraDirectPersistenceTest.java | 371 +++++ .../apache/ignite/tests/DDLGeneratorTest.java | 43 + .../tests/IgnitePersistentStoreLoadTest.java | 111 ++ .../ignite/tests/IgnitePersistentStoreTest.java | 369 +++++ .../LoadTestsCassandraArtifactsCreator.java | 104 ++ .../org/apache/ignite/tests/load/Generator.java | 27 + .../apache/ignite/tests/load/IntGenerator.java | 33 + .../ignite/tests/load/LoadTestDriver.java | 238 +++ .../apache/ignite/tests/load/LongGenerator.java | 28 + .../ignite/tests/load/PersonGenerator.java | 43 + .../ignite/tests/load/PersonIdGenerator.java | 31 + .../ignite/tests/load/StringGenerator.java | 28 + .../org/apache/ignite/tests/load/Worker.java | 429 +++++ .../tests/load/cassandra/BulkReadWorker.java | 63 + .../tests/load/cassandra/BulkWriteWorker.java | 52 + .../ignite/tests/load/cassandra/ReadWorker.java | 51 + .../tests/load/cassandra/WriteWorker.java | 51 + .../tests/load/cassandra/package-info.java | 21 + .../tests/load/ignite/BulkReadWorker.java | 52 + .../tests/load/ignite/BulkWriteWorker.java | 52 + .../ignite/tests/load/ignite/ReadWorker.java | 51 + .../ignite/tests/load/ignite/WriteWorker.java | 51 + .../ignite/tests/load/ignite/package-info.java | 21 + .../apache/ignite/tests/load/package-info.java | 21 + .../org/apache/ignite/tests/package-info.java | 21 + .../org/apache/ignite/tests/pojos/Person.java | 246 +++ .../org/apache/ignite/tests/pojos/PersonId.java | 110 ++ .../apache/ignite/tests/pojos/package-info.java | 21 + .../ignite/tests/utils/CacheStoreHelper.java | 64 + .../tests/utils/CassandraAdminCredentials.java | 38 + .../ignite/tests/utils/CassandraHelper.java | 358 +++++ .../tests/utils/CassandraLifeCycleBean.java | 149 ++ .../utils/CassandraRegularCredentials.java | 38 + .../ignite/tests/utils/TestCacheSession.java | 91 ++ .../apache/ignite/tests/utils/TestsHelper.java | 375 +++++ .../apache/ignite/tests/utils/package-info.java | 21 + .../store/src/test/resources/log4j.properties | 119 ++ .../tests/cassandra/connection-settings.xml | 52 + .../tests/cassandra/connection.properties | 17 + .../tests/cassandra/credentials.properties | 22 + .../tests/cassandra/embedded-cassandra.yaml | 119 ++ .../ignite/tests/cassandra/keyspaces.properties | 17 + .../tests/persistence/blob/ignite-config.xml | 94 ++ .../persistence/blob/persistence-settings-1.xml | 21 + .../persistence/blob/persistence-settings-2.xml | 21 + .../persistence/blob/persistence-settings-3.xml | 29 + .../tests/persistence/pojo/ignite-config.xml | 113 ++ .../persistence/pojo/persistence-settings-1.xml | 21 + .../persistence/pojo/persistence-settings-2.xml | 21 + .../persistence/pojo/persistence-settings-3.xml | 173 ++ .../persistence/primitive/ignite-config.xml | 94 ++ .../primitive/ignite-remote-client-config.xml | 99 ++ .../primitive/ignite-remote-server-config.xml | 110 ++ .../primitive/persistence-settings-1.xml | 21 + .../primitive/persistence-settings-2.xml | 21 + .../store/src/test/resources/tests.properties | 50 + .../src/test/scripts/cassandra-load-tests.bat | 41 + .../src/test/scripts/cassandra-load-tests.sh | 39 + .../src/test/scripts/ignite-load-tests.bat | 41 + .../store/src/test/scripts/ignite-load-tests.sh | 39 + .../cassandra/store/src/test/scripts/jvm-opt.sh | 21 + .../store/src/test/scripts/jvm-opts.bat | 24 + .../scripts/recreate-cassandra-artifacts.bat | 41 + .../scripts/recreate-cassandra-artifacts.sh | 39 + 255 files changed, 18764 insertions(+), 18268 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/README.txt ---------------------------------------------------------------------- diff --git a/modules/cassandra/README.txt b/modules/cassandra/README.txt index cc2134d..146e5d4 100644 --- a/modules/cassandra/README.txt +++ b/modules/cassandra/README.txt @@ -1,16 +1,12 @@ Apache Ignite Cassandra Module ------------------------ -Apache Ignite Cassandra module provides CacheStore implementation backed by Cassandra database. - -To enable Cassandra module when starting a standalone node, move 'optional/ignite-cassandra' folder to -'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will -be added to classpath in this case. +Apache Ignite Cassandra module, used just as a parent container for other Cassandra related modules. Importing Cassandra Module In Maven Project ------------------------------------- -If you are using Maven to manage dependencies of your project, you can add Cassandra module +If you are using Maven to manage dependencies of your project, you can add Cassandra Store module dependency like this (replace '${ignite.version}' with actual Ignite version you are interested in): http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/licenses/apache-2.0.txt ---------------------------------------------------------------------- diff --git a/modules/cassandra/licenses/apache-2.0.txt b/modules/cassandra/licenses/apache-2.0.txt deleted file mode 100644 index d645695..0000000 --- a/modules/cassandra/licenses/apache-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - 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 [yyyy] [name of copyright owner] - - 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. http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/pom.xml ---------------------------------------------------------------------- diff --git a/modules/cassandra/pom.xml b/modules/cassandra/pom.xml index cb2fc55..733d53c 100644 --- a/modules/cassandra/pom.xml +++ b/modules/cassandra/pom.xml @@ -31,311 +31,22 @@ </parent> <artifactId>ignite-cassandra</artifactId> + <packaging>pom</packaging> <version>1.8.0-SNAPSHOT</version> <url>http://ignite.apache.org</url> - <properties> - <commons-beanutils.version>1.8.3</commons-beanutils.version> - <cassandra-driver.version>3.0.0</cassandra-driver.version> - <cassandra-all.version>3.3</cassandra-all.version> - <kryo.version>3.0.3</kryo.version> - <reflectasm.version>1.10.1</reflectasm.version> - <minlog.version>1.3.0</minlog.version> - <asm.version>5.0.3</asm.version> - <objenesis.version>2.1</objenesis.version> - <netty.version>4.0.33.Final</netty.version> - <guava.version>19.0</guava.version> - <metrics-core.version>3.0.2</metrics-core.version> - </properties> - - <dependencies> - <!-- Apache commons --> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>${commons-beanutils.version}</version> - </dependency> - - <!-- Kryo and required dependencies --> - <dependency> - <groupId>com.esotericsoftware</groupId> - <artifactId>kryo</artifactId> - <version>${kryo.version}</version> - </dependency> - - <dependency> - <groupId>com.esotericsoftware</groupId> - <artifactId>reflectasm</artifactId> - <version>${reflectasm.version}</version> - </dependency> - - <dependency> - <groupId>com.esotericsoftware</groupId> - <artifactId>minlog</artifactId> - <version>${minlog.version}</version> - </dependency> - - <dependency> - <groupId>org.ow2.asm</groupId> - <artifactId>asm</artifactId> - <version>${asm.version}</version> - </dependency> - - <dependency> - <groupId>org.objenesis</groupId> - <artifactId>objenesis</artifactId> - <version>${objenesis.version}</version> - </dependency> - - <!-- Ignite --> - <dependency> - <groupId>org.apache.ignite</groupId> - <artifactId>ignite-core</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.ignite</groupId> - <artifactId>ignite-spring</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.ignite</groupId> - <artifactId>ignite-log4j</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <!-- Cassandra and required dependencies --> - <dependency> - <groupId>com.datastax.cassandra</groupId> - <artifactId>cassandra-driver-core</artifactId> - <version>${cassandra-driver.version}</version> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-handler</artifactId> - <version>${netty.version}</version> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-buffer</artifactId> - <version>${netty.version}</version> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-common</artifactId> - <version>${netty.version}</version> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-transport</artifactId> - <version>${netty.version}</version> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec</artifactId> - <version>${netty.version}</version> - </dependency> - - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>${guava.version}</version> - </dependency> - - <dependency> - <groupId>com.codahale.metrics</groupId> - <artifactId>metrics-core</artifactId> - <version>${metrics-core.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.cassandra</groupId> - <artifactId>cassandra-all</artifactId> - <version>${cassandra-all.version}</version> - <scope>test</scope> - <exclusions> - <exclusion> - <artifactId>log4j-over-slf4j</artifactId> - <groupId>org.slf4j</groupId> - </exclusion> - </exclusions> - </dependency> - - <!-- Apache log4j --> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.2</version> - <configuration> - <source>1.7</source> - <target>1.7</target> - <compilerVersion>1.7</compilerVersion> - <encoding>UTF-8</encoding> - <fork>true</fork> - <debug>false</debug> - <debuglevel>lines,vars,source</debuglevel> - <meminitial>256</meminitial> - <maxmem>512</maxmem> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>2.10</version> - <executions> - <execution> - <id>copy-all-dependencies</id> - <phase>package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/tests-package/lib</outputDirectory> - <overWriteReleases>false</overWriteReleases> - <overWriteSnapshots>false</overWriteSnapshots> - <overWriteIfNewer>true</overWriteIfNewer> - <excludeArtifactIds> - netty-all,cassandra-all,snappy-java,lz4,compress-lzf,commons-codec,commons-lang3,commons-math3, - concurrentlinkedhashmap-lru,antlr,ST4,antlr-runtime,jcl-over-slf4j,jackson-core-asl, - jackson-mapper-asl,json-simple,high-scale-lib,snakeyaml,jbcrypt,reporter-config3, - reporter-config-base,hibernate-validator,validation-api,jboss-logging,thrift-server, - disruptor,stream,fastutil,logback-core,logback-classic,libthrift,httpclient,httpcore, - cassandra-thrift,jna,jamm,joda-time,sigar,ecj,tools - </excludeArtifactIds> - </configuration> - </execution> -<!-- --> - <execution> - <id>copy-main-dependencies</id> - <phase>package</phase> - <goals> - <goal>copy-dependencies</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/libs</outputDirectory> - <overWriteReleases>false</overWriteReleases> - <overWriteSnapshots>false</overWriteSnapshots> - <overWriteIfNewer>true</overWriteIfNewer> - <excludeTransitive>true</excludeTransitive> - <excludeGroupIds> - org.apache.ignite,org.springframework,org.gridgain - </excludeGroupIds> - <excludeArtifactIds> - commons-logging,slf4j-api,cache-api,slf4j-api,aopalliance - </excludeArtifactIds> - <includeScope>runtime</includeScope> - </configuration> - </execution> -<!-- --> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <version>1.8</version> - <dependencies> - <dependency> - <groupId>ant-contrib</groupId> - <artifactId>ant-contrib</artifactId> - <version>1.0b3</version> - <exclusions> - <exclusion> - <groupId>ant</groupId> - <artifactId>ant</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - <executions> - <execution> - <id>package-tests</id> - <phase>package</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <target> - <taskdef resource="net/sf/antcontrib/antlib.xml" /> - <if> - <available file="${project.build.directory}/test-classes" type="dir" /> - <then> - <copy todir="${project.build.directory}/tests-package/lib"> - <fileset dir="${project.build.directory}"> - <include name="*.jar" /> - </fileset> - </copy> - - <jar destfile="${project.build.directory}/tests-package/lib/${project.artifactId}-${project.version}-tests.jar"> - <fileset dir="${project.build.directory}/test-classes"> - <include name="**/*.class" /> - </fileset> - </jar> - - <copy todir="${project.build.directory}/tests-package/settings"> - <fileset dir="${project.build.directory}/test-classes"> - <include name="**/*.properties" /> - <include name="**/*.xml" /> - </fileset> - </copy> - - <copy todir="${project.build.directory}/tests-package"> - <fileset dir="${project.build.testSourceDirectory}/../scripts"> - <include name="**/*" /> - </fileset> - </copy> - - <fixcrlf srcdir="${project.build.directory}/tests-package" eol="lf" eof="remove"> - <include name="*.sh" /> - </fixcrlf> - - <copy todir="${project.build.directory}/tests-package"> - <fileset dir="${project.build.testSourceDirectory}/.."> - <include name="bootstrap/**" /> - </fileset> - </copy> - - <fixcrlf srcdir="${project.build.directory}/tests-package/bootstrap" eol="lf" eof="remove"> - <include name="**" /> - </fixcrlf> - - <zip destfile="${project.build.directory}/ignite-cassandra-tests-${project.version}.zip" compress="true" whenempty="create" level="9" encoding="UTF-8" useLanguageEncodingFlag="true" createUnicodeExtraFields="not-encodeable"> - - <zipfileset dir="${project.build.directory}/tests-package" prefix="ignite-cassandra-tests"> - <exclude name="**/*.sh" /> - </zipfileset> - - <zipfileset dir="${project.build.directory}/tests-package" prefix="ignite-cassandra-tests" filemode="555"> - <include name="**/*.sh" /> - </zipfileset> - </zip> - </then> - </if> - </target> - </configuration> - </execution> - </executions> - </plugin> - - </plugins> - </build> + <dependencyManagement> + <dependencies> + <dependency> + <artifactId>ignite-cassandra-store</artifactId> + <groupId>org.apache.ignite</groupId> + <version>${project.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + + <modules> + <module>store</module> + <module>serializers</module> + </modules> </project> http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/serializers/README.txt ---------------------------------------------------------------------- diff --git a/modules/cassandra/serializers/README.txt b/modules/cassandra/serializers/README.txt new file mode 100644 index 0000000..01948ec --- /dev/null +++ b/modules/cassandra/serializers/README.txt @@ -0,0 +1,33 @@ +Apache Ignite Cassandra Serializers Module +------------------------ + +Apache Ignite Cassandra Serializers module provides additional serializers to store objects as BLOBs in Cassandra. The +module could be used as an addition to Ignite Cassandra Store module. + +To enable Cassandra Serializers module when starting a standalone node, move 'optional/ignite-cassandra-serializers' folder to +'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will +be added to classpath in this case. + +Importing Cassandra Serializers Module In Maven Project +------------------------------------- + +If you are using Maven to manage dependencies of your project, you can add Cassandra Store module +dependency like this (replace '${ignite.version}' with actual Ignite version you are +interested in): + +<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"> + ... + <dependencies> + ... + <dependency> + <groupId>org.apache.ignite</groupId> + <artifactId>ignite-cassandra-serializers</artifactId> + <version>${ignite.version}</version> + </dependency> + ... + </dependencies> + ... +</project> http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/serializers/licenses/apache-2.0.txt ---------------------------------------------------------------------- diff --git a/modules/cassandra/serializers/licenses/apache-2.0.txt b/modules/cassandra/serializers/licenses/apache-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/modules/cassandra/serializers/licenses/apache-2.0.txt @@ -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 [yyyy] [name of copyright owner] + + 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. http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/serializers/pom.xml ---------------------------------------------------------------------- diff --git a/modules/cassandra/serializers/pom.xml b/modules/cassandra/serializers/pom.xml new file mode 100644 index 0000000..33be131 --- /dev/null +++ b/modules/cassandra/serializers/pom.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF 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. +--> + +<!-- + POM file. +--> +<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>org.apache.ignite</groupId> + <artifactId>ignite-cassandra</artifactId> + <version>1.8.0-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + + <artifactId>ignite-cassandra-serializers</artifactId> + <version>1.8.0-SNAPSHOT</version> + <url>http://ignite.apache.org</url> + + <properties> + <kryo.version>3.0.3</kryo.version> + <reflectasm.version>1.10.1</reflectasm.version> + <minlog.version>1.3.0</minlog.version> + <asm.version>5.0.3</asm.version> + <objenesis.version>2.1</objenesis.version> + </properties> + + <dependencies> + <dependency> + <artifactId>ignite-cassandra-store</artifactId> + <groupId>org.apache.ignite</groupId> + </dependency> + + <!-- Kryo and required dependencies --> + <dependency> + <groupId>com.esotericsoftware</groupId> + <artifactId>kryo</artifactId> + <version>${kryo.version}</version> + </dependency> + + <dependency> + <groupId>com.esotericsoftware</groupId> + <artifactId>reflectasm</artifactId> + <version>${reflectasm.version}</version> + </dependency> + + <dependency> + <groupId>com.esotericsoftware</groupId> + <artifactId>minlog</artifactId> + <version>${minlog.version}</version> + </dependency> + + <dependency> + <groupId>org.ow2.asm</groupId> + <artifactId>asm</artifactId> + <version>${asm.version}</version> + </dependency> + + <dependency> + <groupId>org.objenesis</groupId> + <artifactId>objenesis</artifactId> + <version>${objenesis.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.2</version> + <configuration> + <source>1.7</source> + <target>1.7</target> + <compilerVersion>1.7</compilerVersion> + <encoding>UTF-8</encoding> + <fork>true</fork> + <debug>false</debug> + <debuglevel>lines,vars,source</debuglevel> + <meminitial>256</meminitial> + <maxmem>512</maxmem> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.10</version> + <executions> + <execution> + <id>copy-main-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/libs</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>false</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <excludeTransitive>true</excludeTransitive> + <excludeArtifactIds> + ignite-cassandra-store + </excludeArtifactIds> + <includeScope>runtime</includeScope> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/serializers/src/main/java/org/apache/ignite/cache/store/cassandra/serializer/KryoSerializer.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/serializers/src/main/java/org/apache/ignite/cache/store/cassandra/serializer/KryoSerializer.java b/modules/cassandra/serializers/src/main/java/org/apache/ignite/cache/store/cassandra/serializer/KryoSerializer.java new file mode 100644 index 0000000..50cb9a2 --- /dev/null +++ b/modules/cassandra/serializers/src/main/java/org/apache/ignite/cache/store/cassandra/serializer/KryoSerializer.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 org.apache.ignite.cache.store.cassandra.serializer; + +import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.io.Input; +import com.esotericsoftware.kryo.io.Output; +import org.apache.ignite.internal.util.typedef.internal.U; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.nio.ByteBuffer; + +/** + * Serializer based on Kryo serialization. + */ +public class KryoSerializer implements Serializer { + /** */ + private static final long serialVersionUID = 0L; + + /** */ + private static final int DFLT_BUFFER_SIZE = 4096; + + /** Thread local instance of {@link com.esotericsoftware.kryo.Kryo} */ + private transient ThreadLocal<Kryo> kryos = new ThreadLocal<Kryo>() { + protected Kryo initialValue() { + return new Kryo(); + } + }; + + /** {@inheritDoc} */ + @Override public ByteBuffer serialize(Object obj) { + if (obj == null) + return null; + + ByteArrayOutputStream stream = null; + + Output out = null; + + try { + stream = new ByteArrayOutputStream(DFLT_BUFFER_SIZE); + + out = new Output(stream); + + kryos.get().writeClassAndObject(out, obj); + out.flush(); + + return ByteBuffer.wrap(stream.toByteArray()); + } + catch (Throwable e) { + throw new IllegalStateException("Failed to serialize object of the class '" + obj.getClass().getName() + "'", e); + } + finally { + U.closeQuiet(out); + U.closeQuiet(stream); + } + } + + /** {@inheritDoc} */ + @Override public Object deserialize(ByteBuffer buf) { + ByteArrayInputStream stream = null; + Input in = null; + + try { + stream = new ByteArrayInputStream(buf.array()); + in = new Input(stream); + + return kryos.get().readClassAndObject(in); + } + catch (Throwable e) { + throw new IllegalStateException("Failed to deserialize object from byte stream", e); + } + finally { + U.closeQuiet(in); + U.closeQuiet(stream); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/serializers/src/test/java/org/apache/ignite/tests/KryoSerializerTest.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/serializers/src/test/java/org/apache/ignite/tests/KryoSerializerTest.java b/modules/cassandra/serializers/src/test/java/org/apache/ignite/tests/KryoSerializerTest.java new file mode 100644 index 0000000..66f6c6a --- /dev/null +++ b/modules/cassandra/serializers/src/test/java/org/apache/ignite/tests/KryoSerializerTest.java @@ -0,0 +1,41 @@ +package org.apache.ignite.tests; + +import org.apache.ignite.cache.store.cassandra.serializer.KryoSerializer; +import org.junit.Test; + +import java.nio.ByteBuffer; +import java.util.Date; + +public class KryoSerializerTest { + @Test public void simpleTest() { + MyPojo pojo1 = new MyPojo("123", 1, 123423453467L, new Date(), null); + + KryoSerializer ser = new KryoSerializer(); + + ByteBuffer buff = ser.serialize(pojo1); + MyPojo pojo2 = (MyPojo)ser.deserialize(buff); + + if (!pojo1.equals(pojo2)) + throw new RuntimeException("Kryo simple serialization test failed"); + } + + @Test public void cyclicStructureTest() { + MyPojo pojo1 = new MyPojo("123", 1, 123423453467L, new Date(), null); + MyPojo pojo2 = new MyPojo("321", 2, 123456L, new Date(), pojo1); + pojo1.setRef(pojo2); + + KryoSerializer ser = new KryoSerializer(); + + ByteBuffer buff1 = ser.serialize(pojo1); + ByteBuffer buff2 = ser.serialize(pojo2); + + MyPojo pojo3 = (MyPojo)ser.deserialize(buff1); + MyPojo pojo4 = (MyPojo)ser.deserialize(buff2); + + if (!pojo1.equals(pojo3) || !pojo1.getRef().equals(pojo3.getRef())) + throw new RuntimeException("Kryo cyclic structure serialization test failed"); + + if (!pojo2.equals(pojo4) || !pojo2.getRef().equals(pojo4.getRef())) + throw new RuntimeException("Kryo cyclic structure serialization test failed"); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/serializers/src/test/java/org/apache/ignite/tests/MyPojo.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/serializers/src/test/java/org/apache/ignite/tests/MyPojo.java b/modules/cassandra/serializers/src/test/java/org/apache/ignite/tests/MyPojo.java new file mode 100644 index 0000000..2161f25 --- /dev/null +++ b/modules/cassandra/serializers/src/test/java/org/apache/ignite/tests/MyPojo.java @@ -0,0 +1,48 @@ +package org.apache.ignite.tests; + +import java.io.Serializable; +import java.util.Date; + +public class MyPojo implements Serializable { + private String field1; + private int field2; + private long field3; + private Date field4; + private MyPojo ref; + + public MyPojo() { + } + + public MyPojo(String field1, int field2, long field3, Date field4, MyPojo ref) { + this.field1 = field1; + this.field2 = field2; + this.field3 = field3; + this.field4 = field4; + this.ref = ref; + } + + public boolean equals(Object obj) { + if (!(obj instanceof MyPojo)) + return false; + + MyPojo myObj = (MyPojo)obj; + + if ((field1 == null && myObj.field1 != null) || + (field1 != null && !field1.equals(myObj.field1))) + return false; + + if ((field4 == null && myObj.field4 != null) || + (field4 != null && !field4.equals(myObj.field4))) + return false; + + return field2 == myObj.field2 && field3 == myObj.field3; + } + + public void setRef(MyPojo ref) { + this.ref = ref; + } + + public MyPojo getRef() { + return ref; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/231ead01/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java ---------------------------------------------------------------------- diff --git a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java b/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java deleted file mode 100644 index f7e7917..0000000 --- a/modules/cassandra/src/main/java/org/apache/ignite/cache/store/cassandra/CassandraCacheStore.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF 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 org.apache.ignite.cache.store.cassandra; - -import com.datastax.driver.core.BoundStatement; -import com.datastax.driver.core.PreparedStatement; -import com.datastax.driver.core.Row; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import javax.cache.Cache; -import javax.cache.integration.CacheLoaderException; -import javax.cache.integration.CacheWriterException; -import org.apache.ignite.IgniteCheckedException; -import org.apache.ignite.IgniteLogger; -import org.apache.ignite.cache.store.CacheStore; -import org.apache.ignite.cache.store.CacheStoreSession; -import org.apache.ignite.cache.store.cassandra.datasource.DataSource; -import org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings; -import org.apache.ignite.cache.store.cassandra.persistence.PersistenceController; -import org.apache.ignite.cache.store.cassandra.session.CassandraSession; -import org.apache.ignite.cache.store.cassandra.session.ExecutionAssistant; -import org.apache.ignite.cache.store.cassandra.session.GenericBatchExecutionAssistant; -import org.apache.ignite.cache.store.cassandra.session.LoadCacheCustomQueryWorker; -import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.lang.IgniteBiInClosure; -import org.apache.ignite.logger.NullLogger; -import org.apache.ignite.resources.CacheStoreSessionResource; -import org.apache.ignite.resources.LoggerResource; - -/** - * Implementation of {@link CacheStore} backed by Cassandra database. - * - * @param <K> Ignite cache key type. - * @param <V> Ignite cache value type. - */ -public class CassandraCacheStore<K, V> implements CacheStore<K, V> { - /** Connection attribute property name. */ - private static final String ATTR_CONN_PROP = "CASSANDRA_STORE_CONNECTION"; - - /** Auto-injected store session. */ - @CacheStoreSessionResource - private CacheStoreSession storeSes; - - /** Auto-injected logger instance. */ - @LoggerResource - private IgniteLogger log; - - /** Cassandra data source. */ - private DataSource dataSrc; - - /** Max workers thread count. These threads are responsible for load cache. */ - private int maxPoolSize = Runtime.getRuntime().availableProcessors(); - - /** Controller component responsible for serialization logic. */ - private PersistenceController controller; - - /** - * Store constructor. - * - * @param dataSrc Data source. - * @param settings Persistence settings for Ignite key and value objects. - * @param maxPoolSize Max workers thread count. - */ - public CassandraCacheStore(DataSource dataSrc, KeyValuePersistenceSettings settings, int maxPoolSize) { - this.dataSrc = dataSrc; - this.controller = new PersistenceController(settings); - this.maxPoolSize = maxPoolSize; - } - - /** {@inheritDoc} */ - @Override public void loadCache(IgniteBiInClosure<K, V> clo, Object... args) throws CacheLoaderException { - if (clo == null || args == null || args.length == 0) - return; - - ExecutorService pool = null; - - Collection<Future<?>> futs = new ArrayList<>(args.length); - - try { - pool = Executors.newFixedThreadPool(maxPoolSize); - - CassandraSession ses = getCassandraSession(); - - for (Object obj : args) { - if (obj == null || !(obj instanceof String) || !((String)obj).trim().toLowerCase().startsWith("select")) - continue; - - futs.add(pool.submit(new LoadCacheCustomQueryWorker<>(ses, (String) obj, controller, log, clo))); - } - - for (Future<?> fut : futs) - U.get(fut); - - if (log != null && log.isDebugEnabled() && storeSes != null) - log.debug("Cache loaded from db: " + storeSes.cacheName()); - } - catch (IgniteCheckedException e) { - if (storeSes != null) - throw new CacheLoaderException("Failed to load Ignite cache: " + storeSes.cacheName(), e.getCause()); - else - throw new CacheLoaderException("Failed to load cache", e.getCause()); - } - finally { - U.shutdownNow(getClass(), pool, log); - } - } - - /** {@inheritDoc} */ - @Override public void sessionEnd(boolean commit) throws CacheWriterException { - if (storeSes == null || storeSes.transaction() == null) - return; - - CassandraSession cassandraSes = (CassandraSession) storeSes.properties().remove(ATTR_CONN_PROP); - - U.closeQuiet(cassandraSes); - } - - /** {@inheritDoc} */ - @SuppressWarnings({"unchecked"}) - @Override public V load(final K key) throws CacheLoaderException { - if (key == null) - return null; - - CassandraSession ses = getCassandraSession(); - - try { - return ses.execute(new ExecutionAssistant<V>() { - @Override public boolean tableExistenceRequired() { - return false; - } - - @Override public String getStatement() { - return controller.getLoadStatement(false); - } - - @Override public BoundStatement bindStatement(PreparedStatement statement) { - return controller.bindKey(statement, key); - } - - @Override public KeyValuePersistenceSettings getPersistenceSettings() { - return controller.getPersistenceSettings(); - } - - @Override public String operationName() { - return "READ"; - } - - @Override public V process(Row row) { - return row == null ? null : (V)controller.buildValueObject(row); - } - }); - } - finally { - closeCassandraSession(ses); - } - } - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override public Map<K, V> loadAll(Iterable<? extends K> keys) throws CacheLoaderException { - if (keys == null || !keys.iterator().hasNext()) - return new HashMap<>(); - - CassandraSession ses = getCassandraSession(); - - try { - return ses.execute(new GenericBatchExecutionAssistant<Map<K, V>, K>() { - private Map<K, V> data = new HashMap<>(); - - /** {@inheritDoc} */ - @Override public String getStatement() { - return controller.getLoadStatement(true); - } - - /** {@inheritDoc} */ - @Override public BoundStatement bindStatement(PreparedStatement statement, K key) { - return controller.bindKey(statement, key); - } - - /** {@inheritDoc} */ - @Override public KeyValuePersistenceSettings getPersistenceSettings() { - return controller.getPersistenceSettings(); - } - - /** {@inheritDoc} */ - @Override public String operationName() { - return "BULK_READ"; - } - - /** {@inheritDoc} */ - @Override public Map<K, V> processedData() { - return data; - } - - /** {@inheritDoc} */ - @Override protected void process(Row row) { - data.put((K)controller.buildKeyObject(row), (V)controller.buildValueObject(row)); - } - }, keys); - } - finally { - closeCassandraSession(ses); - } - } - - /** {@inheritDoc} */ - @Override public void write(final Cache.Entry<? extends K, ? extends V> entry) throws CacheWriterException { - if (entry == null || entry.getKey() == null) - return; - - CassandraSession ses = getCassandraSession(); - - try { - ses.execute(new ExecutionAssistant<Void>() { - @Override public boolean tableExistenceRequired() { - return true; - } - - @Override public String getStatement() { - return controller.getWriteStatement(); - } - - @Override public BoundStatement bindStatement(PreparedStatement statement) { - return controller.bindKeyValue(statement, entry.getKey(), entry.getValue()); - } - - @Override public KeyValuePersistenceSettings getPersistenceSettings() { - return controller.getPersistenceSettings(); - } - - @Override public String operationName() { - return "WRITE"; - } - - @Override public Void process(Row row) { - return null; - } - }); - } - finally { - closeCassandraSession(ses); - } - } - - /** {@inheritDoc} */ - @Override public void writeAll(Collection<Cache.Entry<? extends K, ? extends V>> entries) throws CacheWriterException { - if (entries == null || entries.isEmpty()) - return; - - CassandraSession ses = getCassandraSession(); - - try { - ses.execute(new GenericBatchExecutionAssistant<Void, Cache.Entry<? extends K, ? extends V>>() { - /** {@inheritDoc} */ - @Override public String getStatement() { - return controller.getWriteStatement(); - } - - /** {@inheritDoc} */ - @Override public BoundStatement bindStatement(PreparedStatement statement, - Cache.Entry<? extends K, ? extends V> entry) { - return controller.bindKeyValue(statement, entry.getKey(), entry.getValue()); - } - - /** {@inheritDoc} */ - @Override public KeyValuePersistenceSettings getPersistenceSettings() { - return controller.getPersistenceSettings(); - } - - /** {@inheritDoc} */ - @Override public String operationName() { - return "BULK_WRITE"; - } - - /** {@inheritDoc} */ - @Override public boolean tableExistenceRequired() { - return true; - } - }, entries); - } - finally { - closeCassandraSession(ses); - } - } - - /** {@inheritDoc} */ - @Override public void delete(final Object key) throws CacheWriterException { - if (key == null) - return; - - CassandraSession ses = getCassandraSession(); - - try { - ses.execute(new ExecutionAssistant<Void>() { - @Override public boolean tableExistenceRequired() { - return false; - } - - @Override public String getStatement() { - return controller.getDeleteStatement(); - } - - @Override public BoundStatement bindStatement(PreparedStatement statement) { - return controller.bindKey(statement, key); - } - - - @Override public KeyValuePersistenceSettings getPersistenceSettings() { - return controller.getPersistenceSettings(); - } - - @Override public String operationName() { - return "DELETE"; - } - - @Override public Void process(Row row) { - return null; - } - }); - } - finally { - closeCassandraSession(ses); - } - } - - /** {@inheritDoc} */ - @Override public void deleteAll(Collection<?> keys) throws CacheWriterException { - if (keys == null || keys.isEmpty()) - return; - - CassandraSession ses = getCassandraSession(); - - try { - ses.execute(new GenericBatchExecutionAssistant<Void, Object>() { - /** {@inheritDoc} */ - @Override public String getStatement() { - return controller.getDeleteStatement(); - } - - /** {@inheritDoc} */ - @Override public BoundStatement bindStatement(PreparedStatement statement, Object key) { - return controller.bindKey(statement, key); - } - - /** {@inheritDoc} */ - @Override public KeyValuePersistenceSettings getPersistenceSettings() { - return controller.getPersistenceSettings(); - } - - @Override public String operationName() { - return "BULK_DELETE"; - } - }, keys); - } - finally { - closeCassandraSession(ses); - } - } - - /** - * Gets Cassandra session wrapper or creates new if it doesn't exist. - * This wrapper hides all the low-level Cassandra interaction details by providing only high-level methods. - * - * @return Cassandra session wrapper. - */ - private CassandraSession getCassandraSession() { - if (storeSes == null || storeSes.transaction() == null) - return dataSrc.session(log != null ? log : new NullLogger()); - - CassandraSession ses = (CassandraSession) storeSes.properties().get(ATTR_CONN_PROP); - - if (ses == null) { - ses = dataSrc.session(log != null ? log : new NullLogger()); - storeSes.properties().put(ATTR_CONN_PROP, ses); - } - - return ses; - } - - /** - * Releases Cassandra related resources. - * - * @param ses Cassandra session wrapper. - */ - private void closeCassandraSession(CassandraSession ses) { - if (ses != null && (storeSes == null || storeSes.transaction() == null)) - U.closeQuiet(ses); - } -}
