Package org.wso2.carbon.registry.core

Examples of org.wso2.carbon.registry.core.Collection


        assertEquals("Permalink incorrect", r1e3.getPermanentPath(), r1Versions[1]);
    }

    public void testPermaLinksForCollections() throws Exception {

        Collection c1 = registry.newCollection();
        registry.put("/test/v14/c1", c1);

        registry.createVersion("/test/v14/c1");

        String[] c1Versions = registry.getVersions("/test/v14/c1");
View Full Code Here


        r1.setContent("r1c1");
        registry.put("/vtr1", r1);

        registry.createVersion("/");

        Collection c2 = registry.newCollection();
        registry.put("/vtc2", c2);

        registry.createVersion("/");

        String[] rootVersions = registry.getVersions("/");

        Collection rootv0 = (Collection) registry.get(rootVersions[0]);
        String[] rootv0Choldren = (String[]) rootv0.getContent();
        assertTrue("Root should have child vtr1",
                RegistryUtils.containsAsSubString("/vtr1", rootv0Choldren));
        assertTrue("Root should have child vtc2",
                RegistryUtils.containsAsSubString("/vtc2", rootv0Choldren));

        Collection rootv1 = (Collection) registry.get(rootVersions[1]);
        String[] rootv1Choldren = (String[]) rootv1.getContent();
        assertTrue("Root should have child vtr1",
                RegistryUtils.containsAsSubString("/vtr1", rootv1Choldren));
        assertFalse("Root should not have child vtc2",
                RegistryUtils.containsAsSubString("/vtc2", rootv1Choldren));
    }
View Full Code Here

    public XPathConfigData[] getXPathConfigData() throws RegistryException {
        String resourcePath = ActivityPublisherConstants.STATISTISTICS_REG_PATH + SEPERATOR +
                              ActivityPublisherConstants.XPATH_ROOT_PATH;

        Resource resource;
        Collection collection;
        ArrayList<XPathConfigData> xpathConfigs = new ArrayList<XPathConfigData>();

        if (registry != null) {
            if (registry.resourceExists(resourcePath)) {
                resource = registry.get(resourcePath);
                if (!(resource instanceof Collection)) {
                    return new XPathConfigData[0];
                }

                collection = (Collection) resource;
                String[] children = collection.getChildren();

                if (children != null) {
                    for (String child : children) {
                        Resource xpath = registry.get(child);
View Full Code Here

        try {
            RegistryService registryService = CommonsDataHolder.getInstance().getRegistryService();
            UserRegistry registry = registryService.getGovernanceSystemRegistry();

            // Set queue properties
            Collection queue = null;
            String queueID = CommonsUtil.getQueueID(queueName);

            if (!registry.resourceExists(queueID)) { // Create queue
                queue = registry.newCollection();

                queue.setProperty(OWNER, owner);
                queue.setProperty(NAME, queueName);
                queue.setProperty(CREATED_TIME, ConverterUtil.convertToString(
                        Calendar.getInstance()));
                queue.setProperty(UPDATED_TIME, ConverterUtil.convertToString(
                        Calendar.getInstance()));
                queue.setProperty(CREATED_FROM, CREATED_FROM_AMQP);
                queue.setProperty(USER_COUNT, "1");
            } else { // Share queue
                queue = (Collection)registry.get(queueID);

                queue.setProperty(UPDATED_TIME, ConverterUtil.convertToString(
                        Calendar.getInstance()));

                String userCount = queue.getProperty(USER_COUNT);
                if (null != userCount) {
                    int count = Integer.parseInt(userCount);
                    queue.setProperty(USER_COUNT, Integer.toString(++count));
                }
            }

            registry.put(queueID, queue);
        } catch (RegistryException e) {
View Full Code Here

            if (registry.resourceExists(queueID)) {
                String createdFrom = registry.get(queueID).getProperty(CREATED_FROM);

                if ((null != createdFrom) && (CREATED_FROM_AMQP.equals(createdFrom))) {
                    Collection queue = (Collection)registry.get(queueID);

                    String userCount = queue.getProperty(USER_COUNT);
                    if (null != userCount) {
                        int count = Integer.parseInt(userCount);

                        if (count > 1) {
                            queue.setProperty(USER_COUNT, Integer.toString(--count));
                            registry.put(queueID, queue);
                        } else {
                            registry.delete(queueID);
                        }
                    }
View Full Code Here

            UserRegistry registry = registryService.getGovernanceSystemRegistry();

            // Get queues
            String queuesID = CommonsUtil.getQueuesID();
            if (registry.resourceExists(queuesID)) {
                Collection queueCollection = (Collection)registry.get(queuesID);
                queueDetailsArray = new QueueDetails[queueCollection.getChildCount()];

                int index = 0;
                for (String queueId : queueCollection.getChildren()) {
                    Collection queue = (Collection)registry.get(queueId);

                    QueueDetails queueDetails = new QueueDetails();
                    queueDetails.setName(queue.getProperty(NAME));
                    queueDetails.setOwner(queue.getProperty(OWNER));
                    queueDetails.setCreatedTime(queue.getProperty(CREATED_TIME));

                    queueDetailsArray[index++] = queueDetails;
                }
            }
View Full Code Here

        try {
            RegistryService registryService = CommonsDataHolder.getInstance().getRegistryService();
            UserRegistry registry = registryService.getGovernanceSystemRegistry();

            // Add new subscription and set properties
            Collection subscription = null;
            String subscriptionID = CommonsUtil.getSubscriptionID(topic, subscriptionName);

            if (!registry.resourceExists(subscriptionID)) {
                subscription = registry.newCollection();
            } else {
                subscription = (Collection)registry.get(subscriptionID);
            }

            subscription.setProperty(OWNER, owner);
            subscription.setProperty(NAME, subscriptionName);
            subscription.setProperty(CREATED_TIME, CommonsUtil.getCurrentTime());

            registry.put(subscriptionID, subscription);
        } catch (RegistryException e) {
            throw new RegistryClientException(e);
        }
View Full Code Here

            UserRegistry registry = registryService.getGovernanceSystemRegistry();

            // Get subscriptions
            String subscriptionsID = CommonsUtil.getSubscriptonsID(topic);
            if (registry.resourceExists(subscriptionsID)) {
                Collection subscriptionCollection = (Collection)registry.get(subscriptionsID);
                subscriptionDetailsArray =
                        new SubscriptionDetails[subscriptionCollection.getChildCount()];

                int index = 0;
                for (String subs : subscriptionCollection.getChildren()) {
                    Collection subscription = (Collection)registry.get(subs);

                    SubscriptionDetails subscriptionDetails = new SubscriptionDetails();
                    subscriptionDetails.setName(subscription.getProperty(NAME));
                    subscriptionDetails.setOwner(subscription.getProperty(OWNER));
                    subscriptionDetails.setCreatedTime(subscription.getProperty(CREATED_TIME));

                    subscriptionDetailsArray[index++] = subscriptionDetails;
                }
            }
View Full Code Here

            registry.put(r6Path, r6);
        } catch (RegistryException e) {

        }

        Collection collection = registry.searchContent("word");
        String[] paths = (String[]) collection.getContent();

        assertEquals("Search should return the relevant path corresponding to the content which includes " +
                "submitted keywords.", "/c1/r6", paths[0]);

    }
View Full Code Here

            registry.put(r7Path, r7);
        } catch (RegistryException e) {

        }

        Collection collection = registry.searchContent("excel");
        String[] paths = (String[]) collection.getContent();

        assertEquals("Search should return the relevant path corresponding to the content which includes " +
                "submitted keywords.", "/c1/r7", paths[0]);

    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.Collection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.