VMware GemFire Java API Reference
Package 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanFor those commands that could possibly change the cluster configuration, they need to override this method to return true.voidauthorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, String target) voidauthorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, String target, String key) voidauthorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, ResourcePermission.Target target) booleanthis should be overridden by the child command and annotated with `@CliAvailabilityIndicator("command name")` implementation is provided here for API compatibilityList<org.apache.geode.management.internal.functions.CliFunctionResult>executeAndGetFunctionResult(Function<?> function, Object args, Set<DistributedMember> targetMembers) ResultCollector<?,?> executeFunction(Function<?> function, Object args, Set<DistributedMember> targetMembers) ResultCollector<?,?> executeFunction(Function<?> function, Object args, DistributedMember targetMember) executeFunctionAndGetFirstResult(Function<?> function, Object args, DistributedMember targetMember) org.apache.geode.management.internal.functions.CliFunctionResultexecuteFunctionAndGetFunctionResult(Function<?> function, Object args, DistributedMember targetMember) findAnyMembersForRegion(String regionPath) findLocators(String[] groups, String[] members) findMember(String memberName) this will return the member found or null if no member with that namefindMembers(String[] groups, String[] members) if no members matches these names, an empty set would return, this does not include locatorsfindMembersForRegion(String regionPath) findMembersIncludingLocators(String[] groups, String[] members) if no members matches these names, an empty set would returnfindMembersWithVersionAtLeast(String[] groups, String[] members, org.apache.geode.internal.serialization.KnownVersion minimumVersion) Finds all members that are at, or have a version greater than, the given version.Gets all members in the GemFire distributed system/cache, including locatorsGet All members, excluding locatorsgetCache()<T extends ConfigurationPersistenceService>
T<T extends ManagementService>
Tthis either returns a non-null member or throw an exception if member is not found.getMembers(String[] groups, String[] members) if no members matches these names, a UserErrorException will be throwngetMembersFunctionExecutor(Set<DistributedMember> members) getMembersIncludingLocators(String[] groups, String[] members) if no members matches these names, a UserErrorException will be throwngetNormalMembersWithSameOrNewerVersion(org.apache.geode.internal.serialization.KnownVersion version) Get All members >= a specific version, excluding locatorsorg.apache.geode.internal.security.Subjectprotected final booleanbooleanbooleanbooleanVery basic polling functionality that executes a function until it returns true or the timeout is reached.void
-
Field Details
-
EXPERIMENTAL
- See Also:
-
-
Constructor Details
-
GfshCommand
public GfshCommand()
-
-
Method Details
-
commandAvailable
public boolean commandAvailable()this should be overridden by the child command and annotated with `@CliAvailabilityIndicator("command name")` implementation is provided here for API compatibility- Returns:
- no return, will throw an exception
-
isOnlineCommandAvailable
public boolean isOnlineCommandAvailable() -
isCommandDisabled
protected final boolean isCommandDisabled() -
affectsClusterConfiguration
public boolean affectsClusterConfiguration()For those commands that could possibly change the cluster configuration, they need to override this method to return true.- Returns:
- whether the command may change the cluster configuration
-
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
-
getManagementService
-
getConfigurationPersistenceService
-
getClusterManagementService
-
setCache
-
getSubject
public org.apache.geode.internal.security.Subject getSubject() -
getMember
this either returns a non-null member or throw an exception if member is not found.- Parameters:
memberName- the member name of the member to find- Returns:
- the member
-
findMember
this will return the member found or null if no member with that name- Parameters:
memberName- the member name of the member to find- Returns:
- the member found or null if no member with that name exists
-
getAllMembers
Gets all members in the GemFire distributed system/cache, including locators- Returns:
- a set of all members
-
getAllNormalMembers
Get All members, excluding locators- Returns:
- a set of all non-locator members
-
getNormalMembersWithSameOrNewerVersion
public Set<DistributedMember> getNormalMembersWithSameOrNewerVersion(org.apache.geode.internal.serialization.KnownVersion version) Get All members >= a specific version, excluding locators- Parameters:
version- aKnownVersionto compare with the version of members- Returns:
- a set of non-locator members with version equal to or newer than the given version
-
getMembersFunctionExecutor
-
findMembers
if no members matches these names, an empty set would return, this does not include locators- Parameters:
groups- names of groups to which returned members belongmembers- member names or IDs which returned members match- Returns:
- a set of matching members
-
findMembersWithVersionAtLeast
public Set<DistributedMember> findMembersWithVersionAtLeast(String[] groups, String[] members, org.apache.geode.internal.serialization.KnownVersion minimumVersion) Finds all members that are at, or have a version greater than, the given version.- Parameters:
groups- names of groups to which returned members belongmembers- member names or IDs which returned members matchminimumVersion- the lowest GemFire version which each returned member must conform to- Returns:
- a set of matching members
-
findLocators
-
findAllOtherLocators
-
findAllLocators
-
getMembers
if no members matches these names, a UserErrorException will be thrown- Parameters:
groups- names of groups to which returned members belongmembers- member names or IDs which returned members match- Returns:
- a set of matching members
-
findMembersIncludingLocators
if no members matches these names, an empty set would return- Parameters:
groups- names of groups to which returned members belongmembers- member names or IDs which returned members match- Returns:
- a set of matching members
-
getMembersIncludingLocators
if no members matches these names, a UserErrorException will be thrown- Parameters:
groups- names of groups to which returned members belongmembers- member names or IDs which returned members match- Returns:
- a set of matching members
-
findMembersForRegion
-
findAnyMembersForRegion
-
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) -
executeFunctionAndGetFirstResult
public Object executeFunctionAndGetFirstResult(Function<?> function, Object args, DistributedMember targetMember) -
poll
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:
timeout- the maximum amount of time to wait for the function to returnunit- theTimeUnitfor the timeoutfunction- aSupplier<Boolean>function that will poll for the condition- Returns:
- true if the function returns true within the timeout period; false otherwise
-