How to get the "object tree" and

Started by 165432896, November 15, 2011, 02:58:52 PM

Previous topic - Next topic

165432896

hi:
I am developping our own console by the client java api(version 1.1.5). my friend have been ask you the get the official java-client(nxmc),but we are incapable the read it(because we are a new hand in java) .

Back to our topic:
I want to get the "object tree" just like below:
Entire Network
  + 10.0.0.0/24
  + 10.0.1.0/24
  - 10.0.2.0/24
     + 10.2.2.3/24
     + 10.2.2.4/24

How can it come true in the official java-client(nxmc)? It that some of the existing java api for it?
Best wish!

If you a free,can you tell me how the "topological graph"(ip neighbors) come true? Is it  come true just like the  "object tree"  above

Victor Kirhenshtein

Hi!

In nxmc we use Eclipse viewers, so code to got parent/child relations is actually decoupled into separate pieces. Simple code to print object tree, which you can use as an example:



private void printObject(GenericObject object, int level)
{
for(int i = 0; i < level; i++)
System.out.print(' ');
System.out.println(object.getObjectName());

for(GenericObject o : object.getChildsAsArray())
printObject(o, level + 2);
}

public void main() throws Exception
{
final NXCSession session = connect();  // obtain session somehow

session.syncObjects();

GenericObject object = session.findObjectById(1, EntireNetwork.class);

printObject(object, 0);

session.disconnect();
}


Best regards,
Victor