IGNITE-950-new Fixed compilation.

Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b5c70a94
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b5c70a94
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b5c70a94

Branch: refs/heads/ignite-950-new
Commit: b5c70a9415b39e1b66c830a5c87e8da652a153ea
Parents: 68e40f3 00c3a43
Author: Alexey Goncharuk <[email protected]>
Authored: Fri Oct 30 18:46:18 2015 +0300
Committer: Alexey Goncharuk <[email protected]>
Committed: Fri Oct 30 18:46:18 2015 +0300

----------------------------------------------------------------------
 DEVNOTES.txt                                    |    5 +-
 assembly/dependencies-fabric-lgpl.xml           |  169 +
 assembly/dependencies-fabric.xml                |    3 +
 assembly/release-fabric-base.xml                |  201 +
 assembly/release-fabric-lgpl.xml                |   41 +-
 assembly/release-fabric.xml                     |  177 +-
 assembly/release-hadoop-lgpl.xml                |   39 -
 config/fabric-lgpl/default-config.xml           |   29 +
 examples-lgpl/README.txt                        |   27 -
 examples-lgpl/config/example-cache.xml          |   73 -
 examples-lgpl/config/example-ignite.xml         |   83 -
 examples-lgpl/config/hibernate/README.txt       |    8 -
 .../hibernate/example-hibernate-L2-cache.xml    |   64 -
 examples-lgpl/pom-standalone.xml                |  186 -
 examples-lgpl/pom.xml                           |  128 -
 .../hibernate/HibernateL2CacheExample.java      |  245 -
 .../examples/datagrid/hibernate/Post.java       |  130 -
 .../examples/datagrid/hibernate/User.java       |  154 -
 .../datagrid/hibernate/package-info.java        |   22 -
 .../hibernate/CacheHibernatePersonStore.java    |  122 -
 .../hibernate/CacheHibernateStoreExample.java   |  151 -
 .../datagrid/store/hibernate/Person.hbm.xml     |   34 -
 .../datagrid/store/hibernate/hibernate.cfg.xml  |   41 -
 .../datagrid/store/hibernate/package-info.java  |   22 -
 .../misc/schedule/ComputeScheduleExample.java   |   82 -
 .../examples/misc/schedule/package-info.java    |   22 -
 .../misc/schedule/ComputeScheduleExample.java   |   68 -
 .../java8/misc/schedule/package-info.java       |   22 -
 .../ignite/examples/java8/package-info.java     |   23 -
 .../scalar/examples/ScalarScheduleExample.scala |   66 -
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |   31 -
 .../HibernateL2CacheExampleSelfTest.java        |   33 -
 .../IgniteLgplExamplesSelfTestSuite.java        |   48 -
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |   29 -
 .../HibernateL2CacheExampleSelfTest.java        |   37 -
 .../IgniteLgplExamplesJ8SelfTestSuite.java      |   46 -
 .../ScalarLgplExamplesMultiNodeSelfTest.scala   |   33 -
 .../examples/ScalarLgplExamplesSelfTest.scala   |   36 -
 .../ScalarLgplExamplesSelfTestSuite.scala       |   37 -
 examples/README-LGPL.txt                        |   33 +
 examples/README.txt                             |   21 +-
 examples/config/hibernate/README.txt            |    8 +
 .../hibernate/example-hibernate-L2-cache.xml    |   64 +
 examples/pom-standalone-lgpl.xml                |  217 +
 examples/pom-standalone.xml                     |  156 +-
 examples/pom.xml                                |  157 +-
 .../hibernate/HibernateL2CacheExample.java      |  245 +
 .../examples/datagrid/hibernate/Post.java       |  130 +
 .../examples/datagrid/hibernate/User.java       |  154 +
 .../datagrid/hibernate/package-info.java        |   22 +
 .../hibernate/CacheHibernatePersonStore.java    |  122 +
 .../hibernate/CacheHibernateStoreExample.java   |  151 +
 .../datagrid/store/hibernate/Person.hbm.xml     |   34 +
 .../datagrid/store/hibernate/hibernate.cfg.xml  |   41 +
 .../datagrid/store/hibernate/package-info.java  |   22 +
 .../misc/schedule/ComputeScheduleExample.java   |   82 +
 .../examples/misc/schedule/package-info.java    |   22 +
 ...ibernateL2CacheExampleMultiNodeSelfTest.java |   31 +
 .../HibernateL2CacheExampleSelfTest.java        |   33 +
 .../IgniteLgplExamplesSelfTestSuite.java        |   48 +
 .../ClientAbstractMultiThreadedSelfTest.java    |    3 +-
 .../apache/ignite/IgniteSystemProperties.java   |    9 +
 .../affinity/fair/FairAffinityFunction.java     |  497 +-
 .../rendezvous/RendezvousAffinityFunction.java  |  140 +-
 .../configuration/CacheConfiguration.java       |   30 +-
 .../configuration/TransactionConfiguration.java |    6 +-
 .../ignite/igniteobject/IgniteObject.java       |   16 +-
 .../internal/GridEventConsumeHandler.java       |   19 +-
 .../apache/ignite/internal/IgniteKernal.java    |   69 +-
 .../ignite/internal/IgniteNodeAttributes.java   |    5 +-
 .../deployment/GridDeploymentLocalStore.java    |    8 +-
 .../GridDeploymentPerLoaderStore.java           |    8 +-
 .../GridDeploymentPerVersionStore.java          |    8 +-
 .../portable/GridPortableMarshaller.java        |   26 +-
 .../internal/portable/IgniteObjectEx.java       |   33 +-
 .../internal/portable/IgniteObjectImpl.java     |  143 +-
 .../portable/IgniteObjectOffheapImpl.java       |   52 +-
 .../portable/IgniteObjectReaderExImpl.java      | 1827 +++-----
 .../portable/IgniteObjectWriterExImpl.java      |  617 ++-
 .../portable/PortableClassDescriptor.java       |  106 +-
 .../internal/portable/PortableContext.java      |  143 +-
 .../internal/portable/PortableFieldImpl.java    |   82 +
 .../portable/PortablePositionReadable.java      |   39 +
 .../portable/PortableReaderContext.java         |   37 +-
 .../internal/portable/PortableSchema.java       |  223 +
 .../portable/PortableSchemaRegistry.java        |  172 +
 .../ignite/internal/portable/PortableUtils.java |  159 +-
 .../builder/IgniteObjectBuilderImpl.java        |  198 +-
 .../portable/builder/PortableBuilderReader.java |   22 +-
 .../builder/PortableBuilderSerializer.java      |    6 +-
 .../portable/builder/PortableLazyArrayList.java |    6 +-
 .../builder/PortableLazyLinkedList.java         |    6 +-
 .../portable/builder/PortableLazyMap.java       |    6 +-
 .../portable/builder/PortableLazySet.java       |    4 +-
 .../streams/PortableAbstractInputStream.java    |   24 +-
 .../streams/PortableAbstractOutputStream.java   |   15 +
 .../streams/PortableHeapInputStream.java        |   12 +-
 .../streams/PortableHeapOutputStream.java       |    8 +
 .../portable/streams/PortableInputStream.java   |   12 +-
 .../streams/PortableOffheapInputStream.java     |   12 +-
 .../streams/PortableOffheapOutputStream.java    |    8 +
 .../portable/streams/PortableOutputStream.java  |    8 +
 .../processors/cache/CacheMetricsImpl.java      |   12 +-
 .../processors/cache/CacheObjectContext.java    |   17 +-
 .../processors/cache/GridCacheAdapter.java      |  459 +-
 .../processors/cache/GridCacheContext.java      |   10 +-
 .../processors/cache/GridCacheEntryEx.java      |   62 +-
 .../cache/GridCacheEvictionManager.java         |    5 +-
 .../cache/GridCacheEvictionRequest.java         |   18 +-
 .../cache/GridCacheEvictionResponse.java        |    7 +-
 .../processors/cache/GridCacheIoManager.java    |   62 +-
 .../processors/cache/GridCacheMapEntry.java     |  137 +-
 .../processors/cache/GridCacheMessage.java      |   72 +-
 .../processors/cache/GridCacheMvcc.java         |  143 +-
 .../cache/GridCacheMvccCandidate.java           |   26 +-
 .../processors/cache/GridCacheProcessor.java    |   26 -
 .../cache/GridCacheSharedContext.java           |    3 +
 .../processors/cache/GridCacheUtils.java        |   70 +-
 .../distributed/GridCacheTtlUpdateRequest.java  |    7 +-
 .../distributed/GridCacheTxRecoveryFuture.java  |    9 +-
 .../distributed/GridCacheTxRecoveryRequest.java |    8 +-
 .../GridCacheTxRecoveryResponse.java            |   10 +-
 .../distributed/GridDistributedBaseMessage.java |   16 +-
 .../distributed/GridDistributedCacheEntry.java  |   12 +-
 .../distributed/GridDistributedLockRequest.java |    8 +-
 .../GridDistributedLockResponse.java            |   20 +-
 .../GridDistributedTxFinishRequest.java         |    6 +-
 .../GridDistributedTxFinishResponse.java        |    7 +-
 .../GridDistributedTxPrepareRequest.java        |   13 +-
 .../GridDistributedTxPrepareResponse.java       |   12 +-
 .../GridDistributedTxRemoteAdapter.java         |   31 +-
 .../GridDistributedUnlockRequest.java           |    7 +-
 .../dht/CacheDistributedGetFutureAdapter.java   |  158 +
 .../dht/GridDhtAffinityAssignmentRequest.java   |    7 +-
 .../dht/GridDhtAffinityAssignmentResponse.java  |    7 +-
 .../distributed/dht/GridDhtCacheAdapter.java    |   20 +-
 .../distributed/dht/GridDhtCacheEntry.java      |   23 +-
 .../cache/distributed/dht/GridDhtGetFuture.java |  199 +-
 .../distributed/dht/GridDhtLockFuture.java      |   10 +-
 .../distributed/dht/GridDhtLockRequest.java     |    7 +-
 .../distributed/dht/GridDhtLockResponse.java    |   14 +-
 .../dht/GridDhtTransactionalCacheAdapter.java   |  127 +-
 .../distributed/dht/GridDhtTxFinishFuture.java  |    9 +-
 .../distributed/dht/GridDhtTxFinishRequest.java |    7 +-
 .../dht/GridDhtTxFinishResponse.java            |    2 +-
 .../cache/distributed/dht/GridDhtTxLocal.java   |    4 +-
 .../distributed/dht/GridDhtTxPrepareFuture.java |  118 +-
 .../dht/GridDhtTxPrepareRequest.java            |   28 +-
 .../dht/GridDhtTxPrepareResponse.java           |   13 +-
 .../distributed/dht/GridDhtUnlockRequest.java   |    7 +-
 .../dht/GridPartitionedGetFuture.java           |  182 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   28 +-
 .../GridDhtAtomicDeferredUpdateResponse.java    |   12 +-
 .../dht/atomic/GridDhtAtomicUpdateFuture.java   |    6 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |   25 +-
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |   11 +-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |   12 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |   31 +-
 .../atomic/GridNearAtomicUpdateResponse.java    |   11 +-
 .../dht/colocated/GridDhtColocatedCache.java    |  138 +-
 .../colocated/GridDhtColocatedLockFuture.java   |    9 +-
 .../dht/preloader/GridDhtForceKeysFuture.java   |    5 +-
 .../dht/preloader/GridDhtForceKeysRequest.java  |   35 +-
 .../dht/preloader/GridDhtForceKeysResponse.java |   11 +-
 .../GridDhtPartitionDemandMessage.java          |    5 +
 .../GridDhtPartitionSupplyMessage.java          |    9 +-
 .../preloader/GridDhtPartitionSupplyPool.java   |   10 +-
 .../GridDhtPartitionsAbstractMessage.java       |    7 +-
 .../dht/preloader/GridDhtPreloader.java         |    3 +-
 .../distributed/near/GridNearAtomicCache.java   |    2 -
 .../distributed/near/GridNearCacheAdapter.java  |   32 +-
 .../distributed/near/GridNearCacheEntry.java    |   81 +-
 .../distributed/near/GridNearGetFuture.java     |  333 +-
 .../distributed/near/GridNearGetRequest.java    |   15 +-
 .../distributed/near/GridNearGetResponse.java   |   12 +-
 .../distributed/near/GridNearLockFuture.java    |    3 +-
 .../distributed/near/GridNearLockRequest.java   |    8 +-
 .../distributed/near/GridNearLockResponse.java  |    8 +-
 ...arOptimisticSerializableTxPrepareFuture.java |  930 ++++
 .../near/GridNearOptimisticTxPrepareFuture.java |  255 +-
 ...ridNearOptimisticTxPrepareFutureAdapter.java |  222 +
 .../GridNearPessimisticTxPrepareFuture.java     |   11 +-
 .../near/GridNearTransactionalCache.java        |   22 +-
 .../near/GridNearTxFinishFuture.java            |   20 +-
 .../near/GridNearTxFinishRequest.java           |    7 +-
 .../near/GridNearTxFinishResponse.java          |    2 +-
 .../cache/distributed/near/GridNearTxLocal.java |  157 +-
 .../near/GridNearTxPrepareFutureAdapter.java    |   13 +-
 .../near/GridNearTxPrepareRequest.java          |    8 +-
 .../near/GridNearTxPrepareResponse.java         |    8 +-
 .../distributed/near/GridNearUnlockRequest.java |    7 +-
 .../cache/local/GridLocalCacheEntry.java        |   23 +-
 .../cache/local/GridLocalLockFuture.java        |    2 +
 .../local/atomic/GridLocalAtomicCache.java      |    9 -
 .../portable/CacheObjectPortableContext.java    |    6 +-
 .../CacheObjectPortableProcessorImpl.java       |   11 +-
 .../query/GridCacheDistributedQueryFuture.java  |    5 +-
 .../query/GridCacheDistributedQueryManager.java |   25 +-
 .../cache/query/GridCacheQueryRequest.java      |   46 +-
 .../cache/query/GridCacheQueryResponse.java     |   29 +-
 .../continuous/CacheContinuousQueryHandler.java |    8 +-
 .../continuous/CacheContinuousQueryManager.java |    6 +-
 .../cache/transactions/IgniteInternalTx.java    |    8 +-
 .../transactions/IgniteTransactionsImpl.java    |    6 -
 .../cache/transactions/IgniteTxAdapter.java     |  128 +-
 .../cache/transactions/IgniteTxEntry.java       |   59 +-
 .../cache/transactions/IgniteTxHandler.java     |   20 +-
 .../transactions/IgniteTxLocalAdapter.java      |  838 ++--
 .../cache/transactions/IgniteTxLocalEx.java     |   27 +-
 .../cache/transactions/IgniteTxManager.java     |  327 +-
 .../cache/version/GridCacheVersionManager.java  |   73 +-
 .../IgniteCacheObjectProcessorImpl.java         |    7 +-
 .../datastreamer/DataStreamerImpl.java          |    2 +-
 .../dotnet/PlatformDotNetCacheStore.java        |   53 +-
 .../PlatformDotNetConfigurationClosure.java     |    3 +-
 .../events/PlatformEventFilterListenerImpl.java |   31 +-
 .../PlatformBigEndianInputStreamImpl.java       |    9 +-
 .../PlatformBigEndianOutputStreamImpl.java      |    5 +
 .../memory/PlatformInputStreamImpl.java         |   12 +-
 .../memory/PlatformOutputStreamImpl.java        |    7 +
 .../platform/utils/PlatformUtils.java           |    1 -
 .../ignite/internal/util/lang/GridFunc.java     |    8 +-
 .../ignite/marshaller/AbstractMarshaller.java   |   12 +-
 .../ignite/marshaller/jdk/JdkMarshaller.java    |    7 +-
 .../optimized/OptimizedMarshaller.java          |   14 +-
 .../optimized/OptimizedMarshallerUtils.java     |   35 +-
 .../marshaller/portable/PortableMarshaller.java |    7 +-
 .../dotnet/PlatformDotNetCacheStoreFactory.java |   44 +-
 .../dotnet/PlatformDotNetLifecycleBean.java     |   49 +-
 ...PlatformDotNetPortableTypeConfiguration.java |   18 -
 .../apache/ignite/portable/PortableField.java   |   39 +
 .../ignite/spi/discovery/tcp/ServerImpl.java    |   52 +
 .../apache/ignite/transactions/Transaction.java |    2 +-
 .../transactions/TransactionIsolation.java      |    3 +-
 modules/core/src/test/config/tests.properties   |    4 +-
 .../AbstractAffinityFunctionSelfTest.java       |  293 ++
 .../affinity/AffinityClientNodeSelfTest.java    |  194 +
 ...ityFunctionBackupFilterAbstractSelfTest.java |  138 +
 ...unctionExcludeNeighborsAbstractSelfTest.java |  182 +
 .../affinity/IgniteClientNodeAffinityTest.java  |  194 -
 .../fair/FairAffinityDynamicCacheSelfTest.java  |   99 +
 ...airAffinityFunctionBackupFilterSelfTest.java |   35 +
 ...ffinityFunctionExcludeNeighborsSelfTest.java |   31 +
 .../fair/FairAffinityFunctionNodesSelfTest.java |  245 +
 .../fair/FairAffinityFunctionSelfTest.java      |   31 +
 .../GridFairAffinityFunctionNodesSelfTest.java  |  245 -
 .../fair/GridFairAffinityFunctionSelfTest.java  |  270 --
 .../IgniteFairAffinityDynamicCacheSelfTest.java |   97 -
 ...ousAffinityFunctionBackupFilterSelfTest.java |   35 +
 ...ffinityFunctionExcludeNeighborsSelfTest.java |   32 +
 .../RendezvousAffinityFunctionSelfTest.java     |   50 +
 .../GridDiscoveryManagerAttributesSelfTest.java |   46 +
 .../GridPortableMarshallerSelfTest.java         |   55 +-
 .../cache/CacheNearReaderUpdateTest.java        |  388 ++
 .../CacheSerializableTransactionsTest.java      | 4297 ++++++++++++++++++
 .../cache/CrossCacheTxRandomOperationsTest.java |   10 +-
 .../GridCacheAbstractFailoverSelfTest.java      |   14 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |    4 +-
 .../GridCacheAbstractLocalStoreSelfTest.java    |    5 +
 .../GridCacheAbstractRemoveFailureTest.java     |   94 +-
 ...eAtomicEntryProcessorDeploymentSelfTest.java |  211 +
 .../GridCacheConcurrentTxMultiNodeTest.java     |    3 -
 .../GridCacheConditionalDeploymentSelfTest.java |  190 +
 ...idCacheConfigurationConsistencySelfTest.java |   17 -
 .../GridCacheDeploymentOffHeapSelfTest.java     |   17 +-
 .../cache/GridCacheDeploymentSelfTest.java      |   26 +-
 .../cache/GridCacheMvccFlagsTest.java           |    6 +-
 .../cache/GridCacheMvccPartitionedSelfTest.java |  164 +
 .../processors/cache/GridCacheMvccSelfTest.java |    3 +-
 .../processors/cache/GridCacheTestEntryEx.java  |   53 +-
 ...ctionalEntryProcessorDeploymentSelfTest.java |   31 +
 .../cache/IgniteCacheCreateRestartSelfTest.java |    4 +-
 .../IgniteCacheEntryListenerAbstractTest.java   |   50 +-
 .../processors/cache/IgniteTxAbstractTest.java  |   42 +-
 .../IgniteTxMultiThreadedAbstractTest.java      |  106 +-
 .../IgniteCountDownLatchAbstractSelfTest.java   |    4 +-
 ...PartitionedQueueCreateMultiNodeSelfTest.java |    5 +-
 ...IgnitePartitionedCountDownLatchSelfTest.java |    7 +-
 ...dCachePartitionedAffinityFilterSelfTest.java |  143 -
 ...onedNearDisabledTxMultiThreadedSelfTest.java |   31 +
 ...niteCacheClientNodeChangingTopologyTest.java |  170 +-
 .../dht/GridCacheDhtPreloadPutGetSelfTest.java  |    3 +
 .../IgniteCacheCrossCacheTxFailoverTest.java    |   19 +
 .../dht/IgniteCacheLockFailoverSelfTest.java    |   11 +
 ...eAtomicInvalidPartitionHandlingSelfTest.java |    6 +-
 ...unctionExcludeNeighborsAbstractSelfTest.java |  184 -
 ...omicMultiNodeP2PDisabledFullApiSelfTest.java |    7 +-
 ...omicNearEnabledMultiNodeFullApiSelfTest.java |    7 +-
 .../near/GridCacheNearTxExceptionSelfTest.java  |    1 +
 ...CachePartitionedTxMultiThreadedSelfTest.java |   15 +-
 ...ffinityFunctionExcludeNeighborsSelfTest.java |   32 -
 ...xcludeNeighborsMultiNodeFullApiSelfTest.java |   36 +
 ...tedFairAffinityMultiNodeFullApiSelfTest.java |   35 +
 ...xcludeNeighborsMultiNodeFullApiSelfTest.java |   36 +
 ...dezvousAffinityMultiNodeFullApiSelfTest.java |   36 +
 .../DataStreamerUpdateAfterLoadTest.java        |  184 +
 .../loadtests/hashmap/GridHashMapLoadTest.java  |    6 +-
 .../communication/GridCacheMessageSelfTest.java |   17 +-
 .../tcp/TcpClientDiscoverySpiSelfTest.java      |    4 +-
 .../inmemory/GridTestSwapSpaceSpi.java          |    8 +
 .../ignite/testframework/GridTestUtils.java     |   19 +-
 .../junits/common/GridCommonAbstractTest.java   |   19 +-
 .../ignite/testsuites/IgniteBasicTestSuite.java |    4 +-
 .../IgniteCacheFullApiSelfTestSuite.java        |    8 +
 .../ignite/testsuites/IgniteCacheTestSuite.java |   38 +-
 .../testsuites/IgniteCacheTestSuite2.java       |   14 +-
 .../testsuites/IgniteCacheTestSuite3.java       |    8 +-
 .../testsuites/IgniteCacheTestSuite5.java       |   40 +
 .../testsuites/IgniteP2PSelfTestSuite.java      |   16 +-
 .../p2p/CacheDeploymentEntryProcessor.java      |   35 +
 .../CacheDeploymentPortableEntryProcessor.java  |   35 +
 modules/extdata/uri/pom.xml                     |   21 +-
 .../cache/IgniteCacheAbstractQuerySelfTest.java |    4 +
 ...niteCacheP2pUnmarshallingQueryErrorTest.java |   32 +-
 modules/jms11/pom.xml                           |    9 +-
 .../stream/jms11/IgniteJmsStreamerTest.java     |    9 +-
 .../apache/ignite/stream/mqtt/MqttStreamer.java |  386 +-
 .../stream/mqtt/IgniteMqttStreamerTest.java     |  142 +-
 .../mqtt/IgniteMqttStreamerTestSuite.java       |    4 +-
 modules/platforms/cpp/README.txt                |   12 +-
 .../cpp/core-test/src/cache_query_test.cpp      |  214 +-
 .../src/portable_reader_writer_test.cpp         |  555 ++-
 modules/platforms/cpp/core/Makefile.am          |    1 +
 modules/platforms/cpp/core/include/Makefile.am  |    5 +
 .../cpp/core/include/ignite/cache/cache.h       |   33 +
 .../cpp/core/include/ignite/cache/query/query.h |    1 +
 .../include/ignite/cache/query/query_cursor.h   |   11 +-
 .../ignite/cache/query/query_fields_cursor.h    |  153 +
 .../ignite/cache/query/query_fields_row.h       |  154 +
 .../core/include/ignite/cache/query/query_sql.h |   76 +-
 .../ignite/cache/query/query_sql_fields.h       |  210 +
 .../core/include/ignite/impl/cache/cache_impl.h |   10 +
 .../impl/cache/query/query_fields_row_impl.h    |  174 +
 .../ignite/impl/cache/query/query_impl.h        |   10 +
 .../ignite/impl/interop/interop_output_stream.h |    8 +
 .../ignite/impl/portable/portable_common.h      |   33 +-
 .../ignite/impl/portable/portable_reader_impl.h |  241 +-
 .../ignite/impl/portable/portable_schema.h      |  114 +
 .../ignite/impl/portable/portable_writer_impl.h |  105 +-
 .../platforms/cpp/core/project/vs/core.vcxproj  |    6 +
 .../cpp/core/project/vs/core.vcxproj.filters    |   18 +
 .../cpp/core/src/impl/cache/cache_impl.cpp      |    5 +
 .../core/src/impl/cache/query/query_impl.cpp    |   39 +-
 .../src/impl/interop/interop_input_stream.cpp   |    2 +-
 .../src/impl/interop/interop_output_stream.cpp  |   11 +
 .../src/impl/portable/portable_reader_impl.cpp  |  218 +-
 .../core/src/impl/portable/portable_schema.cpp  |   88 +
 .../src/impl/portable/portable_writer_impl.cpp  |  100 +-
 modules/platforms/cpp/examples/README.txt       |    4 +-
 .../Portable/PortableWriteBenchmark.cs          |    4 +-
 .../Config/Cache/Store/cache-store-session.xml  |    3 +-
 .../Config/Lifecycle/lifecycle-beans.xml        |    4 +-
 .../native-client-test-cache-parallel-store.xml |    3 +-
 .../Config/native-client-test-cache-store.xml   |   12 +-
 .../Apache.Ignite.Core.csproj                   |    5 +
 .../dotnet/Apache.Ignite.Core/Ignition.cs       |    7 +-
 .../Impl/Cache/Store/CacheStore.cs              |    3 +-
 .../Apache.Ignite.Core/Impl/Common/Fnv1Hash.cs  |   54 +
 .../Impl/Common/ResizeableArray.cs              |   70 +
 .../Apache.Ignite.Core/Impl/IgniteUtils.cs      |   14 +-
 .../Impl/Memory/PlatformMemoryStream.cs         |   35 +-
 .../Impl/Portable/IPortableTypeDescriptor.cs    |    5 +
 .../Impl/Portable/Io/IPortableStream.cs         |    8 +-
 .../Impl/Portable/Io/PortableAbstractStream.cs  |   72 +-
 .../Impl/Portable/Io/PortableHeapStream.cs      |   99 +-
 .../Impl/Portable/PortableBuilderImpl.cs        |  145 +-
 .../Impl/Portable/PortableFullTypeDescriptor.cs |    9 +
 .../Impl/Portable/PortableMarshaller.cs         |    7 +-
 .../Impl/Portable/PortableObjectHeader.cs       |  343 ++
 .../Impl/Portable/PortableObjectSchema.cs       |   98 +
 .../Impl/Portable/PortableObjectSchemaField.cs  |  113 +
 .../Impl/Portable/PortableReaderImpl.cs         |  173 +-
 .../Portable/PortableSurrogateTypeDescriptor.cs |    9 +
 .../Impl/Portable/PortableUserObject.cs         |   82 +-
 .../Impl/Portable/PortableUtils.cs              |  147 +-
 .../Impl/Portable/PortableWriterImpl.cs         |  164 +-
 .../Impl/Portable/PortablesImpl.cs              |   16 +-
 .../Structure/PortableStructureTracker.cs       |    8 +
 .../Portable/PortableTypeConfiguration.cs       |   62 +-
 modules/platforms/dotnet/Apache.Ignite.sln      |    4 +
 .../examples/Config/example-cache-store.xml     |    3 +-
 modules/spark-2.10/pom.xml                      |    4 +-
 modules/spark/pom.xml                           |    4 +-
 .../config/benchmark-multicast.properties       |    5 +-
 .../yardstick/IgniteBenchmarkArguments.java     |   11 +
 .../IgniteAccountSerializableTxBenchmark.java   |   81 +
 .../cache/IgniteAccountTxAbstractBenchmark.java |   61 +
 .../cache/IgniteAccountTxBenchmark.java         |   74 +
 .../cache/IgniteCacheAbstractBenchmark.java     |   68 +
 .../IgnitePutAllSerializableTxBenchmark.java    |   77 +
 .../cache/IgnitePutAllTxBenchmark.java          |    6 +-
 .../ignite/yardstick/cache/model/Account.java   |   42 +
 .../ipfinder/zk/ZookeeperIpFinderTestSuite.java |   32 +
 parent/pom.xml                                  |    9 +-
 pom.xml                                         |   64 -
 395 files changed, 21100 insertions(+), 9912 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b5c70a94/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 91ad609,ae3f21f..fa1aaab
--- 
a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@@ -18,22 -18,9 +18,23 @@@
  package org.apache.ignite.configuration;
  
  import java.io.Serializable;
 +import java.lang.reflect.AccessibleObject;
 +import java.lang.reflect.Field;
 +import java.lang.reflect.Member;
 +import java.lang.reflect.Method;
 +import java.util.ArrayList;
 +import java.util.Arrays;
  import java.util.Collection;
 +import java.util.Collections;
 +import java.util.Comparator;
 +import java.util.HashMap;
 +import java.util.HashSet;
 +import java.util.LinkedHashMap;
 +import java.util.Map;
 +import java.util.TreeSet;
  import javax.cache.Cache;
 +import javax.cache.CacheException;
+ import javax.cache.configuration.CacheEntryListenerConfiguration;
  import javax.cache.configuration.CompleteConfiguration;
  import javax.cache.configuration.Factory;
  import javax.cache.configuration.MutableConfiguration;
@@@ -2182,318 -1908,10 +2208,318 @@@ public class CacheConfiguration<K, V> e
  
          /** {@inheritDoc} */
          @Override public boolean equals(Object obj) {
 -            if (obj == null)
 -                return false;
 +            return obj != null && obj.getClass().equals(this.getClass());
 +        }
 +    }
 +
 +    /**
 +     * Descriptor of type.
 +     */
 +    private static class TypeDescriptor {
 +        /** Value field names and types with preserved order. */
 +        @GridToStringInclude
 +        private final Map<String, Class<?>> fields = new LinkedHashMap<>();
 +
 +        /** */
 +        @GridToStringExclude
 +        private final Map<String, ClassProperty> props = new 
LinkedHashMap<>();
 +
 +        /** */
 +        @GridToStringInclude
 +        private final Map<String, IndexDescriptor> indexes = new HashMap<>();
 +
 +        /** */
 +        private IndexDescriptor fullTextIdx;
 +
 +        /** */
 +        private Class<?> keyCls;
 +
 +        /** */
 +        private Class<?> valCls;
 +
 +        /** */
 +        private boolean valTextIdx;
 +
 +        /**
 +         * @return Indexes.
 +         */
 +        public Map<String, GridQueryIndexDescriptor> indexes() {
 +            return Collections.<String, 
GridQueryIndexDescriptor>unmodifiableMap(indexes);
 +        }
 +
 +        /**
 +         * Adds index.
 +         *
 +         * @param idxName Index name.
 +         * @param type Index type.
 +         * @return Index descriptor.
 +         */
 +        public IndexDescriptor addIndex(String idxName, GridQueryIndexType 
type) {
 +            IndexDescriptor idx = new IndexDescriptor(type);
 +
 +            if (indexes.put(idxName, idx) != null)
 +                throw new CacheException("Index with name '" + idxName + "' 
already exists.");
 +
 +            return idx;
 +        }
 +
 +        /**
 +         * Adds field to index.
 +         *
 +         * @param idxName Index name.
 +         * @param field Field name.
 +         * @param orderNum Fields order number in index.
 +         * @param descending Sorting order.
 +         */
 +        public void addFieldToIndex(String idxName, String field, int 
orderNum,
 +            boolean descending) {
 +            IndexDescriptor desc = indexes.get(idxName);
 +
 +            if (desc == null)
 +                desc = addIndex(idxName, SORTED);
 +
 +            desc.addField(field, orderNum, descending);
 +        }
 +
 +        /**
 +         * Adds field to text index.
 +         *
 +         * @param field Field name.
 +         */
 +        public void addFieldToTextIndex(String field) {
 +            if (fullTextIdx == null) {
 +                fullTextIdx = new IndexDescriptor(FULLTEXT);
 +
 +                indexes.put(null, fullTextIdx);
 +            }
 +
 +            fullTextIdx.addField(field, 0, false);
 +        }
 +
 +        /**
 +         * @return Value class.
 +         */
 +        public Class<?> valueClass() {
 +            return valCls;
 +        }
 +
 +        /**
 +         * Sets value class.
 +         *
 +         * @param valCls Value class.
 +         */
 +        void valueClass(Class<?> valCls) {
 +            this.valCls = valCls;
 +        }
 +
 +        /**
 +         * @return Key class.
 +         */
 +        public Class<?> keyClass() {
 +            return keyCls;
 +        }
 +
 +        /**
 +         * Set key class.
 +         *
 +         * @param keyCls Key class.
 +         */
 +        void keyClass(Class<?> keyCls) {
 +            this.keyCls = keyCls;
 +        }
 +
 +        /**
 +         * Adds property to the type descriptor.
 +         *
 +         * @param prop Property.
 +         * @param failOnDuplicate Fail on duplicate flag.
 +         */
 +        public void addProperty(ClassProperty prop, boolean failOnDuplicate) {
 +            String name = prop.fullName();
 +
 +            if (props.put(name, prop) != null && failOnDuplicate)
 +                throw new CacheException("Property with name '" + name + "' 
already exists.");
 +
 +            fields.put(name, prop.type());
 +        }
 +
 +        /**
 +         * @return {@code true} If we need to have a fulltext index on value.
 +         */
 +        public boolean valueTextIndex() {
 +            return valTextIdx;
 +        }
 +
 +        /**
 +         * Sets if this value should be text indexed.
 +         *
 +         * @param valTextIdx Flag value.
 +         */
 +        public void valueTextIndex(boolean valTextIdx) {
 +            this.valTextIdx = valTextIdx;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public String toString() {
 +            return S.toString(TypeDescriptor.class, this);
 +        }
 +    }
 +
 +    /**
 +     * Index descriptor.
 +     */
 +    private static class IndexDescriptor implements GridQueryIndexDescriptor {
 +        /** Fields sorted by order number. */
 +        private final Collection<T2<String, Integer>> fields = new TreeSet<>(
 +            new Comparator<T2<String, Integer>>() {
 +                @Override public int compare(T2<String, Integer> o1, 
T2<String, Integer> o2) {
 +                    if (o1.get2().equals(o2.get2())) // Order is equal, 
compare field names to avoid replace in Set.
 +                        return o1.get1().compareTo(o2.get1());
 +
 +                    return o1.get2() < o2.get2() ? -1 : 1;
 +                }
 +            });
 +
 +        /** Fields which should be indexed in descending order. */
 +        private Collection<String> descendings;
 +
 +        /** */
 +        private final GridQueryIndexType type;
 +
 +        /**
 +         * @param type Type.
 +         */
 +        private IndexDescriptor(GridQueryIndexType type) {
 +            assert type != null;
 +
 +            this.type = type;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public Collection<String> fields() {
 +            Collection<String> res = new ArrayList<>(fields.size());
 +
 +            for (T2<String, Integer> t : fields)
 +                res.add(t.get1());
 +
 +            return res;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public boolean descending(String field) {
 +            return descendings != null && descendings.contains(field);
 +        }
 +
 +        /**
 +         * Adds field to this index.
 +         *
 +         * @param field Field name.
 +         * @param orderNum Field order number in this index.
 +         * @param descending Sort order.
 +         */
 +        public void addField(String field, int orderNum, boolean descending) {
 +            fields.add(new T2<>(field, orderNum));
 +
 +            if (descending) {
 +                if (descendings == null)
 +                    descendings  = new HashSet<>();
 +
 +                descendings.add(field);
 +            }
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public GridQueryIndexType type() {
 +            return type;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public String toString() {
 +            return S.toString(IndexDescriptor.class, this);
 +        }
 +    }
 +
 +    /**
 +     * Description of type property.
 +     */
 +    private static class ClassProperty {
 +        /** */
 +        private final Member member;
 +
 +        /** */
 +        private ClassProperty parent;
 +
 +        /** */
 +        private String name;
 +
 +        /** */
 +        private String alias;
 +
 +        /**
 +         * Constructor.
 +         *
 +         * @param member Element.
 +         */
 +        ClassProperty(Member member) {
 +            this.member = member;
 +
 +            name = member instanceof Method && 
member.getName().startsWith("get") && member.getName().length() > 3 ?
 +                member.getName().substring(3) : member.getName();
 +
 +            ((AccessibleObject) member).setAccessible(true);
 +        }
 +
 +        /**
 +         * @param alias Alias.
 +         */
 +        public void alias(String alias) {
 +            this.alias = alias;
 +        }
 +
 +        /**
 +         * @return Alias.
 +         */
 +        String alias() {
 +            return F.isEmpty(alias) ? name : alias;
 +        }
 +
 +        /**
 +         * @return Type.
 +         */
 +        public Class<?> type() {
 +            return member instanceof Field ? ((Field)member).getType() : 
((Method)member).getReturnType();
 +        }
 +
 +        /**
 +         * @param parent Parent property if this is embeddable element.
 +         */
 +        public void parent(ClassProperty parent) {
 +            this.parent = parent;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public String toString() {
 +            return S.toString(ClassProperty.class, this);
 +        }
 +
 +        /**
 +         * @param cls Class.
 +         * @return {@code true} If this property or some parent relates to 
member of the given class.
 +         */
 +        public boolean knowsClass(Class<?> cls) {
 +            return member.getDeclaringClass() == cls || (parent != null && 
parent.knowsClass(cls));
 +        }
 +
 +        /**
 +         * @return Full name with all parents in dot notation.
 +         */
 +        public String fullName() {
 +            assert name != null;
 +
 +            if (parent == null)
 +                return name;
  
 -            return obj.getClass().equals(this.getClass());
 +            return parent.fullName() + '.' + name;
          }
      }
- }
+ }

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5c70a94/modules/core/src/main/java/org/apache/ignite/igniteobject/IgniteObject.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/main/java/org/apache/ignite/igniteobject/IgniteObject.java
index c3ba1c1,0000000..844f7bf
mode 100644,000000..100644
--- 
a/modules/core/src/main/java/org/apache/ignite/igniteobject/IgniteObject.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/igniteobject/IgniteObject.java
@@@ -1,153 -1,0 +1,163 @@@
 +/*
 + * 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.igniteobject;
 +
- import java.io.Serializable;
 +import java.util.ArrayList;
 +import java.util.HashMap;
 +import java.util.LinkedList;
 +import java.util.TreeMap;
++import org.apache.ignite.IgnitePortables;
++import org.apache.ignite.cache.IgniteObject;
 +import org.apache.ignite.marshaller.portable.PortableMarshaller;
 +import org.jetbrains.annotations.Nullable;
 +
 +/**
 + * Wrapper for portable object in portable binary format. Once an object is 
defined as portable,
 + * Ignite will always store it in memory in the portable (i.e. binary) format.
 + * User can choose to work either with the portable format or with the 
deserialized form
 + * (assuming that class definitions are present in the classpath).
 + * <p>
 + * <b>NOTE:</b> user does not need to (and should not) implement this 
interface directly.
 + * <p>
 + * To work with the portable format directly, user should create a cache 
projection
 + * over {@code PortableObject} class and then retrieve individual fields as 
needed:
 + * <pre name=code class=java>
 + * IgniteCache&lt;PortableObject, PortableObject&gt; prj = 
cache.withKeepBinary();
 + *
 + * // Convert instance of MyKey to portable format.
 + * // We could also use GridPortableBuilder to create the key in portable 
format directly.
 + * PortableObject key = grid.portables().toPortable(new MyKey());
 + *
 + * PortableObject val = prj.get(key);
 + *
 + * String field = val.field("myFieldName");
 + * </pre>
 + * Alternatively, if we have class definitions in the classpath, we may 
choose to work with deserialized
 + * typed objects at all times. In this case we do incur the deserialization 
cost. However, if
 + * {@link PortableMarshaller#isKeepDeserialized()} is {@code true} then 
Ignite will only deserialize on the first access
 + * and will cache the deserialized object, so it does not have to be 
deserialized again:
 + * <pre name=code class=java>
 + * IgniteCache&lt;MyKey.class, MyValue.class&gt; cache = grid.cache(null);
 + *
 + * MyValue val = cache.get(new MyKey());
 + *
 + * // Normal java getter.
 + * String fieldVal = val.getMyFieldName();
 + * </pre>
 + * <h1 class="header">Working With Maps and Collections</h1>
 + * All maps and collections in the portable objects are serialized 
automatically. When working
 + * with different platforms, e.g. C++ or .NET, Ignite will automatically pick 
the most
 + * adequate collection or map in either language. For example, {@link 
ArrayList} in Java will become
 + * {@code List} in C#, {@link LinkedList} in Java is {@link LinkedList} in 
C#, {@link HashMap}
 + * in Java is {@code Dictionary} in C#, and {@link TreeMap} in Java becomes 
{@code SortedDictionary}
 + * in C#, etc.
 + * <h1 class="header">Dynamic Structure Changes</h1>
 + * Since objects are always cached in the portable binary format, server does 
not need to
 + * be aware of the class definitions. Moreover, if class definitions are not 
present or not
 + * used on the server, then clients can continuously change the structure of 
the portable
 + * objects without having to restart the cluster. For example, if one client 
stores a
 + * certain class with fields A and B, and another client stores the same 
class with
 + * fields B and C, then the server-side portable object will have the fields 
A, B, and C.
 + * As the structure of a portable object changes, the new fields become 
available for SQL queries
 + * automatically.
 + * <h1 class="header">Building Portable Objects</h1>
 + * Ignite comes with {@link IgniteObjectBuilder} which allows to build 
portable objects dynamically:
 + * <pre name=code class=java>
 + * PortableBuilder builder = 
Ignition.ignite().portables().builder("org.project.MyObject");
 + *
 + * builder.setField("fieldA", "A");
 + * builder.setField("fieldB", "B");
 + *
 + * PortableObject portableObj = builder.build();
 + * </pre>
 + * For the cases when class definition is present
 + * in the class path, it is also possible to populate a standard POJO and then
 + * convert it to portable format, like so:
 + * <pre name=code class=java>
 + * MyObject obj = new MyObject();
 + *
 + * obj.setFieldA("A");
 + * obj.setFieldB(123);
 + *
 + * PortableObject portableObj = Ignition.ignite().portables().toPortable(obj);
 + * </pre>
 + * <h1 class="header">Portable Metadata</h1>
 + * Even though Ignite portable protocol only works with hash codes for type 
and field names
 + * to achieve better performance, Ignite provides metadata for all portable 
types which
 + * can be queried ar runtime via any of the {@link 
org.apache.ignite.IgniteObjects#metadata(Class)}
 + * methods. Having metadata also allows for proper formatting of {@code 
PortableObject.toString()} method,
 + * even when portable objects are kept in binary format only, which may be 
necessary for audit reasons.
 + */
 +public interface IgniteObject extends Serializable, Cloneable {
 +    /**
 +     * Gets portable object type ID.
 +     *
 +     * @return Type ID.
 +     */
-     public int typeId();
++    @Override public int typeId();
 +
 +    /**
 +     * Gets meta data for this portable object.
 +     *
 +     * @return Meta data.
 +     * @throws IgniteObjectException In case of error.
 +     */
 +    @Nullable public IgniteObjectMetadata metaData() throws 
IgniteObjectException;
 +
 +    /**
 +     * Gets field value.
 +     *
 +     * @param fieldName Field name.
 +     * @return Field value.
 +     * @throws IgniteObjectException In case of any other error.
 +     */
 +    @Nullable public <F> F field(String fieldName) throws 
IgniteObjectException;
 +
 +    /**
 +     * Checks whether field is set.
 +     *
 +     * @param fieldName Field name.
 +     * @return {@code true} if field is set.
 +     */
-     public boolean hasField(String fieldName);
++    @Override public boolean hasField(String fieldName);
++
++    /**
++     * Gets field descriptor.
++     *
++     * @param fieldName Field name.
++     * @return Field descriptor.
++     * @throws PortableException If failed.
++     */
++    public PortableField fieldDescriptor(String fieldName) throws 
PortableException;
 +
 +    /**
 +     * Gets fully deserialized instance of portable object.
 +     *
 +     * @return Fully deserialized instance of portable object.
 +     * @throws IgniteObjectInvalidClassException If class doesn't exist.
 +     * @throws IgniteObjectException In case of any other error.
 +     */
 +    @Nullable public <T> T deserialize() throws IgniteObjectException;
 +
 +    /**
 +     * Copies this portable object.
 +     *
 +     * @return Copy of this portable object.
 +     */
 +    public IgniteObject clone() throws CloneNotSupportedException;
 +}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5c70a94/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5c70a94/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
index 2bd121c,9afe2ee..1752500
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
@@@ -228,16 -231,15 +231,15 @@@ public class GridPortableMarshaller 
  
      /**
       * @param obj Object to marshal.
-      * @param off Offset.
       * @return Byte array.
-      * @throws org.apache.ignite.igniteobject.IgniteObjectException In case 
of error.
 -     * @throws PortableException In case of error.
++.     * @throws org.apache.ignite.igniteobject.IgniteObjectException In case 
of error.
       */
-     public byte[] marshal(@Nullable Object obj, int off) throws 
IgniteObjectException {
 -    public byte[] marshal(@Nullable Object obj) throws PortableException {
++    public byte[] marshal(@Nullable Object obj) throws IgniteObjectException {
          if (obj == null)
              return new byte[] { NULL };
  
-         try (IgniteObjectWriterExImpl writer = new 
IgniteObjectWriterExImpl(ctx, off)) {
 -        try (PortableWriterExImpl writer = new PortableWriterExImpl(ctx)) {
 -            writer.marshal(obj);
++        try (IgniteObjectWriterExImpl writer = new 
IgniteObjectWriterExImpl(ctx)) {
 +            writer.marshal(obj, false);
  
              return writer.array();
          }
@@@ -292,8 -294,8 +294,8 @@@
       * @param out Output stream.
       * @return Writer.
       */
 -    public PortableWriterExImpl writer(PortableOutputStream out) {
 -        return new PortableWriterExImpl(ctx, out);
 +    public IgniteObjectWriterExImpl writer(PortableOutputStream out) {
-         return new IgniteObjectWriterExImpl(ctx, out, 0);
++        return new IgniteObjectWriterExImpl(ctx, out);
      }
  
      /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5c70a94/modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectEx.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectEx.java
index e10b048,0000000..078f67f
mode 100644,000000..100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectEx.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectEx.java
@@@ -1,214 -1,0 +1,245 @@@
 +/*
 + * 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.internal.portable;
 +
 +import java.math.BigDecimal;
 +import java.util.Arrays;
 +import java.util.IdentityHashMap;
 +import org.apache.ignite.IgniteException;
 +import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
 +import org.apache.ignite.internal.util.typedef.internal.SB;
 +import org.apache.ignite.igniteobject.IgniteObjectException;
 +import org.apache.ignite.igniteobject.IgniteObjectMetadata;
 +import org.apache.ignite.igniteobject.IgniteObject;
 +import org.jetbrains.annotations.Nullable;
 +
 +/**
 + * Internal portable object interface.
 + */
 +public abstract class IgniteObjectEx implements IgniteObject {
 +    /**
 +     * @return Length.
 +     */
 +    public abstract int length();
 +
 +    /**
 +     * @return Object start.
 +     */
 +    public abstract int start();
 +
 +    /**
 +     * @return {@code True} if object is array based.
 +     */
 +    protected abstract boolean hasArray();
 +
 +    /**
 +     * @return Object array if object is array based, otherwise {@code null}.
 +     */
 +    public abstract byte[] array();
 +
 +    /**
 +     * @return Object offheap address is object is offheap based, otherwise 0.
 +     */
 +    public abstract long offheapAddress();
 +
 +    /**
++     * Gets field value.
++     *
++     * @param fieldId Field ID.
++     * @return Field value.
++     * @throws PortableException In case of any other error.
++     */
++    @Nullable public abstract <F> F field(int fieldId) throws 
PortableException;
++
++    /**
++     * Get field by offset.
++     *
++     * @param fieldOffset Field offset.
++     * @return Field value.
++     */
++    @Nullable protected abstract <F> F fieldByOffset(int fieldOffset);
++
++    /**
 +     * @param ctx Reader context.
 +     * @param fieldName Field name.
-      * @return Field name.
++     * @return Field value.
 +     */
 +    @Nullable protected abstract <F> F field(PortableReaderContext ctx, 
String fieldName);
 +
++    /**
++     * Get schema ID.
++     *
++     * @return Schema ID.
++     */
++    protected abstract int schemaId();
++
++    /**
++     * Create schema for object.
++     *
++     * @return Schema.
++     */
++    protected abstract PortableSchema createSchema();
++
 +    /** {@inheritDoc} */
 +    @Override public IgniteObject clone() throws CloneNotSupportedException {
 +        return (IgniteObject)super.clone();
 +    }
 +
 +    /** {@inheritDoc} */
 +    public boolean equals(Object other) {
 +        if (other == this)
 +            return true;
 +
 +        if (other == null)
 +            return false;
 +
 +        if (!(other instanceof IgniteObjectEx))
 +            return false;
 +
 +        IgniteObjectEx otherPo = (IgniteObjectEx)other;
 +
 +        if (length() != otherPo.length() || typeId() != otherPo.typeId())
 +            return false;
 +
 +        if (hasArray()) {
 +            if (otherPo.hasArray()) {
 +                int len = length();
 +                int end = start() + len;
 +
 +                byte[] arr = array();
 +                byte[] otherArr = otherPo.array();
 +
 +                for (int i = start(), j = otherPo.start(); i < end; i++, j++) 
{
 +                    if (arr[i] != otherArr[j])
 +                        return false;
 +                }
 +
 +                return true;
 +            }
 +            else {
 +                assert otherPo.offheapAddress() > 0;
 +
 +                return GridUnsafeMemory.compare(otherPo.offheapAddress() + 
otherPo.start(), array());
 +            }
 +        }
 +        else {
 +            assert offheapAddress() > 0;
 +
 +            if (otherPo.hasArray())
 +                return GridUnsafeMemory.compare(offheapAddress() + start(), 
otherPo.array());
 +            else {
 +                assert otherPo.offheapAddress() > 0;
 +
 +                return GridUnsafeMemory.compare(offheapAddress() + start(),
 +                    otherPo.offheapAddress() + otherPo.start(),
 +                    length());
 +            }
 +        }
 +    }
 +
 +    /**
 +     * @param ctx Reader context.
 +     * @param handles Handles for already traversed objects.
 +     * @return String representation.
 +     */
 +    private String toString(PortableReaderContext ctx, 
IdentityHashMap<IgniteObject, Integer> handles) {
 +        int idHash = System.identityHashCode(this);
 +
 +        IgniteObjectMetadata meta;
 +
 +        try {
 +            meta = metaData();
 +        }
 +        catch (IgniteObjectException ignore) {
 +            meta = null;
 +        }
 +
 +        if (meta == null)
 +            return "PortableObject [hash=" + idHash + ", typeId=" + typeId() 
+ ']';
 +
 +        handles.put(this, idHash);
 +
 +        SB buf = new SB(meta.typeName());
 +
 +        if (meta.fields() != null) {
 +            buf.a(" [hash=").a(idHash);
 +
 +            for (String name : meta.fields()) {
 +                Object val = field(ctx, name);
 +
 +                buf.a(", ").a(name).a('=');
 +
 +                if (val instanceof byte[])
 +                    buf.a(Arrays.toString((byte[]) val));
 +                else if (val instanceof short[])
 +                    buf.a(Arrays.toString((short[])val));
 +                else if (val instanceof int[])
 +                    buf.a(Arrays.toString((int[])val));
 +                else if (val instanceof long[])
 +                    buf.a(Arrays.toString((long[])val));
 +                else if (val instanceof float[])
 +                    buf.a(Arrays.toString((float[])val));
 +                else if (val instanceof double[])
 +                    buf.a(Arrays.toString((double[])val));
 +                else if (val instanceof char[])
 +                    buf.a(Arrays.toString((char[])val));
 +                else if (val instanceof boolean[])
 +                    buf.a(Arrays.toString((boolean[]) val));
 +                else if (val instanceof BigDecimal[])
 +                    buf.a(Arrays.toString((BigDecimal[])val));
 +                else {
 +                    if (val instanceof IgniteObjectEx) {
 +                        IgniteObjectEx po = (IgniteObjectEx)val;
 +
 +                        Integer idHash0 = handles.get(val);
 +
 +                        if (idHash0 != null) {  // Circular reference.
 +                            IgniteObjectMetadata meta0 = po.metaData();
 +
 +                            assert meta0 != null;
 +
 +                            buf.a(meta0.typeName()).a(" 
[hash=").a(idHash0).a(", ...]");
 +                        }
 +                        else
 +                            buf.a(po.toString(ctx, handles));
 +                    }
 +                    else
 +                        buf.a(val);
 +                }
 +            }
 +
 +            buf.a(']');
 +        }
 +
 +        return buf.toString();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public String toString() {
 +        try {
 +            PortableReaderContext ctx = new PortableReaderContext();
 +
 +            ctx.setPortableHandler(start(), this);
 +
 +            return toString(ctx, new IdentityHashMap<IgniteObject, 
Integer>());
 +        }
 +        catch (IgniteObjectException e) {
 +            throw new IgniteException("Failed to create string representation 
of portable object.", e);
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5c70a94/modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectImpl.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectImpl.java
index 412ae19,0000000..3303ad9
mode 100644,000000..100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectImpl.java
@@@ -1,411 -1,0 +1,540 @@@
 +/*
 + * 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.internal.portable;
 +
- import java.io.Externalizable;
- import java.io.IOException;
- import java.io.ObjectInput;
- import java.io.ObjectOutput;
- import java.nio.ByteBuffer;
 +import org.apache.ignite.IgniteCheckedException;
 +import org.apache.ignite.internal.GridDirectTransient;
 +import org.apache.ignite.internal.IgniteCodeGeneratingFail;
 +import org.apache.ignite.internal.portable.streams.PortableHeapInputStream;
 +import org.apache.ignite.internal.processors.cache.CacheObject;
 +import org.apache.ignite.internal.processors.cache.CacheObjectContext;
 +import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 +import 
org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
 +import org.apache.ignite.internal.util.typedef.internal.U;
 +import org.apache.ignite.plugin.extensions.communication.Message;
 +import org.apache.ignite.plugin.extensions.communication.MessageReader;
 +import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 +import org.apache.ignite.igniteobject.IgniteObjectException;
 +import org.apache.ignite.igniteobject.IgniteObjectMetadata;
 +import org.apache.ignite.igniteobject.IgniteObject;
 +import org.jetbrains.annotations.Nullable;
 +
++import java.io.Externalizable;
++import java.io.IOException;
++import java.io.ObjectInput;
++import java.io.ObjectOutput;
++import java.nio.ByteBuffer;
++
++import static 
org.apache.ignite.internal.portable.GridPortableMarshaller.BOOLEAN;
++import static org.apache.ignite.internal.portable.GridPortableMarshaller.BYTE;
++import static org.apache.ignite.internal.portable.GridPortableMarshaller.CHAR;
++import static 
org.apache.ignite.internal.portable.GridPortableMarshaller.DOUBLE;
++import static 
org.apache.ignite.internal.portable.GridPortableMarshaller.FLOAT;
++import static org.apache.ignite.internal.portable.GridPortableMarshaller.INT;
++import static org.apache.ignite.internal.portable.GridPortableMarshaller.LONG;
++import static 
org.apache.ignite.internal.portable.GridPortableMarshaller.SHORT;
++
 +/**
 + * Portable object implementation.
 + */
 +@IgniteCodeGeneratingFail // Fields arr and start should not be generated by 
MessageCodeGenerator.
 +public final class IgniteObjectImpl extends IgniteObjectEx implements 
Externalizable,
 +    Message, CacheObject, KeyCacheObject {
 +    /** */
 +    public static final byte TYPE_PORTABLE = 100;
 +
 +    /** */
 +    private static final long serialVersionUID = 0L;
 +
 +    /** */
 +    private static final PortablePrimitives PRIM = PortablePrimitives.get();
 +
 +    /** */
 +    @GridDirectTransient
 +    private PortableContext ctx;
 +
 +    /** */
 +    private byte[] arr;
 +
 +    /** */
 +    private int start;
 +
 +    /** */
 +    @GridDirectTransient
 +    private Object obj;
 +
 +    /** */
 +    @GridDirectTransient
 +    private boolean detachAllowed;
 +
 +    /**
 +     * For {@link Externalizable}.
 +     */
 +    public IgniteObjectImpl() {
 +        // No-op.
 +    }
 +
 +    /**
 +     * @param ctx Context.
 +     * @param arr Array.
 +     * @param start Start.
 +     */
 +    public IgniteObjectImpl(PortableContext ctx, byte[] arr, int start) {
 +        assert ctx != null;
 +        assert arr != null;
 +
 +        this.ctx = ctx;
 +        this.arr = arr;
 +        this.start = start;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte type() {
 +        return TYPE_PORTABLE;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public boolean isPlatformType() {
 +        return false;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public boolean internal() {
 +        return false;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings("unchecked")
 +    @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean 
cpy) {
 +        Object obj0 = obj;
 +
 +        if (obj0 == null || cpy)
 +            obj0 = deserializeValue();
 +
 +        return (T)obj0;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte[] valueBytes(CacheObjectContext ctx) throws 
IgniteCheckedException {
 +        if (detached())
 +            return array();
 +
 +        int len = length();
 +
 +        byte[] arr0 = new byte[len];
 +
 +        U.arrayCopy(arr, start, arr0, 0, len);
 +
 +        return arr0;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public CacheObject prepareForCache(CacheObjectContext ctx) {
 +        if (detached())
 +            return this;
 +
 +        return (IgniteObjectImpl)detach();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void finishUnmarshal(CacheObjectContext ctx, ClassLoader 
ldr) throws IgniteCheckedException {
 +        this.ctx = 
((CacheObjectPortableProcessorImpl)ctx.processor()).portableContext();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void prepareMarshal(CacheObjectContext ctx) throws 
IgniteCheckedException {
 +        // No-op.
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public int length() {
 +        return PRIM.readInt(arr, start + 
GridPortableMarshaller.TOTAL_LEN_POS);
 +    }
 +
 +    /**
 +     * @return Detached portable object.
 +     */
 +    public IgniteObject detach() {
 +        if (!detachAllowed || detached())
 +            return this;
 +
 +        int len = length();
 +
 +        byte[] arr0 = new byte[len];
 +
 +        U.arrayCopy(arr, start, arr0, 0, len);
 +
 +        return new IgniteObjectImpl(ctx, arr0, 0);
 +    }
 +
 +    /**
 +     * @return Detached or not.
 +     */
 +    public boolean detached() {
 +        return start == 0 && length() == arr.length;
 +    }
 +
 +    /**
 +     * @return {@code True} if detach is allowed.
 +     */
 +    public boolean detachAllowed() {
 +        return true;
 +    }
 +
 +    /**
 +     * @param detachAllowed Detach allowed flag.
 +     */
 +    public void detachAllowed(boolean detachAllowed) {
 +        this.detachAllowed = detachAllowed;
 +    }
 +
 +    /**
 +     * @return Context.
 +     */
 +    public PortableContext context() {
 +        return ctx;
 +    }
 +
 +    /**
 +     * @param ctx Context.
 +     */
 +    public void context(PortableContext ctx) {
 +        this.ctx = ctx;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte[] array() {
 +        return arr;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public int start() {
 +        return start;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public long offheapAddress() {
 +        return 0;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override protected boolean hasArray() {
 +        return true;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public int typeId() {
 +        return PRIM.readInt(arr, start + GridPortableMarshaller.TYPE_ID_POS);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Nullable @Override public IgniteObjectMetadata metaData() throws 
IgniteObjectException {
 +        if (ctx == null)
 +            throw new IgniteObjectException("PortableContext is not set for 
the object.");
 +
 +        return ctx.metaData(typeId());
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings("unchecked")
 +    @Nullable @Override public <F> F field(String fieldName) throws 
IgniteObjectException {
 +        IgniteObjectReaderExImpl reader = new IgniteObjectReaderExImpl(ctx, 
arr, start, null);
 +
-         return (F)reader.unmarshal(fieldName);
++        return (F)reader.unmarshalField(fieldName);
++    }
++
++    /** {@inheritDoc} */
++    @SuppressWarnings("unchecked")
++    @Nullable @Override public <F> F field(int fieldId) throws 
PortableException {
++        PortableReaderExImpl reader = new PortableReaderExImpl(ctx, arr, 
start, null);
++
++        return (F)reader.unmarshalField(fieldId);
++    }
++
++    /** {@inheritDoc} */
++    @SuppressWarnings("unchecked")
++    @Nullable @Override protected <F> F fieldByOffset(int fieldOffset) {
++        Object val;
++
++        int schemaOffset = PRIM.readInt(arr, start + 
GridPortableMarshaller.SCHEMA_OR_RAW_OFF_POS);
++        int fieldPos = PRIM.readInt(arr, start + schemaOffset + fieldOffset);
++
++        // Read header and try performing fast lookup for well-known types 
(the most common types go first).
++        byte hdr = PRIM.readByte(arr, fieldPos);
++
++        switch (hdr) {
++            case INT:
++                val = PRIM.readInt(arr, fieldPos + 1);
++
++                break;
++
++            case LONG:
++                val = PRIM.readLong(arr, fieldPos + 1);
++
++                break;
++
++            case BOOLEAN:
++                val = PRIM.readBoolean(arr, fieldPos + 1);
++
++                break;
++
++            case SHORT:
++                val = PRIM.readShort(arr, fieldPos + 1);
++
++                break;
++
++            case BYTE:
++                val = PRIM.readByte(arr, fieldPos + 1);
++
++                break;
++
++            case CHAR:
++                val = PRIM.readChar(arr, fieldPos + 1);
++
++                break;
++
++            case FLOAT:
++                val = PRIM.readFloat(arr, fieldPos + 1);
++
++                break;
++
++            case DOUBLE:
++                val = PRIM.readDouble(arr, fieldPos + 1);
++
++                break;
++
++//            case DECIMAL:
++//                val = doReadDecimal();
++//
++//                break;
++//
++//            case STRING:
++//                val = doReadString();
++//
++//                break;
++//
++//            case UUID:
++//                val = doReadUuid();
++//
++//                break;
++//
++//            case DATE:
++//                val = doReadDate();
++//
++//                break;
++//
++//            case TIMESTAMP:
++//                val = doReadTimestamp();
++//
++//                break;
++
++            default: {
++                // TODO: Pass absolute offset, not relative.
++                PortableReaderExImpl reader = new PortableReaderExImpl(ctx, 
arr, start, null);
++
++                val = reader.unmarshalFieldByOffset(fieldOffset);
++            }
++        }
++
++        return (F)val;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings("unchecked")
 +    @Nullable @Override protected <F> F field(PortableReaderContext rCtx, 
String fieldName) {
 +        IgniteObjectReaderExImpl reader = new IgniteObjectReaderExImpl(ctx,
 +            new PortableHeapInputStream(arr),
 +            start,
 +            null,
 +            rCtx);
 +
-         return (F)reader.unmarshal(fieldName);
++        return (F)reader.unmarshalField(fieldName);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public boolean hasField(String fieldName) {
 +        IgniteObjectReaderExImpl reader = new IgniteObjectReaderExImpl(ctx, 
arr, start, null);
 +
 +        return reader.hasField(fieldName);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings("unchecked")
 +    @Nullable @Override public <T> T deserialize() throws 
IgniteObjectException {
 +        Object obj0 = obj;
 +
 +        if (obj0 == null)
 +            obj0 = deserializeValue();
 +
 +        return (T)obj0;
 +
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public IgniteObject clone() throws CloneNotSupportedException {
 +        return super.clone();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public int hashCode() {
 +        return PRIM.readInt(arr, start + 
GridPortableMarshaller.HASH_CODE_POS);
 +    }
 +
 +    /** {@inheritDoc} */
++    @Override protected int schemaId() {
++        return PRIM.readInt(arr, start + 
GridPortableMarshaller.SCHEMA_ID_POS);
++    }
++
++    /** {@inheritDoc} */
++    @Override protected PortableSchema createSchema() {
++        PortableReaderExImpl reader = new PortableReaderExImpl(ctx, arr, 
start, null);
++
++        return reader.createSchema();
++    }
++
++    /** {@inheritDoc} */
++    @Override public PortableField fieldDescriptor(String fieldName) throws 
PortableException {
++        int typeId = typeId();
++
++        PortableSchemaRegistry schemaReg = ctx.schemaRegistry(typeId);
++
++        int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
++
++        return new PortableFieldImpl(schemaReg, fieldId);
++    }
++
++    /** {@inheritDoc} */
 +    @Override public void writeExternal(ObjectOutput out) throws IOException {
 +        out.writeObject(ctx);
 +
 +        if (detachAllowed) {
 +            int len = length();
 +
 +            out.writeInt(len);
 +            out.write(arr, start, len);
 +            out.writeInt(0);
 +        }
 +        else {
 +            out.writeInt(arr.length);
 +            out.write(arr);
 +            out.writeInt(start);
 +        }
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
 +        ctx = (PortableContext)in.readObject();
 +
 +        arr = new byte[in.readInt()];
 +
 +        in.readFully(arr);
 +
 +        start = in.readInt();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
 +        writer.setBuffer(buf);
 +
 +        if (!writer.isHeaderWritten()) {
 +            if (!writer.writeHeader(directType(), fieldsCount()))
 +                return false;
 +
 +            writer.onHeaderWritten();
 +        }
 +
 +        switch (writer.state()) {
 +            case 0:
 +                if (!writer.writeByteArray("arr",
 +                    arr,
 +                    detachAllowed ? start : 0,
 +                    detachAllowed ? length() : arr.length))
 +                    return false;
 +
 +                writer.incrementState();
 +
 +            case 1:
 +                if (!writer.writeInt("start", detachAllowed ? 0 : start))
 +                    return false;
 +
 +                writer.incrementState();
 +
 +        }
 +
 +        return true;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
 +        reader.setBuffer(buf);
 +
 +        if (!reader.beforeMessageRead())
 +            return false;
 +
 +        switch (reader.state()) {
 +            case 0:
 +                arr = reader.readByteArray("arr");
 +
 +                if (!reader.isLastRead())
 +                    return false;
 +
 +                reader.incrementState();
 +
 +            case 1:
 +                start = reader.readInt("start");
 +
 +                if (!reader.isLastRead())
 +                    return false;
 +
 +                reader.incrementState();
 +
 +        }
 +
 +        return true;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte directType() {
 +        return 113;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte fieldsCount() {
 +        return 3;
 +    }
 +
 +    /**
 +     * Runs value deserialization regardless of whether obj already has the 
deserialized value.
 +     * Will set obj if descriptor is configured to keep deserialized values.
 +     */
 +    private Object deserializeValue() {
 +        // TODO: IGNITE-1272 - Deserialize with proper class loader.
 +        IgniteObjectReaderExImpl reader = new IgniteObjectReaderExImpl(ctx, 
arr, start, null);
 +
 +        Object obj0 = reader.deserialize();
 +
 +        PortableClassDescriptor desc = reader.descriptor();
 +
 +        assert desc != null;
 +
 +        if (desc.keepDeserialized())
 +            obj = obj0;
 +
 +        return obj0;
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/ignite/blob/b5c70a94/modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectOffheapImpl.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectOffheapImpl.java
index 02d4b04,0000000..753ff3b
mode 100644,000000..100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectOffheapImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/IgniteObjectOffheapImpl.java
@@@ -1,255 -1,0 +1,303 @@@
 +/*
 + * 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.internal.portable;
 +
 +import java.io.Externalizable;
 +import java.io.IOException;
 +import java.io.ObjectInput;
 +import java.io.ObjectOutput;
 +import java.nio.ByteBuffer;
 +import org.apache.ignite.IgniteCheckedException;
 +import org.apache.ignite.internal.portable.streams.PortableOffheapInputStream;
 +import org.apache.ignite.internal.processors.cache.CacheObject;
 +import org.apache.ignite.internal.processors.cache.CacheObjectContext;
 +import org.apache.ignite.internal.util.GridUnsafe;
 +import org.apache.ignite.internal.util.typedef.internal.U;
 +import org.apache.ignite.plugin.extensions.communication.MessageReader;
 +import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 +import org.apache.ignite.igniteobject.IgniteObjectException;
 +import org.apache.ignite.igniteobject.IgniteObjectMetadata;
 +import org.apache.ignite.igniteobject.IgniteObject;
 +import org.jetbrains.annotations.Nullable;
 +import sun.misc.Unsafe;
 +
 +/**
 + *  Portable object implementation over offheap memory
 + */
 +public class IgniteObjectOffheapImpl extends IgniteObjectEx implements 
Externalizable, CacheObject {
 +    /** */
 +    private static final long serialVersionUID = 0L;
 +
 +    /** */
 +    private static final Unsafe UNSAFE = GridUnsafe.unsafe();
 +
 +    /** */
 +    private final PortableContext ctx;
 +
 +    /** */
 +    private final long ptr;
 +
 +    /** */
 +    private final int start;
 +
 +    /** */
 +    private final int size;
 +
 +    /**
 +     * For {@link Externalizable} (not supported).
 +     */
 +    public IgniteObjectOffheapImpl() {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /**
 +     * @param ctx Context.
 +     * @param ptr Memory address.
 +     * @param start Object start.
 +     * @param size Memory size.
 +     */
 +    public IgniteObjectOffheapImpl(PortableContext ctx, long ptr, int start, 
int size) {
 +        this.ctx = ctx;
 +        this.ptr = ptr;
 +        this.start = start;
 +        this.size = size;
 +    }
 +
 +    /**
 +     * @return Heap-based copy.
 +     */
 +    public IgniteObject heapCopy() {
 +        return new IgniteObjectImpl(ctx, U.copyMemory(ptr, size), start);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public int typeId() {
 +        return UNSAFE.getInt(ptr + start + 
GridPortableMarshaller.TYPE_ID_POS);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public int length() {
 +        return UNSAFE.getInt(ptr + start + 
GridPortableMarshaller.TOTAL_LEN_POS);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public int hashCode() {
 +        return UNSAFE.getInt(ptr + start + 
GridPortableMarshaller.HASH_CODE_POS);
 +    }
 +
 +    /** {@inheritDoc} */
++    @Override protected int schemaId() {
++        return UNSAFE.getInt(ptr + start + 
GridPortableMarshaller.SCHEMA_ID_POS);
++    }
++
++    /** {@inheritDoc} */
++    @Override protected PortableSchema createSchema() {
++        PortableReaderExImpl reader = new PortableReaderExImpl(ctx,
++            new PortableOffheapInputStream(ptr, size, false),
++            start,
++            null);
++
++        return reader.createSchema();
++    }
++
++    /** {@inheritDoc} */
++    @Override public PortableField fieldDescriptor(String fieldName) throws 
PortableException {
++        int typeId = typeId();
++
++        PortableSchemaRegistry schemaReg = ctx.schemaRegistry(typeId);
++
++        int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
++
++        return new PortableFieldImpl(schemaReg, fieldId);
++    }
++
++    /** {@inheritDoc} */
 +    @Override public int start() {
 +        return start;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte[] array() {
 +        return null;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public long offheapAddress() {
 +        return ptr;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override protected boolean hasArray() {
 +        return false;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Nullable @Override public IgniteObjectMetadata metaData() throws 
IgniteObjectException {
 +        if (ctx == null)
 +            throw new IgniteObjectException("PortableContext is not set for 
the object.");
 +
 +        return ctx.metaData(typeId());
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings("unchecked")
 +    @Nullable @Override public <F> F field(String fieldName) throws 
IgniteObjectException {
 +        IgniteObjectReaderExImpl reader = new IgniteObjectReaderExImpl(ctx,
 +            new PortableOffheapInputStream(ptr, size, false),
 +            start,
 +            null);
 +
-         return (F)reader.unmarshal(fieldName);
++        return (F)reader.unmarshalField(fieldName);
++    }
++
++    /** {@inheritDoc} */
++    @SuppressWarnings("unchecked")
++    @Nullable @Override public <F> F field(int fieldId) throws 
PortableException {
++        PortableReaderExImpl reader = new PortableReaderExImpl(ctx,
++            new PortableOffheapInputStream(ptr, size, false),
++            start,
++            null);
++
++        return (F)reader.unmarshalField(fieldId);
++    }
++
++    /** {@inheritDoc} */
++    @SuppressWarnings("unchecked")
++    @Nullable @Override protected <F> F fieldByOffset(int fieldOffset) {
++        PortableReaderExImpl reader = new PortableReaderExImpl(ctx,
++            new PortableOffheapInputStream(ptr, size, false),
++            start,
++            null);
++
++        return (F)reader.unmarshalFieldByOffset(fieldOffset);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings("unchecked")
 +    @Nullable @Override protected <F> F field(PortableReaderContext rCtx, 
String fieldName) {
 +        IgniteObjectReaderExImpl reader = new IgniteObjectReaderExImpl(ctx,
 +            new PortableOffheapInputStream(ptr, size, false),
 +            start,
 +            null,
 +            rCtx);
 +
-         return (F)reader.unmarshal(fieldName);
++        return (F)reader.unmarshalField(fieldName);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public boolean hasField(String fieldName) {
 +        IgniteObjectReaderExImpl reader = new IgniteObjectReaderExImpl(ctx,
 +            new PortableOffheapInputStream(ptr, size, false),
 +            start,
 +            null);
 +
 +        return reader.hasField(fieldName);
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings("unchecked")
 +    @Nullable @Override public <T> T deserialize() throws 
IgniteObjectException {
 +        return (T)deserializeValue();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings("CloneDoesntCallSuperClone")
 +    @Override public IgniteObject clone() throws CloneNotSupportedException {
 +        return heapCopy();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte type() {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public boolean isPlatformType() {
 +        return false;
 +    }
 +
 +    /** {@inheritDoc} */
 +    @SuppressWarnings("unchecked")
 +    @Nullable @Override public <T> T value(CacheObjectContext ctx, boolean 
cpy) {
 +        return (T)deserializeValue();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte[] valueBytes(CacheObjectContext ctx) throws 
IgniteCheckedException {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public CacheObject prepareForCache(CacheObjectContext ctx) {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void finishUnmarshal(CacheObjectContext ctx, ClassLoader 
ldr) throws IgniteCheckedException {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void prepareMarshal(CacheObjectContext ctx) throws 
IgniteCheckedException {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte directType() {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public byte fieldsCount() {
 +        throw new UnsupportedOperationException();
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void writeExternal(ObjectOutput out) throws IOException {
 +        throw new UnsupportedOperationException(); // To make sure it is not 
marshalled.
 +    }
 +
 +    /** {@inheritDoc} */
 +    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
 +        throw new UnsupportedOperationException(); // To make sure it is not 
marshalled.
 +    }
 +
 +    /**
 +     * @return Deserialized value.
 +     */
 +    private Object deserializeValue() {
 +        // TODO: IGNITE-1272 - Deserialize with proper class loader.
 +        IgniteObjectReaderExImpl reader = new IgniteObjectReaderExImpl(
 +            ctx,
 +            new PortableOffheapInputStream(ptr, size, false),
 +            start,
 +            null);
 +
 +        return reader.deserialize();
 +    }
 +}

Reply via email to