You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2013/07/10 18:51:54 UTC
[19/45] fixing component version issues and adding currently
refactored components to the parent pom
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/pom.xml b/components/org.apache.stratos.common/2.1.2/pom.xml
deleted file mode 100644
index 457684e..0000000
--- a/components/org.apache.stratos.common/2.1.2/pom.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.apache.stratos</groupId>
- <artifactId>stratos-components-parent</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.apache.stratos.common</artifactId>
- <version>2.1.2</version>
- <packaging>bundle</packaging>
- <name>Apache Stratos - Common</name>
-
- <build>
-
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Export-Package>
- org.apache.stratos.common.*,
- </Export-Package>
- <Import-Package>
- org.wso2.carbon.registry.core.*;version=1.0.1,
- org.wso2.carbon.user.core.*,
- javax.servlet;version="${imp.pkg.version.javax.servlet}",
- javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
- org.apache.axiom.*; version="${axiom.osgi.version.range}",
- *;resolution:=optional
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.registry.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.user.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.user.mgt</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/TenantBillingService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/TenantBillingService.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/TenantBillingService.java
deleted file mode 100644
index 23cb7ae..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/TenantBillingService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common;
-
-import org.apache.stratos.common.exception.StratosException;
-import org.wso2.carbon.user.api.Tenant;
-
-/**
- * The OSGI service interface that enables tenant related billing actions.
- */
-public interface TenantBillingService {
-
- public void addUsagePlan(Tenant tenant, String usagePlan) throws StratosException;
-
- public String getActiveUsagePlan(String tenantDomain) throws StratosException;
-
- public void updateUsagePlan(String tenantDomain, String usagePlan) throws StratosException;
-
- public void activateUsagePlan(String tenantDomain) throws StratosException;
-
- public void deactivateActiveUsagePlan(String tenantDomain) throws StratosException;
-
- public void deleteBillingData(int tenantId) throws StratosException;
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/beans/TenantInfoBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/beans/TenantInfoBean.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/beans/TenantInfoBean.java
deleted file mode 100755
index 447814d..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/beans/TenantInfoBean.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.common.beans;
-
-import java.util.Calendar;
-
-/**
- * Bean class for Tenant Information
- */
-public class TenantInfoBean {
-
- private String admin; //admin's user name
- private String firstname;
- private String lastname;
- private String adminPassword;
- private String tenantDomain;
- private int tenantId;
- private String email;
- private boolean active;
- private String successKey;
- Calendar createdDate;
- private String originatedService;
- private String usagePlan;
-
- public String getFirstname() {
- return firstname;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- public String getLastname() {
- return lastname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
- public String getEmail() {
-
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public int getTenantId() {
- return tenantId;
- }
-
- public void setTenantId(int tenantId) {
- this.tenantId = tenantId;
- }
-
- public String getTenantDomain() {
- return tenantDomain;
- }
-
- public void setTenantDomain(String tenantDomain) {
- this.tenantDomain = tenantDomain;
- }
-
- public String getAdmin() {
- return admin;
- }
-
- public void setAdmin(String admin) {
- this.admin = admin;
- }
-
- public String getAdminPassword() {
- return adminPassword;
- }
-
- public void setAdminPassword(String adminPassword) {
- this.adminPassword = adminPassword;
- }
-
- public boolean isActive() {
- return active;
- }
-
- public void setActive(boolean active) {
- this.active = active;
- }
-
- public String getSuccessKey() {
- return successKey;
- }
-
- public void setSuccessKey(String successKey) {
- this.successKey = successKey;
- }
-
- public Calendar getCreatedDate() {
- return createdDate;
- }
-
- public void setCreatedDate(Calendar createdDate) {
- this.createdDate = createdDate;
- }
-
- public String getOriginatedService() {
- return originatedService;
- }
-
- public void setOriginatedService(String originatedService) {
- this.originatedService = originatedService;
- }
-
- public String getUsagePlan() {
- return usagePlan;
- }
-
- public void setUsagePlan(String usagePlan) {
- this.usagePlan = usagePlan;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServiceConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServiceConfig.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServiceConfig.java
deleted file mode 100644
index 62c1664..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServiceConfig.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.config;
-
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class CloudServiceConfig {
- private static final String CONFIG_NS = "http://wso2.com/carbon/cloud/mgt/services";
-
- private static final String NAME_ATTR_NAME = "name";
- private static final String DEFAULT_ATTR_NAME = "default";
- private static final String LABEL_ELEMENT_NAME = "label";
- private static final String LINK_ELEMENT_NAME = "link";
- private static final String ICON_ELEMENT_NAME = "icon";
- private static final String DESCRIPTION_ELEMENT_NAME = "description";
- private static final String PERMISSIONS_ELEMENT_NAME = "permissions";
- private static final String PERMISSION_ELEMENT_NAME = "permission";
- private static final String PRODUCT_PAGE_URL_ELEMENT_NAME = "productPageURL";
-
- private String name;
- private String label;
- private String link;
- private String icon;
- private String description;
- private List<PermissionConfig> permissionConfigs;
- boolean defaultActive;
- private String productPageURL;
-
- public CloudServiceConfig(OMElement configEle) {
- permissionConfigs = new ArrayList<PermissionConfig>();
- serialize(configEle);
- }
-
- public void serialize(OMElement configEle) {
- Iterator cloudServiceChildIt = configEle.getChildElements();
- name = configEle.getAttributeValue(new QName(null, NAME_ATTR_NAME));
- defaultActive = "true".equals(configEle.
- getAttributeValue(new QName(null, DEFAULT_ATTR_NAME)));
- while (cloudServiceChildIt.hasNext()) {
- Object cloudServiceChildObj = cloudServiceChildIt.next();
- if (!(cloudServiceChildObj instanceof OMElement)) {
- continue;
- }
- OMElement cloudServiceChildEle = (OMElement) cloudServiceChildObj;
- if (new QName(CONFIG_NS, LABEL_ELEMENT_NAME, "").
- equals(cloudServiceChildEle.getQName())) {
- label = cloudServiceChildEle.getText();
- } else if (new QName(CONFIG_NS, ICON_ELEMENT_NAME, "").
- equals(cloudServiceChildEle.getQName())) {
- icon = cloudServiceChildEle.getText();
- } else if (new QName(CONFIG_NS, LINK_ELEMENT_NAME, "").
- equals(cloudServiceChildEle.getQName())) {
- link = cloudServiceChildEle.getText();
- } else if (new QName(CONFIG_NS, PRODUCT_PAGE_URL_ELEMENT_NAME, "").
- equals(cloudServiceChildEle.getQName())) {
- productPageURL = cloudServiceChildEle.getText();
- } else if (new QName(CONFIG_NS, DESCRIPTION_ELEMENT_NAME, "").
- equals(cloudServiceChildEle.getQName())) {
- description = cloudServiceChildEle.getText();
- } else if (new QName(CONFIG_NS, PERMISSIONS_ELEMENT_NAME, "").
- equals(cloudServiceChildEle.getQName())) {
- Iterator permissionChildIt = cloudServiceChildEle.getChildElements();
- while (permissionChildIt.hasNext()) {
- Object permissionChildObj = permissionChildIt.next();
- if (!(permissionChildObj instanceof OMElement)) {
- continue;
- }
- OMElement permissionChildEle = (OMElement) permissionChildObj;
-
- if (new QName(CONFIG_NS, PERMISSION_ELEMENT_NAME, "").
- equals(permissionChildEle.getQName())) {
- PermissionConfig permissionConfig =
- new PermissionConfig(permissionChildEle);
- permissionConfigs.add(permissionConfig);
- }
- }
- }
-
- }
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getLabel() {
- return label;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
-
- public String getLink() {
- return link;
- }
-
- public void setLink(String link) {
- this.link = link;
- }
-
- public String getIcon() {
- return icon;
- }
-
- public void setIcon(String icon) {
- this.icon = icon;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public List<PermissionConfig> getPermissionConfigs() {
- return permissionConfigs;
- }
-
- public void setPermissionConfigs(List<PermissionConfig> permissionConfigs) {
- this.permissionConfigs = permissionConfigs;
- }
-
- public boolean isDefaultActive() {
- return defaultActive;
- }
-
- public void setDefaultActive(boolean defaultActive) {
- this.defaultActive = defaultActive;
- }
-
- public String getProductPageURL() {
- return productPageURL;
- }
-
- public void setProductPageURL(String productPageURL) {
- this.productPageURL = productPageURL;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServiceConfigParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServiceConfigParser.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServiceConfigParser.java
deleted file mode 100644
index 3cedeff..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServiceConfigParser.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.config;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.constants.StratosConstants;
-import org.apache.stratos.common.util.CommonUtil;
-import org.wso2.carbon.utils.CarbonUtils;
-
-import java.io.File;
-import java.io.FileInputStream;
-
-public class CloudServiceConfigParser {
-
- private static Log log = LogFactory.getLog(CloudServiceConfigParser.class);
-
- private static class SynchronizingClass {
- }
-
- private static final SynchronizingClass loadlock = new SynchronizingClass();
-
- private static CloudServicesDescConfig cloudServicesDescConfig = null;
-
- private static final String CONFIG_FILENAME = "cloud-services-desc.xml";
-
- public static CloudServicesDescConfig loadCloudServicesConfiguration() throws Exception {
- if (cloudServicesDescConfig != null) {
- return cloudServicesDescConfig;
- }
-
- synchronized (loadlock) {
- if (cloudServicesDescConfig == null) {
- try {
- String configFileName = CarbonUtils.getCarbonConfigDirPath() + File.separator +
- StratosConstants.MULTITENANCY_CONFIG_FOLDER + File.separator + CONFIG_FILENAME;
- OMElement configElement = CommonUtil.buildOMElement(new FileInputStream(configFileName));
- cloudServicesDescConfig = new CloudServicesDescConfig(configElement);
- } catch (Exception e) {
- String msg = "Error in building the cloud service configuration.";
- log.error(msg, e);
- throw new Exception(msg, e);
- }
- }
- }
- return cloudServicesDescConfig;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServicesDescConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServicesDescConfig.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServicesDescConfig.java
deleted file mode 100644
index 1bbd7aa..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/CloudServicesDescConfig.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.config;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-import java.util.*;
-
-public class CloudServicesDescConfig {
- private static final Log log = LogFactory.getLog(CloudServicesDescConfig.class);
- private static final String CONFIG_NS = "http://wso2.com/carbon/cloud/mgt/services";
- private static final String CLOUD_SERVICE_ELEMENT_NAME = "cloudService";
-
- Map<String, CloudServiceConfig> cloudServiceConfigs;
-
- public CloudServicesDescConfig(OMElement configEle) {
- // as the cloud service configs are kept in an order, we use an ordered map.
- cloudServiceConfigs = new LinkedHashMap<String, CloudServiceConfig>();
- serialize(configEle);
- }
-
- public void serialize(OMElement configEle) {
- Iterator configChildIt = configEle.getChildElements();
- while (configChildIt.hasNext()) {
- Object configChildObj = configChildIt.next();
- if (!( configChildObj instanceof OMElement)) {
- continue;
- }
- OMElement configChildEle = (OMElement)configChildObj;
- if (new QName(CONFIG_NS, CLOUD_SERVICE_ELEMENT_NAME, "").
- equals(configChildEle.getQName())) {
- CloudServiceConfig cloudServiceConfig = new CloudServiceConfig(configChildEle);
- String name = cloudServiceConfig.getName();
- cloudServiceConfigs.put(name, cloudServiceConfig);
- }
- }
- }
-
- public Map<String, CloudServiceConfig> getCloudServiceConfigs() {
- return cloudServiceConfigs;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/PermissionConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/PermissionConfig.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/PermissionConfig.java
deleted file mode 100644
index f4d4716..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/config/PermissionConfig.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.config;
-
-import org.apache.axiom.om.OMElement;
-
-import javax.xml.namespace.QName;
-import java.util.Iterator;
-
-public class PermissionConfig {
- private static final String CONFIG_NS = "http://wso2.com/carbon/cloud/mgt/services";
- private static final String PATH = "path";
- private static final String NAME = "name";
- String name;
- String path;
-
- public PermissionConfig(OMElement configEle) {
- serialize(configEle);
- }
-
- public void serialize(OMElement configEle) {
-
- Iterator configChildIt = configEle.getChildElements();
- while (configChildIt.hasNext()) {
- Object configChildObj = configChildIt.next();
- if (!( configChildObj instanceof OMElement)) {
- continue;
- }
- OMElement configChildEle = (OMElement)configChildObj;
- if (new QName(CONFIG_NS, NAME, "").
- equals(configChildEle.getQName())) {
- name = configChildEle.getText();
- } else if (new QName(CONFIG_NS, PATH, "").
- equals(configChildEle.getQName())) {
- path = configChildEle.getText();
- }
- }
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/constants/StratosConstants.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
deleted file mode 100644
index 800206a..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.constants;
-
-
-public class StratosConstants {
-
- public static final String CLOUD_SERVICE_IS_ACTIVE_PROP_KEY = "active";
-
- public static final String CLOUD_SERVICE_INFO_STORE_PATH =
- "/repository/components/org.wso2.stratos/cloud-manager/cloud-services";
-
- public static final String TENANT_USER_VALIDATION_STORE_PATH =
- "/repository/components/org.wso2.carbon.validations";
- public static final String ADMIN_EMAIL_VERIFICATION_FLAG_PATH =
- "/repository/components/org.wso2.carbon.email-confirmation-flag";
- public static final String TENANT_DOMAIN_VERIFICATION_FLAG_PATH =
- "/repository/components/org.wso2.carbon.domain-confirmation-flag";
-
- public static final String DOMAIN_VALIDATOR_INFO_PATH =
- "/repository/components/org.wso2.carbon.domain-validator-info";
-
- public static final String TENANT_CREATION_THEME_PAGE_TOKEN =
- "/repository/components/org.wso2.carbon.theme-page-token";
-
- public static final String TENANT_PACKAGE_INFO_PATH =
- "/repository/components/org.wso2.carbon.package-info";
-
- public static final String ALL_THEMES_PATH =
- "/repository/components/org.wso2.carbon.all-themes";
-
- public static final String THROTTLING_RULES_PATH =
- "/repository/components/org.wso2.carbon.throttling-rules";
-
- public static final String ORIGINATED_SERVICE_PATH =
- "/repository/components/org.wso2.carbon.originated-service";
-
- public static final String PATH_SEPARATOR = "/";
-
- public static final String CLOUD_SERVICE_ICONS_STORE_PATH =
- "/repository/components/org.wso2.carbon.cloud-manager/" +
- "cloud-services-icons";
-
- public static final String VALIDATION_KEY_RESOURCE_NAME = "validation-key";
- public static final String INCOMING_PATH_DIR = "incoming";
- public static final String OUTGOING_PATH_DIR = "outgoing";
- public static final String MULTITENANCY_SCHEDULED_TASK_ID = "multitenancyScheduledTask";
- public static final String MULTITENANCY_VIEWING_TASK_ID = "multitenancyViewingTask";
-
- public static final String INVALID_TENANT = "invalidTenant";
- public static final String INACTIVE_TENANT = "inactiveTenant";
- public static final String ACTIVE_TENANT = "activeTenant";
- public static final String IS_EMAIL_VALIDATED = "isEmailValidated";
- public static final String IS_CREDENTIALS_ALREADY_RESET = "isCredentialsReset";
- public static final String TENANT_ADMIN = "tenantAdminUsername";
-
- public static final String CLOUD_MANAGER_SERVICE = "WSO2 Stratos Manager";
- public static final String CLOUD_IDENTITY_SERVICE = "WSO2 Stratos Identity";
- public static final String CLOUD_GOVERNANCE_SERVICE = "WSO2 Stratos Governance";
- public static final String CLOUD_ESB_SERVICE = "WSO2 Stratos Enterprise Service Bus";
-
- // keystore mgt related Constants
- public static final String TENANT_KS = "/repository/security/key-stores/";
- public static final String TENANT_PUB_KEY = "/repository/security/pub-key";
- public static final String PROP_TENANT_KS_TYPE = "key-store-type";
- public static final String PROP_TENANT_KS_PASSWD = "key-store-password";
- public static final String PROP_TENANT_KS_PRIV_KEY_PASSWD = "priv-key-password";
- public static final String PROP_TENANT_KS_ALIAS = "alias";
-
- // constants related to redirection
-
- public static final String UNVERIFIED_ACCOUNT_DOMAIN_SUFFIX = "-unverified";
- public static final String TENANT_SPECIFIC_URL_RESOLVED = "tenant-sepcific-url-resolved";
- public static final String SUFFIXED_UNVERIFIED_SESSION_FLAG = "temp-suffixed-unverified";
-
- // metering constants
- public static final String THROTTLING_ALL_ACTION = "all_actions";
- public static final String THROTTLING_IN_DATA_ACTION = "in_data_action"; //this covers registry capacity + registry bandwidth
- public static final String THROTTLING_OUT_DATA_ACTION = "out_data_action"; //this covers registry bandwidth
- public static final String THROTTLING_ADD_USER_ACTION = "add_user_action";
- public static final String THROTTLING_SERVICE_IN_BANDWIDTH_ACTION = "service_in_bandwith_action";
- public static final String THROTTLING_SERVICE_OUT_BANDWIDTH_ACTION = "service_out_bandwith_action";
- public static final String THROTTLING_WEBAPP_IN_BANDWIDTH_ACTION = "webapp_in_bandwith_action";
- public static final String THROTTLING_WEBAPP_OUT_BANDWIDTH_ACTION = "webapp_out_bandwith_action";
- public static final String THROTTLING_SERVICE_REQUEST_ACTION = "service_request_action";
- public static final String THROTTLING_SERVICE_RESPONSE_ACTION = "service_response_action";
-
- // the session attribute to keep track whether the registry action validated
- // and the usage persisted
- public static final String REGISTRY_ACTION_VALIDATED_SESSION_ATTR = "registryActionValidated";
- public static final String REGISTRY_USAGE_PERSISTED_SESSION_ATTR = "usagePersited";
-
- // Metering servlet attributes
- public static final String SERVICE_NAME_SERVLET_ATTR = "meteringServiceName";
- public static final String TENANT_ID_SERVLET_ATTR = "tenantId";
- public static final String ADMIN_SERVICE_SERVLET_ATTR = "adminService";
-
- // * as a Service impl related constants
- public static final String ORIGINATED_SERVICE = "originatedService";
-
- // Configuration file name
- public static final String STRATOS_CONF_FILE = "stratos.xml";
- //public static final String STRATOS_CONF_LOC = "repository/conf/";
- //public static final String STRATOS_CONF_FILE_WITH_PATH = STRATOS_CONF_LOC + STRATOS_CONF_FILE;
-
- // EULA location
- public static final String STRATOS_EULA = "eula.xml";
-
- // EULA default text.
- public static final String STRATOS_EULA_DEFAULT_TEXT =
- "Please refer to: " + StratosConstants.STRATOS_TERMS_OF_USAGE +
- " for terms and usage and " + StratosConstants.STRATOS_PRIVACY_POLICY +
- " for privacy policy of WSO2 Stratos.";
-
- // Web location of Terms of Usage and privacy policy
- public static final String STRATOS_TERMS_OF_USAGE =
- "http://wso2.com/cloud/services/terms-of-use/";
- public static final String STRATOS_PRIVACY_POLICY =
- "http://wso2.com/cloud/services/privacy-policy/";
- public static final String MULTITENANCY_FREE_PLAN = "Demo";
- public static final String MULTITENANCY_SMALL_PLAN = "SMB";
- public static final String MULTITENANCY_MEDIUM_PLAN = "Professional";
- public static final String MULTITENANCY_LARGE_PLAN = "Enterprise";
- public static final String EMAIL_CONFIG= "email";
- public static final String MULTITENANCY_CONFIG_FOLDER = "multitenancy";
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/constants/UsageConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/constants/UsageConstants.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/constants/UsageConstants.java
deleted file mode 100644
index 607aa27..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/constants/UsageConstants.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.constants;
-
-public class UsageConstants {
- final public static String ANY_DURATION = "anyDuration";
-
- public static final String SYSTEM_METERING_PATH =
- "/repository/components/org.wso2.carbon.system-metering";
-
- public static final String CUSTOM_METERING_PATH =
- "/repository/components/org.wso2.carbon.system-metering";
-
- // the measurements
- final public static String CAPACITY_USAGE = "capacity-usage";
-
- final public static String SERVICE_REQUEST_COUNT = "serviceRequestCount";
- final public static String SERVICE_RESPONSE_COUNT = "serviceResponseCount";
- final public static String SERVICE_FAULT_COUNT = "serviceFaultCount";
-
- public static final String BANDWIDTH_KEY_PATTERN = "%Bandwidth%";
- public static final String REGISTRY_BANDWIDTH = "RegistryBandwidth";
- public static final String SERVICE_BANDWIDTH = "ServiceBandwidth";
- public static final String WEBAPP_BANDWIDTH = "WebappBandwidth";
- public static final String IN_LABLE = "-In";
- public static final String OUT_LABLE = "-Out";
- public static final String REGISTRY_CONTENT_BANDWIDTH = "ContentBandwidth";
-
- final public static String REGISTRY_INCOMING_BW = REGISTRY_BANDWIDTH + IN_LABLE;
- final public static String REGISTRY_OUTGOING_BW = REGISTRY_BANDWIDTH + OUT_LABLE;
- final public static String REGISTRY_TOTAL_BW = "registry-total-bw-usage";
- final public static String NUMBER_OF_USERS = "number-of-users";
-
- final public static String SERVICE_INCOMING_BW = SERVICE_BANDWIDTH + IN_LABLE;
- final public static String SERVICE_OUTGOING_BW = SERVICE_BANDWIDTH + OUT_LABLE;
- final public static String SERVICE_TOTAL_BW = "serviceRequestTotalBw";
-
- final public static String WEBAPP_INCOMING_BW = WEBAPP_BANDWIDTH + IN_LABLE;
- final public static String WEBAPP_OUTGOING_BW = WEBAPP_BANDWIDTH + OUT_LABLE;
-
- final public static String API_CALL_COUNT = "apiCallCount";
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/exception/StratosException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/exception/StratosException.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/exception/StratosException.java
deleted file mode 100644
index 8be9f89..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/exception/StratosException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.common.exception;
-
-/**
- * This class is defined as the general Exception implementation for Stratos. This can be used
- * within Stratos components when handling exceptions.
- */
-public class StratosException extends Exception{
-
- public StratosException() {
- }
-
- public StratosException(String message) {
- super(message);
- }
-
- public StratosException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public StratosException(Throwable cause) {
- super(cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/internal/CloudCommonServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/internal/CloudCommonServiceComponent.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/internal/CloudCommonServiceComponent.java
deleted file mode 100644
index e43c9a6..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/internal/CloudCommonServiceComponent.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.internal;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.packages.PackageInfoHolder;
-import org.apache.stratos.common.util.CommonUtil;
-import org.apache.stratos.common.util.StratosConfiguration;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.user.core.tenant.TenantManager;
-
-/**
- * @scr.component name="apache.stratos.common" immediate="true"
- * @scr.reference name="registry.service"
- * interface="org.wso2.carbon.registry.core.service.RegistryService"
- * cardinality="1..1" policy="dynamic" bind="setRegistryService"
- * unbind="unsetRegistryService"
- * @scr.reference name="user.realmservice.default"
- * interface="org.wso2.carbon.user.core.service.RealmService"
- * cardinality="1..1" policy="dynamic" bind="setRealmService"
- * unbind="unsetRealmService"
- */
-public class CloudCommonServiceComponent {
-
- private static Log log = LogFactory.getLog(CloudCommonServiceComponent.class);
-
- private static BundleContext bundleContext;
- private static RealmService realmService;
- private static RegistryService registryService;
- private static PackageInfoHolder packageInfos;
-
- protected void activate(ComponentContext context) {
- try {
- bundleContext = context.getBundleContext();
- if (CommonUtil.getStratosConfig() == null) {
- StratosConfiguration stratosConfig = CommonUtil.loadStratosConfiguration();
- CommonUtil.setStratosConfig(stratosConfig);
- }
-
- // Loading the EULA
- if (CommonUtil.getEula() == null) {
- String eula = CommonUtil.loadTermsOfUsage();
- CommonUtil.setEula(eula);
- }
-
- packageInfos = new PackageInfoHolder();
- context.getBundleContext().registerService(
- PackageInfoHolder.class.getName(), packageInfos, null);
-
- //Register manager configuration OSGI service
- try {
- StratosConfiguration stratosConfiguration = CommonUtil.loadStratosConfiguration();
- bundleContext.registerService(StratosConfiguration.class.getName(), stratosConfiguration, null);
- if (log.isDebugEnabled()) {
- log.debug("******* Cloud Common Service bundle is activated ******* ");
- }
- } catch (Exception ex) {
- String msg = "An error occurred while initializing Cloud Common Service as an OSGi Service";
- log.error(msg, ex);
- }
- } catch (Throwable e) {
- log.error("Error in activating Cloud Common Service Component" + e.toString());
- }
- }
-
- protected void deactivate(ComponentContext context) {
- log.debug("******* Tenant Core bundle is deactivated ******* ");
- }
-
- protected void setRegistryService(RegistryService registryService) {
- CloudCommonServiceComponent.registryService = registryService;
- }
-
- protected void unsetRegistryService(RegistryService registryService) {
- setRegistryService(null);
- }
-
- protected void setRealmService(RealmService realmService) {
- CloudCommonServiceComponent.realmService = realmService;
- }
-
- protected void unsetRealmService(RealmService realmService) {
- setRealmService(null);
- }
-
- public static BundleContext getBundleContext() {
- return bundleContext;
- }
-
- public static RegistryService getRegistryService() {
- return registryService;
- }
-
-
- public static RealmService getRealmService() {
- return realmService;
- }
-
- public static TenantManager getTenantManager() {
- return realmService.getTenantManager();
- }
-
- public static UserRegistry getGovernanceSystemRegistry(int tenantId) throws RegistryException {
- return registryService.getGovernanceSystemRegistry(tenantId);
- }
-
- public static UserRegistry getConfigSystemRegistry(int tenantId) throws RegistryException {
- return registryService.getConfigSystemRegistry(tenantId);
- }
-
- public static PackageInfoHolder getPackageInfos() {
- return packageInfos;
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/listeners/TenantMgtListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/listeners/TenantMgtListener.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/listeners/TenantMgtListener.java
deleted file mode 100644
index 4a9a316..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/listeners/TenantMgtListener.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.listeners;
-
-
-import org.apache.stratos.common.beans.TenantInfoBean;
-import org.apache.stratos.common.exception.StratosException;
-
-public interface TenantMgtListener {
- public void onTenantCreate(TenantInfoBean tenantInfo) throws StratosException;
-
- public void onTenantUpdate(TenantInfoBean tenantInfo) throws StratosException;
-
- public void onTenantRename(int tenantId, String oldDomainName,
- String newDomainName)throws StratosException;
-
- public void onTenantInitialActivation(int tenantId) throws StratosException;
-
- public void onTenantActivation(int tenantId) throws StratosException;
-
- public void onTenantDeactivation(int tenantId) throws StratosException;
-
- public void onSubscriptionPlanChange(int tenentId, String oldPlan,
- String newPlan) throws StratosException;
-
- public int getListenerOrder();
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/packages/PackageInfo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/packages/PackageInfo.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/packages/PackageInfo.java
deleted file mode 100644
index f20a6cd..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/packages/PackageInfo.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.packages;
-
-/*
- * Deserialize following XML
-<packages xmlns="http://wso2.com/carbon/multitenancy/billing/pacakges">
- <package name="multitenancy-free">
- <!--<subscriptionCharge>0</subscriptionCharge>--> <!-- $ per month -->
- <users>
- <limit>5</limit>
- <charge>0</charge> <!-- charge per month -->
- </users>
- <resourceVolume>
- <limit>10</limit> <!--mb per user -->
- </resourceVolume>
- <bandwidth>
- <limit>1000</limit> <!-- mb per user -->
- <overuseCharge>0</overuseCharge> <!-- $ per user per month -->
- </bandwidth>
- </package>
- <package name="multitenancy-small">
- ...
- </package>
-</packages>
- */
-public class PackageInfo {
-
- private String name;
- private int usersLimit;
- private int subscriptionCharge;
- private int chargePerUser;
- private int resourceVolumeLimit;
- private int bandwidthLimit;
- private int bandwidthOveruseCharge;
-
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getUsersLimit() {
- return usersLimit;
- }
-
- public void setUsersLimit(int usersLimit) {
- this.usersLimit = usersLimit;
- }
-
- public int getSubscriptionCharge() {
- return subscriptionCharge;
- }
-
- public void setSubscriptionCharge(int subscriptionCharge) {
- this.subscriptionCharge = subscriptionCharge;
- }
-
- public int getChargePerUser() {
- return chargePerUser;
- }
-
- public void setChargePerUser(int chargePerUser) {
- this.chargePerUser = chargePerUser;
- }
-
- public int getResourceVolumeLimit() {
- return resourceVolumeLimit;
- }
-
- public void setResourceVolumeLimit(int resourceVolumeLimit) {
- this.resourceVolumeLimit = resourceVolumeLimit;
- }
-
- public int getBandwidthLimit() {
- return bandwidthLimit;
- }
-
- public void setBandwidthLimit(int bandwidthLimit) {
- this.bandwidthLimit = bandwidthLimit;
- }
-
- public int getBandwidthOveruseCharge() {
- return bandwidthOveruseCharge;
- }
-
- public void setBandwidthOveruseCharge(int bandwidthOveruseCharge) {
- this.bandwidthOveruseCharge = bandwidthOveruseCharge;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/packages/PackageInfoHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/packages/PackageInfoHolder.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/packages/PackageInfoHolder.java
deleted file mode 100644
index 68fc5da..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/packages/PackageInfoHolder.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.packages;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.constants.StratosConstants;
-import org.apache.stratos.common.exception.StratosException;
-import org.apache.stratos.common.util.CommonUtil;
-import org.jaxen.JaxenException;
-import org.wso2.carbon.utils.CarbonUtils;
-
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class PackageInfoHolder {
- private static Log log = LogFactory.getLog(PackageInfoHolder.class);
- private static final String PACKAGE_DESCRIPTION_CONFIG = "multitenancy-packages.xml";
- private static final String PACKAGE_DESCRIPTION_CONFIG_NS =
- "http://wso2.com/carbon/multitenancy/billing/pacakges";
-
- List<PackageInfo> multitenancyPackages = new ArrayList<PackageInfo>();
-
- public PackageInfoHolder() throws StratosException {
- multitenancyPackages = deserializePackageDescriptionConfig();
- }
-
- public List<PackageInfo> getMultitenancyPackages() {
- return multitenancyPackages;
- }
-
- /*
- * Deserialize following XML
- <packages xmlns="http://wso2.com/carbon/multitenancy/billing/pacakges">
- <package name="multitenancy-free">
- <!--<subscriptionCharge>0</subscriptionCharge>--> <!-- $ per month -->
- <users>
- <limit>5</limit>
- <charge>0</charge> <!-- charge per month -->
- </users>
- <resourceVolume>
- <limit>10</limit> <!--mb per user -->
- </resourceVolume>
- <bandwidth>
- <limit>1000</limit> <!-- mb per user -->
- <overuseCharge>0</overuseCharge> <!-- $ per user per month -->
- </bandwidth>
- </package>
- <package name="multitenancy-small">
- ...
- </package>
- </packages>
- */
- private List<PackageInfo> deserializePackageDescriptionConfig() throws StratosException {
- String configFilePath = CarbonUtils.getCarbonConfigDirPath() + File.separator +
- StratosConstants.MULTITENANCY_CONFIG_FOLDER + File.separator +
- PACKAGE_DESCRIPTION_CONFIG;
-
- OMElement packageConfigs;
- try {
- packageConfigs = CommonUtil.buildOMElement(new FileInputStream(configFilePath));
- } catch (Exception e) {
- String msg = "Error in deserializing the packageConfigs file: " + configFilePath + ".";
- log.error(msg, e);
- throw new StratosException(msg, e);
- }
-
- @SuppressWarnings("unchecked")
- Iterator<OMElement> packageConfigsChildsIt = packageConfigs.getChildElements();
- while (packageConfigsChildsIt.hasNext()) {
- OMElement packageConfigEle = packageConfigsChildsIt.next();
- if (!new QName(PACKAGE_DESCRIPTION_CONFIG_NS, "package").equals(
- packageConfigEle.getQName())) {
- continue;
- }
-
- PackageInfo multitenancyPackage = new PackageInfo();
- String packageName = packageConfigEle.getAttributeValue(new QName("name"));
- String subscriptionCharge = getPackageConfigValue("subscriptionCharge", packageConfigEle);
- String usersLimit = getPackageConfigValue("users.limit", packageConfigEle);
- String usersCharge = getPackageConfigValue("users.charge", packageConfigEle);
-
- String resourceVolumeLimit =
- getPackageConfigValue("resourceVolume.limit", packageConfigEle);
- String resourceVolumeOveruseCharge =
- getPackageConfigValue("resourceVolume.overuseCharge", packageConfigEle);
- String bandwidthLimit = getPackageConfigValue("bandwidth.limit", packageConfigEle);
- String bandwidthOveruseCharge =
- getPackageConfigValue("bandwidth.overuseCharge", packageConfigEle);
- int usersLimitInt = -1;
- if (!usersLimit.equals("unlimited")) {
- usersLimitInt = Integer.parseInt(usersLimit);
- }
- int resourceVolumeLimitInt = -1;
- if (!resourceVolumeLimit.equals("unlimited")) {
- resourceVolumeLimitInt = Integer.parseInt(resourceVolumeLimit);
- }
- int bandwidthLimitInt = -1;
- if (!bandwidthLimit.equals("unlimited")) {
- bandwidthLimitInt = Integer.parseInt(bandwidthLimit);
- }
-
- multitenancyPackage.setName(packageName);
- //In the PackageInfo class subscriptionCharge, chargeperUser and bandwidthOverUsageCharge
- //are declared as Integers. I think it is better to change them to float. If somebody
- //enters a float value to the conf file it will cause an exception here
- multitenancyPackage.setSubscriptionCharge(Integer.parseInt(subscriptionCharge));
- multitenancyPackage.setUsersLimit(usersLimitInt);
- // multitenancyPackage.setChargePerUser(Integer.parseInt(usersCharge));
- multitenancyPackage.setResourceVolumeLimit(resourceVolumeLimitInt);
- multitenancyPackage.setBandwidthLimit(bandwidthLimitInt);
- // multitenancyPackage.setBandwidthOveruseCharge(Integer.parseInt(bandwidthOveruseCharge));
-
- multitenancyPackages.add(multitenancyPackage);
- }
- return multitenancyPackages;
- }
-
- private String getPackageConfigValue(String key, OMElement packageNode) throws StratosException {
- String qualifiedKey = "ns:" + key.replaceAll("\\.", "/ns:");
- AXIOMXPath xpathExpression;
- try {
- xpathExpression = new AXIOMXPath(qualifiedKey);
- xpathExpression.addNamespace("ns", PACKAGE_DESCRIPTION_CONFIG_NS);
- List valueNodes = xpathExpression.selectNodes(packageNode);
- if (valueNodes.isEmpty()) {
- if (log.isDebugEnabled()) {
- String msg = "No results found parsing package configuration for key: " +
- qualifiedKey + ".";
- log.debug(msg);
- }
- return null;
- }
- OMElement valueNode = (OMElement) valueNodes.get(0);
- return valueNode.getText();
- } catch (JaxenException e) {
- String msg = "Error in retrieving the key: " + qualifiedKey + ".";
- log.error(msg, e);
- throw new StratosException(msg, e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/services/PackageInfoService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/services/PackageInfoService.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/services/PackageInfoService.java
deleted file mode 100644
index 6ace99f..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/services/PackageInfoService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.services;
-
-import org.apache.stratos.common.internal.CloudCommonServiceComponent;
-import org.apache.stratos.common.packages.PackageInfo;
-
-import java.util.List;
-
-
-public class PackageInfoService {
-
- public PackageInfo[] getPackageInfos() throws Exception {
- List<PackageInfo> list = CloudCommonServiceComponent.getPackageInfos().
- getMultitenancyPackages();
- PackageInfo[] packageInfos = list.toArray(new PackageInfo[list.size()]);
- return packageInfos;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/util/ClaimsMgtUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/util/ClaimsMgtUtil.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/util/ClaimsMgtUtil.java
deleted file mode 100644
index d151df9..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/util/ClaimsMgtUtil.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.apache.stratos.common.util;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.user.core.UserCoreConstants;
-import org.wso2.carbon.user.core.UserStoreException;
-import org.wso2.carbon.user.core.UserStoreManager;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
-
-/*
- * This class handles the parameters that are input during the registration
- * which later are
- * stored as claims.
- *
- * Current claims are:
- * First Name - GIVEN_NAME
- * Last Name - SURNAME
- */
-public class ClaimsMgtUtil {
-
- private static final Log log = LogFactory.getLog(ClaimsMgtUtil.class);
-
- /* Methods to get the first and last names from the getNames() */
- /**
- * gets first name
- *
- * @param realmService realmService
- * @param tenantId
- * tenant id
- * @return first name
- * @throws Exception
- * if error in getting the first name
- */
- public static String getFirstName(RealmService realmService, int tenantId)throws Exception {
- String names[] = getNames(realmService, tenantId);
- return names[0];
- }
-
- /**
- * gets last name
- *
- * @param tenant
- * tenant
- * @param tenantId
- * tenant id
- * @return last name
- * @throws Exception
- * if error in getting the last name
- */
- public static String getLastName(RealmService realmService, int tenantId) throws Exception {
- String names[] = getNames(realmService, tenantId);
- return names[1];
- }
-
- /**
- * Gets the first name of a tenant admin to address him/her in the
- * notifications
- *
- * @param tenant
- * tenant
- * @param tenantId
- * tenant Id
- * @return first name / calling name
- * @throws Exception
- * if unable to retrieve the admin name
- */
- public static String[] getNames(RealmService realmService, int tenantId) throws Exception {
- String[] names = new String[2];
- String firstname = "", lastname = "";
- try {
- firstname = getFirstNamefromUserStoreManager(realmService, tenantId);
- } catch (Exception ignore) {
- if (log.isDebugEnabled()) {
- // Not exceptions,due to the existence of tenants with no full name.
- String msg = "Unable to get the firstname from the user store manager";
- log.debug(msg, ignore);
- }
- }
- if (firstname != null && !firstname.trim().equals("")) {
- lastname = getLastNamefromUserStoreManager(realmService, tenantId);
- if ((lastname != null) && (!lastname.trim().equals(""))) {
- names[0] = firstname;
- names[1] = lastname;
- } else {
- // no last name - fullname was considered givenname;
- names = getNamesfromFullName(realmService, firstname);
- }
- } else {
- // Work around for old tenants - where even full name is not input.
- if (log.isDebugEnabled()) {
- log.debug("First name is not available");
- }
- try {
- firstname = getAdminUserNameFromTenantId(realmService, tenantId);
- names[0] = firstname;
- names[1] = lastname;
- } catch (Exception e) {
- String msg = "Unable to get the admin Name from the user store manager";
- log.error(msg, e);
- throw new Exception(msg, e);
- }
- }
- return names;
- }
-
- /**
- * Method to get the name of the admin user given the tenant id
- *
- * @param tenantId
- * tenant id
- * @return admin user name
- * @throws Exception
- * UserStoreException
- */
- public static String getAdminUserNameFromTenantId(RealmService realmService, int tenantId)
- throws Exception {
- if (tenantId == MultitenantConstants.SUPER_TENANT_ID) {
- return realmService.getBootstrapRealmConfiguration().getAdminUserName();
- }
- String tenantAdminName ="";
- try {
- if (realmService.getTenantManager().getTenant(tenantId) != null) {
- tenantAdminName = realmService.getTenantManager().getTenant(tenantId).getAdminName();
- }
- } catch (org.wso2.carbon.user.api.UserStoreException e) {
- String msg = "Unable to retrieve the admin name for the tenant with the tenant Id: " +
- tenantId;
- log.error(msg, e);
- throw new Exception(msg, e);
- }
- return tenantAdminName;
- }
-
- /**
- * Let's split the givenname into two.
- *
- * @param fullName
- * full name of the tenant admin
- * @return first name
- */
- public static String[] getNamesfromFullName(RealmService realmService, String fullName) {
- String[] names = new String[0];
-
- if (!fullName.trim().equals("")) {
- names = fullName.split(" ", 2); // split by space.
- }
- return names; // first entry as the calling name.
- }
-
- /**
- * Get the claims from the user store manager
- *
- * @param tenant
- * tenant information
- * @param tenantId
- * tenantId
- * @param claim
- * claim name
- * @return claim value
- * @throws org.wso2.carbon.user.core.UserStoreException
- * exception in getting the user store manager
- */
- public static String getClaimfromUserStoreManager(RealmService realmService, int tenantId,
- String claim) throws UserStoreException {
- UserStoreManager userStoreManager = null;
- String claimValue = "";
- try {
- if (realmService.getTenantUserRealm(tenantId) != null) {
- userStoreManager =
- (UserStoreManager) realmService.getTenantUserRealm(tenantId)
- .getUserStoreManager();
- }
-
- } catch (Exception e) {
- String msg = "Error retrieving the user store manager for the tenant";
- log.error(msg, e);
- throw new UserStoreException(msg, e);
- }
- try {
- if (userStoreManager != null) {
- claimValue =
- userStoreManager.getUserClaimValue(
- getAdminUserNameFromTenantId(realmService, tenantId), claim,
- UserCoreConstants.DEFAULT_PROFILE);
- }
- return claimValue;
- } catch (Exception e) {
- String msg = "Unable to retrieve the claim for the given tenant";
- log.error(msg, e);
- throw new UserStoreException(msg, e);
- }
- }
-
- /**
- * Gets first name from the user store manager
- *
- * @param tenant
- * tenant
- * @param tenantId
- * tenant id
- * @return first name
- * @throws UserStoreException
- * , if error in getting the claim GIVEN_NAME
- */
- public static String getFirstNamefromUserStoreManager(RealmService realmService,
- int tenantId) throws UserStoreException {
- try {
- return getClaimfromUserStoreManager(realmService, tenantId,
- UserCoreConstants.ClaimTypeURIs.GIVEN_NAME);
- } catch (Exception e) {
- String msg = "First Name not found for the tenant";
- log.debug(msg, e);
- return ""; // returns empty string
- }
- }
-
- /**
- * Gets last name from the user store manager
- *
- * @param tenant
- * tenant
- * @param tenantId
- * tenant id
- * @return last name
- * @throws UserStoreException
- * , if error in getting the claim SURNAME
- */
- public static String getLastNamefromUserStoreManager(RealmService realmService,
- int tenantId) throws UserStoreException {
- String lastname = "";
- try {
- lastname = getClaimfromUserStoreManager(realmService, tenantId,
- UserCoreConstants.ClaimTypeURIs.SURNAME);
- } catch (Exception e) {
- String msg = "Last Name not found for the tenant";
- log.debug(msg, e);
- }
- return lastname; // returns empty string, if couldn't get last name from
- // userStore manager
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/util/CloudServicesUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/util/CloudServicesUtil.java b/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/util/CloudServicesUtil.java
deleted file mode 100644
index 4108973..0000000
--- a/components/org.apache.stratos.common/2.1.2/src/main/java/org/apache/stratos/common/util/CloudServicesUtil.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.common.util;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.config.CloudServiceConfig;
-import org.apache.stratos.common.config.CloudServicesDescConfig;
-import org.apache.stratos.common.config.PermissionConfig;
-import org.apache.stratos.common.constants.StratosConstants;
-import org.apache.stratos.common.internal.CloudCommonServiceComponent;
-import org.wso2.carbon.registry.core.Collection;
-import org.wso2.carbon.registry.core.RegistryConstants;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.wso2.carbon.user.core.UserStoreException;
-import org.wso2.carbon.user.mgt.UserMgtConstants;
-import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
-
-public class CloudServicesUtil {
-
- private static final Log log = LogFactory.getLog(CloudServicesUtil.class);
- // TODO protect using Java security
-
- public static void activateAllServices(CloudServicesDescConfig cloudServicesDesc, int tenantId) throws Exception {
-
- java.util.Collection<CloudServiceConfig> cloudServiceConfigList =
- cloudServicesDesc.getCloudServiceConfigs().
- values();
- if (cloudServiceConfigList != null) {
- for (CloudServiceConfig cloudServiceConfig : cloudServiceConfigList) {
- if (cloudServiceConfig.isDefaultActive()) {
- String cloudServiceName = cloudServiceConfig.getName();
- try {
- if (!CloudServicesUtil.isCloudServiceActive(cloudServiceName, tenantId)) {
- CloudServicesUtil.setCloudServiceActive(true,
- cloudServiceName,
- tenantId,
- cloudServicesDesc.getCloudServiceConfigs().
- get(cloudServiceName));
- }
- } catch (Exception e) {
- String msg = "Error in activating the cloud service at the tenant" +
- "creation. tenant id: " + tenantId + ", service name: " +
- cloudServiceName;
- log.error(msg, e);
- throw new UserStoreException(msg, e);
- }
- }
- }
- }
- }
-
- public static void activateOriginalAndCompulsoryServices(CloudServicesDescConfig cloudServicesDesc,
- String originalService,
- int tenantId) throws Exception {
-
- Map<String, CloudServiceConfig> cloudServiceConfigs =
- cloudServicesDesc.getCloudServiceConfigs();
- if (CloudServicesUtil.isServiceNameValid(cloudServicesDesc, originalService)) {
- if (!CloudServicesUtil.isCloudServiceActive(originalService, tenantId)) {
- CloudServicesUtil.setCloudServiceActive(true, originalService, tenantId,
- cloudServiceConfigs.get(originalService));
- log.info("Successfully activated the " + originalService + " for the tenant " +
- tenantId);
- }
- // register the compulsory services
- if (!CloudServicesUtil.isCloudServiceActive(StratosConstants.CLOUD_IDENTITY_SERVICE,
- tenantId)) {
- CloudServicesUtil.setCloudServiceActive(true,
- StratosConstants.CLOUD_IDENTITY_SERVICE,
- tenantId,
- cloudServiceConfigs.get(StratosConstants.CLOUD_IDENTITY_SERVICE));
- }
- if (!CloudServicesUtil.isCloudServiceActive(StratosConstants.CLOUD_GOVERNANCE_SERVICE,
- tenantId)) {
- CloudServicesUtil.setCloudServiceActive(true,
- StratosConstants.CLOUD_GOVERNANCE_SERVICE,
- tenantId,
- cloudServiceConfigs.get(StratosConstants.CLOUD_GOVERNANCE_SERVICE));
- }
- } else {
- log.warn("Unable to activate the " + originalService + " for the tenant " + tenantId);
- }
-
- }
-
- public static void setCloudServiceActive(boolean active,
- String cloudServiceName,
- int tenantId, CloudServiceConfig cloudServiceConfig)
- throws Exception {
- if (cloudServiceConfig.getLabel() == null) {
- // for the non-labled services, we are not setting/unsetting the
- // service active
- return;
- }
-
- UserRegistry govRegistry =
- CloudCommonServiceComponent.getGovernanceSystemRegistry(
- MultitenantConstants.SUPER_TENANT_ID);
- UserRegistry configRegistry = CloudCommonServiceComponent.getConfigSystemRegistry(tenantId);
- String cloudServiceInfoPath = StratosConstants.CLOUD_SERVICE_INFO_STORE_PATH +
- RegistryConstants.PATH_SEPARATOR + tenantId +
- RegistryConstants.PATH_SEPARATOR + cloudServiceName;
-
- Resource cloudServiceInfoResource;
- if (govRegistry.resourceExists(cloudServiceInfoPath)) {
- cloudServiceInfoResource = govRegistry.get(cloudServiceInfoPath);
- } else {
- cloudServiceInfoResource = govRegistry.newCollection();
- }
- cloudServiceInfoResource.setProperty(StratosConstants.CLOUD_SERVICE_IS_ACTIVE_PROP_KEY,
- active ? "true" : "false");
- govRegistry.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 (!configRegistry.resourceExists(path)) {
- Collection collection = configRegistry.newCollection();
- collection.setProperty(UserMgtConstants.DISPLAY_NAME, name);
- configRegistry.put(path, collection);
- }
- } else {
- if (configRegistry.resourceExists(path)) {
- configRegistry.delete(path);
- }
- }
- }
- }
-
- public static boolean isCloudServiceActive(String cloudServiceName,
- int tenantId) throws Exception {
- UserRegistry govRegistry = CloudCommonServiceComponent.getGovernanceSystemRegistry(
- MultitenantConstants.SUPER_TENANT_ID);
- return isCloudServiceActive(cloudServiceName, tenantId, govRegistry);
- }
-
- public static boolean isCloudServiceActive(String cloudServiceName,
- int tenantId, UserRegistry govRegistry)
- throws Exception {
- // The cloud manager is always active
- if (StratosConstants.CLOUD_MANAGER_SERVICE.equals(cloudServiceName)) {
- return true;
- }
-
- String cloudServiceInfoPath = StratosConstants.CLOUD_SERVICE_INFO_STORE_PATH +
- RegistryConstants.PATH_SEPARATOR + tenantId +
- RegistryConstants.PATH_SEPARATOR + cloudServiceName;
- Resource cloudServiceInfoResource;
- if (govRegistry.resourceExists(cloudServiceInfoPath)) {
- cloudServiceInfoResource = govRegistry.get(cloudServiceInfoPath);
- String isActiveStr =
- cloudServiceInfoResource.getProperty(
- StratosConstants.CLOUD_SERVICE_IS_ACTIVE_PROP_KEY);
- return "true".equals(isActiveStr);
- }
- return false;
- }
-
- public static boolean isServiceNameValid(CloudServicesDescConfig cloudServicesDesc,
- String cloudServiceName) {
- if(cloudServiceName == null) {
- return false;
- }
- java.util.Collection<CloudServiceConfig> cloudServiceConfigList =
- cloudServicesDesc.getCloudServiceConfigs().values();
- if (cloudServiceName.equals(StratosConstants.CLOUD_MANAGER_SERVICE)) {
- return false;
- }
- for (CloudServiceConfig cloudServiceConfig : cloudServiceConfigList) {
- if (cloudServiceConfig.getName().equals(cloudServiceName)) {
- return true;
- }
- }
- return false;
- }
-}