</address>
</address>
Sample Code
* Tests replacing an Address object
*/
public void testReplaceAddressObject() {
try {
File addressFile = new File( File.sep pathO
"/Input/" + "testAddressReplace.xml");
System.out.println("Running testReplaceAddressObject()");
ModifyObjectViewRequest request = new ModifyObjectViewRequest();
request.setAuthToken(DataCentricServiceTest.authToken);
ModifyViewCommandType modifyCmd = new ModifyViewCommandType();
//specifies the address object to replace:
ObjectIdentifierType objectId = new ObjectIdentifierType();
objectId.setCategory("address");
objectId.setDomainId(new UnsignedShort("1"));
ObjectIdOrNameType objIdOrName = new ObjectIdOrNameType();
//objIdOrName.setObjectId(new UnsignedInt("1"));
objIdOrName.setObjectName("AddrA");
objectId.setObjectIdOrName(objIdOrName);
ReplaceObjectViewType replaceObject = new ReplaceObjectViewType();
//reads the new address in XML format from the file
"testAddressReplace.xml”:
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
XMLStreamReader parser =
xmlInputFactory.createXMLStreamReader(new
FileInputStream(addressFile));
StAXOMBuilder builder = new StAXOMBuilder(parser);
OMElement ome = builder.getDocumentElement();
replaceObject.setObjecData(new ObjectDataType());
replaceObject.getObjecData().setData(this.createOpaqueDataType(ome));
replaceObject.setObjectIdentifier(objectId);
modifyCmd.setReplaceObject(replaceObject);
request.addCommand(modifyCmd);
ModifyObjectViewResponse response =
DataCentricServiceTest.stub.ModifyObjectViewRequest(request);
assertTrue(response.getStatus() == StatusCodeType.Success);
} catch (Exception e) {
e.printStackTrace();
}
}
107
Copyright © 2010, Juniper Networks, Inc.
Chapter 11: Using APIs for Shared Object Management
Summary of Contents for NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1
Page 6: ...Copyright 2010 Juniper Networks Inc vi...
Page 10: ...Copyright 2010 Juniper Networks Inc x Network and Security Manager 2010 4 API Guide...
Page 12: ...Copyright 2010 Juniper Networks Inc xii Network and Security Manager 2010 4 API Guide...
Page 20: ...Copyright 2010 Juniper Networks Inc 2 Network and Security Manager 2010 4 API Guide...
Page 24: ...Copyright 2010 Juniper Networks Inc 6 Network and Security Manager 2010 4 API Guide...
Page 34: ...Copyright 2010 Juniper Networks Inc 16 Network and Security Manager 2010 4 API Guide...
Page 92: ...Copyright 2010 Juniper Networks Inc 74 Network and Security Manager 2010 4 API Guide...
Page 98: ...Copyright 2010 Juniper Networks Inc 80 Network and Security Manager 2010 4 API Guide...
Page 100: ...Copyright 2010 Juniper Networks Inc 82 Network and Security Manager 2010 4 API Guide...
Page 112: ...Copyright 2010 Juniper Networks Inc 94 Network and Security Manager 2010 4 API Guide...
Page 128: ...Copyright 2010 Juniper Networks Inc 110 Network and Security Manager 2010 4 API Guide...
Page 138: ...Copyright 2010 Juniper Networks Inc 120 Network and Security Manager 2010 4 API Guide...
Page 152: ...Copyright 2010 Juniper Networks Inc 134 Network and Security Manager 2010 4 API Guide...
Page 165: ...PART 6 Index Index on page 149 147 Copyright 2010 Juniper Networks Inc...
Page 166: ...Copyright 2010 Juniper Networks Inc 148 Network and Security Manager 2010 4 API Guide...