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

Api guide
Table of Contents

Advertisement

Network and Security Manager 2010.4 API Guide

Replace a Shared Object

testAddressReplace.xml
106
System.out.println("Running testInsertAddressObject()");
//creates an object of ModifyObjectViewRequest:
ModifyObjectViewRequest request = new ModifyObjectViewRequest();
request.setAuthToken(DataCentricServiceTest.authToken);
ModifyViewCommandType modifyCmd = new ModifyViewCommandType();
DomainIdOrNameType domain = new DomainIdOrNameType();
domain.setDomainId(new UnsignedShort("1"));
InsertObjectViewType insertObject = new InsertObjectViewType();
insertObject.setCategory("address");
insertObject.setDomainId(new UnsignedShort("1"));
//reads the address object in XML format from the file
"testAddressInsert.xml":
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
XMLStreamReader parser =
xmlInputFactory.createXMLStreamReader(new
FileInputStream(addressFile));
StAXOMBuilder builder = new StAXOMBuilder(parser);
OMElement ome = builder.getDocumentElement();
insertObject.setObjecData(new ObjectDataType());
insertObject.getObjecData().setData(this.createOpaqueDataType(ome));
modifyCmd.setInsertObject(insertObject);
request.addCommand(modifyCmd);
//invokes the service:
ModifyObjectViewResponse response =
stub.ModifyObjectViewRequest(request);
assertTrue(response.getStatus() == StatusCodeType.Success);
} catch (Exception e) {
e.printStackTrace();
}
}
The following Data Centric Service API sample code replaces a shared address object.
The following XML documentation is the input for the Data Centric Service API sample
code shown below.
<?xml version="1.0" encoding="UTF-8"?>
<address>
<name_>AddrA</name_>
<address>
<zone>trust</zone>
<address>
<subnet>
<ip>1.1.1.7</ip>
<netmask>21</netmask>
</subnet>
</address>
Copyright © 2010, Juniper Networks, Inc.

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

This manual is also suitable for:

Network and security manager 2010.4

Table of Contents