Hi Senaka,

On Wed, Aug 7, 2013 at 1:23 PM, Senaka Fernando <sen...@wso2.com> wrote:

> Hi Nuwan,
>
> No simply wait for the BE call (VM-operation or WS-call) to complete.
>

The java operation doesn't return anything upon success,  hence javascript
code just trigger this operation and go on to the next line, which sets the
permission to the asset path. This doesn't happen because the asset is not
yet added by the 1st operation. What do you suggest ?

Regards,
/Nuwan

If you want to make this asynchronous and still check whether the operation
> completed, then you can see whether the asset can be fetched by ID. But, I
> believe that the former is a straightforward thing to do.
>
> Thanks,
> Senaka.
>
>
> On Wed, Aug 7, 2013 at 12:29 PM, Nuwan Bandara <nu...@wso2.com> wrote:
>
>> Hi Senaka
>>
>>
>> On Wed, Aug 7, 2013 at 10:08 AM, Senaka Fernando <sen...@wso2.com> wrote:
>>
>>> Hi Dulitha,
>>>
>>> It depends on the client you use. If your code (or the BE code of the
>>> Jaggery code you've written, waits for the operation to complete, then it
>>> is synchronous. If it is not, then it wont behave that way.
>>>
>>
>> How can we wait for the operation to complete, I mean how can we know
>> when the asset is created ? by doing res.exists() ?
>>
>>
>>>
>>> Thanks,
>>> Senaka.
>>>
>>>
>>> On Wed, Aug 7, 2013 at 8:58 AM, Dulitha Wijewantha <duli...@wso2.com>wrote:
>>>
>>>> Hi guys,
>>>> I am inserting to the registry using the system registry of the generic
>>>> store using the Generic Artifact Manager. The issue is that when I insert
>>>> through the GAM - it take sometime to be inserted to the registry. I want
>>>> to set get operation for the anon role using the UserManager. Since the
>>>> instance is not existing the permission is not applied.
>>>>
>>>>         am = new carbon.registry.ArtifactManager(registry, "mobileapp");
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>    var attributes ={
>>>>
>>>>         overview_status: "PENDING-REVIEW",
>>>>
>>>>         overview_name: ctx.name,
>>>>
>>>>            overview_platform:t,
>>>>         overview_version: ctx.version,
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>         overview_url: ctx.url,
>>>>         overview_provider: ctx.provider,
>>>>            overview_description: ctx.description,
>>>>            overview_market:ctx.markettype,
>>>>            // overview_recentChanges:ctx.recentChanges,
>>>>            overview_packageName:ctx.packagename,
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>            overview_category:ctx.category,
>>>>            images_icon:icon,
>>>>
>>>>            images_banner:banner,
>>>>            images_screenshots:screenshots
>>>>     };
>>>>    attributes[attributes.overview_status+"_date"]=printDate();
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>    am.add({
>>>>                name: ctx.name,
>>>>                    lifecycle:["applifecycle"],
>>>>                    path:path,
>>>>                    attributes:attributes
>>>>            });
>>>>   // The above call is not synchrnous. The method returns without actually 
>>>> adding the asset to the registry.
>>>>   // A JavaScript way of dealing with such things would be to implement a 
>>>> callback. Maybe for Java we need a listner.
>>>>    um.authorizeRole(carbon.user.anonRole, path, 
>>>> carbon.registry.actions.GET);
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   //Above call will not work since the asset is not there in the registry
>>>>
>>>>
>>>> Can someone from registry team explain whether the *addGenericArtifact
>>>> *method is synchronous or not. Just for the sake of testing I even
>>>> tried out a while loop using exists method- it also go infinite.
>>>>
>>>> Thanks
>>>> --
>>>> Chan (Dulitha Wijewantha)
>>>> Software Engineer - Mobile Development
>>>> WSO2Mobile
>>>> Lean.Enterprise.Mobileware
>>>>  * ~Email       duli...@wso2.com <duli...@wso2mobile.com>*
>>>> *  ~Mobile     +94712112165*
>>>> *  ~Website   dulithawijewantha.com
>>>> *
>>>> *  ~Blog         
>>>> blog.dulithawijewantha.com<http://dulichan.github.io/chan/>
>>>> *
>>>> *  ~Twitter     @dulitharw <https://twitter.com/dulitharw>*
>>>>
>>>
>>>
>>>
>>> --
>>> * <http://us13.wso2con.com/>
>>> *
>>> *
>>> *
>>> *Senaka Fernando*
>>> Senior Technical Lead; WSO2 Inc.; http://wso2.com*
>>> Member; Apache Software Foundation; http://apache.org
>>>
>>> E-mail: senaka AT wso2.com
>>> **P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
>>> Linked-In: http://linkedin.com/in/senakafernando
>>>
>>> *Lean . Enterprise . Middleware
>>>
>>
>>
>>
>> --
>> *Thanks & Regards,
>>
>> Nuwan Bandara
>> Technical Lead; **WSO2 Inc. *
>> *lean . enterprise . middleware |  http://wso2.com *
>> *blog : http://nuwanbando.com; email: nu...@wso2.com; phone: +94 11 763
>> 9629
>> *
>> <http://www.nuwanbando.com/>
>>
>
>
>
> --
> * <http://us13.wso2con.com/>
> *
> *
> *
> *Senaka Fernando*
> Senior Technical Lead; WSO2 Inc.; http://wso2.com*
> Member; Apache Software Foundation; http://apache.org
>
> E-mail: senaka AT wso2.com
> **P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
> Linked-In: http://linkedin.com/in/senakafernando
>
> *Lean . Enterprise . Middleware
>



-- 
*Thanks & Regards,

Nuwan Bandara
Technical Lead; **WSO2 Inc. *
*lean . enterprise . middleware |  http://wso2.com *
*blog : http://nuwanbando.com; email: nu...@wso2.com; phone: +94 11 763 9629
*
<http://www.nuwanbando.com/>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to