Package org.apache.stratos.common.config

Examples of org.apache.stratos.common.config.CloudServiceConfig


                cloudServicesDesc.getCloudServiceConfigs();
        List<CloudService> cloudServices = new ArrayList<CloudService>();
        if (cloudServiceConfigs != null) {
            Set<String> configKeys = cloudServiceConfigs.keySet();
            for (String configKey : configKeys) {
                CloudServiceConfig cloudServiceConfig = cloudServiceConfigs.get(configKey);
                String label = cloudServiceConfig.getLabel();
                if (label == null) {
                    // we are only returning display-able services
                    continue;
                }
                CloudService cloudService = new CloudService();
                String name = cloudServiceConfig.getName();
                cloudService.setName(name);
                cloudService.setLabel(label);
                cloudService.setLink(cloudServiceConfig.getLink());
                cloudService.setIcon(cloudServiceConfig.getIcon());
                cloudService.setDescription(cloudServiceConfig.getDescription());
                cloudService.setProductPageURL(cloudServiceConfig.getProductPageURL());
                boolean active = Util.isCloudServiceActive(name, tenantId);
                cloudService.setActive(tenantId == 0 || active);

                cloudServices.add(cloudService);
            }
View Full Code Here


        return cloudServiceConfigs.get(cloudServiceName);
    }

    public static void setCloudServiceActive(boolean active, String cloudServiceName,
                                             int tenantId)throws Exception {
        CloudServiceConfig cloudServiceConfig = getCloudServiceConfig(cloudServiceName);
        if (cloudServiceConfig.getLabel() == null) {
            // for the non-labeled services, we are not setting/unsetting the service active
            return;
        }

        UserRegistry tenantZeroSystemGovernanceRegistry;
        UserRegistry systemConfigRegistry;
        try {
            tenantZeroSystemGovernanceRegistry = Util.getTenantZeroSystemGovernanceRegistry();
            systemConfigRegistry = Util.getSystemConfigRegistry(tenantId);
        } catch (RegistryException e) {
            String msg = "Error in getting the tenant 0 system config registry";
            log.error(msg, e);
            throw new Exception(msg, e);
        }

        String cloudServiceInfoPath =
                Constants.CLOUD_SERVICE_INFO_STORE_PATH + RegistryConstants.PATH_SEPARATOR +
                        tenantId + RegistryConstants.PATH_SEPARATOR + cloudServiceName;
        Resource cloudServiceInfoResource;
        if (tenantZeroSystemGovernanceRegistry.resourceExists(cloudServiceInfoPath)) {
            cloudServiceInfoResource = tenantZeroSystemGovernanceRegistry.get(cloudServiceInfoPath);
        } else {
            cloudServiceInfoResource = tenantZeroSystemGovernanceRegistry.newCollection();
        }
        cloudServiceInfoResource.setProperty(Constants.CLOUD_SERVICE_IS_ACTIVE_PROP_KEY,
                active ? "true" : "false");
        tenantZeroSystemGovernanceRegistry.put(cloudServiceInfoPath, cloudServiceInfoResource);

        // then we will copy the permissions
        List<PermissionConfig> permissionConfigs = cloudServiceConfig.getPermissionConfigs();
        for (PermissionConfig permissionConfig : permissionConfigs) {
            String path = permissionConfig.getPath();
            String name = permissionConfig.getName();
            if (active) {
                if (!systemConfigRegistry.resourceExists(path)) {
View Full Code Here

TOP

Related Classes of org.apache.stratos.common.config.CloudServiceConfig

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.