GfshCommand (Apache Geode 1.13.6)
Date: 2021-12-14

org.apache.geode.management.cli

## Class GfshCommand

- java.lang.Object
- - org.apache.geode.management.cli.GfshCommand

- All Implemented Interfaces:
    org.springframework.shell.core.CommandMarker
  Direct Known Subclasses:
    SingleGfshCommand

      @Experimental
      public abstract class GfshCommand
      extends Object
      implements org.springframework.shell.core.CommandMarker

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `EXPERIMENTAL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GfshCommand()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `authorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, ResourcePermission.Target target)`
    `void` | `authorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, String target)`
    `void` | `authorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, String target, String key)`
    `List<org.apache.geode.management.internal.functions.CliFunctionResult>` | `executeAndGetFunctionResult(Function<?> function, Object args, Set<DistributedMember> targetMembers)`
    `ResultCollector<?,?>` | `executeFunction(Function<?> function, Object args, DistributedMember targetMember)`
    `ResultCollector<?,?>` | `executeFunction(Function<?> function, Object args, Set<DistributedMember> targetMembers)`
    `org.apache.geode.management.internal.functions.CliFunctionResult` | `executeFunctionAndGetFunctionResult(Function<?> function, Object args, DistributedMember targetMember)`
    `Set<DistributedMember>` | `findAnyMembersForRegion(String regionPath)`
    `DistributedMember` | `findMember(String memberName)` this will return the member found or null if no member with that name
    `Set<DistributedMember>` | `findMembers(String[] groups, String[] members)` if no members matches these names, an empty set would return, this does not include locators
    `Set<DistributedMember>` | `findMembersForRegion(String regionPath)`
    `Set<DistributedMember>` | `findMembersIncludingLocators(String[] groups, String[] members)` if no members matches these names, an empty set would return
    `Set<DistributedMember>` | `getAllMembers()` Gets all members in the GemFire distributed system/cache, including locators
    `Set<DistributedMember>` | `getAllNormalMembers()` Get All members, excluding locators
    `Cache` | `getCache()`
    `ClusterManagementService` | `getClusterManagementService()`
    `<T extends ConfigurationPersistenceService> T` | `getConfigurationPersistenceService()`
    `<T extends ManagementService> T` | `getManagementService()`
    `DistributedMember` | `getMember(String memberName)` this either returns a non-null member or throw an exception if member is not found.
    `Set<DistributedMember>` | `getMembers(String[] groups, String[] members)` if no members matches these names, a UserErrorException will be thrown
    `Execution` | `getMembersFunctionExecutor(Set<DistributedMember> members)`
    `Set<DistributedMember>` | `getMembersIncludingLocators(String[] groups, String[] members)` if no members matches these names, a UserErrorException will be thrown
    `Set<DistributedMember>` | `getNormalMembersWithSameOrNewerVersion(org.apache.geode.internal.serialization.Version version)` Get All members >= a specific version, excluding locators
    `org.apache.shiro.subject.Subject` | `getSubject()`
    `boolean` | `isOnlineCommandAvailable()`
    `boolean` | `isSharedConfigurationRunning()`
    `boolean` | `poll(long timeout, TimeUnit unit, Supplier<Boolean> function)` Very basic polling functionality that executes a function until it returns true or the timeout is reached.
    `void` | `setCache(Cache cache)`

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

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

- - ### Field Detail

    - #### EXPERIMENTAL

          public static final String EXPERIMENTAL

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GfshCommand

          public GfshCommand()

  - ### Method Detail

    - #### isOnlineCommandAvailable

          public boolean isOnlineCommandAvailable()

    - #### authorize

          public void authorize(ResourcePermission.Resource resource,
                                ResourcePermission.Operation operation,
                                ResourcePermission.Target target)

    - #### authorize

          public void authorize(ResourcePermission.Resource resource,
                                ResourcePermission.Operation operation,
                                String target)

    - #### authorize

          public void authorize(ResourcePermission.Resource resource,
                                ResourcePermission.Operation operation,
                                String target,
                                String key)

    - #### getCache

          public Cache getCache()

    - #### getManagementService

          public <T extends ManagementService> T getManagementService()

    - #### getConfigurationPersistenceService

          public <T extends ConfigurationPersistenceService> T getConfigurationPersistenceService()

    - #### getClusterManagementService

          public ClusterManagementService getClusterManagementService()

    - #### setCache

          public void setCache(Cache cache)

    - #### isSharedConfigurationRunning

          public boolean isSharedConfigurationRunning()

    - #### getSubject

          public org.apache.shiro.subject.Subject getSubject()

    - #### getMember

          public DistributedMember getMember(String memberName)

      this either returns a non-null member or throw an exception if member is not found.

    - #### findMember

          public DistributedMember findMember(String memberName)

      this will return the member found or null if no member with that name

    - #### getAllMembers

          public Set<DistributedMember> getAllMembers()

      Gets all members in the GemFire distributed system/cache, including locators

    - #### getAllNormalMembers

          public Set<DistributedMember> getAllNormalMembers()

      Get All members, excluding locators

    - #### getNormalMembersWithSameOrNewerVersion

          public Set<DistributedMember> getNormalMembersWithSameOrNewerVersion(org.apache.geode.internal.serialization.Version version)

      Get All members >= a specific version, excluding locators

    - #### getMembersFunctionExecutor

          public Execution getMembersFunctionExecutor(Set<DistributedMember> members)

    - #### findMembers

          public Set<DistributedMember> findMembers(String[] groups,
                                                    String[] members)

      if no members matches these names, an empty set would return, this does not include locators

    - #### getMembers

          public Set<DistributedMember> getMembers(String[] groups,
                                                   String[] members)

      if no members matches these names, a UserErrorException will be thrown

    - #### findMembersIncludingLocators

          public Set<DistributedMember> findMembersIncludingLocators(String[] groups,
                                                                     String[] members)

      if no members matches these names, an empty set would return

    - #### getMembersIncludingLocators

          public Set<DistributedMember> getMembersIncludingLocators(String[] groups,
                                                                    String[] members)

      if no members matches these names, a UserErrorException will be thrown

    - #### findMembersForRegion

          public Set<DistributedMember> findMembersForRegion(String regionPath)

    - #### findAnyMembersForRegion

          public Set<DistributedMember> findAnyMembersForRegion(String regionPath)

    - #### executeFunction

          public ResultCollector<?,?> executeFunction(Function<?> function,
                                                      Object args,
                                                      Set<DistributedMember> targetMembers)

    - #### executeFunction

          public ResultCollector<?,?> executeFunction(Function<?> function,
                                                      Object args,
                                                      DistributedMember targetMember)

    - #### executeFunctionAndGetFunctionResult

          public org.apache.geode.management.internal.functions.CliFunctionResult executeFunctionAndGetFunctionResult(Function<?> function,
                                                                                                                      Object args,
                                                                                                                      DistributedMember targetMember)

    - #### executeAndGetFunctionResult

          public List<org.apache.geode.management.internal.functions.CliFunctionResult> executeAndGetFunctionResult(Function<?> function,
                                                                                                                    Object args,
                                                                                                                    Set<DistributedMember> targetMembers)

    - #### poll

          public boolean poll(long timeout,
                              TimeUnit unit,
                              Supplier<Boolean> function)

      Very basic polling functionality that executes a function until it returns true or the timeout is reached. The polling call is performed on the calling thread. Do not use it with a function that may have an unbounded runtime. The timeout is very coarse and will not account for the function overrunning the given time.
      Parameters:
        `function` - a `Supplier<Boolean>` function that will poll for the condition
      Returns:
        true if the function returns true within the timeout period; false otherwise