Package org.wso2.carbon.registry.api

Examples of org.wso2.carbon.registry.api.Registry.resourceExists()


        sandeshaPolicy.addPolicyComponent(sandeshaPolicyBean);

        try {
            String resourcePath = moduleResourcePath + RegistryResources.POLICIES + sandeshaPolicy.getId();
            Resource policyResource = null;
            if (registry.resourceExists(resourcePath)) {
                policyResource = registry.get(resourcePath);
            } else {
                policyResource = registry.newResource();
                policyResource.setProperty(RegistryResources.ServiceProperties.POLICY_TYPE,
                        String.valueOf(PolicyInclude.SERVICE_POLICY));
View Full Code Here


        boolean success = false;
        try {
            registry.beginTransaction();

            String secretKeyPath = AdminMgtConstants.ADMIN_MANAGEMENT_COLLECTION + "/" + secretKey;
            if (!registry.resourceExists(secretKeyPath)) {
                String msg = "Failed Admin account management attempt.";
                log.error(msg);
                throw new Exception(msg);
            }
            Resource resource = registry.get(secretKeyPath);
View Full Code Here

        Registry systemRegistry = registryService.getGovernanceSystemRegistry();
        String uuid = null;
        systemRegistry.beginTransaction();
        boolean isSuccess = false;
        try {
            if (systemRegistry.resourceExists(instIdPath)) {
                Resource resource = systemRegistry.get(instIdPath);
                byte[] uuidBytes = (byte[])resource.getContent();
                uuid = new String(uuidBytes);
            }
            if (uuid == null) {
View Full Code Here

    public boolean uploadSample(String sampleName) throws RegistryException {
        SuperTenantCarbonContext carbonContext =
                SuperTenantCarbonContext.getCurrentContext();
        Registry registry = (Registry) carbonContext.getRegistry(RegistryType.SYSTEM_GOVERNANCE);
        try {
            if (registry.resourceExists(getSamplePath(sampleName))) {
                return true;
            }
        } catch (Exception ignored) {
            // Ignore any exceptions that may occur in the process, and try to re-upload the sample
            // assuming that it is not already on the registry.
View Full Code Here

            accessValidation = new ThrottlingAccessValidation();
            throttlingDataContext.setAccessValidation(accessValidation);
        }
        try {
            Registry governanceSystemRegistry = Util.getSuperTenantGovernanceSystemRegistry();
            if (governanceSystemRegistry.resourceExists(tenantValidationInfoResourcePath)) {
                Resource tenantValidationInfoResource =
                        governanceSystemRegistry.get(tenantValidationInfoResourcePath);
                Properties properties = tenantValidationInfoResource.getProperties();
                Set<String> actions = MeteringAccessValidationUtils.getAvailableActions(properties);
View Full Code Here

        ThrottlingAccessValidation accessValidation = throttlingDataContext.getAccessValidation();
        try {
            Registry governanceSystemRegistry = Util.getSuperTenantGovernanceSystemRegistry();

            Resource tenantValidationInfoResource;
            if (governanceSystemRegistry.resourceExists(tenantValidationInfoResourcePath)) {
                tenantValidationInfoResource =
                        governanceSystemRegistry.get(tenantValidationInfoResourcePath);
            } else {
                tenantValidationInfoResource = governanceSystemRegistry.newResource();
            }
View Full Code Here

                        }
                    }
                    resourceContent.append("#");
                }
                Registry registry = requestContext.getRegistry();
                if (registry.resourceExists(path)) {
                    col = (ResourceImpl) registry.get(path);
                    col.setContent(resourceContent.toString());
                }
            } catch (UserStoreException e) {
                log.error("An error occurred while reading profile details", e);
View Full Code Here

      if (transactionStarted) {
        registry.beginTransaction();
      }
      String serviceResourcePath = RegistryResources.SERVICE_GROUPS + serviceGroupName;
      /* the resource should already exist */
      if (registry.resourceExists(serviceResourcePath)) {
        Resource serviceResource = registry.get(serviceResourcePath);
        serviceResource.setProperty(RegistryResources.ServiceGroupProperties.HASH_VALUE,
            hash);
        registry.put(serviceResourcePath, serviceResource);
        serviceResource.discard();
View Full Code Here

        Resource resource = null;

        try {
            systemRegistry = EventingServiceComponent.getRegistry();

            if (systemRegistry.resourceExists(EVENTING_ROOT + serviceName + "/subscribers/"
                    + subscriberId)) {
                resource = systemRegistry.get(EVENTING_ROOT + serviceName + "/subscribers/"
                        + subscriberId);
                return getSubscriber(resource);
            }
View Full Code Here

        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++) {
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.