IGNITE-1753 Merged with ignite-950-new.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5fd4df59 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5fd4df59 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5fd4df59 Branch: refs/heads/ignite-1753-1282 Commit: 5fd4df5933539a790c3eadf90de2cb70b7b0914b Parents: 3e5e4c0 c61f12e Author: Alexey Kuznetsov <[email protected]> Authored: Thu Nov 5 10:03:14 2015 +0700 Committer: Alexey Kuznetsov <[email protected]> Committed: Thu Nov 5 10:06:57 2015 +0700 ---------------------------------------------------------------------- .../config/binary/example-ignite-binary.xml | 44 + .../config/portable/example-ignite-portable.xml | 44 - .../apache/ignite/examples/binary/Address.java | 72 + .../apache/ignite/examples/binary/Employee.java | 93 + .../ignite/examples/binary/EmployeeKey.java | 90 + .../binary/ExampleBinaryNodeStartup.java | 36 + .../ignite/examples/binary/Organization.java | 93 + .../examples/binary/OrganizationType.java | 32 + ...ComputeClientBinaryTaskExecutionExample.java | 153 + .../binary/computegrid/ComputeClientTask.java | 116 + .../binary/computegrid/package-info.java | 21 + .../CacheClientBinaryPutGetExample.java | 230 ++ .../datagrid/CacheClientBinaryQueryExample.java | 330 +++ .../examples/binary/datagrid/package-info.java | 21 + .../ignite/examples/binary/package-info.java | 21 + .../ignite/examples/portable/Address.java | 72 - .../ignite/examples/portable/Employee.java | 93 - .../ignite/examples/portable/EmployeeKey.java | 90 - .../portable/ExamplePortableNodeStartup.java | 36 - .../ignite/examples/portable/Organization.java | 93 - .../examples/portable/OrganizationType.java | 32 - ...mputeClientPortableTaskExecutionExample.java | 154 - .../portable/computegrid/ComputeClientTask.java | 116 - .../portable/computegrid/package-info.java | 21 - .../CacheClientPortablePutGetExample.java | 230 -- .../CacheClientPortableQueryExample.java | 325 -- .../portable/datagrid/package-info.java | 21 - .../ignite/examples/portable/package-info.java | 21 - .../CacheClientPortableExampleTest.java | 8 +- .../ComputeClientPortableExampleTest.java | 4 +- .../ignite/codegen/MessageCodeGenerator.java | 5 +- .../src/main/java/org/apache/ignite/Ignite.java | 6 +- .../java/org/apache/ignite/IgniteBinary.java | 366 +++ .../java/org/apache/ignite/IgniteCache.java | 14 +- .../org/apache/ignite/IgniteDataStreamer.java | 16 + .../java/org/apache/ignite/IgnitePortables.java | 370 --- .../org/apache/ignite/binary/BinaryField.java | 46 + .../binary/BinaryInvalidTypeException.java | 58 + .../org/apache/ignite/binary/BinaryObject.java | 163 + .../ignite/binary/BinaryObjectBuilder.java | 136 + .../ignite/binary/BinaryObjectException.java | 57 + .../apache/ignite/binary/BinaryRawReader.java | 240 ++ .../apache/ignite/binary/BinaryRawWriter.java | 225 ++ .../org/apache/ignite/binary/BinaryReader.java | 290 ++ .../apache/ignite/binary/BinarySerializer.java | 49 + .../org/apache/ignite/binary/BinaryType.java | 59 + .../ignite/binary/BinaryTypeConfiguration.java | 156 + .../ignite/binary/BinaryTypeIdMapper.java | 56 + .../org/apache/ignite/binary/BinaryWriter.java | 273 ++ .../org/apache/ignite/binary/Binarylizable.java | 48 + .../org/apache/ignite/binary/package-info.java | 22 + .../ignite/cache/CacheKeyConfiguration.java | 92 + .../apache/ignite/cache/CacheTypeMetadata.java | 67 +- .../org/apache/ignite/cache/IgniteObject.java | 60 - .../org/apache/ignite/cache/QueryEntity.java | 217 ++ .../org/apache/ignite/cache/QueryIndex.java | 192 ++ .../org/apache/ignite/cache/QueryIndexType.java | 38 + .../store/jdbc/CacheAbstractJdbcStore.java | 14 +- .../cache/store/jdbc/CacheJdbcPojoStore.java | 67 +- .../cache/store/jdbc/JdbcTypeDefaultHasher.java | 2 - .../ignite/cache/store/jdbc/JdbcTypeHasher.java | 2 +- .../configuration/CacheConfiguration.java | 662 ++++- .../configuration/IgniteConfiguration.java | 24 + .../apache/ignite/internal/IgniteKernal.java | 7 +- .../internal/client/GridClientCompute.java | 2 +- .../impl/connection/GridClientConnection.java | 2 +- .../GridClientConnectionManagerAdapter.java | 2 +- .../connection/GridClientNioTcpConnection.java | 6 +- .../communication/GridIoMessageFactory.java | 4 +- .../swapspace/GridSwapSpaceManager.java | 34 - .../internal/portable/BinaryFieldImpl.java | 104 + .../portable/BinaryMetaDataCollector.java | 263 ++ .../internal/portable/BinaryMetaDataImpl.java | 150 + .../internal/portable/BinaryObjectEx.java | 245 ++ .../internal/portable/BinaryObjectImpl.java | 606 ++++ .../portable/BinaryObjectOffheapImpl.java | 470 +++ .../internal/portable/BinaryRawReaderEx.java | 33 + .../internal/portable/BinaryRawWriterEx.java | 60 + .../internal/portable/BinaryReaderExImpl.java | 2774 +++++++++++++++++ .../internal/portable/BinaryWriterExImpl.java | 1915 ++++++++++++ .../portable/GridPortableMarshaller.java | 32 +- .../portable/PortableClassDescriptor.java | 146 +- .../internal/portable/PortableContext.java | 182 +- .../internal/portable/PortableFieldImpl.java | 104 - .../portable/PortableMetaDataCollector.java | 263 -- .../portable/PortableMetaDataHandler.java | 12 +- .../internal/portable/PortableMetaDataImpl.java | 150 - .../internal/portable/PortableObjectEx.java | 245 -- .../internal/portable/PortableObjectImpl.java | 586 ---- .../portable/PortableObjectOffheapImpl.java | 458 --- .../internal/portable/PortableRawReaderEx.java | 33 - .../internal/portable/PortableRawWriterEx.java | 60 - .../portable/PortableReaderContext.java | 8 +- .../internal/portable/PortableReaderExImpl.java | 2775 ------------------ .../ignite/internal/portable/PortableUtils.java | 14 +- .../internal/portable/PortableWriterExImpl.java | 1915 ------------ .../builder/BinaryObjectBuilderImpl.java | 569 ++++ .../portable/builder/PortableBuilderEnum.java | 8 +- .../portable/builder/PortableBuilderImpl.java | 570 ---- .../portable/builder/PortableBuilderReader.java | 56 +- .../PortableBuilderSerializationAware.java | 2 +- .../builder/PortableBuilderSerializer.java | 30 +- .../builder/PortableEnumArrayLazyValue.java | 12 +- .../portable/builder/PortableLazyArrayList.java | 2 +- .../builder/PortableLazyLinkedList.java | 2 +- .../portable/builder/PortableLazyMap.java | 2 +- .../portable/builder/PortableLazyMapEntry.java | 2 +- .../portable/builder/PortableLazySet.java | 4 +- .../builder/PortableModifiableLazyValue.java | 2 +- .../builder/PortableObjectArrayLazyValue.java | 8 +- .../builder/PortablePlainLazyValue.java | 2 +- .../builder/PortablePlainPortableObject.java | 22 +- .../portable/builder/PortableValueWithType.java | 4 +- .../streams/PortableAbstractInputStream.java | 6 +- .../affinity/GridAffinityAssignmentCache.java | 3 +- .../affinity/GridAffinityProcessor.java | 5 +- .../processors/cache/CacheInvokeEntry.java | 11 +- .../processors/cache/CacheLazyEntry.java | 23 +- .../internal/processors/cache/CacheObject.java | 11 +- .../processors/cache/CacheObjectAdapter.java | 2 +- .../cache/CacheObjectByteArrayImpl.java | 7 +- .../processors/cache/CacheObjectContext.java | 128 +- .../processors/cache/CacheObjectImpl.java | 5 + .../processors/cache/CacheOperationContext.java | 22 +- .../processors/cache/GridCacheAdapter.java | 98 +- .../cache/GridCacheConcurrentMap.java | 10 +- .../processors/cache/GridCacheContext.java | 14 +- .../processors/cache/GridCacheEntryEx.java | 15 +- .../processors/cache/GridCacheEventManager.java | 31 +- .../cache/GridCacheEvictionManager.java | 5 +- .../processors/cache/GridCacheMapEntry.java | 153 +- .../processors/cache/GridCacheProxyImpl.java | 4 +- .../processors/cache/GridCacheReturn.java | 27 +- .../processors/cache/GridCacheSwapManager.java | 37 +- .../processors/cache/GridCacheUtils.java | 3 + .../processors/cache/IgniteCacheProxy.java | 8 +- .../processors/cache/IgniteInternalCache.java | 6 +- .../processors/cache/KeyCacheObjectImpl.java | 5 + .../CacheDataStructuresManager.java | 4 +- .../GridDistributedCacheAdapter.java | 40 +- .../distributed/GridDistributedCacheEntry.java | 9 +- .../distributed/GridDistributedLockRequest.java | 17 + .../GridDistributedTxRemoteAdapter.java | 3 + .../distributed/dht/GridDhtCacheEntry.java | 5 +- .../distributed/dht/GridDhtLocalPartition.java | 3 +- .../distributed/dht/GridDhtLockFuture.java | 10 +- .../distributed/dht/GridDhtLockRequest.java | 3 + .../dht/GridDhtTransactionalCacheAdapter.java | 23 +- .../distributed/dht/GridDhtTxLocalAdapter.java | 17 +- .../distributed/dht/GridDhtTxPrepareFuture.java | 15 +- .../cache/distributed/dht/GridDhtTxRemote.java | 12 +- .../dht/GridPartitionedGetFuture.java | 6 +- .../dht/atomic/GridDhtAtomicCache.java | 75 +- .../dht/atomic/GridDhtAtomicUpdateFuture.java | 6 +- .../dht/atomic/GridDhtAtomicUpdateRequest.java | 82 +- .../dht/atomic/GridNearAtomicUpdateFuture.java | 15 +- .../dht/atomic/GridNearAtomicUpdateRequest.java | 68 +- .../atomic/GridNearAtomicUpdateResponse.java | 5 +- .../dht/colocated/GridDhtColocatedCache.java | 29 +- .../colocated/GridDhtColocatedLockFuture.java | 14 +- .../dht/preloader/GridDhtForceKeysFuture.java | 2 +- .../preloader/GridDhtPartitionDemandPool.java | 2 +- .../distributed/near/GridNearAtomicCache.java | 4 + .../distributed/near/GridNearCacheEntry.java | 17 +- .../distributed/near/GridNearGetFuture.java | 47 +- .../distributed/near/GridNearLockFuture.java | 14 +- .../distributed/near/GridNearLockRequest.java | 2 + .../near/GridNearTransactionalCache.java | 8 +- .../cache/distributed/near/GridNearTxLocal.java | 9 +- .../distributed/near/GridNearTxRemote.java | 12 +- .../cache/local/GridLocalCacheEntry.java | 16 +- .../cache/local/GridLocalLockFuture.java | 3 +- .../local/atomic/GridLocalAtomicCache.java | 108 +- .../CacheDefaultPortableAffinityKeyMapper.java | 6 +- .../portable/CacheObjectPortableContext.java | 133 - .../portable/CacheObjectPortableProcessor.java | 26 +- .../CacheObjectPortableProcessorImpl.java | 205 +- .../cache/portable/IgniteBinaryImpl.java | 177 ++ .../cache/portable/IgnitePortablesImpl.java | 177 -- .../cache/query/GridCacheQueryManager.java | 13 +- .../cache/query/GridCacheQueryRequest.java | 4 +- .../continuous/CacheContinuousQueryEvent.java | 7 +- .../store/GridCacheStoreManagerAdapter.java | 47 +- .../transactions/IgniteTransactionsImpl.java | 10 +- .../cache/transactions/IgniteTxAdapter.java | 5 +- .../cache/transactions/IgniteTxEntry.java | 54 +- .../transactions/IgniteTxLocalAdapter.java | 109 +- .../cache/transactions/IgniteTxLocalEx.java | 1 + .../cache/transactions/IgniteTxManager.java | 2 +- .../datastreamer/DataStreamProcessor.java | 1 + .../datastreamer/DataStreamerEntry.java | 6 +- .../datastreamer/DataStreamerImpl.java | 16 +- .../datastreamer/DataStreamerRequest.java | 58 +- .../datastreamer/DataStreamerUpdateJob.java | 10 +- .../platform/PlatformAbstractTarget.java | 30 +- .../processors/platform/PlatformContext.java | 26 +- .../platform/PlatformContextImpl.java | 47 +- .../platform/PlatformExtendedException.java | 4 +- .../platform/PlatformProcessorImpl.java | 6 +- .../platform/cache/PlatformCache.java | 45 +- .../cache/PlatformCacheEntryFilterImpl.java | 6 +- .../cache/PlatformCacheEntryProcessorImpl.java | 12 +- .../platform/cache/PlatformCacheIterator.java | 4 +- .../PlatformCachePartialUpdateException.java | 4 +- .../cache/affinity/PlatformAffinity.java | 8 +- .../query/PlatformAbstractQueryCursor.java | 10 +- .../PlatformContinuousQueryRemoteFilter.java | 4 +- .../cache/query/PlatformFieldsQueryCursor.java | 4 +- .../cache/query/PlatformQueryCursor.java | 4 +- .../cache/store/PlatformCacheStoreCallback.java | 6 +- .../platform/cluster/PlatformClusterGroup.java | 12 +- .../cluster/PlatformClusterNodeFilterImpl.java | 4 +- .../platform/compute/PlatformAbstractJob.java | 4 +- .../platform/compute/PlatformAbstractTask.java | 6 +- .../platform/compute/PlatformClosureJob.java | 4 +- .../platform/compute/PlatformCompute.java | 26 +- .../platform/compute/PlatformFullJob.java | 6 +- .../platform/compute/PlatformFullTask.java | 12 +- .../datastreamer/PlatformDataStreamer.java | 5 +- .../PlatformStreamReceiverImpl.java | 4 +- .../dotnet/PlatformDotNetCacheStore.java | 50 +- .../PlatformDotNetConfigurationClosure.java | 16 +- .../events/PlatformEventFilterListenerImpl.java | 6 +- .../platform/events/PlatformEvents.java | 18 +- .../messaging/PlatformMessageFilterImpl.java | 6 +- .../messaging/PlatformMessageLocalFilter.java | 4 +- .../platform/messaging/PlatformMessaging.java | 8 +- .../services/PlatformAbstractService.java | 16 +- .../platform/services/PlatformServices.java | 20 +- .../transactions/PlatformTransactions.java | 5 +- .../platform/utils/PlatformFutureUtils.java | 10 +- .../platform/utils/PlatformReaderBiClosure.java | 4 +- .../platform/utils/PlatformReaderClosure.java | 4 +- .../platform/utils/PlatformUtils.java | 60 +- .../platform/utils/PlatformWriterBiClosure.java | 4 +- .../platform/utils/PlatformWriterClosure.java | 4 +- .../processors/query/GridQueryIndexing.java | 18 +- .../processors/query/GridQueryProcessor.java | 618 ++-- .../client/message/GridClientTaskRequest.java | 6 +- .../ignite/internal/util/IgniteUtils.java | 9 +- .../marshaller/portable/PortableMarshaller.java | 42 +- .../apache/ignite/portable/PortableBuilder.java | 137 - .../ignite/portable/PortableException.java | 57 - .../apache/ignite/portable/PortableField.java | 46 - .../ignite/portable/PortableIdMapper.java | 56 - .../portable/PortableInvalidClassException.java | 58 - .../ignite/portable/PortableMarshalAware.java | 48 - .../ignite/portable/PortableMetadata.java | 61 - .../apache/ignite/portable/PortableObject.java | 163 - .../ignite/portable/PortableRawReader.java | 240 -- .../ignite/portable/PortableRawWriter.java | 225 -- .../apache/ignite/portable/PortableReader.java | 291 -- .../ignite/portable/PortableSerializer.java | 49 - .../portable/PortableTypeConfiguration.java | 177 -- .../apache/ignite/portable/PortableWriter.java | 273 -- .../apache/ignite/portable/package-info.java | 22 - .../spi/discovery/tcp/TcpDiscoverySpi.java | 2 + .../apache/ignite/spi/swapspace/SwapKey.java | 9 +- .../org/apache/ignite/stream/StreamAdapter.java | 3 +- .../portable/BinaryFieldsAbstractSelfTest.java | 730 +++++ .../portable/BinaryFieldsHeapSelfTest.java | 32 + .../portable/BinaryFieldsOffheapSelfTest.java | 61 + ...idBinaryObjectBuilderAdditionalSelfTest.java | 1289 ++++++++ .../GridBinaryObjectBuilderSelfTest.java | 1069 +++++++ ...tBuilderStringAsCharsAdditionalSelfTest.java | 28 + ...inaryObjectBuilderStringAsCharsSelfTest.java | 28 + .../GridPortableAffinityKeySelfTest.java | 10 +- .../GridPortableBuilderAdditionalSelfTest.java | 1289 -------- .../portable/GridPortableBuilderSelfTest.java | 1069 ------- ...eBuilderStringAsCharsAdditionalSelfTest.java | 28 - ...ridPortableBuilderStringAsCharsSelfTest.java | 28 - ...idPortableMarshallerCtxDisabledSelfTest.java | 27 +- .../GridPortableMarshallerSelfTest.java | 478 +-- .../GridPortableMetaDataDisabledSelfTest.java | 64 +- .../portable/GridPortableMetaDataSelfTest.java | 52 +- .../portable/GridPortableWildcardsSelfTest.java | 73 +- .../PortableCompactOffsetsAbstractSelfTest.java | 26 +- .../PortableCompactOffsetsHeapSelfTest.java | 4 +- .../PortableCompactOffsetsOffheapSelfTest.java | 4 +- .../PortableFieldsAbstractSelfTest.java | 729 ----- .../portable/PortableFieldsHeapSelfTest.java | 32 - .../portable/PortableFieldsOffheapSelfTest.java | 61 - .../GridBinaryMarshalerAwareTestClass.java | 67 + .../GridPortableMarshalerAwareTestClass.java | 67 - .../mutabletest/GridPortableTestClasses.java | 6 +- .../cache/CacheNearReaderUpdateTest.java | 60 +- .../cache/GridCacheAbstractSelfTest.java | 9 +- ...heOffHeapTieredEvictionAbstractSelfTest.java | 2 +- .../processors/cache/GridCacheTestEntryEx.java | 13 +- .../cache/IgniteCachePeekModesAbstractTest.java | 30 +- ...IgniteCacheAbstractExecutionContextTest.java | 5 + .../IgniteCacheTxExecutionContextTest.java | 2 + ...tractDistributedByteArrayValuesSelfTest.java | 4 + ...naryObjectsAbstractDataStreamerSelfTest.java | 190 ++ ...aryObjectsAbstractMultiThreadedSelfTest.java | 231 ++ .../GridCacheBinaryObjectsAbstractSelfTest.java | 981 +++++++ ...ntNodeBinaryObjectMetadataMultinodeTest.java | 295 ++ ...CacheClientNodeBinaryObjectMetadataTest.java | 290 ++ ...ClientNodePortableMetadataMultinodeTest.java | 295 -- ...GridCacheClientNodePortableMetadataTest.java | 286 -- ...ableObjectsAbstractDataStreamerSelfTest.java | 190 -- ...bleObjectsAbstractMultiThreadedSelfTest.java | 231 -- ...ridCachePortableObjectsAbstractSelfTest.java | 978 ------ .../GridCachePortableStoreAbstractSelfTest.java | 4 +- .../GridCachePortableStoreObjectsSelfTest.java | 2 +- ...GridCachePortableStorePortablesSelfTest.java | 12 +- ...ridPortableCacheEntryMemorySizeSelfTest.java | 11 +- ...leDuplicateIndexObjectsAbstractSelfTest.java | 8 +- .../DataStreamProcessorPortableSelfTest.java | 11 +- .../GridDataStreamerImplSelfTest.java | 28 +- ...ridCacheAffinityRoutingPortableSelfTest.java | 10 +- ...rtableDataStreamerMultithreadedSelfTest.java | 4 +- ...tionedOnlyPortableMultithreadedSelfTest.java | 4 +- ...AtomicNearDisabledOffheapTieredSelfTest.java | 29 + ...BinaryObjectsAtomicNearDisabledSelfTest.java | 51 + ...inaryObjectsAtomicOffheapTieredSelfTest.java | 29 + .../GridCacheBinaryObjectsAtomicSelfTest.java | 51 + ...tionedNearDisabledOffheapTieredSelfTest.java | 30 + ...yObjectsPartitionedNearDisabledSelfTest.java | 51 + ...ObjectsPartitionedOffheapTieredSelfTest.java | 30 + ...idCacheBinaryObjectsPartitionedSelfTest.java | 51 + ...acheOffHeapTieredAtomicPortableSelfTest.java | 2 +- ...eapTieredEvictionAtomicPortableSelfTest.java | 8 +- ...heOffHeapTieredEvictionPortableSelfTest.java | 8 +- .../GridCacheOffHeapTieredPortableSelfTest.java | 2 +- ...AtomicNearDisabledOffheapTieredSelfTest.java | 29 - ...rtableObjectsAtomicNearDisabledSelfTest.java | 51 - ...tableObjectsAtomicOffheapTieredSelfTest.java | 29 - .../GridCachePortableObjectsAtomicSelfTest.java | 51 - ...tionedNearDisabledOffheapTieredSelfTest.java | 30 - ...eObjectsPartitionedNearDisabledSelfTest.java | 51 - ...ObjectsPartitionedOffheapTieredSelfTest.java | 30 - ...CachePortableObjectsPartitionedSelfTest.java | 51 - ...ridCacheBinaryObjectsReplicatedSelfTest.java | 51 + ...dCachePortableObjectsReplicatedSelfTest.java | 51 - ...idCacheBinaryObjectsAtomicLocalSelfTest.java | 32 + ...BinaryObjectsLocalOffheapTieredSelfTest.java | 29 + .../GridCacheBinaryObjectsLocalSelfTest.java | 51 + ...CachePortableObjectsAtomicLocalSelfTest.java | 32 - ...rtableObjectsLocalOffheapTieredSelfTest.java | 29 - .../GridCachePortableObjectsLocalSelfTest.java | 51 - .../DataStreamProcessorSelfTest.java | 8 + .../loadtests/hashmap/GridHashMapLoadTest.java | 3 +- .../PlatformComputePortableArgTask.java | 8 +- .../platform/PlatformEventsWriteEventTask.java | 6 +- .../file/GridFileSwapSpaceSpiSelfTest.java | 11 +- .../ignite/testframework/junits/IgniteMock.java | 4 +- .../multijvm/IgniteCacheProcessProxy.java | 4 +- .../junits/multijvm/IgniteProcessProxy.java | 4 +- .../IgnitePortableObjectsTestSuite.java | 80 +- .../processors/query/h2/IgniteH2Indexing.java | 25 +- .../query/h2/opt/GridH2ValueCacheObject.java | 8 +- .../query/h2/opt/GridLuceneIndex.java | 4 +- .../IgniteCacheAbstractFieldsQuerySelfTest.java | 3 +- ...CacheOffheapTieredMultithreadedSelfTest.java | 25 +- ...niteCacheP2pUnmarshallingQueryErrorTest.java | 19 +- ...hePartitionedQueryMultiThreadedSelfTest.java | 22 +- .../h2/GridIndexingSpiAbstractSelfTest.java | 7 +- .../Cache/CacheAbstractTest.cs | 2 +- .../Config/Compute/compute-grid1.xml | 6 +- .../org/apache/ignite/IgniteSpringBean.java | 4 +- .../yardstick/cache/model/Organization.java | 16 +- .../ignite/yardstick/cache/model/Person.java | 16 +- .../ignite/yardstick/cache/model/SampleKey.java | 16 +- .../yardstick/cache/model/SampleValue.java | 16 +- parent/pom.xml | 7 +- 366 files changed, 20991 insertions(+), 19180 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/5fd4df59/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java index 49cd284,6e27b9a..e9c2b9e --- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheAbstractJdbcStore.java @@@ -166,15 -148,9 +166,15 @@@ public abstract class CacheAbstractJdbc /** Data source. */ protected DataSource dataSrc; - /** Cache with entry mapping description. (cache name, (key id, mapping description)). */ + /** Cache with entry mapping description. (cache name, (keyID, mapping description)). */ protected volatile Map<String, Map<Object, EntryMapping>> cacheMappings = Collections.emptyMap(); - /** Map for quick check whether type is Built in, POJO or Portable. */ ++ /** Map for quick check whether type is Built in, POJO or Binary. */ + private volatile Map<String, Map<String, TypeKind>> typeKinds = new HashMap<>(); + + /** Maximum batch size for writeAll and deleteAll operations. */ + private int batchSz = DFLT_BATCH_SIZE; + /** Database dialect. */ protected JdbcDialect dialect; @@@ -224,23 -193,22 +224,23 @@@ throws CacheLoaderException; /** - * Extract key type id from key object. + * Calculate type ID for object. * - * @param key Key object. - * @return Key type id. - * @throws CacheException If failed to get type key id from object. + * @param obj Object to calculate type ID for. + * @return Type ID. + * @throws CacheException If failed to calculate type ID for given object. */ - protected abstract Object keyTypeId(Object key) throws CacheException; + protected abstract Object typeIdForObject(Object obj) throws CacheException; /** - * Extract key type id from key class name. + * Calculate type ID for given type name. * - * @param kind If {@code true} then calculate type ID for POJO otherwise for portable object . - * @param type String description of key type. - * @return Key type id. - * @throws CacheException If failed to get type key id from object. ++ * @param kind If {@code true} then calculate type ID for POJO otherwise for binary object . + * @param typeName String description of type name. + * @return Type ID. + * @throws CacheException If failed to get type ID for given type name. */ - protected abstract Object keyTypeId(String type) throws CacheException; + protected abstract Object typeIdForTypeName(TypeKind kind, String typeName) throws CacheException; /** * Prepare internal store specific builders for provided types metadata. @@@ -591,69 -574,7 +591,69 @@@ } } catch (ClassNotFoundException e) { - throw new CacheException("Failed to find class: " + clsName, e); + throw new CacheException("Failed to find class: " + typeName, e); + } + } + + /** + * For backward compatibility translate old field type descriptors to new format. + * + * @param oldFields Fields in old format. + * @return Fields in new format. + */ + @Deprecated + private JdbcTypeField[] translateFields(Collection<CacheTypeFieldMetadata> oldFields) { + JdbcTypeField[] newFields = new JdbcTypeField[oldFields.size()]; + + int idx = 0; + + for (CacheTypeFieldMetadata oldField : oldFields) { + newFields[idx] = new JdbcTypeField(oldField.getDatabaseType(), oldField.getDatabaseName(), + oldField.getJavaType(), oldField.getJavaName()); + + idx++; + } + + return newFields; + } + + /** - * Checks for Built in/POJO/Portable type kind. ++ * Checks for Built in/POJO/Binary type kind. + * + * @param cacheName Cache name to get types settings. - * @param typeName Type name to check for POJO/portable format. - * @return {@code true} If portable format configured. ++ * @param typeName Type name to check for Builtin/POJO/binary format. ++ * @return {@code true} Type kind. + * @throws CacheException In case of error. + */ + protected TypeKind typeKind(String cacheName, String typeName) { + Map<String, TypeKind> cacheTypes = typeKinds.get(cacheName); + + if (cacheTypes == null) + throw new CacheException("Failed to find types metadata for cache: " + U.maskName(cacheName)); + + TypeKind kind = cacheTypes.get(typeName); + + if (kind == null) + throw new CacheException("Failed to find type metadata for type: " + typeName); + + return kind; + } + + /** + * @param type Type name to check. + * @return {@code True} if class not found. + */ + private TypeKind kindForName(String type) { + if (BUILT_IN_TYPES.contains(type)) + return TypeKind.BUILT_IN; + + try { + Class.forName(type); + + return TypeKind.POJO; + } + catch(ClassNotFoundException ignored) { - return TypeKind.PORTABLE; ++ return TypeKind.BINARY; } } @@@ -1646,18 -1460,6 +1646,18 @@@ } /** + * Type kind. + */ + protected enum TypeKind { + /** Type is known as Java built in type, like {@link String} */ + BUILT_IN, + /** Class for this type is available. */ + POJO, + /** Class for this type is not available. */ - PORTABLE ++ BINARY + } + + /** * Entry mapping description. */ protected static class EntryMapping { http://git-wip-us.apache.org/repos/asf/ignite/blob/5fd4df59/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java index ce22bdc,d78ea48..607b229 --- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStore.java @@@ -28,13 -27,12 +28,12 @@@ import java.util.HashMap import java.util.Map; import javax.cache.CacheException; import javax.cache.integration.CacheLoaderException; - import org.apache.ignite.IgnitePortables; - import org.apache.ignite.cache.IgniteObject; -import org.apache.ignite.cache.CacheTypeFieldMetadata; -import org.apache.ignite.cache.CacheTypeMetadata; ++import org.apache.ignite.IgniteBinary; ++import org.apache.ignite.binary.BinaryObject; ++import org.apache.ignite.binary.BinaryObjectBuilder; import org.apache.ignite.cache.store.CacheStore; import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; - import org.apache.ignite.portable.PortableBuilder; - import org.apache.ignite.portable.PortableObject; import org.jetbrains.annotations.Nullable; /** @@@ -44,155 -43,136 +43,155 @@@ * Use {@link CacheJdbcPojoStoreFactory} factory to pass {@link CacheJdbcPojoStore} to {@link CacheConfiguration}. */ public class CacheJdbcPojoStore<K, V> extends CacheAbstractJdbcStore<K, V> { - /** - * POJO methods cache. - */ - protected static class PojoMethodsCache { - /** POJO class. */ - protected final Class<?> cls; - - /** Constructor for POJO object. */ - private Constructor ctor; + /** POJO methods cache. */ + private volatile Map<String, Map<String, PojoMethodsCache>> pojosMethods = Collections.emptyMap(); - /** Portables builders cache. */ - private volatile Map<String, Map<String, Integer>> portablesTypeIds = Collections.emptyMap(); - /** {@code true} if object is a simple type. */ - private final boolean simple; ++ /** Binary types cache. */ ++ private volatile Map<String, Map<String, Integer>> binariesTypeIds = Collections.emptyMap(); - /** Cached setters for POJO object. */ - private Map<String, Method> getters; - - /** Cached getters for POJO object. */ - private Map<String, Method> setters; + /** + * Get field value from object for use as query parameter. + * + * @param cacheName Cache name. + * @param typeName Type name. + * @param fieldName Field name. + * @param obj Cache object. + * @return Field value from object. + * @throws CacheException in case of error. + */ + @Override @Nullable protected Object extractParameter(@Nullable String cacheName, String typeName, String fieldName, + Object obj) throws CacheException { + switch (typeKind(cacheName, typeName)) { + case BUILT_IN: + return obj; + case POJO: + return extractPojoParameter(cacheName, typeName, fieldName, obj); + default: - return extractPortableParameter(fieldName, obj); ++ return extractBinaryParameter(fieldName, obj); + } + } - /** - * POJO methods cache. - * - * @param clsName Class name. - * @param fields Fields. - * - * @throws CacheException If failed to construct type cache. - */ - public PojoMethodsCache(String clsName, Collection<CacheTypeFieldMetadata> fields) throws CacheException { - try { - cls = Class.forName(clsName); + /** + * Get field value from POJO for use as query parameter. + * + * @param cacheName Cache name. + * @param typeName Type name. + * @param fieldName Field name. + * @param obj Cache object. + * @return Field value from object. + * @throws CacheException in case of error. + */ + @Nullable private Object extractPojoParameter(@Nullable String cacheName, String typeName, String fieldName, + Object obj) throws CacheException { + try { + Map<String, PojoMethodsCache> cacheMethods = pojosMethods.get(cacheName); - if (simple = simpleType(cls)) - return; + if (cacheMethods == null) + throw new CacheException("Failed to find POJO type metadata for cache: " + U.maskName(cacheName)); - ctor = cls.getDeclaredConstructor(); + PojoMethodsCache mc = cacheMethods.get(typeName); - if (!ctor.isAccessible()) - ctor.setAccessible(true); - } - catch (ClassNotFoundException e) { - throw new CacheException("Failed to find class: " + clsName, e); - } - catch (NoSuchMethodException e) { - throw new CacheException("Failed to find default constructor for class: " + clsName, e); - } + if (mc == null) + throw new CacheException("Failed to find POJO type metadata for type: " + typeName); - setters = U.newHashMap(fields.size()); + Method getter = mc.getters.get(fieldName); - getters = U.newHashMap(fields.size()); + if (getter == null) + throw new CacheLoaderException("Failed to find getter in POJO class [class=" + typeName + + ", prop=" + fieldName + "]"); - for (CacheTypeFieldMetadata field : fields) { - String prop = capitalFirst(field.getJavaName()); + return getter.invoke(obj); + } + catch (Exception e) { + throw new CacheException("Failed to read object of class: " + typeName, e); + } + } - try { - getters.put(field.getJavaName(), cls.getMethod("get" + prop)); - } - catch (NoSuchMethodException ignored) { - try { - getters.put(field.getJavaName(), cls.getMethod("is" + prop)); - } - catch (NoSuchMethodException e) { - throw new CacheException("Failed to find getter in POJO class [clsName=" + clsName + - ", prop=" + field.getJavaName() + "]", e); - } - } + /** - * Get field value from Portable for use as query parameter. ++ * Get field value from Binary object for use as query parameter. + * + * @param fieldName Field name to extract query parameter for. + * @param obj Object to process. + * @return Field value from object. + * @throws CacheException in case of error. + */ - private Object extractPortableParameter(String fieldName, Object obj) throws CacheException { - if (obj instanceof PortableObject) { - PortableObject pobj = (PortableObject)obj; ++ private Object extractBinaryParameter(String fieldName, Object obj) throws CacheException { ++ if (obj instanceof BinaryObject) { ++ BinaryObject pobj = (BinaryObject)obj; - try { - setters.put(field.getJavaName(), cls.getMethod("set" + prop, field.getJavaType())); - } - catch (NoSuchMethodException e) { - throw new CacheException("Failed to find setter in POJO class [clsName=" + clsName + - ", prop=" + field.getJavaName() + "]", e); - } - } + return pobj.field(fieldName); } - throw new CacheException("Failed to read property value from non portable object [class=" + - /** - * Capitalizes the first character of the given string. - * - * @param str String. - * @return String with capitalized first character. - */ - @Nullable private String capitalFirst(@Nullable String str) { - return str == null ? null : - str.isEmpty() ? "" : Character.toUpperCase(str.charAt(0)) + str.substring(1); - } ++ throw new CacheException("Failed to read property value from non binary object [class=" + + obj.getClass() + ", property=" + fieldName + "]"); } - /** Methods cache. */ - protected volatile Map<String, Map<String, PojoMethodsCache>> mtdsCache = Collections.emptyMap(); - /** {@inheritDoc} */ - @Override protected void prepareBuilders(@Nullable String cacheName, Collection<CacheTypeMetadata> types) - throws CacheException { - Map<String, PojoMethodsCache> typeMethods = U.newHashMap(types.size() * 2); + @Override protected <R> R buildObject(@Nullable String cacheName, String typeName, + JdbcTypeField[] fields, Collection<String> hashFields, Map<String, Integer> loadColIdxs, ResultSet rs) + throws CacheLoaderException { + switch (typeKind(cacheName, typeName)) { + case BUILT_IN: + return (R)buildSimpleObject(typeName, fields, loadColIdxs, rs); + case POJO: + return (R)buildPojoObject(cacheName, typeName, fields, loadColIdxs, rs); + default: - return (R)buildPortableObject(cacheName, typeName, fields, hashFields, loadColIdxs, rs); ++ return (R)buildBinaryObject(cacheName, typeName, fields, hashFields, loadColIdxs, rs); + } + } - for (CacheTypeMetadata type : types) { - String keyType = type.getKeyType(); - typeMethods.put(keyType, new PojoMethodsCache(keyType, type.getKeyFields())); + /** + * Construct Java built in object from query result. + * + * @param typeName Type name. + * @param fields Fields descriptors. + * @param loadColIdxs Select query columns indexes. + * @param rs ResultSet to take data from. + * @return Constructed object. + * @throws CacheLoaderException If failed to construct POJO. + */ + private Object buildSimpleObject(String typeName, JdbcTypeField[] fields, Map<String, Integer> loadColIdxs, + ResultSet rs) throws CacheLoaderException { + try { + JdbcTypeField field = fields[0]; - String valType = type.getValueType(); - typeMethods.put(valType, new PojoMethodsCache(valType, type.getValueFields())); + return getColumnValue(rs, loadColIdxs.get(field.getDatabaseFieldName()), field.getJavaFieldType()); + } + catch (SQLException e) { + throw new CacheLoaderException("Failed to read object of class: " + typeName, e); } + } - Map<String, Map<String, PojoMethodsCache>> newMtdsCache = new HashMap<>(mtdsCache); + /** + * Construct POJO from query result. + * + * @param cacheName Cache name. + * @param typeName Type name. + * @param fields Fields descriptors. + * @param loadColIdxs Select query columns index. + * @param rs ResultSet. + * @return Constructed POJO. + * @throws CacheLoaderException If failed to construct POJO. + */ + private Object buildPojoObject(@Nullable String cacheName, String typeName, + JdbcTypeField[] fields, Map<String, Integer> loadColIdxs, ResultSet rs) + throws CacheLoaderException { - newMtdsCache.put(cacheName, typeMethods); + Map<String, PojoMethodsCache> cacheMethods = pojosMethods.get(cacheName); - mtdsCache = newMtdsCache; - } + if (cacheMethods == null) + throw new CacheLoaderException("Failed to find POJO types metadata for cache: " + U.maskName(cacheName)); - /** {@inheritDoc} */ - @Override protected <R> R buildObject(String cacheName, String typeName, Collection<CacheTypeFieldMetadata> fields, - Map<String, Integer> loadColIdxs, ResultSet rs) throws CacheLoaderException { - PojoMethodsCache mc = mtdsCache.get(cacheName).get(typeName); + PojoMethodsCache mc = cacheMethods.get(typeName); if (mc == null) - throw new CacheLoaderException("Failed to find cache type metadata for type: " + typeName); + throw new CacheLoaderException("Failed to find POJO type metadata for type: " + typeName); try { - if (mc.simple) { - CacheTypeFieldMetadata field = F.first(fields); - - return (R)getColumnValue(rs, loadColIdxs.get(field.getDatabaseName()), mc.cls); - } - Object obj = mc.ctor.newInstance(); - for (CacheTypeFieldMetadata field : fields) { - String fldJavaName = field.getJavaName(); + for (JdbcTypeField field : fields) { + String fldJavaName = field.getJavaFieldName(); Method setter = mc.setters.get(fldJavaName); @@@ -228,219 -203,44 +227,219 @@@ } } - /** {@inheritDoc} */ - @Nullable @Override protected Object extractParameter(String cacheName, String typeName, String fieldName, - Object obj) - throws CacheException { + /** - * Construct portable object from query result. ++ * Construct binary object from query result. + * + * @param cacheName Cache name. + * @param typeName Type name. + * @param fields Fields descriptors. + * @param hashFields Collection of fields to build hash for. + * @param loadColIdxs Select query columns index. + * @param rs ResultSet. - * @return Constructed portable object. - * @throws CacheLoaderException If failed to construct portable object. ++ * @return Constructed binary object. ++ * @throws CacheLoaderException If failed to construct binary object. + */ - protected Object buildPortableObject(String cacheName, String typeName, JdbcTypeField[] fields, ++ protected Object buildBinaryObject(String cacheName, String typeName, JdbcTypeField[] fields, + Collection<String> hashFields, Map<String, Integer> loadColIdxs, ResultSet rs) throws CacheLoaderException { - Map<String, Integer> cacheTypeIds = portablesTypeIds.get(cacheName); ++ Map<String, Integer> cacheTypeIds = binariesTypeIds.get(cacheName); + + if (cacheTypeIds == null) - throw new CacheLoaderException("Failed to find portable types IDs for cache: " + U.maskName(cacheName)); ++ throw new CacheLoaderException("Failed to find binary types IDs for cache: " + U.maskName(cacheName)); + + Integer typeId = cacheTypeIds.get(typeName); + + if (typeId == null) - throw new CacheLoaderException("Failed to find portable type ID for type: " + typeName); ++ throw new CacheLoaderException("Failed to find binary type ID for type: " + typeName); + try { - PortableBuilder builder = ignite.portables().builder(typeId); - PojoMethodsCache mc = mtdsCache.get(cacheName).get(typeName); ++ BinaryObjectBuilder builder = ignite.binary().builder(typeId); - if (mc == null) - throw new CacheException("Failed to find cache type metadata for type: " + typeName); + boolean calcHash = hashFields != null; - if (mc.simple) - return obj; + Collection<Object> hashValues = calcHash ? new ArrayList<>(hashFields.size()) : null; - Method getter = mc.getters.get(fieldName); + for (JdbcTypeField field : fields) { + Integer colIdx = loadColIdxs.get(field.getDatabaseFieldName()); - if (getter == null) - throw new CacheLoaderException("Failed to find getter in POJO class [clsName=" + typeName + - ", prop=" + fieldName + "]"); + Object colVal = getColumnValue(rs, colIdx, field.getJavaFieldType()); - return getter.invoke(obj); + builder.setField(field.getJavaFieldName(), colVal); + + if (calcHash) + hashValues.add(colVal); + } + + if (calcHash) + builder.hashCode(hasher.hashCode(hashValues)); + + return builder.build(); } - catch (Exception e) { - throw new CacheException("Failed to read object of class: " + typeName, e); + catch (SQLException e) { - throw new CacheException("Failed to read portable object", e); ++ throw new CacheException("Failed to read binary object", e); } } - /** {@inheritDoc} */ - @Override protected Object keyTypeId(Object key) throws CacheException { - return key.getClass(); + /** + * Calculate type ID for object. + * + * @param obj Object to calculate type ID for. + * @return Type ID. + * @throws CacheException If failed to calculate type ID for given object. + */ + @Override protected Object typeIdForObject(Object obj) throws CacheException { - if (obj instanceof IgniteObject) - return ((IgniteObject)obj).typeId(); ++ if (obj instanceof BinaryObject) ++ return ((BinaryObject)obj).typeId(); + + return obj.getClass(); } /** {@inheritDoc} */ - @Override protected Object keyTypeId(String type) throws CacheException { + @Override protected Object typeIdForTypeName(TypeKind kind, String typeName) throws CacheException { - if (kind == TypeKind.PORTABLE) - return ignite.portables().typeId(typeName); ++ if (kind == TypeKind.BINARY) ++ return ignite.binary().typeId(typeName); + try { - return Class.forName(type); + return Class.forName(typeName); } catch (ClassNotFoundException e) { - throw new CacheException("Failed to find class: " + type, e); + throw new CacheException("Failed to find class: " + typeName, e); + } + } + + /** + * Prepare internal store specific builders for provided types metadata. + * + * @param cacheName Cache name to prepare builders for. + * @param types Collection of types. + * @throws CacheException If failed to prepare internal builders for types. + */ + @Override protected void prepareBuilders(@Nullable String cacheName, Collection<JdbcType> types) + throws CacheException { + Map<String, PojoMethodsCache> pojoMethods = U.newHashMap(types.size() * 2); + Map<String, Integer> typeIds = U.newHashMap(types.size() * 2); + - IgnitePortables portables = ignite.portables(); ++ IgniteBinary binary = ignite.binary(); + + for (JdbcType type : types) { + String keyTypeName = type.getKeyType(); + + TypeKind keyKind = typeKind(cacheName, keyTypeName); + + if (keyKind == TypeKind.POJO) { + if (pojoMethods.containsKey(keyTypeName)) + throw new CacheException("Found duplicate key type [cache=" + U.maskName(cacheName) + + ", keyType=" + keyTypeName + "]"); + + pojoMethods.put(keyTypeName, new PojoMethodsCache(keyTypeName, type.getKeyFields())); + } - else if (keyKind == TypeKind.PORTABLE) - typeIds.put(keyTypeName, portables.typeId(keyTypeName)); ++ else if (keyKind == TypeKind.BINARY) ++ typeIds.put(keyTypeName, binary.typeId(keyTypeName)); + + String valTypeName = type.getValueType(); + + TypeKind valKind = typeKind(cacheName, valTypeName); + + if (valKind == TypeKind.POJO) + pojoMethods.put(valTypeName, new PojoMethodsCache(valTypeName, type.getValueFields())); - else if (valKind == TypeKind.PORTABLE) - typeIds.put(valTypeName, portables.typeId(valTypeName)); ++ else if (valKind == TypeKind.BINARY) ++ typeIds.put(valTypeName, binary.typeId(valTypeName)); + } + + if (!pojoMethods.isEmpty()) { + Map<String, Map<String, PojoMethodsCache>> newPojosMethods = new HashMap<>(pojosMethods); + + newPojosMethods.put(cacheName, pojoMethods); + + pojosMethods = newPojosMethods; + } + + if (!typeIds.isEmpty()) { - Map<String, Map<String, Integer>> newPortablesTypeIds = new HashMap<>(portablesTypeIds); ++ Map<String, Map<String, Integer>> newBinariesTypeIds = new HashMap<>(binariesTypeIds); + - newPortablesTypeIds.put(cacheName, typeIds); ++ newBinariesTypeIds.put(cacheName, typeIds); + - portablesTypeIds = newPortablesTypeIds; ++ binariesTypeIds = newBinariesTypeIds; + } + } + + /** + * POJO methods cache. + */ + private static class PojoMethodsCache { + /** POJO class. */ + private final Class<?> cls; + + /** Constructor for POJO object. */ + private Constructor ctor; + + /** Cached setters for POJO object. */ + private Map<String, Method> getters; + + /** Cached getters for POJO object. */ + private Map<String, Method> setters; + + /** + * POJO methods cache. + * + * @param clsName Class name. + * @param fields Fields. + * @throws CacheException If failed to construct type cache. + */ + private PojoMethodsCache(String clsName, JdbcTypeField[] fields) throws CacheException { + try { + cls = Class.forName(clsName); + + ctor = cls.getDeclaredConstructor(); + + if (!ctor.isAccessible()) + ctor.setAccessible(true); + } + catch (ClassNotFoundException e) { + throw new CacheException("Failed to find class: " + clsName, e); + } + catch (NoSuchMethodException e) { + throw new CacheException("Failed to find default constructor for class: " + clsName, e); + } + + setters = U.newHashMap(fields.length); + + getters = U.newHashMap(fields.length); + + for (JdbcTypeField field : fields) { + String prop = capitalFirst(field.getJavaFieldName()); + + try { + getters.put(field.getJavaFieldName(), cls.getMethod("get" + prop)); + } + catch (NoSuchMethodException ignored) { + try { + getters.put(field.getJavaFieldName(), cls.getMethod("is" + prop)); + } + catch (NoSuchMethodException e) { + throw new CacheException("Failed to find getter in POJO class [class=" + clsName + + ", prop=" + field.getJavaFieldName() + "]", e); + } + } + + try { + setters.put(field.getJavaFieldName(), cls.getMethod("set" + prop, field.getJavaFieldType())); + } + catch (NoSuchMethodException e) { + throw new CacheException("Failed to find setter in POJO class [class=" + clsName + + ", prop=" + field.getJavaFieldName() + "]", e); + } + } + } + + /** + * Capitalizes the first character of the given string. + * + * @param str String. + * @return String with capitalized first character. + */ + @Nullable private String capitalFirst(@Nullable String str) { + return str == null ? null : + str.isEmpty() ? "" : Character.toUpperCase(str.charAt(0)) + str.substring(1); } } -} +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5fd4df59/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypeDefaultHasher.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypeDefaultHasher.java index e7de753,0000000..3baad3b mode 100644,000000..100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypeDefaultHasher.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypeDefaultHasher.java @@@ -1,45 -1,0 +1,43 @@@ +/* + * 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.jdbc; + - import org.apache.ignite.cache.IgniteObject; - +import java.util.Collection; + +/** + * Default implementation of {@link JdbcTypeHasher}. + * + * This implementation ignores type and field names. + */ +public class JdbcTypeDefaultHasher implements JdbcTypeHasher { + /** */ + private static final long serialVersionUID = 0L; + + /** Singleton instance to use. */ + public static final JdbcTypeHasher INSTANCE = new JdbcTypeDefaultHasher(); + + /** {@inheritDoc} */ + @Override public int hashCode(Collection<?> values) { + int hash = 0; + + for (Object val : values) + hash = 31 * hash + (val != null ? val.hashCode() : 0); + + return hash; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5fd4df59/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypeHasher.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypeHasher.java index ed35899,0000000..9d1fcea mode 100644,000000..100644 --- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypeHasher.java +++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcTypeHasher.java @@@ -1,34 -1,0 +1,34 @@@ +/* + * 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.jdbc; + +import java.io.Serializable; +import java.util.Collection; + +/** - * API for implementing custom hashing logic for portable objects on server side. ++ * API for implementing custom hashing logic for binary objects on server side. + */ +public interface JdbcTypeHasher extends Serializable { + /** + * Calculate hash code for specified object and fields. + * + * @param values Collection of values that should participate in hash code calculation. + * @return Hash code. + */ + public int hashCode(Collection<?> values); +} http://git-wip-us.apache.org/repos/asf/ignite/blob/5fd4df59/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java ---------------------------------------------------------------------- diff --cc modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java index efb71d6,f457e7e..8185e84 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Organization.java @@@ -124,4 -124,4 +124,4 @@@ public class Organization implements Ex return "Organization [id=" + id + ", name=" + name + ']'; } --} ++} http://git-wip-us.apache.org/repos/asf/ignite/blob/5fd4df59/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java ---------------------------------------------------------------------- diff --cc modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java index e826d65,e59ba19..1656f1f --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/Person.java @@@ -212,4 -212,4 +212,4 @@@ public class Person implements External ", salary=" + salary + ']'; } --} ++} http://git-wip-us.apache.org/repos/asf/ignite/blob/5fd4df59/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java ---------------------------------------------------------------------- diff --cc modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java index 5fa9dea,e089696..7f37c0f --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleKey.java @@@ -102,4 -102,4 +102,4 @@@ public class SampleKey implements Exter @Override public String toString() { return "Key [id=" + id + ']'; } --} ++} http://git-wip-us.apache.org/repos/asf/ignite/blob/5fd4df59/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java ---------------------------------------------------------------------- diff --cc modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java index f15d671,b28862c..71069b9 --- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java +++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/model/SampleValue.java @@@ -83,4 -83,4 +83,4 @@@ public class SampleValue implements Ext @Override public String toString() { return "Value [id=" + id + ']'; } --} ++}
