com.hazelcast.cache

## Class HazelcastCachingProvider

- java.lang.Object
- - com.hazelcast.cache.HazelcastCachingProvider

- All Implemented Interfaces:
    Closeable, AutoCloseable, javax.cache.spi.CachingProvider

      public final class HazelcastCachingProvider
      extends Object
      implements javax.cache.spi.CachingProvider

  This class is the Hazelcast JCache public `CachingProvider` implementation. This provider class acts as the commonly used entry point for the JCache SPI to register Hazelcast JCache as an eligible JCache implementation.

  Main purpose of this provider implementation is to delegate to the user-selected internal `CachingProvider` implementation.

  Hazelcast uses two internal `CachingProvider`s depending on the environment:

  - `HazelcastServerCachingProvider`
  - `HazelcastClientCachingProvider`

  ### Provider Type Selection:

  The first step is to check whether a selection exists using the system property `hazelcast.jcache.provider.type` with values of `client` or `server`. If no selection exists, then the default behavior for selecting the internal provider type is based on which dependency is found on the classpath. Client and server provider classes are searched on the classpath. If both `CachingProvider` implementations are found (client and server), the client provider has precedence. To select the server provider, use the above mentioned property.
  Since:
    3.4

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `HAZELCAST_CONFIG_LOCATION` Hazelcast config location property
    `static String` | `HAZELCAST_INSTANCE_ITSELF` Hazelcast instance itself property
    `static String` | `HAZELCAST_INSTANCE_NAME` Hazelcast instance name property

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HazelcastCachingProvider()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `close(ClassLoader classLoader)`
    `void` | `close(URI uri, ClassLoader classLoader)`
    `javax.cache.CacheManager` | `getCacheManager()`
    `javax.cache.CacheManager` | `getCacheManager(URI uri, ClassLoader classLoader)`
    `javax.cache.CacheManager` | `getCacheManager(URI uri, ClassLoader classLoader, Properties properties)`
    `ClassLoader` | `getDefaultClassLoader()`
    `Properties` | `getDefaultProperties()`
    `URI` | `getDefaultURI()`
    `boolean` | `isSupported(javax.cache.configuration.OptionalFeature optionalFeature)`
    `static Properties` | `propertiesByInstanceItself(HazelcastInstance instance)` Create the `Properties` with the provided instance itself.
    `static Properties` | `propertiesByInstanceName(String instanceName)` Create the `Properties` with the provided instance name.
    `static Properties` | `propertiesByLocation(String configFileLocation)` Create the `Properties` with the provided config file location.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### HAZELCAST_CONFIG_LOCATION

          public static final String HAZELCAST_CONFIG_LOCATION

      Hazelcast config location property
      See Also:
        Constant Field Values

    - #### HAZELCAST_INSTANCE_NAME

          public static final String HAZELCAST_INSTANCE_NAME

      Hazelcast instance name property
      See Also:
        Constant Field Values

    - #### HAZELCAST_INSTANCE_ITSELF

          public static final String HAZELCAST_INSTANCE_ITSELF

      Hazelcast instance itself property
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HazelcastCachingProvider

          public HazelcastCachingProvider()

  - ### Method Detail

    - #### propertiesByLocation

          public static Properties propertiesByLocation(String configFileLocation)

      Create the `Properties` with the provided config file location.
      Parameters:
        `configFileLocation` - the location of the config file to configure
      Returns:
        properties instance pre-configured with the configuration location

    - #### propertiesByInstanceName

          public static Properties propertiesByInstanceName(String instanceName)

      Create the `Properties` with the provided instance name.
      Parameters:
        `instanceName` - the instance name to configure
      Returns:
        the properties instance pre-configured with the instance name

    - #### propertiesByInstanceItself

          public static Properties propertiesByInstanceItself(HazelcastInstance instance)

      Create the `Properties` with the provided instance itself.
      Parameters:
        `instance` - the instance itself to be used
      Returns:
        the properties instance pre-configured with the instance itself

    - #### getCacheManager

          public javax.cache.CacheManager getCacheManager(URI uri,
                                                          ClassLoader classLoader,
                                                          Properties properties)

      Specified by:
        `getCacheManager` in interface `javax.cache.spi.CachingProvider`

    - #### getDefaultClassLoader

          public ClassLoader getDefaultClassLoader()

      Specified by:
        `getDefaultClassLoader` in interface `javax.cache.spi.CachingProvider`

    - #### getDefaultURI

          public URI getDefaultURI()

      Specified by:
        `getDefaultURI` in interface `javax.cache.spi.CachingProvider`

    - #### getDefaultProperties

          public Properties getDefaultProperties()

      Specified by:
        `getDefaultProperties` in interface `javax.cache.spi.CachingProvider`

    - #### getCacheManager

          public javax.cache.CacheManager getCacheManager(URI uri,
                                                          ClassLoader classLoader)

      Specified by:
        `getCacheManager` in interface `javax.cache.spi.CachingProvider`

    - #### getCacheManager

          public javax.cache.CacheManager getCacheManager()

      Specified by:
        `getCacheManager` in interface `javax.cache.spi.CachingProvider`

    - #### close

          public void close()

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `javax.cache.spi.CachingProvider`

    - #### close

          public void close(ClassLoader classLoader)

      Specified by:
        `close` in interface `javax.cache.spi.CachingProvider`

    - #### close

          public void close(URI uri,
                            ClassLoader classLoader)

      Specified by:
        `close` in interface `javax.cache.spi.CachingProvider`

    - #### isSupported

          public boolean isSupported(javax.cache.configuration.OptionalFeature optionalFeature)

      Specified by:
        `isSupported` in interface `javax.cache.spi.CachingProvider`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2018. All rights reserved.