Package org.apache.stratos.throttling.manager.dataobjects

Examples of org.apache.stratos.throttling.manager.dataobjects.ThrottlingAccessValidation


        // retrieve validation info for the tenant
        String tenantValidationInfoResourcePath =
                StratosConstants.TENANT_USER_VALIDATION_STORE_PATH +
                        RegistryConstants.PATH_SEPARATOR + tenantId;

        ThrottlingAccessValidation accessValidation = throttlingDataContext.getAccessValidation();
        if (accessValidation == null) {
            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);

                for (String action : actions) {
                    String blockActionStr =
                            tenantValidationInfoResource.getProperty(MeteringAccessValidationUtils
                                    .generateIsBlockedPropertyKey(action));

                    String blockActionMsg =
                            tenantValidationInfoResource.getProperty(MeteringAccessValidationUtils
                                    .generateErrorMsgPropertyKey(action));
                    accessValidation.setTenantBlocked(action, "true".equals(blockActionStr),
                            blockActionMsg);

                }
            }
        } catch (RegistryException e) {
View Full Code Here


        // retrieve validation info for the tenant
        String tenantValidationInfoResourcePath =
                StratosConstants.TENANT_USER_VALIDATION_STORE_PATH +
                        RegistryConstants.PATH_SEPARATOR + tenantId;

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

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

            Set<String> actions = accessValidation.getActions();
            for (String action : actions) {
                boolean blockAction = accessValidation.isTenantBlocked(action);
                String blockActionMsg = accessValidation.getTenantBlockedMsg(action);

                tenantValidationInfoResource.setProperty(MeteringAccessValidationUtils
                        .generateIsBlockedPropertyKey(action), blockAction ? "true" : "false");

                tenantValidationInfoResource.setProperty(MeteringAccessValidationUtils
View Full Code Here

TOP

Related Classes of org.apache.stratos.throttling.manager.dataobjects.ThrottlingAccessValidation

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.