[ https://issues.apache.org/jira/browse/SLING-5900?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simone Tripodi updated SLING-5900: ---------------------------------- Attachment: SLING-5900.patch Hi there [~teofili], please find in attachment a first proposal to handle conflicts with IDs: it is a simple HTTP filter which intercepts all {{POST /libs/sling/distribution/settings/agents/.*}} request and look in the OSGi registry if there is a {{org.apache.sling.distribution.agent.DistributionAgent}} service already registered with the same {{name}} but different {{type}}. Please let me know if more stuff need to be implemented, I'd be more than glad to provide my help! > Improve create agents API handling of duplicate IDs > --------------------------------------------------- > > Key: SLING-5900 > URL: https://issues.apache.org/jira/browse/SLING-5900 > Project: Sling > Issue Type: Bug > Components: Distribution > Affects Versions: Content Distribution Core 0.1.18 > Reporter: Ana Vinatoru > Assignee: Simone Tripodi > Fix For: Content Distribution 0.2.0 > > Attachments: SLING-5900.patch > > > The distribution agent creation API has the wrong results in the following > scenarios: > * Scenario 1: > ** create agent with id Bob and type Forward > ** create agent with id Bob and type Reverse > ** the first agent is now replaced by the second one. I think this should be > an error case (i.e. if there's already an agent with the same ID and a > different type, the API should return an error). > * Scenario 2 > ** create agent with id Bob and type Forward > ** create agent with id Bob and type Forward > ** the properties of the first agent are overwritten by what we inputted at > step 2 > I am using the API from a create / update UI context, so one solution would > be to add an ":operation" parameter to distinguish between the two cases. > So a "create" on an existing agent resource should fail, regardless of agent > type, but an "update" should work. -- This message was sent by Atlassian JIRA (v6.3.4#6332)