Package org.wso2.carbon.registry.core

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


        if (uiPermissions != null) {
            // at the starup we are only adding permission only to tenant 0
            Registry registry = UserMgtDSComponent.getRegistryService().getGovernanceSystemRegistry();
            for (ManagementPermission uiPermission : uiPermissions) {
                if (registry.resourceExists(uiPermission.getResourceId())) {
                    continue;
                }
                Collection resource = registry.newCollection();
                resource.setProperty(UserMgtConstants.DISPLAY_NAME, uiPermission.getDisplayName());
                registry.put(uiPermission.getResourceId(), resource);
View Full Code Here


            for (Mount mount : registryContext.getMounts()) {
                if (isFixedMount(registry, mount.getPath(), mount.getTargetPath(), isSuperTenant)) {
                    addFixedMount(tenantId, superTenantRegistry, mount.getPath());
                    continue;
                }
                if (!registry.resourceExists(mount.getPath())) {
                    if (isSuperTenant) {
                        superTenantRegistry.createLink(mount.getPath(), mount.getInstanceId(),
                                mount.getTargetPath());
                    } else {
                        createPseudoLink(registry, mount.getPath(), mount.getInstanceId(),
View Full Code Here

                    log.error("Unable to create remote mount. A resource already exists at the " +
                            "given location: " + mount.getPath());
                    continue;
                }
                try {
                    if (!registry.resourceExists(mount.getPath())) {
                        log.warn("Target path does not exist for the given mount: " +
                                mount.getPath());
                    }
                } catch (Exception e) {
                    log.warn("Target path does not exist for the given mount: " +
View Full Code Here

        Registry registry = getConfigSystemRegistry();
        try {
            String resourcePath = moduleResourcePath + RegistryResources.PARAMETERS + paramName;
            Resource paramResource = null;
            if (registry.resourceExists(resourcePath)) {
                paramResource = registry.get(resourcePath);
                paramResource.setContent("<parameter name=\"" + paramName + "\" locked=\"false\">" + paramValue + "</parameter>");
                registry.put(resourcePath, paramResource);
            } else {
                paramResource = registry.newResource();
View Full Code Here

                    remainingPolicies.add(info);
                }
            }
            proxyService.setPolicies(remainingPolicies);

            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 :
View Full Code Here

        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

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.