Hi Ranga,

It is not a best practice to remove the resource that you have applied the
lifecycle from an Executor.

In the lifecycle implementation, we do some work such as setting the new
lifecycle state and its check items after the execution of the Executor
chain. When you delete the same resource(that was associated with the
lifecycle), these operations can not be performed and because of that, you
may get various errors.

To overcome this situation you can modify your code segment in the
following way. This will instruct the default lifecycle implementation to
return immediately.

public boolean execute(RequestContext requestContext, String currentState,
String targetState) {
   // some more logic
   requestContext.getRegistry().delete(resourcePath);
*   requestContext.setResource(null);*
}

Thanks,
Janaka

On Thu, Aug 2, 2012 at 6:01 PM, Ranga Siriwardena <[email protected]> wrote:

> Hi,
>
> I'm trying to move or delete a resource inside a class which extends
> "org.wso2.carbon.governance.registry.extensions.interfaces.Execution"
> class. Following is my my code segment which I'm trying to delete a
> resource in the given path.
>
> public boolean execute(RequestContext requestContext, String currentState,
> String targetState) {
>    // some more logic
>    requestContext.getRegistry().delete(resourcePath);
> }
>
> Same way, the copy operation works without any issue. But move and
> delete doesn't work as expected. Am I missing anything
> here. Appreciate your feedback.
>
> Thank You.
>  Ranga.
>
> --
> Ranga Siriwardena
> Software Engineer
> WSO2 Inc.
>
>


-- 
Janaka Ranabahu
Software Engineer
WSO2 Inc.

Mobile +94 718370861
Email : [email protected]
Blog : janakaranabahu.blogspot.com
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to