Hi Pubudu,

Here is some sample code snippet, You'll get an idea on how to iterate
through.

if (governanceRegistry.resourceExists(Constants.GREG_RESOURCE_PATH)) {
    Collection govCollection = (Collection)
governanceRegistry.get(Constants.GREG_RESOURCE_PATH);
    String[] child = govCollection.getChildren();
    for (int i = 0; i < child.length; i++) {
        Collection collection = (Collection)
governanceRegistry.get(child[i]);
        String[] ch = collection.getChildren();
        for (int j = 0; j < ch.length; j++) {
            Resource r = governanceRegistry.get(ch[j]);
            try {
                byte[] contentBytes = (byte[]) r.getContent();
            } catch (ClassCastException e) {
                log.error("Class cast Exception", e);
            }
        }
    }
}

Regards,
Aruna


On Mon, Mar 16, 2015 at 1:02 AM, Danushka Fernando <danush...@wso2.com>
wrote:

> AFAIU what you want is to get all resources in a collection. You can
> retrieve collection from registry and iterate though all resources in that
> collection.
>
> Thanks & Regards
> Danushka Fernando
> Software Engineer
> WSO2 inc. http://wso2.com/
> Mobile : +94716332729
>
> On Mon, Mar 16, 2015 at 1:28 PM, Pubudu Dodangoda <pubu...@wso2.com>
> wrote:
>
>> If I say it specifically,I want to know how to get all the resources in a
>> directory in registry
>> I know how to do this when the resource names are known, by using this
>> registry.getResource("resourceName")
>>
>> I want to get all the resources
>>
>> Thank You and kind regards
>>
>> On Mon, Mar 16, 2015 at 1:19 PM, Pubudu Dodangoda <pubu...@wso2.com>
>> wrote:
>>
>>> Where can I find the complete documentations for carbon context API?
>>> link <https://docs.wso2.com/display/Carbon420/CarbonContext+API>
>>>
>>> I mean something similar to this collections
>>> <http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html>
>>>
>>> My truest intention is to get an idea about the methods provided in this
>>> API for Registry access
>>>
>>> If someone can point me in the correct direction, I'd be very much
>>> grateful
>>>
>>> Thank You
>>> --
>>> Pubudu Dodangoda
>>> BSc Engineering(Hon's) Undergraduate
>>> Department of Computer Science Engineering
>>> University of Moratuwa
>>> 0716053681 / 0775192994
>>>
>>
>>
>>
>> --
>> Pubudu Dodangoda
>> BSc Engineering(Hon's) Undergraduate
>> Department of Computer Science Engineering
>> University of Moratuwa
>> 0716053681 / 0775192994
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

*Aruna Sujith Karunarathna* | Software Engineer
WSO2, Inc | lean. enterprise. middleware.
#20, Palm Grove, Colombo 03, Sri Lanka
Mobile: +94 71 9040362 | Work: +94 112145345
Email: ar...@wso2.com | Web: www.wso2.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to