Package org.wso2.carbon.registry.core

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


        String path = requestContext.getResourcePath().getPath();

        String confPath = path +
                RegistryConstants.PATH_SEPARATOR + RegistryConstants
                .SYNAPSE_CONF_COLLECTION_NAME;
        CollectionImpl confCollection = new CollectionImpl();
        confCollection.setPath(confPath);
        confCollection.setMediaType(RegistryConstants.SYNAPSE_CONF_COLLECTION_MEDIA_TYPE);
        requestContext.getRegistry().put(confPath, confCollection);

        String seqPath = path + RegistryConstants.PATH_SEPARATOR +
                RegistryConstants.SYNAPSE_SEQUENCES_COLLECTION_NAME;
        CollectionImpl seqCollection = new CollectionImpl();
        seqCollection.setPath(seqPath);
        seqCollection.setMediaType(RegistryConstants.SYNAPSE_SEQUENCE_COLLECTION_MEDIA_TYPE);
        requestContext.getRegistry().put(seqPath, seqCollection);

        String epPath = path + RegistryConstants.PATH_SEPARATOR +
                RegistryConstants.SYNAPSE_ENDPOINT_COLLECTION_NAME;
        CollectionImpl epCollection = new CollectionImpl();
        epCollection.setPath(epPath);
        epCollection.setMediaType(RegistryConstants.SYNAPSE_ENDPOINT_COLLECTION_MEDIA_TYPE);
        requestContext.getRegistry().put(epPath, epCollection);

        String proxyServicesPath = path + RegistryConstants.PATH_SEPARATOR +
                RegistryConstants.SYNAPSE_PROXY_SERVICES_COLLECTION_NAME;
        CollectionImpl proxyCollection = new CollectionImpl();
        proxyCollection.setPath(proxyServicesPath);
        proxyCollection
                .setMediaType(RegistryConstants.SYNAPSE_PROXY_SERVICES_COLLECTION_MEDIA_TYPE);
        requestContext.getRegistry().put(proxyServicesPath, proxyCollection);

        String tasksPath = path + RegistryConstants.PATH_SEPARATOR +
                RegistryConstants.SYNAPSE_TASKS_COLLECTION_NAME;
        CollectionImpl tasksCollection = new CollectionImpl();
        tasksCollection.setPath(tasksPath);
        tasksCollection.setMediaType(RegistryConstants.SYNAPSE_TASKS_COLLECTION_MEDIA_TYPE);
        requestContext.getRegistry().put(tasksPath, tasksCollection);

        String entriesPath = path + RegistryConstants.PATH_SEPARATOR +
                RegistryConstants.SYNAPSE_ENTRIES_COLLECTION_NAME;
        CollectionImpl entryCollection = new CollectionImpl();
        entryCollection.setPath(entriesPath);
        entryCollection.setMediaType(RegistryConstants.SYNAPSE_ENTRIES_COLLECTION_MEDIA_TYPE);
        requestContext.getRegistry().put(entriesPath, entryCollection);
    }
View Full Code Here


            path = RegistryConstants.ROOT_PATH + collectionName;
        } else {
            path = parentPath + RegistryConstants.PATH_SEPARATOR + collectionName;
        }

        CollectionImpl collection = null;
        try {
            collection = (CollectionImpl) registry.newCollection();
        } catch (RegistryException e) {
            String msg = "Failed to create new collection instance for the collection " +
                    path + ". " + e.getMessage();
            log.error(msg, e);
            throw new RegistryException(msg, e);
        }

        collection.setPath(path);
        if (!mediaType.equals(RegistryConstants.DEFAULT_MEDIA_TYPE)) {
            collection.setMediaType(mediaType);
        }
        collection.setDescription(description);

        try {
            registry.put(path, collection);
        } catch (RegistryException e) {
            String msg = "Failed to add collection " + path + ". " +
View Full Code Here

                String[] regVerPaths = ((RegistrySession) session).getUserRegistry().getVersions(s);
                latestVersionPath = regVerPaths[0]; //Here we assume that latest version path is given by the last element of tye version array

                if (((RegistrySession) session).getUserRegistry().get(s) instanceof CollectionImpl) {

                    CollectionImpl tempColl = ((CollectionImpl) ((RegistrySession) session).getUserRegistry().get(s));
                    tempColl.getPropertyValues("wso2.registry.jcr.versions").add(latestVersionPath);
                    ((RegistrySession) session).getUserRegistry().put(s, tempColl);
                }

                ((CollectionImpl) ((RegistrySession) session).getUserRegistry().get(s)).getPropertyValues("wso2.registry.jcr.versions");
            } catch (RegistryException e) {
View Full Code Here

                "/custom-queries";
    }

    public Node storeAsNode(String s) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, UnsupportedRepositoryOperationException, RepositoryException {
        RegistryNode node = new RegistryNode(s, session);
        CollectionImpl subCollection = null;

        try {
            subCollection = (CollectionImpl) session.getUserRegistry().newCollection();
            subCollection.setDescription("nt:query");
            session.getUserRegistry().put(s, subCollection);

        } catch (RegistryException e) {
            e.printStackTrace();
View Full Code Here

        String path = requestContext.getResourcePath().getPath();

        String confPath = path +
                          RegistryConstants.PATH_SEPARATOR + RegistryConstants
                .AXIS2_CONF_COLLECTION_NAME;
        CollectionImpl confCollection = new CollectionImpl();
        confCollection.setPath(confPath);
        confCollection.setMediaType(RegistryConstants.AXIS2_CONF_COLLECTION_MEDIA_TYPE);
        requestContext.getRegistry().put(confPath, confCollection);

        String servicesPath = path +
                              RegistryConstants.PATH_SEPARATOR + RegistryConstants
                .AXIS2_SERVICES_COLLECTION_NAME;
        CollectionImpl servicesCollection = new CollectionImpl();
        servicesCollection.setPath(servicesPath);
        servicesCollection.setMediaType(RegistryConstants.AXIS2_SERVICES_COLLECTION_MEDIA_TYPE);
        requestContext.getRegistry().put(servicesPath, servicesCollection);

        String modulesPath = path +
                             RegistryConstants.PATH_SEPARATOR + RegistryConstants
                .AXIS2_MODULES_COLLECTION_NAME;
        CollectionImpl modulesCollection = new CollectionImpl();
        modulesCollection.setPath(modulesPath);
        modulesCollection.setMediaType(RegistryConstants.AXIS2_MODULES_COLLECTION_MEDIA_TYPE);
        requestContext.getRegistry().put(modulesPath, modulesCollection);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Iterator retrieveAllSubscribers() {
        Registry systemRegistry = null;
        CollectionImpl resourceCollection = null;
        ArrayList allSubscribers = new ArrayList();

        try {
            systemRegistry = EventingServiceComponent.getRegistry();

            if (systemRegistry.resourceExists(EVENTING_ROOT + serviceName
                    + "/subscribers")) {
                resourceCollection = (CollectionImpl) systemRegistry.get(EVENTING_ROOT
                        + serviceName + "/subscribers");
                String[] resources = resourceCollection.getChildren();
                for (int i = 0; i < resources.length; i++) {
                    allSubscribers.add(getSubscriber(systemRegistry.get(resources[i])));
                }
            }
        } catch (Exception e) {
View Full Code Here

                                    MultitenantConstants.SUPER_TENANT_ID);
                    if (!superTenantRegistry.resourceExists(
                            StratosConstants.CAPTCHA_DETAILS_PATH)) {
                        return// resource doesn't exist in the superTenantRegistry. just return.
                    }
                    CollectionImpl c = (CollectionImpl) superTenantRegistry.get(
                            StratosConstants.CAPTCHA_DETAILS_PATH);
                    String[] childPaths = c.getChildren();
                    for (String childPath : childPaths) {
                        Resource resource = superTenantRegistry.get(childPath);
                        long createdTime = resource.getCreatedTime().getTime();
                        long currentTime = new Date().getTime();
View Full Code Here

    public void setRegistry(Registry registry) {
        this.registry = registry;
        try {
            if (!registry.resourceExists(ESBRegistryConstants.ROOT_PATH)) {
                CollectionImpl collection = new CollectionImpl();
                collection.setPath(ESBRegistryConstants.ROOT_PATH);
                registry.put(ESBRegistryConstants.ROOT_PATH, collection);
            }
        } catch (RegistryException e) {
            handleException("Error during initiating 'PersistenceManager'", e);
        }
View Full Code Here

        //assertTrue("/d15/d14/r1 is not tagged with the tag \"tag1\"", artifactFound);
        assertTrue("tag 'tag1' is not associated with the artifact /d15/d14/r1", tagFound);
    }

    public void testRemoveCollectionTagging() throws Exception {
        CollectionImpl r1 = new CollectionImpl();
        r1.setAuthorUserName("Author q1 remove");
        registry.put("/d15/d14/d13/d12", r1);

        registry.applyTag("/d15/d14/d13", "tag1");
        registry.applyTag("/d15/d14/d13", "tag2");
        registry.applyTag("/d15/d14/d13", "tag3");
View Full Code Here

            if (systemRegistry.resourceExists(ServiceBusConstants.META_INF_REGISTRY_PATH)) {
                Resource resource = systemRegistry.get(ServiceBusConstants.META_INF_REGISTRY_PATH);
                resource.addProperty(ServiceBusConstants.DEFAULT_COLLECTIONS_PROPERTY,
                        ServiceBusConstants.STRUCTURE_CREATED);
            } else {
                CollectionImpl collection = new CollectionImpl();
                collection.setPath(ServiceBusConstants.META_INF_REGISTRY_PATH);
                collection.setProperty(ServiceBusConstants.DEFAULT_COLLECTIONS_PROPERTY,
                        ServiceBusConstants.STRUCTURE_CREATED);
                systemRegistry.put(ServiceBusConstants.META_INF_REGISTRY_PATH, collection);
            }
        } catch (RegistryException rege) {
            log.warn("Couldn't persist the default ESB collections structure created action", rege);
View Full Code Here

TOP

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

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.