From: <hr...@rh...> - 2009-05-25 09:14:24
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [3977] Add a children command to display the direct children of a resource.</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>3977</dd> <dt>Author</dt> <dd>hrupp</dd> <dt>Date</dt> <dd>2009-05-25 04:14:17 -0500 (Mon, 25 May 2009)</dd> </dl> <h3>Log Message</h3> <pre>Add a children command to display the direct children of a resource.</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcStandaloneContainerjava">rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulescoreplugincontainersrcmainjavaorgrhqcorepcStandaloneContainerjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java (3976 => 3977)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java 2009-05-22 15:44:28 UTC (rev 3976) +++ rhq/trunk/modules/core/plugin-container/src/main/java/org/rhq/core/pc/StandaloneContainer.java 2009-05-25 09:14:17 UTC (rev 3977) </span><span class="lines">@@ -304,6 +304,9 @@ </span><span class="cx"> case AVAIL: avail(tokens); break; </span><span class="add">+ case CHILDREN: + children(tokens); + break; </span><span class="cx"> case DISCOVER: discover(tokens); break; </span><span class="lines">@@ -446,6 +449,19 @@ </span><span class="cx"> } /** </span><span class="add">+ * Print the direct child resources of a given resource + * @param tokens tokenized command line tokens[0] is the command itself + */ + private void children(String[] tokens) { + int id = Integer.valueOf(tokens[1]); + Resource r = inventoryManager.getResourceContainer(id).getResource(); + Set<Resource> resources = r.getChildResources(); + for (Resource res : resources) { + System.out.println(res); + } + } + + /** </span><span class="cx"> * Helper to obtain the list of known resources * @return Set of resources including the platform */ </span><span class="lines">@@ -650,6 +666,7 @@ </span><span class="cx"> private enum Command { ASCAN("as", "", 0, "Triggers an availability scan"), // AVAIL("a", " ( id )", 0, "Shows an availability report. If id is given, only shows availability for resource with id id"), // </span><span class="add">+ CHILDREN("chi","id",1, "Shows the direct children of the resource with the passed id"),// </span><span class="cx"> DISCOVER("disc", " s | i |Êall", 1, "Triggers a discovery scan for (s)erver, serv(i)ce or all resources"), // // EVENT("e", "", 0, "Pull events"), // TODO needs to be defined FIND("find", "r | t | rt <name>", 2, "Searches a (r)esource, resource (t)ype or resources of (rt)ype. Use * as wildcard.\n" </span> </pre> </div> </div> </body> </html> |