Hi all,
I am developing a policy management application with the Java SDK framework provided by CA. Please take a look at the method I posted below. I am calling this method from a Jbutton in a different class. I wonder if someone familiar with the API's can look at this and give input. Please excuse the formatting, when I copied from Eclipse it seemed to lose my indentations.
I am storing the ACO properties in a hash map and displaying them to a Jtable (not seen in the code below) This code below is working, but it is not the way I want it to work. I am making updates to the ACO parameters directly from the JTable which uses an abstract table model I created to get and set the AcoUpdateMap(). The problem is when I try to use the setAgentConfigProperties method and pass in the acoUpdates hash map that was edited by the user in the JTable, it does not take unless I first call the:
policyapi.deleteAgentConfig
then call the: setAgentConfigProperties()
and finally call the: policyapi.addAgentConfigProperties.
The CA code states that you can call the setAgentConfigProperty on an SmProperty property object and it will update the value of an existing one. I tried to update each in a for loop as well and that method did nothing. This causes issues for me because it is constantly creating a new OID value on the delete and recreate of the object and I would like that OID value to stay the same after ACO parameter updates.
Any help on this would be greatly appreciated.
The CA SDK documentation states:
MY CODE START
================
public void doModificationUpdateACO() throws SmApiException{
SmApiResult result = new SmApiResult();
SmPolicyApi policyapi = new SmPolicyApiImpl(session);
SmAgentConfig acoRetrieve = new SmAgentConfig(ACO_TO_RETRIEVE);
result = policyapi.getAgentConfig(ACO_TO_RETRIEVE, acoRetrieve);
boolean getacosuccess = result.isSuccess();
System.out.println("Agent successfully retrieved in update method: " + getacosuccess);
String acoOldOid = acoRetrieve.getOid().toString();
SmProperty acoUpdates[] = new SmProperty[ getAcoUpdateMap().size() ];
System.out.println("ACO map size is" + getAcoUpdateMap().size());
int i = 0;
for (Map.Entry<String, String> entry : getAcoUpdateMap().entrySet()){
acoUpdates[i] = new SmProperty(entry.getKey(), entry.getValue());
i++;
}
result = policyapi.deleteAgentConfig(ACO_TO_RETRIEVE);
boolean delACOsucc = result.isSuccess();
System.out.println("ACO delete success: " + delACOsucc);
acoRetrieve.setAgentConfigProperties(acoUpdates);
result = policyapi.addAgentConfig(acoRetrieve);
boolean addACOsucc = result.isSuccess();
acoRetrieve.setOid(acoOldOid);
System.out.println("ACO add success: " + addACOsucc + "OID: " + acoRetrieve.getOid().toString());
}
Thank you!
Adam