Gemfire JavaDocs
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 java.lang.Object implements org.springframework.shell.core.CommandMarker
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXPERIMENTAL
-
Constructor Summary
Constructors Constructor Description GfshCommand()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
affectsClusterConfiguration()
For those commands that could possibly change the cluster configuration, they need to override this method to return true.void
authorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, java.lang.String target)
void
authorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, java.lang.String target, java.lang.String key)
void
authorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, ResourcePermission.Target target)
java.util.List<org.apache.geode.management.internal.functions.CliFunctionResult>
executeAndGetFunctionResult(Function<?> function, java.lang.Object args, java.util.Set<DistributedMember> targetMembers)
ResultCollector<?,?>
executeFunction(Function<?> function, java.lang.Object args, java.util.Set<DistributedMember> targetMembers)
ResultCollector<?,?>
executeFunction(Function<?> function, java.lang.Object args, DistributedMember targetMember)
org.apache.geode.management.internal.functions.CliFunctionResult
executeFunctionAndGetFunctionResult(Function<?> function, java.lang.Object args, DistributedMember targetMember)
java.util.Set<DistributedMember>
findAllLocators()
java.util.Set<DistributedMember>
findAllOtherLocators()
java.util.Set<DistributedMember>
findAnyMembersForRegion(java.lang.String regionPath)
DistributedMember
findMember(java.lang.String memberName)
this will return the member found or null if no member with that namejava.util.Set<DistributedMember>
findMembers(java.lang.String[] groups, java.lang.String[] members)
if no members matches these names, an empty set would return, this does not include locatorsjava.util.Set<DistributedMember>
findMembersForRegion(java.lang.String regionPath)
java.util.Set<DistributedMember>
findMembersIncludingLocators(java.lang.String[] groups, java.lang.String[] members)
if no members matches these names, an empty set would returnjava.util.Set<DistributedMember>
getAllMembers()
Gets all members in the GemFire distributed system/cache, including locatorsjava.util.Set<DistributedMember>
getAllNormalMembers()
Get All members, excluding locatorsCache
getCache()
ClusterManagementService
getClusterManagementService()
<T extends ConfigurationPersistenceService>
TgetConfigurationPersistenceService()
<T extends ManagementService>
TgetManagementService()
DistributedMember
getMember(java.lang.String memberName)
this either returns a non-null member or throw an exception if member is not found.java.util.Set<DistributedMember>
getMembers(java.lang.String[] groups, java.lang.String[] members)
if no members matches these names, a UserErrorException will be thrownExecution
getMembersFunctionExecutor(java.util.Set<DistributedMember> members)
java.util.Set<DistributedMember>
getMembersIncludingLocators(java.lang.String[] groups, java.lang.String[] members)
if no members matches these names, a UserErrorException will be thrownjava.util.Set<DistributedMember>
getNormalMembersWithSameOrNewerVersion(org.apache.geode.internal.serialization.KnownVersion version)
Get All members >= a specific version, excluding locatorsorg.apache.shiro.subject.Subject
getSubject()
boolean
isOnlineCommandAvailable()
boolean
isSharedConfigurationRunning()
boolean
poll(long timeout, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<java.lang.Boolean> function)
Very basic polling functionality that executes a function until it returns true or the timeout is reached.void
setCache(Cache cache)
-
-
-
Field Detail
-
EXPERIMENTAL
public static final java.lang.String EXPERIMENTAL
- See Also:
- Constant Field Values
-
-
Method Detail
-
isOnlineCommandAvailable
public boolean isOnlineCommandAvailable()
-
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, java.lang.String target)
-
authorize
public void authorize(ResourcePermission.Resource resource, ResourcePermission.Operation operation, java.lang.String target, java.lang.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(java.lang.String memberName)
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
public DistributedMember findMember(java.lang.String memberName)
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
public java.util.Set<DistributedMember> getAllMembers()
Gets all members in the GemFire distributed system/cache, including locators- Returns:
- a set of all members
-
getAllNormalMembers
public java.util.Set<DistributedMember> getAllNormalMembers()
Get All members, excluding locators- Returns:
- a set of all non-locator members
-
getNormalMembersWithSameOrNewerVersion
public java.util.Set<DistributedMember> getNormalMembersWithSameOrNewerVersion(org.apache.geode.internal.serialization.KnownVersion version)
Get All members >= a specific version, excluding locators- Parameters:
version
- aKnownVersion
to compare with the version of members- Returns:
- a set of non-locator members with version equal to or newer than the given version
-
getMembersFunctionExecutor
public Execution getMembersFunctionExecutor(java.util.Set<DistributedMember> members)
-
findMembers
public java.util.Set<DistributedMember> findMembers(java.lang.String[] groups, java.lang.String[] members)
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
-
findAllOtherLocators
public java.util.Set<DistributedMember> findAllOtherLocators()
-
findAllLocators
public java.util.Set<DistributedMember> findAllLocators()
-
getMembers
public java.util.Set<DistributedMember> getMembers(java.lang.String[] groups, java.lang.String[] members)
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
public java.util.Set<DistributedMember> findMembersIncludingLocators(java.lang.String[] groups, java.lang.String[] members)
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
public java.util.Set<DistributedMember> getMembersIncludingLocators(java.lang.String[] groups, java.lang.String[] members)
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
public java.util.Set<DistributedMember> findMembersForRegion(java.lang.String regionPath)
-
findAnyMembersForRegion
public java.util.Set<DistributedMember> findAnyMembersForRegion(java.lang.String regionPath)
-
executeFunction
public ResultCollector<?,?> executeFunction(Function<?> function, java.lang.Object args, java.util.Set<DistributedMember> targetMembers)
-
executeFunction
public ResultCollector<?,?> executeFunction(Function<?> function, java.lang.Object args, DistributedMember targetMember)
-
executeFunctionAndGetFunctionResult
public org.apache.geode.management.internal.functions.CliFunctionResult executeFunctionAndGetFunctionResult(Function<?> function, java.lang.Object args, DistributedMember targetMember)
-
executeAndGetFunctionResult
public java.util.List<org.apache.geode.management.internal.functions.CliFunctionResult> executeAndGetFunctionResult(Function<?> function, java.lang.Object args, java.util.Set<DistributedMember> targetMembers)
-
poll
public boolean poll(long timeout, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<java.lang.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:
timeout
- the maximum amount of time to wait for the function to returnunit
- theTimeUnit
for the timeoutfunction
- aSupplier<Boolean>
function that will poll for the condition- Returns:
- true if the function returns true within the timeout period; false otherwise
-
-