Package org.wso2.carbon.registry.core

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


        try {
            UserRegistry userRegistry =
                    this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
            String subscriptionID = null;
            if (userRegistry.resourceExists(topicResourcePath)) {
                Collection subscriptions = (Collection) userRegistry.get(topicResourcePath);
                String[] subscriptionPaths = (String[]) subscriptions.getContent();
                for (String subscriptionPath : subscriptionPaths) {
                    Resource resource = userRegistry.get(subscriptionPath);
                    Subscription subscription = JavaUtil.getSubscription(resource);
                    subscriptionID = subscriptionPath.substring(subscriptionPath.lastIndexOf("/") + 1);
                    subscription.setId(subscriptionID);
View Full Code Here


            if (registry.resourceExists(servicePoliciesPath)) {
                // there are service level policies
                Resource servicePoliciesResource = registry.get(servicePoliciesPath);
                if (servicePoliciesResource instanceof Collection) {
                    Collection servicePoliciesCollection = (Collection) servicePoliciesResource;
                    for (String servicePolicyResourcePath :
                            servicePoliciesCollection.getChildren()) {
                        PolicyInfo pi = handlePolicy(config,
                                proxyService, servicePolicyResourcePath, (UserRegistry) registry);
                        if (pi != null) {
                            pi.setPolicyKey("conf:" + pi.getPolicyKey());
                            proxyService.addPolicyInfo(pi);
View Full Code Here

    resource.setMatchingSnapshotID(wsResource.getMatchingSnapshotID());
    return resource;
  }

  public static Collection transformWSCollectiontoCollection(WSRegistryServiceClient client, WSCollection wsCollection, Object content) throws RegistryException, IOException, ClassNotFoundException {
    Collection collection = (Collection) transformWSResourcetoResource(client, wsCollection, content);
        if (wsCollection.getChildCount() > 0) {
            String[] children = wsCollection.getChildren();
            if (children != null) {
                collection.setChildren(children);
            }
        }
    return collection;

  }
View Full Code Here

            }
        } else if (arguments.length == 3) {
            if (arguments[0] instanceof String && arguments[1] instanceof Number &&
                arguments[2] instanceof Number) {
                try {
                    Collection collection = registryHostObject.registry.get(
                            getAbsoluteRegistryPath((String) arguments[0]), ((Number) arguments[1]).intValue(),
                            ((Number) arguments[2]).intValue());
                    CollectionHostObject collectionHostobject = (CollectionHostObject) cx.newObject(
                            registryHostObject, "Collection", new Object[]{collection});
                    return collectionHostobject;
View Full Code Here

                                                      Function funObj) throws CarbonException {
        RegistryHostObject registryHostObject = (RegistryHostObject) thisObj;
        if (arguments.length == 0) {
            if (registryHostObject.registry != null) {
                try {
                    Collection collection = registryHostObject.registry.newCollection();
                    CollectionHostObject collectionHostobject = (CollectionHostObject) cx.newObject(
                            registryHostObject, "Collection", new Object[]{collection});
                    return collectionHostobject;
                } catch (RegistryException e) {
                    throw new CarbonException("Error occurred while creating a new Collection.", e);
View Full Code Here

        }
        assertTrue("tag 'tag1' is not associated with the artifact /d12/r1", tagFound);
    }

    public void testAddTaggingCollection() throws Exception {
        Collection r1 = registry.newCollection();
        registry.put("/d13/d14", r1);
        registry.applyTag("/d13/d14", "col_tag1");

        Tag[] tags = registry.getTags("/d13/d14");
View Full Code Here

                long queryStart = System.nanoTime();
                //*****************************//
                Map params = new HashMap();
                params.put("1", "%production%");
                Collection r2 = registry.executeQuery(QUERY_PATH, params);

                //*****************************//
                long queryEnd = System.nanoTime();
                long queryTime = queryEnd - queryStart;
                System.out.println("CSV," + threadName + "," + "query," + queryTime / 1000000);

                r2.discard();

                //System.out.println("~~~~~begin delete~~~~~");
                long deleteStart = System.nanoTime();
                //*****************************//
                registry.delete(basePath + i + "/s1/a1");
View Full Code Here

                r1vv2.getProperty("p2"), "v2");
    }

    public void testSimpleCollectionVersioning() throws Exception {

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

        registry.createVersion("/v3/c1");

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

        registry.createVersion("/v3/c1");

        Collection c3 = registry.newCollection();
        registry.put("/v3/c1/c3", c3);

        registry.createVersion("/v3/c1");

        Collection c4 = registry.newCollection();
        registry.put("/v3/c1/c2/c4", c4);

        registry.createVersion("/v3/c1");

        Collection c5 = registry.newCollection();
        registry.put("/v3/c1/c2/c5", c5);

        registry.createVersion("/v3/c1");

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

                "content 1", new String((byte[]) r1r1.getContent()));
    }

    public void testSimpleCollectionRestore() throws Exception {

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

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

        Resource r1 = registry.newResource();
        r1.setContent("r1c1");
        registry.put("/test/v11/c1/r1", r1);

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

        Resource r2 = registry.newResource();
        r2.setContent("r1c1");
        registry.put("/test/v11/c1/r2", r2);

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

        String[] c1Versions = registry.getVersions("/test/v11/c1");
        assertEquals("/test/v11/c1 should have 3 versions.", c1Versions.length, 3);

        registry.restoreVersion(c1Versions[2]);
        Collection c1r1 = (Collection) registry.get("/test/v11/c1");
        assertEquals("version 1 of c1 should not have any children", 0, c1r1.getChildren().length);

        try {
            registry.get("/test/v11/c1/r1");
            fail("Version 1 of c1 should not have child r1");
        } catch (Exception e) {}

        try {
            registry.get("/test/v11/c1/r2");
            fail("Version 1 of c1 should not have child r2");
        } catch (Exception e) {}

        registry.restoreVersion(c1Versions[1]);
        Collection c1r2 = (Collection) registry.get("/test/v11/c1");
        assertEquals("version 2 of c1 should have 1 child", 1, c1r2.getChildren().length);

        try {
            registry.get("/test/v11/c1/r1");
        } catch (Exception e) {
            fail("Version 2 of c1 should have child r1");
        }

        try {
            registry.get("/test/v11/c1/r2");
            fail("Version 2 of c1 should not have child r2");
        } catch (Exception e) {

        }

        registry.restoreVersion(c1Versions[0]);
        Collection c1r3 = (Collection) registry.get("/test/v11/c1");
        assertEquals("version 3 of c1 should have 2 children", 2, c1r3.getChildren().length);

        try {
            registry.get("/test/v11/c1/r1");
        } catch (Exception e) {
            fail("Version 3 of c1 should have child r1");
View Full Code Here

        }
    }

    public void testAdvancedCollectionRestore() throws Exception {

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

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

        Resource r1 = registry.newResource();
        r1.setContent("r1c1".getBytes());
        registry.put("/test/v12/c1/c11/r1", r1);

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

        Collection c2 = registry.newCollection();
        registry.put("/test/v12/c1/c11/c2", c2);

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

        Resource r1e1 = registry.get("/test/v12/c1/c11/r1");
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.