Created
May 17, 2013 06:54
-
-
Save zevnull/5597383 to your computer and use it in GitHub Desktop.
Get list of Solutions Overview names from config file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get list of Solutions Overview names from config file | |
* | |
* @return List<String> - Solutions Overview names | |
* @throws Exception | |
*/ | |
public List<String> getSolutionsOverviewNamesFromConfig() throws Exception | |
{ | |
DMLogger.methodStarted(); | |
// TODO add path for QH DM2Web config (system-config.json) | |
// String jsonTxt = ssh.runCommand( "less /opt/ddn/directmon/web/etc/ddn/directmon/system-config.json" ); | |
String jsonTxt = ssh.runCommand( "less /etc/ddn/directmon/system-config.json" ); | |
JSONObject json = ( JSONObject ) JSONSerializer.toJSON( jsonTxt ); | |
Set<?> s = json.keySet(); | |
List<String> result = new ArrayList<String>(); | |
Iterator<?> it = s.iterator(); | |
while( it.hasNext() ) | |
{ | |
Set<String> keySet = json.getJSONObject( it.next().toString() ).keySet(); | |
result.addAll( keySet ); | |
} | |
for( int i = 0; i < result.size(); i++ ) | |
{ | |
String element = result.get( i ).toString(); | |
element = element.substring( 0, element.indexOf( ":" ) ); | |
result.set( i, element ); | |
} | |
DMLogger.methodFinished( result ); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment