Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This articles talks about changes required to add a new gfsh command or parameter for a Geode feature (operated using Gfsh).

这份文档介绍如何在geode中增加一个gfsh命令。

1. Adding a new Gfsh command

...

public class LuceneCreateIndexFunction extends FunctionAdapter implements InternalEntity {

...

}

 

/* Only show these commands as available when gfsh is online */

@CliAvailabilityIndicator({LuceneCliStrings.LUCENE_SEARCH_INDEX, LuceneCliStrings.LUCENE_CREATE_INDEX,

 LuceneCliStrings.LUCENE_DESCRIBE_INDEX, LuceneCliStrings.LUCENE_LIST_INDEX})

 public boolean indexCommandsAvailable() {

  return (!CliUtil.isGfshVM() || (getGfsh() != null && getGfsh().isConnectedAndReady()))

 }

1.4  Tests

For each command, need at least dunit test and junit tests. 

LuceneIndexCommandsDUnitTest.java

LuceneIndexCommandsJUnitTest.java

LuceneListIndexFunctionJUnitTest.java

LuceneCreateIndexFunctionJUnitTest.java

 

2. Adding new parameter to existing command

...

src/test/java/com/com/gemstone/gemfire/management/internal/configuration/SharedConfigurationEndToEndDUnitTest.java


 

@CliAvailabilityIndicator({LuceneCliStrings.LUCENE_SEARCH_INDEX, LuceneCliStrings.LUCENE_CREATE_INDEX,
  + LuceneCliStrings.LUCENE_DESCRIBE_INDEX, LuceneCliStrings.LUCENE_LIST_INDEX})
  + public boolean indexCommandsAvailable() {
  + return (!CliUtil.isGfshVM() || (getGfsh() != null && getGfsh().isConnectedAndReady()));
  + }