oracle.kv.coherence

## Class NoSQLAvroSerializer

- java.lang.Object
- - com.tangosol.util.Base
  - - oracle.kv.coherence.NoSQLAvroSerializer

- All Implemented Interfaces:
    Serializer, XmlConfigurable

      public class NoSQLAvroSerializer
      extends Base
      implements Serializer, XmlConfigurable

  This is an Oracle NoSQL Database-based implementation of the Oracle Coherence `Serializer` interface. This implementation is Avro schema-aware and will convert values to Object format using Avro binding objects when they are read from the database. Though it is possible that it could be useful in other contexts, it is primarily intended for use in conjunction with the `NoSQLAvroCacheStore` module.

  Users are not expected to directly interact with this class. It is expected that the class is managed by Oracle Coherence as the result of XML configuration supplied to Oracle Coherence at program startup. The documentation contained in this class is intended primarily to explain the XML configuration options.

  ### Usage

  The primary purpose of this is to handle the Oracle NoSQL Database-specific types. This module natively handles a few basic types, including `Key`, `Value`, plus Avro schema-based Records, and delegates other types to the default serializer.

  Avro records may be any of `RawRecord`, `JsonRecord`, `GenericRecord`, or an implementation of `SpecificRecord`. Avro-based types are not known to us at compile-time, so we need to communicate the Schema as part of the stream. In order to keep the stream compact, it relies on the Oracle NoSQL Database schema catalog. Since these types are either sourced from the database or destined to be stored in the database, so there must be an Avro type in the schema catalog, and the serialization leverages the schema type identifiers from the catalog.

  When a serialized `GenericRecord` or `JsonRecord` object is received by the Serializer and it needs to be deserialized, this module needs to know the Schema version that is expected by the application. The schema files that define the Avro types must be declared by the application (see schemaFiles). When a `SpecificRecord` is received, its schema version is determined by loading the corresponding SpecificRecord implementation class.

  ### XML Configuration Options

  There are a few configuration parameters that should be used to tailor the serializer to your environment. These are specified within the cache definition XML using `<init-param>` elements:

  `storeName` - (Required) The Oracle NoSQL Database instance name that is used to provide persistence for your Oracle Coherence cache.

  `helperHosts` - (Required) A comma-separated list of helperHost:port values that serve as the gateway to the Oracle NoSQL Database instance.

  `schemaFiles` - (Optional) When Generic or Json format is selected, The application needs to identify the specific version of the schema that it expects. It does this by providing a comma separated list of schema definition files. Each file is located as a system resource and should be named in resource form (e.g. /my/path/to/schema.avsc).

  ### Example

  Here is an example for the configuration of a `NoSQLAvroSerializer` module.

       <serializer>
             <instance>
                <class-name>oracle.kv.coherence.NoSQLAvroSerializer</class-name>
                <init-params>
                   <init-param>
                     <param-name>storeName</param-name>
                     <param-value>kvstore</param-value>
                   </init-param>
                   <init-param>
                     <param-name>helperHosts</param-name>
                     <param-value>myhost:5000</param-value>
                   </init-param>
                   <init-param>
                     <param-name>schemaFiles</param-name>
                     <param-value>my/app/datatype.avsc,my/app/othertype.avsc</param-value>
                  </init-param>
                 </init-params>
             </instance>
          </serializer>

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.tangosol.util.Base

      `Base.CommonMonitor, Base.LoggingWriter, Base.StackFrame`

  - ### Field Summary

    - ### Fields inherited from class com.tangosol.util.Base

      `LOG_ALWAYS, LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_MAX, LOG_MIN, LOG_QUIET, LOG_WARN, POWER_0, POWER_G, POWER_K, POWER_M, POWER_T, UNIT_D, UNIT_H, UNIT_M, UNIT_MS, UNIT_NS, UNIT_S, UNIT_US`

  - ### Method Summary

    - ### Methods inherited from class com.tangosol.util.Base

      `azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getRandom, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, read, read, read, read, read, read, read, redirectAll, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, wait`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.tangosol.io.Serializer

      `deserialize, serialize`

    - ### Methods inherited from interface com.tangosol.run.xml.XmlConfigurable

      `getConfig, setConfig`

Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.