System.out.println("actorsToAddStr ="+actorsToAddStr);
System.out.println("actorsToRemoveStr ="+actorsToRemoveStr);
if(actorsToAddStr != null){
if(resourceID == null){
throw new
GfacException("When capability update info is provided, resourceID must not be null",FaultCode.InvaliedLocalArgumnet);
}
List<Capability> actorsToAdd = new ArrayList<Capability>();
String[] actorsToAddRaw = actorsToAddStr.split(ACTOR_SEPERATOR);
for(String raw:actorsToAddRaw){
if(raw != null && raw.trim().length() > 0){
String[] data = raw.split(ACTOR_FILED_SEPERATOR);
actorsToAdd.add(new Capability(data[0], data[1]));
}
}
if(actorsToRemoveStr != null){
String[] actorsToRemoveRaw = actorsToRemoveStr.split(ACTOR_SEPERATOR);
for(String actor:actorsToRemoveRaw){
if(actor != null && actor.trim().length() > 0){
if(!hasCapabilityWithName(actorsToAdd,actor)){
xregistryServiceWrapper.removeCapability(resourceID, actor);
}else{
removeCapabilitybyName(actorsToAdd, actor);
}
}
}
}
for(Capability capability:actorsToAdd){
xregistryServiceWrapper.addCapability(resourceID, capability.actor,
capability.isUser, capability.action);
}
return "Capability updated for resource "+resourceID;
}else{
return null;
}
} else {
throw new
GfacException("Capabilities are only avalible with xregistry",FaultCode.InvaliedLocalArgumnet);
}
}