Topic
  • 2 replies
  • Latest Post - ‏2012-12-24T13:59:00Z by DavidSeager
NickLaqua
NickLaqua
17 Posts

Pinned topic How to automatically delete associated SLD

‏2012-12-21T02:18:38Z |
Hi there,

based on some recommendations how to simplify GEP, I have done the following changes around ServiceVersion and SLD:

  • changed the multiplicity to 1..1 for the "gep63_provides" relationship
  • added an configurable modifier action to create an SLD once a Service Version is created and link it to the service version
  • Remove SLD from the SLD lifecycle

Everything works fine when creating service versions, but I am having problems to convince WSRR to also delete the SLD if the service version is deleted. below my action file snippet.

<?xml version="1.0" encoding="UTF-8"?>
<action-configuration
name="DeleteAssociatedSLD"
xmlns="http://www.ibm.com/xmlns/prod/serviceregistry/Actions"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/serviceregistry/Actions Actions.xsd">
<delete-action target-query="//*/gep63_provides(.)"/>
</action-configuration>

It seems that the action is properly fired as I get error messages if I stuff up the syntax of the delete-action target-query. The query itself seems to point to the right object as well as I can use it with the REST interface returning the correct SLD.

But anyway, once I delete the service version, the SLD still remains. any idea ?

Nick
Updated on 2012-12-24T13:59:00Z at 2012-12-24T13:59:00Z by DavidSeager
  • DavidSeager
    DavidSeager
    64 Posts

    Re: How to automatically delete associated SLD

    ‏2012-12-24T13:50:51Z  
    I think you need to include the original Service Version being deleted, in the query, so it only finds the SLD for that SV. Something like:

    <delete-action
    target-query="//*/gep63_provides(.)"/>

    The original query looked like it would delete all SLDs in WSRR.

    However... this query will not work. When the modifier is run, the Service Version has already been deleted, so running the above query will not find the Service Version. The only things available are the properties on the Service Version which has been deleted.

    What I can think of, is that you store a user-defined property on the Service Version called "sldBsrURI". This UDP stores the bsrURI of the SLD. Then your rule is to use this property to find and delete the SLD, triggered from deleting the Service Version.

    <action-configuration
    name="DeleteSLD"
    xmlns="http://www.ibm.com/xmlns/prod/serviceregistry/Actions"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/serviceregistry/Actions Actions.xsd">
    <delete-action
    target-query="/WSRR/GenericObject"/>
    </action-configuration>
    To get this set on the SV you can make another modifier rule. Perhaps a rule which triggers on the update of a Service Version (with the gep63_provides relationship having a target added if you want to be exact). You can in the action then use "copy" to pull the bsrURI value from the SLD. Something like:

    <update-action copy="/WSRR/GenericObject/gep63_provides">
    <set-property name="sldBsrURI" value="${copy.bsrURI}"
    </update-action>

    I haven't tried the above. But it should, when the trigger is the SV, look for generic objects with the bsrURI of the SV, follow the gep63_provides relationship and get the SLD back. Then set a property on the SV taking the value of the SLD bsrURI.
  • DavidSeager
    DavidSeager
    64 Posts

    Re: How to automatically delete associated SLD

    ‏2012-12-24T13:59:00Z  
    I think you need to include the original Service Version being deleted, in the query, so it only finds the SLD for that SV. Something like:

    <delete-action
    target-query="//*/gep63_provides(.)"/>

    The original query looked like it would delete all SLDs in WSRR.

    However... this query will not work. When the modifier is run, the Service Version has already been deleted, so running the above query will not find the Service Version. The only things available are the properties on the Service Version which has been deleted.

    What I can think of, is that you store a user-defined property on the Service Version called "sldBsrURI". This UDP stores the bsrURI of the SLD. Then your rule is to use this property to find and delete the SLD, triggered from deleting the Service Version.

    <action-configuration
    name="DeleteSLD"
    xmlns="http://www.ibm.com/xmlns/prod/serviceregistry/Actions"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/serviceregistry/Actions Actions.xsd">
    <delete-action
    target-query="/WSRR/GenericObject"/>
    </action-configuration>
    To get this set on the SV you can make another modifier rule. Perhaps a rule which triggers on the update of a Service Version (with the gep63_provides relationship having a target added if you want to be exact). You can in the action then use "copy" to pull the bsrURI value from the SLD. Something like:

    <update-action copy="/WSRR/GenericObject/gep63_provides">
    <set-property name="sldBsrURI" value="${copy.bsrURI}"
    </update-action>

    I haven't tried the above. But it should, when the trigger is the SV, look for generic objects with the bsrURI of the SV, follow the gep63_provides relationship and get the SLD back. Then set a property on the SV taking the value of the SLD bsrURI.
    Hmm the forum is eating my special codes. The queries should be:

    
    <delete-action target-query=
    "//*[@bsrURI='${trigger.bsrURI}']/gep63_provides(.)"/>
    


    
    <action-configuration name=
    "DeleteSLD" xmlns=
    "http://www.ibm.com/xmlns/prod/serviceregistry/Actions" xmlns:xsi=
    "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=
    "http://www.ibm.com/xmlns/prod/serviceregistry/Actions Actions.xsd"> <delete-action target-query=
    "/WSRR/GenericObject[@bsrURI='${trigger.sldBsrURI}']"/> </action-configuration>
    


    
    <update-action copy=
    "/WSRR/GenericObject[@bsrURI='${trigger.bsrURI}']/gep63_provides(.)"> <set-property name=
    "sldBsrURI" value=
    "${copy.bsrURI}"/> </update-action>