org.keycloak.models.authorization.infinispan

## Class CachedResourceStore

- java.lang.Object
- - org.keycloak.models.authorization.infinispan.CachedResourceStore

- All Implemented Interfaces:
    ResourceStore

      public class CachedResourceStore
      extends Object
      implements ResourceStore

  Author:
    Pedro Igor

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CachedResourceStore(KeycloakSession session, org.keycloak.models.authorization.infinispan.InfinispanStoreFactoryProvider.CacheTransaction transaction)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Resource` | `create(String name, ResourceServer resourceServer, String owner)` Creates a `Resource` instance backed by this persistent storage implementation.
    `void` | `delete(String id)` Removes a `Resource` instance, with the given `id` from the persistent storage.
    `Resource` | `findById(String id)` Returns a `Resource` instance based on its identifier.
    `Resource` | `findByName(String name, String resourceServerId)` Find a `Resource` by its name.
    `List<Resource>` | `findByOwner(String ownerId)` Finds all `Resource` instances with the given `ownerId`.
    `List<Resource>` | `findByResourceServer(String resourceServerId)` Finds all `Resource` instances associated with a given resource server.
    `List<Resource>` | `findByScope(String... id)` Finds all `Resource` associated with a given scope.
    `List<Resource>` | `findByType(String type)` Finds all `Resource` with the given type.

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

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

- - ### Constructor Detail

    - #### CachedResourceStore

          public CachedResourceStore(KeycloakSession session,
                                     org.keycloak.models.authorization.infinispan.InfinispanStoreFactoryProvider.CacheTransaction transaction)

  - ### Method Detail

    - #### create

          public Resource create(String name,
                                 ResourceServer resourceServer,
                                 String owner)

      Description copied from interface: `ResourceStore`

      Creates a `Resource` instance backed by this persistent storage implementation.

      Specified by:
        `create` in interface `ResourceStore`
      Parameters:
        `name` - the name of this resource. It must be unique.
        `resourceServer` - the resource server to where the given resource belongs to
        `owner` - the owner of this resource or null if the resource server is the owner
      Returns:
        an instance backed by the underlying storage implementation

    - #### delete

          public void delete(String id)

      Description copied from interface: `ResourceStore`
      Removes a `Resource` instance, with the given `id` from the persistent storage.
      Specified by:
        `delete` in interface `ResourceStore`
      Parameters:
        `id` - the identifier of an existing resource instance

    - #### findById

          public Resource findById(String id)

      Description copied from interface: `ResourceStore`
      Returns a `Resource` instance based on its identifier.
      Specified by:
        `findById` in interface `ResourceStore`
      Parameters:
        `id` - the identifier of an existing resource instance
      Returns:
        the resource instance with the given identifier or null if no instance was found

    - #### findByOwner

          public List<Resource> findByOwner(String ownerId)

      Description copied from interface: `ResourceStore`
      Finds all `Resource` instances with the given `ownerId`.
      Specified by:
        `findByOwner` in interface `ResourceStore`
      Parameters:
        `ownerId` - the identifier of the owner
      Returns:
        a list with all resource instances owned by the given owner

    - #### findByResourceServer

          public List<Resource> findByResourceServer(String resourceServerId)

      Description copied from interface: `ResourceStore`
      Finds all `Resource` instances associated with a given resource server.
      Specified by:
        `findByResourceServer` in interface `ResourceStore`
      Parameters:
        `resourceServerId` - the identifier of the resource server
      Returns:
        a list with all resources associated with the given resource server

    - #### findByScope

          public List<Resource> findByScope(String... id)

      Description copied from interface: `ResourceStore`
      Finds all `Resource` associated with a given scope.
      Specified by:
        `findByScope` in interface `ResourceStore`
      Parameters:
        `id` - one or more scope identifiers
      Returns:
        a list of resources associated with the given scope(s)

    - #### findByName

          public Resource findByName(String name,
                                     String resourceServerId)

      Description copied from interface: `ResourceStore`
      Find a `Resource` by its name.
      Specified by:
        `findByName` in interface `ResourceStore`
      Parameters:
        `name` - the name of the resource
        `resourceServerId` - the identifier of the resource server
      Returns:
        a resource with the given name

    - #### findByType

          public List<Resource> findByType(String type)

      Description copied from interface: `ResourceStore`
      Finds all `Resource` with the given type.
      Specified by:
        `findByType` in interface `ResourceStore`
      Parameters:
        `type` - the type of the resource
      Returns:
        a list of resources with the given type

Copyright © 2016 JBoss by Red Hat. All rights reserved.