You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Anthony Baker (JIRA)" <ji...@apache.org> on 2018/04/20 19:57:30 UTC

[jira] [Closed] (GEODE-2270) Need API to call gfsh and get results dynamically from code

     [ https://issues.apache.org/jira/browse/GEODE-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Baker closed GEODE-2270.
--------------------------------

> Need API to call gfsh and get results dynamically from code
> -----------------------------------------------------------
>
>                 Key: GEODE-2270
>                 URL: https://issues.apache.org/jira/browse/GEODE-2270
>             Project: Geode
>          Issue Type: Improvement
>          Components: docs, gfsh, management
>            Reporter: Wes Williams
>            Priority: Major
>              Labels: ManagementService, MemberMXBean, gfsh, jmx
>
> GIVEN:
> 1) The GfshParser and CommandResult are internal classes.
> 2) CommandResult returns headings, line.separator's and UI concerns along with the answer
> WHEN:
> I pass a gfsh command into a public gfsh API from code
> THEN:
> I get back an XML or JSON representation of the core results without the headings, line.separator's and UI concerns
> EXAMPLE (idea node and not actual implementation):
> WHEN:
>         String gfshResults = gfshPublicAPI("list regions");
>         return gfshResults;
>     String gfshPublicAPI(String gfshCommand) {
>         ParseResult parseResult = gfshParser.parse(gfshCommand);
>         String results = (String) parseResult.getMethod()+"Json"
>           .invoke(parseResult.getInstance(), parseResult.getArguments())
>        return results;
>     }
>     CommandResult gfshInternalAPI(String gfshCommand) {
>         ParseResult parseResult = gfshParser.parse(gfshCommand);
>         CommandResult results = (CommandResult) parseResult.getMethod()
>           .invoke(parseResult.getInstance(), parseResult.getArguments())
>        return results;
>     }
> Another option is to include a new property --output=json into gfsh commands that return the core results without the UI concerns, per Anthony Baker's comment on Fri, 04 Nov, 20:31 at: https://mail-archives.apache.org/mod_mbox/incubator-geode-dev/201611.mbox/browser



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)