Package org.wso2.carbon.registry.core

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


        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[] rootV0Children = (String[]) rootV0.getContent();
        assertTrue("Root should have child vtr1",
                RegistryUtils.containsAsSubString("/vtr1", rootV0Children));
        assertTrue("Root should have child vtc2",
                RegistryUtils.containsAsSubString("/vtc2", rootV0Children));

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


                long queryStart = System.nanoTime();
                //*****************************//
                Map<String, String> params = new HashMap<String, String>();
                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();

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

                        APPConstants.PARAMETER_QUERY) + "?" +
                buildQueryString(parameters),
                requestOptions);
        Document introspection = resp.getDocument();
        Feed feed = (Feed) introspection.getRoot();
        Collection c = createResourceFromFeed(feed);
        abderaClient.teardown();
        return c;
    }
View Full Code Here

            if (log.isTraceEnabled()) {
                log.trace("Creating the '" + RegistryConstants.LOCAL_REPOSITORY_BASE_PATH +
                        RegistryConstants.SYSTEM_MOUNT_PATH +
                        "' collection of the Registry.");
            }
            Collection mountCollection = registry.newCollection();
            String description = "Mount collection stores details of mount points of the registry.";
            mountCollection.setDescription(description);
            registry.put(RegistryConstants.LOCAL_REPOSITORY_BASE_PATH +
                    RegistryConstants.SYSTEM_MOUNT_PATH, mountCollection);
        }
    }
View Full Code Here

                try {
                    boolean inTransaction = Transaction.isStarted();
                    if (!inTransaction) {
                        systemRegistry.beginTransaction();
                    }
                    Collection systemCollection = systemRegistry.newCollection();
                    String systemDesc = "This collection is used to store system data of the " +
                            "WSO2 Registry server. User nor the admins of the registry are not expected " +
                            "to edit any content of this collection. Changing content of this collection " +
                            "may result in unexpected behaviors.";
                    systemCollection.setDescription(systemDesc);
                    systemRegistry.put("/system", systemCollection);

                    Collection advancedQueryCollection = systemRegistry.newCollection();
                    String advaceDesc = "This collection is used to store auto generated queries " +
                            "to support various combinations of advanced search criteria. " +
                            "This is initialy empty and gets filled as advanced search is " +
                            "executed from the web UI.";
                    advancedQueryCollection.setDescription(advaceDesc);
                    systemRegistry.put("/system/queries/advanced", advancedQueryCollection);
                    if (!inTransaction) {
                        systemRegistry.commitTransaction();
                    }
                } catch (Exception e) {
View Full Code Here

        Map<String, String> params = new HashMap <String, String> ();
        params.put("query", sql);
        params.put(RegistryConstants.RESULT_TYPE_PROPERTY_NAME,
                RegistryConstants.COMMENTS_RESULT_TYPE);
        params.put("1", "backward-compatibility1%");
        Collection qResults = rootRegistry.executeQuery("/beep/x", params);

        String[] qPaths = (String[]) qResults.getContent();

        assertEquals("Query result count should be 1", qPaths.length, 1);
    }
View Full Code Here

                RegistryConstants.TAGS_RESULT_TYPE);
        systemRegistry.put("/qs/q3", q1);

        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put("1", "%production%");
        Collection result = registry.executeQuery("/qs/q3", parameters);

        String[] tagPaths = result.getChildren();
        assertEquals("There should be two matching tags.", tagPaths.length, 2);

        Resource tag2 = registry.get(tagPaths[0]);
        assertEquals("First matching tag should be 'java'",
                (String)tag2.getContent(), "java");
View Full Code Here

                RegistryConstants.TAGS_RESULT_TYPE);
        systemRegistry.put("/qs/q3", q1);

        Map<String, String> parameters = new HashMap<String, String>();
        parameters.put("1", "%production%");
        Collection result = registry.executeQuery("/qs/q3", parameters);

        String[] tagPaths = result.getChildren();
        assertEquals("There should be two matching tags.", tagPaths.length, 2);

        Resource tag2 = registry.get(tagPaths[0]);
        assertEquals("First matching tag should be 'java'",
                (String)tag2.getContent(), "java");
View Full Code Here

    public UIPermissionNode getAllUIPermissions(int tenantId, Registry registry)
            throws UserAdminException {
        UIPermissionNode nodeRoot;
        try {
            Collection regRoot;
            if (tenantId == 0) {
                if (CarbonContext.getCurrentContext().getTenantId() != MultitenantConstants.SUPER_TENANT_ID) {
                    log.error("Illegal access attempt");
                    throw new UserStoreException("Illegal access attempt");
                }
                regRoot = (Collection) registry.get(UserMgtConstants.UI_PERMISSION_ROOT);
                String displayName = regRoot.getProperty(UserMgtConstants.DISPLAY_NAME);
                nodeRoot = new UIPermissionNode(UserMgtConstants.UI_PERMISSION_ROOT, displayName);
            } else {
                regRoot = (Collection) registry.get(UserMgtConstants.UI_ADMIN_PERMISSION_ROOT);
                String displayName = regRoot.getProperty(UserMgtConstants.DISPLAY_NAME);
                nodeRoot = new UIPermissionNode(UserMgtConstants.UI_ADMIN_PERMISSION_ROOT,
                        displayName);
            }
            buildUIPermissionNode(regRoot, nodeRoot, registry, null, null, null);
            return nodeRoot;
View Full Code Here

    public UIPermissionNode getRolePermissions(String roleName, int tenantId, Registry registry)
            throws UserAdminException {
        UIPermissionNode nodeRoot;
        try {
            Collection regRoot;
            if (tenantId == 0) {
                regRoot = (Collection) registry.get(UserMgtConstants.UI_PERMISSION_ROOT);
                String displayName = regRoot.getProperty(UserMgtConstants.DISPLAY_NAME);
                nodeRoot = new UIPermissionNode(UserMgtConstants.UI_PERMISSION_ROOT, displayName);
            } else {
                regRoot = (Collection) registry.get(UserMgtConstants.UI_ADMIN_PERMISSION_ROOT);
                String displayName = regRoot.getProperty(UserMgtConstants.DISPLAY_NAME);
                nodeRoot = new UIPermissionNode(UserMgtConstants.UI_ADMIN_PERMISSION_ROOT,
                        displayName);
            }
            buildUIPermissionNode(regRoot, nodeRoot, registry, realm.getAuthorizationManager(),
                    roleName, null);
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.