Get A Shared Object - Juniper NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1 Manual

Api guide
Table of Contents

Advertisement

Get a Shared Object

Copyright © 2010, Juniper Networks, Inc.
response.getObject()[0].getObjectData().getData().getBase64Binary().getInputStream();
//uses XPath to get the IP address of the address object without
deserializing the whole object:
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
XPathExpression expr =
xpath.compile("/address/address/address/subnet/ip/text()");
String ipAddr = expr.evaluate(new InputSource(inputStream));
System.out.println("The ip address is " + ipAddr);
assertTrue(response.getStatus() == StatusCodeType.Success);
} catch (Exception e) {
e.printStackTrace();
}
}
The following Data Centric Service API sample code gets a shared address object.
* Gets a single Address Object
* <p/>
* Prerequisite:
* An address object has been added in NSM
*/
public void testGetAddressObject() {
try {
System.out.println("Running testGetAddressObject()");
GetObjectViewByIdRequest request = new GetObjectViewByIdRequest();
request.setAuthToken(DataCentricServiceTest.authToken);
ObjectIdentifierType oid = new ObjectIdentifierType();
oid.setDomainId(new UnsignedShort("1"));
oid.setCategory("address");
ObjectIdOrNameType choice = new ObjectIdOrNameType();
choice.setObjectName("AddrA");
oid.setObjectIdOrName(choice);
request.addObjectIdentifier(oid);
GetObjectViewByIdResponse response =
DataCentricServiceTest.stub.GetObjectViewByIdRequest(request);
DataCentricServiceTest.print(response.getObject());
assertTrue(response.getStatus() == StatusCodeType.Success);
} catch (Exception e) {
e.printStackTrace();
}
}
Chapter 11: Using APIs for Shared Object Management
109

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Network and security manager 2010.4

Table of Contents