Package org.wso2.carbon.registry.core.session

Examples of org.wso2.carbon.registry.core.session.UserRegistry.resourceExists()


    public TopicNode getTopicTree() throws EventBrokerException {
        try {
            UserRegistry userRegistry =
                    this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
            if (!userRegistry.resourceExists(topicStoragePath)) {
                userRegistry.put(topicStoragePath,
                                 userRegistry.newCollection());
            }
            Resource root = userRegistry.get(this.topicStoragePath);
            TopicNode rootTopic = new TopicNode("/", "/");
View Full Code Here


                    this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
            String resourcePath = getResourcePath(topicName);

            //we add the topic only if it does not exits. if the topic exists then
            //we don't do any thing.
            if (!userRegistry.resourceExists(resourcePath)) {
                Collection collection = userRegistry.newCollection();
                userRegistry.put(resourcePath, collection);

                // Grant this user (owner) rights to update permission on newly created topic
                UserRealm userRealm = CarbonContext.getCurrentContext().getUserRealm();
View Full Code Here

                    this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
            String subscriptionsPath = getSubscriptionsPath(resourcePath);

            //first if there are subscriptions for this topic add them. else go to the other folders.

            if (userRegistry.resourceExists(subscriptionsPath)) {
                Collection collection = (Collection) userRegistry.get(subscriptionsPath);
                for (String subscriptionPath : collection.getChildren()) {
                    Resource subscriptionResource = userRegistry.get(subscriptionPath);
                    Subscription subscription = JavaUtil.getSubscription(subscriptionResource);
                    subscription.setTopicName(removeResourcePath(resourcePath));
View Full Code Here

        try {
            UserRegistry userRegistry =
                    this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
            String resourcePath = getResourcePath(topicName);

            if (userRegistry.resourceExists(resourcePath)) {
                userRegistry.delete(resourcePath);
                return true;
            } else {
                return false;
            }
View Full Code Here

    private boolean isDefaultRegistryStructureCreated() {
        if (registryService != null) {
            try {
                UserRegistry registry = registryService.getConfigSystemRegistry();
                if (registry.resourceExists(ServiceBusConstants.META_INF_REGISTRY_PATH)) {
                    Resource resource = registry.get(ServiceBusConstants.META_INF_REGISTRY_PATH);
                    if (resource != null && ServiceBusConstants.STRUCTURE_CREATED.equals(resource
                            .getProperty(ServiceBusConstants.DEFAULT_COLLECTIONS_PROPERTY))) {
                        if (log.isDebugEnabled()) {
                            log.debug("Default Registry structure of ESB has already been created");
View Full Code Here

            }
        }

        try {
            UserRegistry systemRegistry = registryService.getConfigSystemRegistry();
            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();
View Full Code Here

                InputStream inputStream = new ByteArrayInputStream(functionIds.getBytes());
                functionId.setContent(inputStream);
                registry.put(resourcePath + "functionId" , functionId);
            }

            if (!registry.resourceExists(resourcePath + "matchId")){

                Resource matchId = registry.newResource();
                String matchIds =
                "urn:oasis:names:tc:xacml:1.0:function:string-equal\n" +
                "urn:oasis:names:tc:xacml:1.0:function:integer-equal\n" +
View Full Code Here

                InputStream inputStream = new ByteArrayInputStream(matchIds.getBytes());
                matchId.setContent(inputStream);
                registry.put(resourcePath + "matchId" , matchId);
            }
            if(!registry.resourceExists(resourcePath + "dataType")) {

                Resource dataType = registry.newResource();
                String dataTypes =
                    "http://www.w3.org/2001/XMLSchema#string\n" +
                    "http://www.w3.org/2001/XMLSchema#boolean\n" +
View Full Code Here

                InputStream inputStream = new ByteArrayInputStream(dataTypes.getBytes());
                dataType.setContent(inputStream);
                registry.put(resourcePath + "dataType" , dataType);
            }

            if(!registry.resourceExists(resourcePath + "mustBePresent")) {
                Resource mustBePresent = registry.newResource();
                String mustBePresents =
                        "true\n" +
                        "false";
                InputStream inputStream = new ByteArrayInputStream(mustBePresents.getBytes());
View Full Code Here

                InputStream inputStream = new ByteArrayInputStream(mustBePresents.getBytes());
                mustBePresent.setContent(inputStream);
                registry.put(resourcePath + "mustBePresent" , mustBePresent);
            }

            if(!registry.resourceExists(resourcePath + "ruleEffect")) {
                Resource ruleEffect = registry.newResource();
                String ruleEffects =
                        "Permit\n" +
                        "Deny";
                InputStream inputStream = new ByteArrayInputStream(ruleEffects.getBytes());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.