[ https://issues.apache.org/jira/browse/GEODE-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15801659#comment-15801659 ]
Wes Williams commented on GEODE-2270: ------------------------------------- There was a thread on this topic in the geode dev mailing list on this. Another option is to include a --output=json attribute in gfsh per Anthony Baker's suggestion here: https://mail-archives.apache.org/mod_mbox/incubator-geode-dev/201611.mbox/ajax/%3C1895B674-A87E-453B-BC39-E464B16C4678%40pivotal.io%3E > 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: gfsh > Reporter: Wes Williams > Fix For: 1.1.0 > > > 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 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); > XmlResult results = (XmlResult) parseResult.getMethod()+"Xml" > .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; > } -- This message was sent by Atlassian JIRA (v6.3.4#6332)