You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/11/02 16:31:12 UTC
[31/50] [abbrv] stratos git commit: Revert "Merge with
tenant-isolation branch"
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
index ad361b8..f9b585e 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
@@ -144,7 +144,7 @@ public class CloudControllerUtil {
iaasProvider.setNetworkInterfaces(networkInterfaces.getNetworkInterfaces());
}
- CloudControllerContext.getInstance().addIaasProvider(cartridge.getUuid(), iaasProvider);
+ CloudControllerContext.getInstance().addIaasProvider(cartridge.getType(), iaasProvider);
}
}
}
@@ -257,7 +257,7 @@ public class CloudControllerUtil {
public static String getPartitionIds(Partition[] partitions) {
StringBuilder str = new StringBuilder("");
for (Partition partition : partitions) {
- str.append(partition.getUuid() + ", ");
+ str.append(partition.getId() + ", ");
}
String partitionStr = str.length() == 0 ? str.toString() : str.substring(0, str.length() - 2);
@@ -270,17 +270,17 @@ public class CloudControllerUtil {
if (kubernetesCluster == null) {
throw new InvalidKubernetesClusterException("Kubernetes cluster can not be null");
}
- if (StringUtils.isEmpty(kubernetesCluster.getClusterUuid())) {
+ if (StringUtils.isEmpty(kubernetesCluster.getClusterId())) {
throw new InvalidKubernetesClusterException("Kubernetes cluster groupId can not be empty");
}
if (kubernetesCluster.getKubernetesMaster() == null) {
throw new InvalidKubernetesClusterException("Mandatory field master has not been set " +
- "for the Kubernetes cluster [id] " + kubernetesCluster.getClusterUuid());
+ "for the Kubernetes cluster [id] " + kubernetesCluster.getClusterId());
}
if (kubernetesCluster.getPortRange() == null) {
throw new InvalidKubernetesClusterException("Mandatory field portRange has not been set " +
- "for the Kubernetes cluster [id] " + kubernetesCluster.getClusterUuid());
+ "for the Kubernetes cluster [id] " + kubernetesCluster.getClusterId());
}
// Port range validation
@@ -290,7 +290,7 @@ public class CloudControllerUtil {
kubernetesCluster.getPortRange().getLower() < CloudControllerConstants.PORT_RANGE_MIN ||
kubernetesCluster.getPortRange().getUpper() < kubernetesCluster.getPortRange().getLower()) {
throw new InvalidKubernetesClusterException("Port range is invalid in kubernetes cluster " +
- "[kubenetes-cluster-id] " + kubernetesCluster.getClusterUuid() + " " +
+ "[kubenetes-cluster-id] " + kubernetesCluster.getClusterId() + " " +
" [valid-min] " + CloudControllerConstants.PORT_RANGE_MIN + " [valid-max] " +
CloudControllerConstants.PORT_RANGE_MAX);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/ApplicationBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/ApplicationBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/ApplicationBean.java
index ae1e6bb..1c7295d 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/ApplicationBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/ApplicationBean.java
@@ -30,7 +30,7 @@ public class ApplicationBean implements Serializable {
private static final long serialVersionUID = -2829206180707597651L;
- private String applicationId;
+ private String applicationId;
private boolean multiTenant;
private String name;
private String description;
@@ -108,4 +108,7 @@ public class ApplicationBean implements Serializable {
return signUpsExist;
}
+ public void setSignUpsExist(boolean signUpsExist) {
+ this.signUpsExist = signUpsExist;
+ }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/SubscribableInfo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/SubscribableInfo.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/SubscribableInfo.java
index 1bb5e48..c83ee6d 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/SubscribableInfo.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/application/SubscribableInfo.java
@@ -35,15 +35,13 @@ public class SubscribableInfo implements Serializable {
private String alias;
private String deploymentPolicy;
private String autoscalingPolicy;
- private String deploymentPolicyUuid;
- private String autoscalingPolicyUuid;
private int maxMembers;
private int minMembers;
private String[] dependencyAliases;
private ArtifactRepositoryBean artifactRepository;
private List<PropertyBean> property;
private PersistenceBean persistence;
- private int tenantId;
+ private String lvsVirtualIP;
public String getAlias() {
return alias;
@@ -117,11 +115,11 @@ public class SubscribableInfo implements Serializable {
this.persistence = persistence;
}
- public int getTenantId() {
- return tenantId;
+ public String getLvsVirtualIP() {
+ return lvsVirtualIP;
}
- public void setTenantId(int tenantId) {
- this.tenantId = tenantId;
+ public void setLvsVirtualIP(String lvsVirtualIP) {
+ this.lvsVirtualIP = lvsVirtualIP;
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupBean.java
index d14fd53..3fe85df 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupBean.java
@@ -30,11 +30,19 @@ public class CartridgeGroupBean implements Serializable {
private static final long serialVersionUID = 4696832597498594267L;
- private String name;
+ private String name;
private List<CartridgeGroupBean> groups;
private List<String> cartridges;
private DependencyBean dependencies;
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
public List<String> getCartridges() {
return cartridges;
}
@@ -58,12 +66,4 @@ public class CartridgeGroupBean implements Serializable {
public void setGroups(List<CartridgeGroupBean> groups) {
this.groups = groups;
}
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupReferenceBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupReferenceBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupReferenceBean.java
index 3870624..128fc05 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupReferenceBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeGroupReferenceBean.java
@@ -27,8 +27,7 @@ import java.util.List;
public class CartridgeGroupReferenceBean implements Serializable {
private static final long serialVersionUID = 7261380706841894892L;
- private String uuid;
- private int tenantId;
+
private String name;
private String alias;
private int groupMinInstances;
@@ -37,22 +36,6 @@ public class CartridgeGroupReferenceBean implements Serializable {
private List<CartridgeReferenceBean> cartridges;
private List<CartridgeGroupReferenceBean> groups;
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public int getTenantId() {
- return tenantId;
- }
-
- public void setTenantId(int tenantId) {
- this.tenantId = tenantId;
- }
-
public String getName() {
return name;
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeReferenceBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeReferenceBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeReferenceBean.java
index 7a150d9..163bc6c 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeReferenceBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/cartridge/CartridgeReferenceBean.java
@@ -31,21 +31,11 @@ public class CartridgeReferenceBean implements Serializable {
private static final long serialVersionUID = 8968224678298479827L;
- private String uuid;
private String type;
- private int tenantId;
private int cartridgeMin;
private int cartridgeMax;
private SubscribableInfo subscribableInfo;
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
public String getType() {
return type;
}
@@ -54,14 +44,6 @@ public class CartridgeReferenceBean implements Serializable {
this.type = type;
}
- public int getTenantId() {
- return tenantId;
- }
-
- public void setTenantId(int tenantId) {
- this.tenantId = tenantId;
- }
-
public int getCartridgeMin() {
return cartridgeMin;
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/kubernetes/KubernetesClusterBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/kubernetes/KubernetesClusterBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/kubernetes/KubernetesClusterBean.java
index 53e292a..ccab17c 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/kubernetes/KubernetesClusterBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/kubernetes/KubernetesClusterBean.java
@@ -27,13 +27,21 @@ import java.util.List;
@XmlRootElement
public class KubernetesClusterBean {
- private String clusterId;
+ private String clusterId;
private String description;
private List<KubernetesHostBean> kubernetesHosts;
private KubernetesMasterBean kubernetesMaster;
private PortRangeBean portRange;
private List<PropertyBean> property;
+ public String getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(String clusterId) {
+ this.clusterId = clusterId;
+ }
+
public List<KubernetesHostBean> getKubernetesHosts() {
return kubernetesHosts;
}
@@ -73,12 +81,4 @@ public class KubernetesClusterBean {
public void setDescription(String description) {
this.description = description;
}
-
- public String getClusterId() {
- return clusterId;
- }
-
- public void setClusterId(String clusterId) {
- this.clusterId = clusterId;
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java
index 05e1beb..3a31903 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/NetworkPartitionBean.java
@@ -26,6 +26,7 @@ import java.util.List;
@XmlRootElement
public class NetworkPartitionBean {
+
private String id;
private String provider;
private List<PartitionBean> partitions;
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java
index 4be030c..b6a6fee 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionBean.java
@@ -27,11 +27,18 @@ import java.util.List;
@XmlRootElement
public class PartitionBean {
- private String uuid;
- private String id;
+ private String id;
private String description;
private List<PropertyBean> property;
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
public String getDescription() {
return description;
}
@@ -47,12 +54,4 @@ public class PartitionBean {
public void setProperty(List<PropertyBean> property) {
this.property = property;
}
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionReferenceBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionReferenceBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionReferenceBean.java
index c63862f..a7b57c2 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionReferenceBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/partition/PartitionReferenceBean.java
@@ -27,18 +27,17 @@ import java.util.List;
@XmlRootElement
public class PartitionReferenceBean {
- private String uuid;
- private String id;
+ private String id;
private String description;
private List<PropertyBean> property;
private int partitionMax;
- public String getUuid() {
- return uuid;
+ public String getId() {
+ return id;
}
- public void setUuid(String uuid) {
- this.uuid = uuid;
+ public void setId(String id) {
+ this.id = id;
}
public String getDescription() {
@@ -64,12 +63,4 @@ public class PartitionReferenceBean {
public void setPartitionMax(int partitionMax) {
this.partitionMax = partitionMax;
}
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/ApplicationPolicyBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/ApplicationPolicyBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/ApplicationPolicyBean.java
index 93c2c2b..8c906aa 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/ApplicationPolicyBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/policy/deployment/ApplicationPolicyBean.java
@@ -30,7 +30,6 @@ public class ApplicationPolicyBean {
private String id;
private String algorithm;
String[] networkPartitions;
- private String[] networkPartitionsUuid;
List<PropertyBean> properties;
public String getId() {
@@ -64,12 +63,4 @@ public class ApplicationPolicyBean {
public void setProperties(List<PropertyBean> properties) {
this.properties = properties;
}
-
- public String[] getNetworkPartitionsUuid() {
- return networkPartitionsUuid;
- }
-
- public void setNetworkPartitionsUuid(String[] networkPartitionsUuid) {
- this.networkPartitionsUuid = networkPartitionsUuid;
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/ApplicationInstanceBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/ApplicationInstanceBean.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/ApplicationInstanceBean.java
index e7c45f5..d7f651d 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/ApplicationInstanceBean.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/beans/topology/ApplicationInstanceBean.java
@@ -29,8 +29,7 @@ public class ApplicationInstanceBean implements Serializable {
private String status;
private String instanceId;
private String parentInstanceId;
- private String applicationUuid;
- private String applicationId;
+ private String applicationId;
private List<GroupInstanceBean> groupInstances;
private List<ClusterInstanceBean> clusterInstances;
@@ -63,12 +62,12 @@ public class ApplicationInstanceBean implements Serializable {
this.parentInstanceId = parentInstanceId;
}
- public String getApplicationUuid() {
- return applicationUuid;
+ public String getApplicationId() {
+ return applicationId;
}
- public void setApplicationUuid(String applicationUuid) {
- this.applicationUuid = applicationUuid;
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
}
public List<GroupInstanceBean> getGroupInstances() {
@@ -86,12 +85,4 @@ public class ApplicationInstanceBean implements Serializable {
public void setClusterInstances(List<ClusterInstanceBean> clusterInstances) {
this.clusterInstances = clusterInstances;
}
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
index 5a3f5cc..5d6bf16 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/AutoscalerServiceClient.java
@@ -90,11 +90,6 @@ public class AutoscalerServiceClient {
return stub.getAutoscalingPolicy(autoscalingPolicyId);
}
- public org.apache.stratos.autoscaler.stub.autoscale.policy.AutoscalePolicy getAutoScalePolicyForTenant(
- String autoscalingPolicyId,int tenantId) throws RemoteException {
- return stub.getAutoscalingPolicyForTenant(autoscalingPolicyId,tenantId);
- }
-
public void addApplication(ApplicationContext applicationContext)
throws AutoscalerServiceApplicationDefinitionExceptionException,
RemoteException, AutoscalerServiceCartridgeNotFoundExceptionException,
@@ -113,22 +108,14 @@ public class AutoscalerServiceClient {
return stub.getApplication(applicationId);
}
- public ApplicationContext getApplicationByTenant(String applicationId, int tenantId) throws RemoteException {
- return stub.getApplicationByTenant(applicationId, tenantId);
- }
-
- public boolean existApplication(String applicationId,int tenantId) throws RemoteException {
- return stub.existApplication(applicationId,tenantId);
+ public boolean existApplication(String applicationId) throws RemoteException {
+ return stub.existApplication(applicationId);
}
public ApplicationContext[] getApplications() throws RemoteException {
return stub.getApplications();
}
- public ApplicationContext[] getApplicationsByTenant(int tenantId) throws RemoteException {
- return stub.getApplicationsByTenant(tenantId);
- }
-
public boolean deployApplication(String applicationId, String applicationPolicyId) throws RemoteException,
AutoscalerServiceInvalidPolicyExceptionException, AutoscalerServiceApplicationDefinitionExceptionException {
return stub.deployApplication(applicationId, applicationPolicyId);
@@ -140,27 +127,14 @@ public class AutoscalerServiceClient {
stub.addApplicationPolicy(applicationPolicy);
}
- public ApplicationPolicy getApplicationPolicyByUuid(String applicationPolicyUuid) throws RemoteException {
- return stub.getApplicationPolicyByUuid(applicationPolicyUuid);
- }
-
- public ApplicationPolicy getApplicationPolicy(String applicationPolicyId, int tenantId) throws RemoteException {
- return stub.getApplicationPolicy(applicationPolicyId, tenantId);
- }
-
- public ApplicationPolicy getApplicationPolicyByTenant(String applicationPolicyId,
- int tenantId) throws RemoteException {
- return stub.getApplicationPolicyByTenant(applicationPolicyId, tenantId);
+ public ApplicationPolicy getApplicationPolicy(String applicationPolicyId) throws RemoteException {
+ return stub.getApplicationPolicy(applicationPolicyId);
}
public ApplicationPolicy[] getApplicationPolicies() throws RemoteException {
return stub.getApplicationPolicies();
}
- public ApplicationPolicy[] getApplicationPoliciesByTenant(int tenantId) throws RemoteException {
- return stub.getApplicationPoliciesByTenant(tenantId);
- }
-
public void updateApplicationPolicy(ApplicationPolicy applicationPolicy)
throws RemoteException, AutoscalerServiceApplicatioinPolicyNotExistsExceptionException,
AutoscalerServiceRemoteExceptionException, AutoscalerServiceInvalidApplicationPolicyExceptionException {
@@ -196,41 +170,19 @@ public class AutoscalerServiceClient {
return stub.updateAutoScalingPolicy(autoScalePolicy);
}
- public boolean removeAutoscalingPolicy(String autoScalePolicyUuid) throws RemoteException,
+ public boolean removeAutoscalingPolicy(String autoScalePolicyId) throws RemoteException,
AutoscalerServicePolicyDoesNotExistExceptionException, AutoscalerServiceUnremovablePolicyExceptionException {
- return stub.removeAutoScalingPolicy(autoScalePolicyUuid);
+ return stub.removeAutoScalingPolicy(autoScalePolicyId);
}
public ServiceGroup getServiceGroup(String serviceGroupDefinitionName) throws RemoteException {
return stub.getServiceGroup(serviceGroupDefinitionName);
}
- public ServiceGroup getServiceGroupByTenant(String serviceGroupDefinitionName,int tenantId) throws RemoteException {
- return stub.getServiceGroupByTenant(serviceGroupDefinitionName,tenantId);
- }
-
- public ServiceGroup getOuterServiceGroupByTenant(String serviceGroupDefinitionName,
- int tenantId) throws RemoteException {
- return stub.getOuterServiceGroupByTenant(serviceGroupDefinitionName, tenantId);
- }
-
- public DeploymentPolicy getDeploymentPolicyByTenant(String deploymentPolicyId,int tenantId) throws RemoteException {
- return stub.getDeploymentPolicyByTenant(deploymentPolicyId, tenantId);
- }
-
- public DeploymentPolicy[] getDeploymentPoliciesByTenant(int tenantId) throws RemoteException {
- return stub.getDeploymentPoliciesByTenant(tenantId);
- }
-
public ServiceGroup[] getServiceGroups() throws RemoteException, AutoscalerServiceAutoScalerExceptionException {
return stub.getServiceGroups();
}
- public ServiceGroup[] getServiceGroupsByTenant(int tenantId) throws RemoteException,
- AutoscalerServiceAutoScalerExceptionException {
- return stub.getServiceGroupsByTenant(tenantId);
- }
-
public void addServiceGroup(ServiceGroup serviceGroup) throws AutoscalerServiceInvalidServiceGroupExceptionException,
RemoteException {
stub.addServiceGroup(serviceGroup);
@@ -268,31 +220,18 @@ public class AutoscalerServiceClient {
stub.updateDeploymentPolicy(deploymentPolicy);
}
- public void removeDeploymentPolicy(String deploymentPolicyId) throws RemoteException,
+ public void removeDeploymentPolicy(String deploymentPolicyID) throws RemoteException,
AutoscalerServiceDeploymentPolicyNotExistsExceptionException,
AutoscalerServiceUnremovablePolicyExceptionException {
- stub.removeDeployementPolicy(deploymentPolicyId);
+ stub.removeDeployementPolicy(deploymentPolicyID);
}
- public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyId) throws RemoteException {
- return stub.getDeploymentPolicy(deploymentPolicyId);
+ public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyID) throws RemoteException {
+ return stub.getDeploymentPolicy(deploymentPolicyID);
}
- public DeploymentPolicy getDeploymentPolicyForTenant(String deploymentPolicyId,int tenantId) throws RemoteException {
- return stub.getDeploymentPolicyForTenant(deploymentPolicyId,tenantId);
- }
-
public DeploymentPolicy[] getDeploymentPolicies() throws RemoteException {
return stub.getDeploymentPolicies();
}
- public AutoscalePolicy[] getAutoScalingPoliciesByTenant(int tenantId) throws RemoteException {
- return stub.getAutoScalingPoliciesByTenant(tenantId);
- }
-
- public boolean validateNetworkPartitionWithApplication(String networkPartitionId, int tenantId)
- throws RemoteException, AutoscalerServicePartitionValidationExceptionException {
- return stub.validateNetworkPartitionWithApplication(networkPartitionId,tenantId);
- }
-
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
index b0784f3..8944564 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/CloudControllerServiceClient.java
@@ -92,8 +92,8 @@ public class CloudControllerServiceClient {
stub.updateCartridge(cartridgeConfig);
}
- public void removeCartridge(String cartridgeTypeUuid) throws RemoteException, CloudControllerServiceInvalidCartridgeTypeExceptionException {
- stub.removeCartridge(cartridgeTypeUuid);
+ public void removeCartridge(String cartridgeType) throws RemoteException, CloudControllerServiceInvalidCartridgeTypeExceptionException {
+ stub.removeCartridge(cartridgeType);
}
public String[] getServiceGroupSubGroups(String name) throws RemoteException, CloudControllerServiceInvalidServiceGroupExceptionException {
@@ -116,18 +116,9 @@ public class CloudControllerServiceClient {
return stub.getCartridges();
}
- public Cartridge[] getCartridgesByTenant(int tenantId) throws RemoteException {
- return stub.getCartridgesByTenant(tenantId);
- }
-
- public Cartridge getCartridge(String cartridgeUuid) throws RemoteException,
- CloudControllerServiceCartridgeNotFoundExceptionException {
- return stub.getCartridge(cartridgeUuid);
- }
-
- public Cartridge getCartridgeByTenant(String cartridgeType,int tenantId) throws RemoteException,
+ public Cartridge getCartridge(String cartridgeType) throws RemoteException,
CloudControllerServiceCartridgeNotFoundExceptionException {
- return stub.getCartridgeByTenant(cartridgeType,tenantId);
+ return stub.getCartridge(cartridgeType);
}
public ClusterContext getClusterContext(String clusterId) throws RemoteException {
@@ -147,11 +138,11 @@ public class CloudControllerServiceClient {
return stub.addKubernetesCluster(kubernetesCluster);
}
- public boolean addKubernetesHost(String kubernetesClusterUuid, KubernetesHost kubernetesHost)
+ public boolean addKubernetesHost(String kubernetesClusterId, KubernetesHost kubernetesHost)
throws RemoteException, CloudControllerServiceInvalidKubernetesHostExceptionException,
CloudControllerServiceNonExistingKubernetesClusterExceptionException {
- return stub.addKubernetesHost(kubernetesClusterUuid, kubernetesHost);
+ return stub.addKubernetesHost(kubernetesClusterId, kubernetesHost);
}
public boolean updateKubernetesMaster(KubernetesMaster kubernetesMaster) throws RemoteException,
@@ -160,8 +151,8 @@ public class CloudControllerServiceClient {
return stub.updateKubernetesMaster(kubernetesMaster);
}
- public KubernetesCluster[] getAvailableKubernetesClusters(int tenantId) throws RemoteException {
- return stub.getKubernetesClusters(tenantId);
+ public KubernetesCluster[] getAvailableKubernetesClusters() throws RemoteException {
+ return stub.getKubernetesClusters();
}
public KubernetesCluster getKubernetesCluster(String kubernetesClusterId) throws RemoteException,
@@ -195,11 +186,11 @@ public class CloudControllerServiceClient {
return stub.updateKubernetesHost(kubernetesHost);
}
- public void validateNetworkPartitionOfDeploymentPolicy(String cartridgeUuid, String networkPartitionId)
+ public void validateNetworkPartitionOfDeploymentPolicy(String cartridgeType, String networkPartitionId)
throws RemoteException,
CloudControllerServiceInvalidPartitionExceptionException,
CloudControllerServiceInvalidCartridgeTypeExceptionException {
- stub.validateDeploymentPolicyNetworkPartition(cartridgeUuid, networkPartitionId);
+ stub.validateDeploymentPolicyNetworkPartition(cartridgeType, networkPartitionId);
}
public void addNetworkPartition(NetworkPartition networkPartition) throws RemoteException,
@@ -208,9 +199,9 @@ public class CloudControllerServiceClient {
stub.addNetworkPartition(networkPartition);
}
- public void removeNetworkPartition(String networkPartitionId, int tenantId) throws RemoteException,
+ public void removeNetworkPartition(String networkPartitionId) throws RemoteException,
CloudControllerServiceNetworkPartitionNotExistsExceptionException {
- stub.removeNetworkPartition(networkPartitionId, tenantId);
+ stub.removeNetworkPartition(networkPartitionId);
}
public void updateNetworkPartition(NetworkPartition networkPartition) throws RemoteException,
@@ -222,33 +213,16 @@ public class CloudControllerServiceClient {
return stub.getNetworkPartitions();
}
- public NetworkPartition[] getNetworkPartitionsByTenant(int tenantId) throws RemoteException {
- return stub.getNetworkPartitionsByTenant(tenantId);
- }
-
- public NetworkPartition getNetworkPartitionByTenant(String networkPartitionId, int tenantId) throws
- RemoteException {
- return stub.getNetworkPartitionByTenant(networkPartitionId, tenantId);
- }
-
public NetworkPartition getNetworkPartition(String networkPartitionId) throws RemoteException {
return stub.getNetworkPartition(networkPartitionId);
}
- public Partition[] getPartitionsByNetworkPartition(String networkPartitionId, int tenantId) throws RemoteException {
- return stub.getPartitionsByNetworkPartition(networkPartitionId, tenantId);
- }
-
- public String getNetworkPartitionUuid(String networkPartitionId, int tenantId) throws RemoteException {
- return stub.getNetworkPartitionUuid(networkPartitionId, tenantId);
- }
-
- public void createClusterInstance(String serviceUuid, String clusterId,
+ public void createClusterInstance(String serviceType, String clusterId,
String alias, String instanceId, String partitionId,
- String networkPartitionUuid) throws RemoteException {
+ String networkPartitionId) throws RemoteException {
try {
- stub.createClusterInstance(serviceUuid, clusterId, alias,
- instanceId, partitionId, networkPartitionUuid);
+ stub.createClusterInstance(serviceType, clusterId, alias,
+ instanceId, partitionId, networkPartitionId);
} catch (CloudControllerServiceClusterInstanceCreationExceptionException e) {
String msg = e.getFaultMessage().getClusterInstanceCreationException().getMessage();
@@ -261,14 +235,4 @@ public class CloudControllerServiceClient {
return stub.getIaasProviders();
}
- public KubernetesCluster getKubernetesClusterByTenantId(String clusterId, int tenantId)
- throws RemoteException {
- try {
- return stub.getKubernetesClusterByTenant(clusterId,tenantId);
- } catch (CloudControllerServiceNonExistingKubernetesClusterExceptionException e) {
- String msg = e.getFaultMessage().getNonExistingKubernetesClusterException().getMessage();
- log.error(msg, e);
- throw new RuntimeException(msg, e);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java
index 0dc6da9..a7dd9ad 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java
@@ -182,12 +182,12 @@ public class StratosManagerServiceClient {
/**
* Adds the used cartridges in cartridge groups to cache.
*
- * @param cartridgeGroupUuid the cartridge group uuid
- * @param cartridgeUuids the cartridge uuids
+ * @param cartridgeGroupName the cartridge group name
+ * @param cartridgeNames the cartridge names
* @throws RemoteException the remote exception
*/
- public void addUsedCartridgesInCartridgeGroups(String cartridgeGroupUuid, String[] cartridgeUuids) throws RemoteException {
- stub.addUsedCartridgesInCartridgeGroups(cartridgeGroupUuid, cartridgeUuids);
+ public void addUsedCartridgesInCartridgeGroups(String cartridgeGroupName, String[] cartridgeNames) throws RemoteException {
+ stub.addUsedCartridgesInCartridgeGroups(cartridgeGroupName, cartridgeNames);
}
/**
@@ -226,12 +226,12 @@ public class StratosManagerServiceClient {
/**
* Validates whether a cartridge can be removed.
*
- * @param cartridgeNameUuid the cartridge name
+ * @param cartridgeName the cartridge name
* @return true, if successful
* @throws RemoteException the remote exception
*/
- public boolean canCartridgeBeRemoved(String cartridgeNameUuid) throws RemoteException {
- return stub.canCartridgeBeRemoved(cartridgeNameUuid);
+ public boolean canCartridgeBeRemoved(String cartridgeName) throws RemoteException {
+ return stub.canCartridgeBeRemoved(cartridgeName);
}
/**
@@ -281,11 +281,11 @@ public class StratosManagerServiceClient {
/**
* Validates whether a cartridge group can be removed.
*
- * @param cartridgeGroupUuid the cartridge group name
+ * @param cartridgeGroupName the cartridge group name
* @return true, if successful
* @throws RemoteException the remote exception
*/
- public boolean canCartirdgeGroupBeRemoved(String cartridgeGroupUuid) throws RemoteException {
- return stub.canCartirdgeGroupBeRemoved(cartridgeGroupUuid);
+ public boolean canCartirdgeGroupBeRemoved(String cartridgeGroupName) throws RemoteException {
+ return stub.canCartirdgeGroupBeRemoved(cartridgeGroupName);
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
index a1f2fa9..ee0477c 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
@@ -91,8 +91,7 @@ public class StratosConstants {
// 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_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";
@@ -159,8 +158,6 @@ public class StratosConstants {
public static final String MAX_CHECK_DROOL_FILE = "maxcheck.drl";
public static final String OBSOLETE_CHECK_DROOL_FILE = "obsoletecheck.drl";
public static final String MIN_COUNT = "MIN_COUNT";
- public static final String SCALING_REASON = "SCALING_REASON";
- public static final String SCALING_TIME = "SCALING_TIME";
// Policy and definition related constants
public static final int PUBLIC_DEFINITION = 0;
@@ -169,8 +166,7 @@ public class StratosConstants {
public static final String PENDING_MEMBER_EXPIRY_TIMEOUT = "autoscaler.member.pendingMemberExpiryTimeout";
public static final String SPIN_TERMINATE_PARALLEL = "autoscaler.member.spinAfterTerminate";
public static final String OBSOLETED_MEMBER_EXPIRY_TIMEOUT = "autoscaler.member.obsoletedMemberExpiryTimeout";
- public static final String PENDING_TERMINATION_MEMBER_EXPIRY_TIMEOUT =
- "autoscaler.member.pendingTerminationMemberExpiryTimeout";
+ public static final String PENDING_TERMINATION_MEMBER_EXPIRY_TIMEOUT = "autoscaler.member.pendingTerminationMemberExpiryTimeout";
public static final String FILTER_VALUE_SEPARATOR = ",";
public static final String TOPOLOGY_APPLICATION_FILTER = "stratos.topology.application.filter";
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartitionRef.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartitionRef.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartitionRef.java
index de2b4a4..00df0a5 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartitionRef.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/NetworkPartitionRef.java
@@ -30,7 +30,6 @@ public class NetworkPartitionRef implements Serializable {
private static final long serialVersionUID = -8043298009352097370L;
private String id;
- private String uuid;
private PartitionRef[] partitionRefs;
private String partitionAlgo;
@@ -66,17 +65,9 @@ public class NetworkPartitionRef implements Serializable {
this.id = id;
}
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
public PartitionRef getPartitionRef(String partitionId) {
for (PartitionRef partitionRef : partitionRefs) {
- if (partitionRef.getUuid().equals(partitionId)) {
+ if (partitionRef.getId().equals(partitionId)) {
return partitionRef;
}
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/PartitionRef.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/PartitionRef.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/PartitionRef.java
index acdaf7f..249cc2c 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/PartitionRef.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/partition/PartitionRef.java
@@ -35,30 +35,29 @@ public class PartitionRef implements Serializable {
/**
* provider should match with an IaasProvider type.
*/
- private String uuid;
- private String id;
+ private String id;
private String description;
private int partitionMax;
private Properties properties = new Properties();
- private int tenantId;
+
/**
* Gets the value of the id property.
*
* @return possible object is
* {@link String }
*/
- public String getUuid() {
- return uuid;
+ public String getId() {
+ return id;
}
/**
* Sets the value of the id property.
*
- * @param uuid allowed object is
+ * @param id allowed object is
* {@link String }
*/
- public void setUuid(String uuid) {
- this.uuid = uuid;
+ public void setId(String id) {
+ this.id = id;
}
/**
@@ -99,12 +98,12 @@ public class PartitionRef implements Serializable {
@Override
public String toString() {
- return "Partition [id=" + uuid + ", description=" + description + ", properties=" + properties + "]";
+ return "Partition [id=" + id + ", description=" + description + ", properties=" + properties + "]";
}
public boolean equals(Object obj) {
if (obj != null && obj instanceof PartitionRef) {
- return this.uuid.equals(((PartitionRef) obj).getUuid());
+ return this.id.equals(((PartitionRef) obj).getId());
}
return false;
@@ -112,7 +111,7 @@ public class PartitionRef implements Serializable {
@Override
public int hashCode() {
- return this.uuid.hashCode();
+ return this.id.hashCode();
}
public int getPartitionMax() {
@@ -122,20 +121,4 @@ public class PartitionRef implements Serializable {
public void setPartitionMax(int partitionMax) {
this.partitionMax = partitionMax;
}
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public int getTenantId() {
- return tenantId;
- }
-
- public void setTenantId(int tenantId) {
- this.tenantId = tenantId;
- }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/HealthStatisticsPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/HealthStatisticsPublisher.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/HealthStatisticsPublisher.java
index 6af1317..dd7ddd4 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/HealthStatisticsPublisher.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/HealthStatisticsPublisher.java
@@ -27,7 +27,6 @@ public interface HealthStatisticsPublisher extends StatisticsPublisher {
/**
* Publish health statistics to complex event processor.
*
- * @param timestamp Time
* @param clusterId Cluster id of the member
* @param clusterInstanceId Cluster instance id of the member
* @param networkPartitionId Network partition id of the member
@@ -36,6 +35,6 @@ public interface HealthStatisticsPublisher extends StatisticsPublisher {
* @param health Health type: memory_consumption | load_average
* @param value Health type value
*/
- void publish(Long timestamp, String clusterId, String clusterInstanceId, String networkPartitionId,
+ void publish(String clusterId, String clusterInstanceId, String networkPartitionId,
String memberId, String partitionId, String health, double value);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/InFlightRequestPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/InFlightRequestPublisher.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/InFlightRequestPublisher.java
index e4e65c0..289be8b 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/InFlightRequestPublisher.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/InFlightRequestPublisher.java
@@ -27,12 +27,10 @@ public interface InFlightRequestPublisher extends StatisticsPublisher {
/**
* Publish in-flight request count.
*
- * @param timestamp Time
* @param clusterId Cluster id
* @param clusterInstanceId Cluster instance id
* @param networkPartitionId Network partition id of the cluster
* @param inFlightRequestCount In-flight request count of the cluster
*/
- void publish(Long timestamp, String clusterId, String clusterInstanceId, String networkPartitionId,
- int inFlightRequestCount);
+ void publish(String clusterId, String clusterInstanceId, String networkPartitionId, int inFlightRequestCount);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/StatisticsPublisherType.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/StatisticsPublisherType.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/StatisticsPublisherType.java
index d4b9a87..77c5b78 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/StatisticsPublisherType.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/StatisticsPublisherType.java
@@ -23,5 +23,5 @@ package org.apache.stratos.common.statistics.publisher;
* Statistics publisher type enumneration.
*/
public enum StatisticsPublisherType {
- WSO2CEP, WSO2DAS
+ WSO2CEP
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientConfig.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientConfig.java
deleted file mode 100644
index 7f6d8c4..0000000
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientConfig.java
+++ /dev/null
@@ -1,101 +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.statistics.publisher;
-
-
-import org.apache.commons.lang.StringUtils;
-
-/**
- * Thrift Client configuration.
- */
-public class ThriftClientConfig {
-
- public static final String THRIFT_CLIENT_CONFIG_FILE_PATH = "thrift.client.config.file.path";
- public static final String CEP_THRIFT_CLIENT_NAME = "cep";
- public static final String DAS_THRIFT_CLIENT_NAME = "das";
-
- private static volatile ThriftClientConfig instance;
- private ThriftClientInfo cepThriftClientInfo, dasThriftClientInfo;
-
- /*
- * A private Constructor prevents any other
- * class from instantiating.
- */
- ThriftClientConfig() {
- }
-
- public static ThriftClientConfig getInstance() {
- if (instance == null) {
- synchronized (ThriftClientConfig.class) {
- if (instance == null) {
- String configFilePath = System.getProperty(THRIFT_CLIENT_CONFIG_FILE_PATH);
- if (StringUtils.isBlank(configFilePath)) {
- throw new RuntimeException(String.format("Thrift client configuration file path system " +
- "property is not set: %s", THRIFT_CLIENT_CONFIG_FILE_PATH));
- }
- instance = ThriftClientConfigParser.parse(configFilePath);
- }
- }
- }
- return instance;
- }
-
- /**
- * Returns an ThriftClientInfo Object that stores the credential information.
- * Thrift client credential information can be found under thrift-client-config.xml file
- * These credential information then get parsed and assigned into ThriftClientInfo
- * Object.
- * <p/>
- * This method is used to return the assigned values in ThriftClientInfo Object
- *
- * @param thriftClientName Thrift Client Name
- * @return ThriftClientInfo object which consists of username,password,ip and port values
- */
- public ThriftClientInfo getThriftClientInfo(String thriftClientName) {
- if (CEP_THRIFT_CLIENT_NAME.equals(thriftClientName)) {
- return cepThriftClientInfo;
- } else if (DAS_THRIFT_CLIENT_NAME.equals(thriftClientName)) {
- return dasThriftClientInfo;
- }
- return null;
- }
-
- /**
- * Parsed values will be assigned to dasThriftClientInfo object. Required fields will be taken
- * from thrift-client-config.xml file.
- *
- * @param thriftClientInfo DAS Thrift Client Information
- */
-
- public void setDASThriftClientInfo(ThriftClientInfo thriftClientInfo) {
- this.dasThriftClientInfo = thriftClientInfo;
- }
-
- /**
- * Parsed values will be assigned to cepThriftClientInfo object. Required fields will be taken
- * from thrift-client-config.xml file.
- *
- * @param thriftClientInfo CEP Thrift Client Information
- */
-
- public void setCEPThriftClientInfo(ThriftClientInfo thriftClientInfo) {
- this.cepThriftClientInfo = thriftClientInfo;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientConfigParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientConfigParser.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientConfigParser.java
deleted file mode 100644
index 361b56a..0000000
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientConfigParser.java
+++ /dev/null
@@ -1,173 +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.statistics.publisher;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.util.AxiomXpathParserUtil;
-import org.wso2.securevault.SecretResolver;
-import org.wso2.securevault.SecretResolverFactory;
-
-import java.io.File;
-import java.util.Iterator;
-
-/**
- * Thrift client config parser.
- */
-public class ThriftClientConfigParser {
-
- private static final Log log = LogFactory.getLog(ThriftClientConfigParser.class);
-
- /**
- * Fields to be read from the thrift-client-config.xml file
- */
- private static final String NAME_ELEMENT = "name";
- private static final String STATS_PUBLISHER_ENABLED = "statsPublisherEnabled";
- private static final String USERNAME_ELEMENT = "username";
- private static final String PASSWORD_ELEMENT = "password";
- private static final String IP_ELEMENT = "ip";
- private static final String PORT_ELEMENT = "port";
-
- private static final String CEP_NAME_ELEMENT = "cep";
- private static final String DAS_NAME_ELEMENT = "das";
-
- /**
- * This method reads thrift-client-config.xml file and assign necessary credential
- * values into thriftClientInfo object. A singleton design has been implemented
- * with the use of thriftClientIConfig class.
- * <p/>
- * The filePath argument is the path to thrift-client-config.xml file
- *
- * @param filePath the path to thrift-client-config.xml file
- * @return ThriftClientConfig object
- */
- public static ThriftClientConfig parse(String filePath) {
- try {
- if (log.isDebugEnabled()) {
- log.debug(String.format("Parsing thrift client config file: %s", filePath));
- }
-
- ThriftClientConfig thriftClientIConfig = new ThriftClientConfig();
- ThriftClientInfo cepThriftClientInfo = new ThriftClientInfo();
- ThriftClientInfo dasThriftClientInfo = new ThriftClientInfo();
-
- File configFile = new File(filePath);
- if (!configFile.exists()) {
- throw new RuntimeException(String.format("Thrift client config file does not exist: %s", filePath));
- }
- OMElement document = AxiomXpathParserUtil.parse(configFile);
- Iterator thriftClientIterator = document.getChildElements();
-
- //Initialize the SecretResolver providing the configuration element.
- SecretResolver secretResolver = SecretResolverFactory.create(document, false);
-
- String nameValuesStr = null;
- boolean statsPublisherEnabled;
- String userNameValuesStr = null;
- String passwordValueStr = null;
- String ipValuesStr = null;
- String portValueStr = null;
-
- //same entry used in cipher-text.properties and cipher-tool.properties.
- String secretAlias = "thrift.client.configuration.password";
-
- // Iterate the thrift-client-config.xml file and read child element
- // consists of credential information necessary for ThriftStatisticsPublisher
- while (thriftClientIterator.hasNext()) {
- OMElement thriftClientConfig = (OMElement) thriftClientIterator.next();
- Iterator thriftClientConfigIterator = thriftClientConfig.getChildElements();
- ThriftClientInfo thriftClientInfo = new ThriftClientInfo();
-
- while (thriftClientConfigIterator.hasNext()) {
- OMElement thriftClientConfigElement = (OMElement) thriftClientConfigIterator.next();
-
- if (NAME_ELEMENT.equals(thriftClientConfigElement.getQName().getLocalPart())) {
- nameValuesStr = thriftClientConfigElement.getText();
- if (CEP_NAME_ELEMENT.equals(nameValuesStr)) {
- cepThriftClientInfo = thriftClientInfo;
- } else if (DAS_NAME_ELEMENT.equals(nameValuesStr)) {
- dasThriftClientInfo = thriftClientInfo;
- }
- }
-
- if (STATS_PUBLISHER_ENABLED.equals(thriftClientConfigElement.getQName().getLocalPart())) {
- statsPublisherEnabled = Boolean.parseBoolean(thriftClientConfigElement.getText());
- thriftClientInfo.setStatsPublisherEnabled(statsPublisherEnabled);
- }
-
- if (USERNAME_ELEMENT.equals(thriftClientConfigElement.getQName().getLocalPart())) {
- userNameValuesStr = thriftClientConfigElement.getText();
- thriftClientInfo.setUsername(userNameValuesStr);
- }
-
- //password field protected using Secure vault
- if (PASSWORD_ELEMENT.equals(thriftClientConfigElement.getQName().getLocalPart())) {
- if ((secretResolver != null) && (secretResolver.isInitialized())) {
- if (secretResolver.isTokenProtected(secretAlias)) {
- passwordValueStr = secretResolver.resolve(secretAlias);
- } else {
- passwordValueStr = thriftClientConfigElement.getText();
- }
- } else {
- passwordValueStr = thriftClientConfigElement.getText();
- }
- thriftClientInfo.setPassword(passwordValueStr);
- }
-
- if (IP_ELEMENT.equals(thriftClientConfigElement.getQName().getLocalPart())) {
- ipValuesStr = thriftClientConfigElement.getText();
- thriftClientInfo.setIp(ipValuesStr);
- }
-
- if (PORT_ELEMENT.equals(thriftClientConfigElement.getQName().getLocalPart())) {
- portValueStr = thriftClientConfigElement.getText();
- thriftClientInfo.setPort(portValueStr);
- }
- }
- }
- if (nameValuesStr == null) {
- throw new RuntimeException("Name value not found in thrift client configuration ");
- }
-
- if (userNameValuesStr == null) {
- throw new RuntimeException("Username value not found in thrift client configuration");
- }
- if (passwordValueStr == null) {
- throw new RuntimeException("Password not found in thrift client configuration ");
- }
-
- if (ipValuesStr == null) {
- throw new RuntimeException("Ip values not found in thrift client configuration ");
- }
-
- if (portValueStr == null) {
- throw new RuntimeException("Port not found in thrift client configuration ");
- }
-
- thriftClientIConfig.setCEPThriftClientInfo(cepThriftClientInfo);
- thriftClientIConfig.setDASThriftClientInfo(dasThriftClientInfo);
-
- return thriftClientIConfig;
- } catch (Exception e) {
- throw new RuntimeException("Could not parse thrift client configuration", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientInfo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientInfo.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientInfo.java
deleted file mode 100644
index 162c04f..0000000
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftClientInfo.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.statistics.publisher;
-
-/**
- * Thrift Client Info
- */
-public class ThriftClientInfo {
- private boolean statsPublisherEnabled;
- private String username;
- private String password;
- private String ip;
- private String port;
-
- public boolean isStatsPublisherEnabled() {
- return statsPublisherEnabled;
- }
-
- public void setStatsPublisherEnabled(boolean statsPublisherEnabled) {
- this.statsPublisherEnabled = statsPublisherEnabled;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getIp() {
- return ip;
- }
-
- public void setIp(String ip) {
- this.ip = ip;
- }
-
- public String getPort() {
- return port;
- }
-
- public void setPort(String port) {
- this.port = port;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
deleted file mode 100644
index 151137e..0000000
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/ThriftStatisticsPublisher.java
+++ /dev/null
@@ -1,116 +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.statistics.publisher;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.databridge.agent.thrift.Agent;
-import org.wso2.carbon.databridge.agent.thrift.AsyncDataPublisher;
-import org.wso2.carbon.databridge.agent.thrift.conf.AgentConfiguration;
-import org.wso2.carbon.databridge.agent.thrift.exception.AgentException;
-import org.wso2.carbon.databridge.commons.Event;
-import org.wso2.carbon.databridge.commons.StreamDefinition;
-
-import java.util.HashMap;
-
-/**
- * Thrift statistics publisher.
- */
-public class ThriftStatisticsPublisher implements StatisticsPublisher {
-
- private static final Log log = LogFactory.getLog(ThriftStatisticsPublisher.class);
-
- private StreamDefinition streamDefinition;
- private AsyncDataPublisher asyncDataPublisher;
- private String ip;
- private String port;
- private String username;
- private String password;
- private boolean enabled = false;
-
- /**
- * Credential information stored inside thrift-client-config.xml file
- * is parsed and assigned into ip,port,username and password fields
- *
- * @param streamDefinition Thrift Event Stream Definition
- * @param thriftClientName Thrift Client Name
- */
- public ThriftStatisticsPublisher(StreamDefinition streamDefinition, String thriftClientName) {
- ThriftClientConfig thriftClientConfig = ThriftClientConfig.getInstance();
- ThriftClientInfo thriftClientInfo = thriftClientConfig.getThriftClientInfo(thriftClientName);
-
- this.streamDefinition = streamDefinition;
- this.enabled = thriftClientInfo.isStatsPublisherEnabled();
- this.ip = thriftClientInfo.getIp();
- this.port = thriftClientInfo.getPort();
- this.username = thriftClientInfo.getUsername();
- this.password = thriftClientInfo.getPassword();
-
- if (enabled) {
- init();
- }
- }
-
- private void init() {
- AgentConfiguration agentConfiguration = new AgentConfiguration();
- Agent agent = new Agent(agentConfiguration);
-
- // Initialize asynchronous data publisher
- asyncDataPublisher = new AsyncDataPublisher("tcp://" + ip + ":" + port + "", username, password, agent);
- asyncDataPublisher.addStreamDefinition(streamDefinition);
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- if (this.enabled) {
- init();
- }
- }
-
- @Override
- public boolean isEnabled() {
- return enabled;
- }
-
- @Override
- public void publish(Object[] payload) {
- if (!isEnabled()) {
- throw new RuntimeException("Statistics publisher is not enabled");
- }
-
- Event event = new Event();
- event.setPayloadData(payload);
- event.setArbitraryDataMap(new HashMap<String, String>());
-
- try {
- if (log.isDebugEnabled()) {
- log.debug(String.format("Publishing thrift event: [stream] %s [version] %s",
- streamDefinition.getName(), streamDefinition.getVersion()));
- }
- asyncDataPublisher.publish(streamDefinition.getName(), streamDefinition.getVersion(), event);
- } catch (AgentException e) {
- if (log.isErrorEnabled()) {
- log.error(String.format("Could not publish thrift event: [stream] %s [version] %s",
- streamDefinition.getName(), streamDefinition.getVersion()), e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientConfig.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientConfig.java
new file mode 100644
index 0000000..178c5a6
--- /dev/null
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientConfig.java
@@ -0,0 +1,81 @@
+/*
+ * 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.statistics.publisher.wso2.cep;
+
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * Thrift Client configuration.
+ */
+public class ThriftClientConfig {
+
+ public static final String THRIFT_CLIENT_CONFIG_FILE_PATH = "thrift.client.config.file.path";
+
+ private static volatile ThriftClientConfig instance;
+ private ThriftClientInfo thriftClientInfo;
+
+ /*
+ * A private Constructor prevents any other
+ * class from instantiating.
+ */
+ ThriftClientConfig() {
+ }
+
+ public static ThriftClientConfig getInstance() {
+ if (instance == null) {
+ synchronized (ThriftClientConfig.class) {
+ if (instance == null) {
+ String configFilePath = System.getProperty(THRIFT_CLIENT_CONFIG_FILE_PATH);
+ if (StringUtils.isBlank(configFilePath)) {
+ throw new RuntimeException(String.format("Thrift client configuration file path system " +
+ "property is not set: %s", THRIFT_CLIENT_CONFIG_FILE_PATH));
+ }
+ instance = ThriftClientConfigParser.parse(configFilePath);
+ }
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Returns an ThriftClientInfo Object that stores the credential information.
+ * CEP credential information can be found under thrift-client-config.xml file
+ * These credential information then get parsed and assigned into ThriftClientInfo
+ * Object.
+ * <p/>
+ * This method is used to return the assigned values in ThriftClientInfo Object
+ *
+ * @return ThriftClientInfo object which consists of username,password,ip and port values
+ */
+ public ThriftClientInfo getThriftClientInfo() {
+ return thriftClientInfo;
+ }
+
+ /**
+ * Parsed values will be assigned to ThriftClientInfo object. Required fields will be taken
+ * from thrift-client-config.xml file.
+ *
+ * @param thriftClientInfo Object of the ThriftClientInfo
+ */
+ public void setThriftClientInfo(ThriftClientInfo thriftClientInfo) {
+ this.thriftClientInfo = thriftClientInfo;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientConfigParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientConfigParser.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientConfigParser.java
new file mode 100644
index 0000000..ae3c692
--- /dev/null
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientConfigParser.java
@@ -0,0 +1,139 @@
+/*
+ * 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.statistics.publisher.wso2.cep;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.util.AxiomXpathParserUtil;
+import org.wso2.securevault.SecretResolver;
+import org.wso2.securevault.SecretResolverFactory;
+
+import java.io.File;
+import java.util.Iterator;
+
+/**
+ * Thrift client config parser.
+ */
+public class ThriftClientConfigParser {
+
+ private static final Log log = LogFactory.getLog(ThriftClientConfigParser.class);
+
+ /**
+ * Fields to be read from the thrift-client-config.xml file
+ */
+ private static final String USERNAME_ELEMENT = "username";
+ private static final String PASSWORD_ELEMENT = "password";
+ private static final String IP_ELEMENT = "ip";
+ private static final String PORT_ELEMENT = "port";
+
+ /**
+ * This method reads thrift-client-config.xml file and assign necessary credential
+ * values into thriftClientInfo object. A singleton design has been implemented
+ * with the use of thriftClientIConfig class.
+ * <p/>
+ * The filePath argument is the path to thrift-client-config.xml file
+ *
+ * @param filePath the path to thrift-client-config.xml file
+ * @return ThriftClientConfig object
+ */
+ public static ThriftClientConfig parse(String filePath) {
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Parsing thrift client config file: %s", filePath));
+ }
+
+ ThriftClientConfig thriftClientIConfig = new ThriftClientConfig();
+ ThriftClientInfo thriftClientInfo = new ThriftClientInfo();
+ thriftClientIConfig.setThriftClientInfo(thriftClientInfo);
+
+ File configFile = new File(filePath);
+ if (!configFile.exists()) {
+ throw new RuntimeException(String.format("Thrift client config file does not exist: %s", filePath));
+ }
+ OMElement document = AxiomXpathParserUtil.parse(configFile);
+ Iterator thriftClientIterator = document.getChildElements();
+
+ //Initialize the SecretResolver providing the configuration element.
+ SecretResolver secretResolver = SecretResolverFactory.create(document, false);
+
+ String userNameValuesStr = null;
+ String passwordValueStr = null;
+ String ipValuesStr = null;
+ String portValueStr = null;
+
+ //same entry used in cipher-text.properties and cipher-tool.properties.
+ String secretAlias = "thrift.client.configuration.password";
+
+ // Iterate the thrift-client-config.xml file and read child element
+ // consists of credential information necessary for WSO2CEPStatisticsPublisher
+ while (thriftClientIterator.hasNext()) {
+ OMElement thriftClientElement = (OMElement) thriftClientIterator.next();
+
+ if (USERNAME_ELEMENT.equals(thriftClientElement.getQName().getLocalPart())) {
+ userNameValuesStr = thriftClientElement.getText();
+ thriftClientInfo.setUsername(userNameValuesStr);
+ }
+ //password field protected using Secure vault
+ if (PASSWORD_ELEMENT.equals(thriftClientElement.getQName().getLocalPart())) {
+ if ((secretResolver != null) && (secretResolver.isInitialized())) {
+ if (secretResolver.isTokenProtected(secretAlias)) {
+ passwordValueStr = secretResolver.resolve(secretAlias);
+ } else {
+ passwordValueStr = thriftClientElement.getText();
+ }
+ } else {
+ passwordValueStr = thriftClientElement.getText();
+ }
+ thriftClientInfo.setPassword(passwordValueStr);
+ }
+
+ if (IP_ELEMENT.equals(thriftClientElement.getQName().getLocalPart())) {
+ ipValuesStr = thriftClientElement.getText();
+ thriftClientInfo.setIp(ipValuesStr);
+ }
+
+ if (PORT_ELEMENT.equals(thriftClientElement.getQName().getLocalPart())) {
+ portValueStr = thriftClientElement.getText();
+ thriftClientInfo.setPort(portValueStr);
+ }
+ }
+
+ if (userNameValuesStr == null) {
+ throw new RuntimeException("Username value not found in thrift client configuration");
+ }
+ if (passwordValueStr == null) {
+ throw new RuntimeException("Password not found in thrift client configuration ");
+ }
+
+ if (ipValuesStr == null) {
+ throw new RuntimeException("Ip values not found in thrift client configuration ");
+ }
+
+ if (portValueStr == null) {
+ throw new RuntimeException("Port not found in thrift client configuration ");
+ }
+
+ return thriftClientIConfig;
+ } catch (Exception e) {
+ throw new RuntimeException("Could not parse thrift client configuration", e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/4b864473/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientInfo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientInfo.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientInfo.java
new file mode 100644
index 0000000..1a9ba81
--- /dev/null
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/ThriftClientInfo.java
@@ -0,0 +1,63 @@
+/*
+ * 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.statistics.publisher.wso2.cep;
+
+/**
+ * Thrift Client Info
+ */
+public class ThriftClientInfo {
+ private String username;
+ private String password;
+ private String ip;
+ private String port;
+
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getIp() {
+ return ip;
+ }
+
+ public void setIp(String ip) {
+ this.ip = ip;
+ }
+
+ public String getPort() {
+ return port;
+ }
+
+ public void setPort(String port) {
+ this.port = port;
+ }
+}