You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2013/11/28 17:03:37 UTC
[1/8] git commit: removing Partition from topology and removing CC
API specific classes
Updated Branches:
refs/heads/master 640d8748d -> 530af9eb4
removing Partition from topology and removing CC API specific classes
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/99f9951f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/99f9951f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/99f9951f
Branch: refs/heads/master
Commit: 99f9951f4d329b2c7ab88ca98adc14f6a5068e9b
Parents: 640d874
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Nov 28 15:47:49 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Nov 28 15:47:49 2013 +0530
----------------------------------------------------------------------
.../domain/policy/DeploymentPolicy.java | 85 ------------
.../messaging/domain/policy/Partition.java | 130 -------------------
.../messaging/domain/policy/PartitionGroup.java | 81 ------------
.../messaging/domain/topology/Member.java | 10 --
.../messaging/domain/topology/Topology.java | 37 ------
.../event/topology/ClusterCreatedEvent.java | 2 +-
.../event/topology/InstanceSpawnedEvent.java | 9 --
.../event/topology/PartitionCreatedEvent.java | 27 ++--
.../CompleteTopologyEventProcessor.java | 3 -
.../topology/InstanceSpawnedEventProcessor.java | 1 -
10 files changed, 14 insertions(+), 371 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/DeploymentPolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/DeploymentPolicy.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/DeploymentPolicy.java
deleted file mode 100644
index 8f024b3..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/DeploymentPolicy.java
+++ /dev/null
@@ -1,85 +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.messaging.domain.policy;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The model class for Deployment-Policy definition.
- */
-public class DeploymentPolicy {
-
- private String id;
- private List<PartitionGroup> partitionGroups;
-
- /**
- * Gets the value of the id property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getId() {
- return id;
- }
-
- /**
- * Sets the value of the id property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setId(String value) {
- this.id = value;
- }
-
- /**
- * Gets the value of the partition-groups.
- */
- public List<PartitionGroup> getPartitionGroups() {
- if (partitionGroups == null) {
- partitionGroups = new ArrayList<PartitionGroup>();
- }
- return this.partitionGroups;
- }
-
- /**
- * Returns all the partitions referenced by this policy.
- * @return List of {@link Partition}
- */
- public List<Partition> getAllPartitions() {
- List<Partition> partitions = new ArrayList<Partition>();
- for (PartitionGroup group : partitionGroups) {
- if (group != null) {
- partitions.addAll(group.getPartitions());
- }
- }
- return partitions;
- }
-
- public String toString() {
- return "Deployment Policy: "+this.id;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/Partition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/Partition.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/Partition.java
deleted file mode 100644
index c400540..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/Partition.java
+++ /dev/null
@@ -1,130 +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.messaging.domain.policy;
-
-import java.io.Serializable;
-
-import org.apache.stratos.messaging.util.Properties;
-
-/**
- * The model class for Partition definition.
- */
-public class Partition implements Serializable{
-
- private static final long serialVersionUID = 3725971214092010720L;
- private int partitionMax;
- private int partitionMin;
- /**
- * provider should match with an IaasProvider type.
- */
- private String provider;
- private Properties properties = new Properties();
- private String id;
-
-
- /**
- * Gets the value of the partitionMax property.
- *
- */
- public int getPartitionMembersMax() {
- return partitionMax;
- }
-
- /**
- * Sets the value of the partitionMax property.
- *
- */
- public void setPartitionMax(int value) {
- this.partitionMax = value;
- }
-
- /**
- * Gets the value of the partitionMin property.
- *
- */
- public int getPartitionMembersMin() {
- return partitionMin;
- }
-
- /**
- * Sets the value of the partitionMin property.
- *
- */
- public void setPartitionMin(int value) {
- this.partitionMin = value;
- }
- /**
- * Gets the value of the id property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getId() {
- return id;
- }
-
- /**
- * Sets the value of the id property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setId(String id) {
- this.id = id;
- }
-
- public Properties getProperties() {
- return properties;
- }
-
- public void setProperties(Properties properties) {
- this.properties = properties;
- }
-
- public String getProvider() {
- return provider;
- }
-
- public void setProvider(String provider) {
- this.provider = provider;
- }
-
- public String toString() {
- return "Partition Id: "+this.id+", Partition Provider: "+this.provider;
- }
-
- public boolean equals(Object obj) {
- if(obj != null && obj instanceof Partition) {
- return this.id.equals(((Partition) obj).getId());
- }
- return false;
-
- }
-
- @Override
- public int hashCode() {
- return this.id.hashCode();
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/PartitionGroup.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/PartitionGroup.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/PartitionGroup.java
deleted file mode 100644
index 06ce872..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/policy/PartitionGroup.java
+++ /dev/null
@@ -1,81 +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.messaging.domain.policy;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The model class for PartitionGroup definition.
- */
-public class PartitionGroup {
-
- private String id;
- private String partitionAlgo;
- private List<Partition> partitions;
-
- /**
- * Gets the value of the partitionAlgo property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getPartitionAlgo() {
- return partitionAlgo;
- }
-
- /**
- * Sets the value of the partitionAlgo property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setPartitionAlgo(String value) {
- this.partitionAlgo = value;
- }
-
- /**
- * Gets the value of the partitions.
- */
- public List<Partition> getPartitions() {
- if (partitions == null) {
- partitions = new ArrayList<Partition>();
- }
- return this.partitions;
- }
-
- /**
- * Gets the value of the id.
- */
- public String getId() {
- return id;
- }
-
- /**
- * sets the value of the id.
- */
- public void setId(String id) {
- this.id = id;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
index ce6c620..98f08c4 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Member.java
@@ -25,8 +25,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.apache.stratos.messaging.domain.policy.Partition;
-
/**
* Defines a member node in a cluster.
* Key: serviceName, clusterId, memberId
@@ -43,7 +41,6 @@ public class Member implements Serializable {
private Map<String, Port> portMap;
private Properties properties;
private String iaasNodeId;
- private Partition partition;
public Member(String serviceName, String clusterId, String memberId) {
this.serviceName = serviceName;
@@ -146,12 +143,5 @@ public class Member implements Serializable {
this.iaasNodeId = iaasNodeId;
}
- public Partition getPartition() {
- return partition;
- }
-
- public void setPartition(Partition partition) {
- this.partition = partition;
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
index 4e6552f..a510087 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Topology.java
@@ -24,8 +24,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import org.apache.stratos.messaging.domain.policy.Partition;
-
/**
* Defines a topology of serviceMap in Stratos.
*/
@@ -33,21 +31,15 @@ public class Topology implements Serializable {
private static final long serialVersionUID = -2453583548027402122L;
// Key: Service.serviceName
private Map<String, Service> serviceMap;
- private Map<String, Partition> partitionMap;
public Topology() {
this.serviceMap = new HashMap<String, Service>();
- partitionMap = new HashMap<String, Partition>();
}
public Collection<Service> getServices() {
return serviceMap.values();
}
- public Collection<Partition> getPartitions() {
- return partitionMap.values();
- }
-
public void addService(Service service) {
this.serviceMap.put(service.getServiceName(), service);
}
@@ -74,33 +66,4 @@ public class Topology implements Serializable {
return this.serviceMap.containsKey(serviceName);
}
- public Map<String, Partition> getPartitionMap() {
- return partitionMap;
- }
-
- public Partition getPartition(String id) {
- return this.partitionMap.get(id);
- }
-
- public void setPartitionMap(Map<String, Partition> partitionMap) {
- this.partitionMap = partitionMap;
- }
-
- public void addPartition(Partition partition) {
- this.partitionMap.put(partition.getId(), partition);
- }
-
- public void addPartitions(Collection<Partition> partitions) {
- for (Partition partition : partitions) {
- addPartition(partition);
- }
- }
-
- public void removePartition(Partition partition) {
- this.partitionMap.remove(partition.getId());
- }
-
- public void removePartition(String partitionId) {
- this.partitionMap.remove(partitionId);
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java
index 2aeea1a..c78b730 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterCreatedEvent.java
@@ -35,7 +35,7 @@ public class ClusterCreatedEvent extends TopologyEvent implements Serializable {
private String hostName;
private String tenantRange;
private String autoscalingPolicyName;
- private String deploymentPolicyName;
+ private String deploymentPolicyName = "economy-deployment";
private Properties properties;
public ClusterCreatedEvent(String serviceName, String clusterId, String hostName) {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java
index b5bc434..4b872a8 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/InstanceSpawnedEvent.java
@@ -21,14 +21,12 @@ package org.apache.stratos.messaging.event.topology;
import java.io.Serializable;
-import org.apache.stratos.messaging.domain.policy.Partition;
/**
* This event is fired by Cloud Controller when a member is spawned by the IaaS in a given cluster.
*/
public class InstanceSpawnedEvent extends TopologyEvent implements Serializable {
private static final long serialVersionUID = 2672909702971355178L;
- private Partition partition;
private String serviceName;
private String clusterId;
private String memberId;
@@ -61,11 +59,4 @@ public class InstanceSpawnedEvent extends TopologyEvent implements Serializable
this.iaasNodeId = iaasNodeId;
}
- public Partition getPartition() {
- return partition;
- }
-
- public void setPartition(Partition partition) {
- this.partition = partition;
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/PartitionCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/PartitionCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/PartitionCreatedEvent.java
index 604dc6e..39c5ab0 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/PartitionCreatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/PartitionCreatedEvent.java
@@ -18,23 +18,22 @@
*/
package org.apache.stratos.messaging.event.topology;
-import org.apache.stratos.messaging.domain.policy.Partition;
import java.io.Serializable;
public class PartitionCreatedEvent extends TopologyEvent implements Serializable {
private static final long serialVersionUID = -312209596940292730L;
- private Partition partition;
-
- public PartitionCreatedEvent(Partition partition) {
- this.setPartition(partition);
- }
-
- public Partition getPartition() {
- return partition;
- }
-
- public void setPartition(Partition partition) {
- this.partition = partition;
- }
+// private Partition partition;
+//
+// public PartitionCreatedEvent(Partition partition) {
+// this.setPartition(partition);
+// }
+//
+// public Partition getPartition() {
+// return partition;
+// }
+//
+// public void setPartition(Partition partition) {
+// this.partition = partition;
+// }
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyEventProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyEventProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyEventProcessor.java
index 3624ef6..c61a2a5 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyEventProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/CompleteTopologyEventProcessor.java
@@ -79,9 +79,6 @@ public class CompleteTopologyEventProcessor extends MessageProcessor {
}
}
- // Add partitions
- topology.addPartitions(event.getTopology().getPartitions());
-
if (log.isInfoEnabled()) {
log.info("Topology initialized");
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/99f9951f/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedEventProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedEventProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedEventProcessor.java
index 830de83..cae031f 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedEventProcessor.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/InstanceSpawnedEventProcessor.java
@@ -88,7 +88,6 @@ public class InstanceSpawnedEventProcessor extends MessageProcessor {
// Apply changes to the topology
Member member = new Member(event.getServiceName(), event.getClusterId(), event.getMemberId());
member.setStatus(MemberStatus.Created);
- member.setPartition(event.getPartition());
cluster.addMember(member);
if (log.isInfoEnabled()) {
[2/8] more refactoring to CC
Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/TopologyConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/TopologyConfig.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/TopologyConfig.java
deleted file mode 100644
index 0536ff5..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/TopologyConfig.java
+++ /dev/null
@@ -1,59 +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.cloud.controller.util;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Configuration related to Topology synchronization
- *
- */
-public class TopologyConfig implements Serializable{
-
- private static final long serialVersionUID = 4435173744617096911L;
-
- /**
- * Key - Value pair.
- */
- private Map<String, String> properties = new HashMap<String, String>();
-
- public void setProperty(String key, String value) {
- properties.put(key, value);
- }
-
- public String getProperty(String key) {
-
- if(properties.containsKey(key)){
- return properties.get(key);
- }
-
- return null;
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Zone.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Zone.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Zone.java
deleted file mode 100644
index 9ac8826..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Zone.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.apache.stratos.cloud.controller.util;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.Template;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class Zone extends Region {
- private String id;
- private String type;
- private List<Host> listOfHosts;
-
- private Map<String, String> properties = new HashMap<String, String>();
- private transient ComputeService computeService;
-
- private transient Template template;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
- public void setProperty(String key, String value) {
-
- if (key != null && value != null) {
- getProperties().put(key, value);
- }
- }
-
- public String getProperty(String key) {
- if(getProperties().get(key) != null) {
- return getProperties().get(key);
- } else {
- return super.getProperty(key);
- }
- }
-
- public List<Host> getListOfHosts() {
- return listOfHosts;
- }
-
- public void setListOfHosts(List<Host> listOfHosts) {
- this.listOfHosts = listOfHosts;
- }
-
- public void addHost(Host host) {
- this.listOfHosts.add(host);
- }
-
- public void removeHost(Host host) {
- this.listOfHosts.remove(host);
- }
-
- public ComputeService getComputeService() {
- return computeService;
- }
-
- public void setComputeService(ComputeService computeService) {
- this.computeService = computeService;
- }
-
- public Template getTemplate() {
- return template;
- }
-
- public void setTemplate(Template template) {
- this.template = template;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/AWSEC2PartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/AWSEC2PartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/AWSEC2PartitionValidator.java
index 0431193..dd6730c 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/AWSEC2PartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/AWSEC2PartitionValidator.java
@@ -24,8 +24,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
import org.apache.stratos.cloud.controller.interfaces.Iaas;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
import org.apache.stratos.messaging.domain.topology.Scope;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/OpenstackNovaPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/OpenstackNovaPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/OpenstackNovaPartitionValidator.java
index 2bf0dc9..cc8e1a2 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/OpenstackNovaPartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/OpenstackNovaPartitionValidator.java
@@ -24,8 +24,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
import org.apache.stratos.cloud.controller.interfaces.Iaas;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
import org.apache.stratos.messaging.domain.topology.Scope;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/interfaces/PartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/interfaces/PartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/interfaces/PartitionValidator.java
index eaa1862..0016255 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/interfaces/PartitionValidator.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/interfaces/PartitionValidator.java
@@ -21,7 +21,7 @@ package org.apache.stratos.cloud.controller.validate.interfaces;
import java.util.Properties;
import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
/**
* All the Partition Validators should implement this interface.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/util/ServiceContextTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/util/ServiceContextTest.java b/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/util/ServiceContextTest.java
index e948589..b4ea101 100644
--- a/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/util/ServiceContextTest.java
+++ b/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/util/ServiceContextTest.java
@@ -18,7 +18,8 @@
*/
package org.apache.cartridge.autoscaler.service.util;
-import org.apache.stratos.cloud.controller.util.ServiceContext;
+import org.apache.stratos.cloud.controller.pojo.ServiceContext;
+
import junit.framework.TestCase;
public class ServiceContextTest extends TestCase {
[3/8] more refactoring to CC
Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/ServiceContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/ServiceContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/ServiceContext.java
new file mode 100644
index 0000000..df025f9
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/ServiceContext.java
@@ -0,0 +1,366 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.exception.CloudControllerException;
+import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import java.io.*;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * We keep information regarding a service (i.e. a cartridge instance)
+ * in this object.
+ */
+public class ServiceContext implements Serializable{
+ private static Log log = LogFactory.getLog(ServiceContext.class);
+
+ private static final long serialVersionUID = -6740964802890082678L;
+ private File file;
+ private String clusterId;
+ private String tenantRange;
+ private String hostName;
+ private String payloadFilePath = "/tmp/" + CloudControllerConstants.PAYLOAD_NAME + ".zip";
+ private String cartridgeType;
+ private Cartridge cartridge;
+ private StringBuilder payload;
+ private String autoScalerPolicyName;
+
+ /**
+ * Key - Value pair.
+ */
+ private Map<String, String> properties = new HashMap<String, String>();
+ /**
+ * Key - IaaS Type
+ * Value - {@link IaasContext} object
+ */
+ private Map<String, IaasContext> iaasCtxts = new HashMap<String, IaasContext>();
+
+ public Map<String, IaasContext> getIaasCtxts() {
+ return iaasCtxts;
+ }
+
+ public String getClusterId() {
+ return clusterId;
+ }
+
+ public boolean setClusterId(String domainName) {
+ if (!"".equals(domainName)) {
+ this.clusterId = domainName;
+ return true;
+ }
+
+ return false;
+ }
+
+ public void setProperty(String key, String value) {
+ properties.put(key, value);
+ }
+
+ public String getProperty(String key) {
+
+ if(properties.containsKey(key)){
+ return properties.get(key);
+ }
+
+ return "";
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+
+ public Cartridge getCartridge() {
+ return cartridge;
+ }
+
+ public void setCartridge(Cartridge cartridge) {
+ this.cartridge = cartridge;
+ }
+
+ public String getTenantRange() {
+ return tenantRange;
+ }
+
+ public void setTenantRange(String tenantRange) {
+ this.tenantRange = tenantRange;
+ }
+
+ public IaasContext addIaasContext(String iaasType){
+ IaasContext ctxt = new IaasContext(iaasType);
+ iaasCtxts.put(iaasType, ctxt);
+ return ctxt;
+ }
+
+ public IaasContext getIaasContext(String type){
+ return iaasCtxts.get(type);
+ }
+
+ public void setIaasContextMap(Map<String, IaasContext> map){
+ iaasCtxts = map;
+ }
+
+ public String getPayloadFile() {
+ return payloadFilePath;
+ }
+
+ public void setPayloadFile(String payloadFile) {
+ this.payloadFilePath = payloadFile;
+ }
+
+ public String getHostName() {
+ if(cartridge != null && (hostName == null || hostName.isEmpty())){
+ return cartridge.getHostName();
+ }
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public String getCartridgeType() {
+ return cartridgeType;
+ }
+
+ public void setCartridgeType(String cartridgeType) {
+ this.cartridgeType = cartridgeType;
+ }
+
+ public StringBuilder getPayload() {
+ return payload;
+ }
+
+ public void setPayload(StringBuilder payload) {
+ this.payload = payload;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ public String toXml() {
+ String str = "<service domain=\"" + clusterId +
+ "\" tenantRange=\"" + tenantRange + "\" policyName=\"" + autoScalerPolicyName + "\">\n" +
+ "\t<cartridge type=\"" + cartridgeType +
+ "\"/>\n" + "\t<host>" + hostName +
+ "</host>\n" + "\t<payload>" + payload +
+ "</payload>\n" +
+ propertiesToXml() +
+ "</service>";
+ return str;
+ }
+
+ public String propertiesToXml() {
+ StringBuilder builder = new StringBuilder("");
+ for (Iterator<Map.Entry<String, String>> iterator = getProperties().entrySet().iterator(); iterator.hasNext();) {
+ Map.Entry<String, String> prop = iterator.next();
+
+ String key = prop.getKey();
+ String value = prop.getValue();
+ if (key != null) {
+ builder.append("\t<property name=\""+key +"\" value=\"" + (value == null ? "" : value) +"\"/>\n");
+ }
+
+ }
+
+ return builder.toString();
+ }
+
+ public byte[] generatePayload() {
+ String payloadStringTempFile = "launch-params";
+
+ FileWriter fstream;
+ try {
+ fstream = new FileWriter(payloadStringTempFile);
+
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+ BufferedWriter out = new BufferedWriter(fstream);
+ try {
+ out.write(payload.toString());
+ out.close();
+
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+
+
+ FileInputStream fis;
+ try {
+ fis = new FileInputStream(payloadStringTempFile);
+ } catch (FileNotFoundException e) {
+ String msg = "Failed while persisting the payload of clusterId : "
+ + clusterId;
+ log.error(msg, e);
+ throw new CloudControllerException(msg, e);
+ }
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(this.payloadFilePath);
+
+ } catch (FileNotFoundException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+
+ ZipOutputStream zos = new ZipOutputStream(fos);
+ addToZipFile(System.getProperty("user.dir"), payloadStringTempFile, zos);
+
+ File folder = new File(CarbonUtils.getCarbonHome() + File.separator
+ + "repository" + File.separator + "resources" + File.separator
+ + "user-data");
+
+ if(folder != null && folder.exists()) {
+ for (File fileEntry : folder.listFiles()) {
+ if (fileEntry != null && !fileEntry.isDirectory()) {
+ addToZipFile(folder.getPath(), fileEntry.getName(), zos);
+ }
+ }
+ }
+
+ try {
+ zos.close();
+ fos.close();
+
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+ byte [] payloadData = null;
+ File file = null;
+ FileInputStream fileInputStream = null;
+ try {
+ file = new File(payloadFilePath);
+ payloadData = new byte[(int)file.length()];
+ fileInputStream = new FileInputStream(file);
+ try {
+ fileInputStream.read(payloadData);
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+ } catch (FileNotFoundException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+ try {
+ fileInputStream.close();
+ file.delete();
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+
+ return payloadData;
+ }
+
+ /**
+ * Adds content to a zip file
+ *
+ * @param dir Name of directory
+ * @param fileName Name of file to add
+ * @param zos ZipOutputStream subscription to write
+ * @throws CloudControllerException in an error
+ */
+ private void addToZipFile(String dir, String fileName, ZipOutputStream zos) throws CloudControllerException {
+
+ log.info("Writing '" + fileName + "' to zip file");
+
+ File file = new File(dir + File.separator + fileName);
+ FileInputStream fis;
+ try {
+ fis = new FileInputStream(file);
+
+ } catch (FileNotFoundException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+
+ ZipEntry zipEntry = new ZipEntry(fileName);
+ try {
+ zos.putNextEntry(zipEntry);
+
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+
+ byte[] bytes = new byte[1024];
+ int length;
+
+ try {
+ while ((length = fis.read(bytes)) >= 0) {
+ zos.write(bytes, 0, length);
+ }
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+
+ try {
+ zos.closeEntry();
+ fis.close();
+
+ } catch (IOException e) {
+ log.error(e.getMessage());
+ throw new CloudControllerException(e.getMessage(), e);
+ }
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof ServiceContext) {
+ return this.clusterId.equals(((ServiceContext) obj).getClusterId());
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder(17, 31). // two randomly chosen prime numbers
+ append(clusterId).
+ toHashCode();
+ }
+
+ public String getAutoScalerPolicyName() {
+ return autoScalerPolicyName;
+ }
+
+ public void setAutoScalerPolicyName(String autoScalerPolicyName) {
+ this.autoScalerPolicyName = autoScalerPolicyName;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/TopologyConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/TopologyConfig.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/TopologyConfig.java
new file mode 100644
index 0000000..2d309a1
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/TopologyConfig.java
@@ -0,0 +1,59 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Configuration related to Topology synchronization
+ *
+ */
+public class TopologyConfig implements Serializable{
+
+ private static final long serialVersionUID = 4435173744617096911L;
+
+ /**
+ * Key - Value pair.
+ */
+ private Map<String, String> properties = new HashMap<String, String>();
+
+ public void setProperty(String key, String value) {
+ properties.put(key, value);
+ }
+
+ public String getProperty(String key) {
+
+ if(properties.containsKey(key)){
+ return properties.get(key);
+ }
+
+ return null;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Zone.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Zone.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Zone.java
new file mode 100644
index 0000000..803bef5
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Zone.java
@@ -0,0 +1,90 @@
+package org.apache.stratos.cloud.controller.pojo;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.Template;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Zone extends Region {
+ private String id;
+ private String type;
+ private List<Host> listOfHosts;
+
+ private Map<String, String> properties = new HashMap<String, String>();
+ private transient ComputeService computeService;
+
+ private transient Template template;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+ public void setProperty(String key, String value) {
+
+ if (key != null && value != null) {
+ getProperties().put(key, value);
+ }
+ }
+
+ public String getProperty(String key) {
+ if(getProperties().get(key) != null) {
+ return getProperties().get(key);
+ } else {
+ return super.getProperty(key);
+ }
+ }
+
+ public List<Host> getListOfHosts() {
+ return listOfHosts;
+ }
+
+ public void setListOfHosts(List<Host> listOfHosts) {
+ this.listOfHosts = listOfHosts;
+ }
+
+ public void addHost(Host host) {
+ this.listOfHosts.add(host);
+ }
+
+ public void removeHost(Host host) {
+ this.listOfHosts.remove(host);
+ }
+
+ public ComputeService getComputeService() {
+ return computeService;
+ }
+
+ public void setComputeService(ComputeService computeService) {
+ this.computeService = computeService;
+ }
+
+ public Template getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(Template template) {
+ this.template = template;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/publisher/CartridgeInstanceDataPublisherTask.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/publisher/CartridgeInstanceDataPublisherTask.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/publisher/CartridgeInstanceDataPublisherTask.java
index dcc1042..80cfe8f 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/publisher/CartridgeInstanceDataPublisherTask.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/publisher/CartridgeInstanceDataPublisherTask.java
@@ -21,9 +21,14 @@ package org.apache.stratos.cloud.controller.publisher;
import com.google.common.collect.MapDifference;
import com.google.common.collect.MapDifference.ValueDifference;
import com.google.common.collect.Maps;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.exception.CloudControllerException;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInstanceData;
+import org.apache.stratos.cloud.controller.pojo.IaasContext;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.ServiceContext;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
import org.apache.stratos.cloud.controller.util.*;
import org.jclouds.compute.ComputeService;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
index 1412e32..ebdcbc4 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/runtime/FasterLookUpDataHolder.java
@@ -18,8 +18,13 @@
*/
package org.apache.stratos.cloud.controller.runtime;
+import org.apache.stratos.cloud.controller.pojo.Cartridge;
import org.apache.stratos.cloud.controller.pojo.ClusterContext;
+import org.apache.stratos.cloud.controller.pojo.DataPublisherConfig;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.pojo.MemberContext;
+import org.apache.stratos.cloud.controller.pojo.ServiceContext;
+import org.apache.stratos.cloud.controller.pojo.TopologyConfig;
import org.apache.stratos.cloud.controller.registry.RegistryManager;
import org.apache.stratos.cloud.controller.util.*;
import org.apache.stratos.messaging.broker.publish.EventPublisher;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
index 795bf2c..f87953e 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
@@ -20,14 +20,14 @@ package org.apache.stratos.cloud.controller.topology;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.pojo.Cartridge;
import org.apache.stratos.cloud.controller.pojo.ClusterContext;
+import org.apache.stratos.cloud.controller.pojo.PortMapping;
import org.apache.stratos.cloud.controller.pojo.Registrant;
+import org.apache.stratos.cloud.controller.pojo.ServiceContext;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
-import org.apache.stratos.cloud.controller.util.Cartridge;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-import org.apache.stratos.cloud.controller.util.PortMapping;
-import org.apache.stratos.cloud.controller.util.ServiceContext;
-import org.apache.stratos.messaging.domain.policy.Partition;
import org.apache.stratos.messaging.domain.topology.*;
import org.apache.stratos.messaging.event.instance.status.MemberActivatedEvent;
import org.apache.stratos.messaging.event.instance.status.MemberStartedEvent;
@@ -75,22 +75,22 @@ public class TopologyBuilder {
}
- public static void handlePartitionCreated(Partition partition) {
-
- Topology topology = TopologyManager.getInstance().getTopology();
- if (partition == null) {
- throw new RuntimeException(String.format("Partition is empty"));
- }
- try {
- TopologyManager.getInstance().acquireWriteLock();
- topology.addPartition(partition);
- TopologyManager.getInstance().updateTopology(topology);
- } finally {
- TopologyManager.getInstance().releaseWriteLock();
- }
- TopologyEventSender.sendPartitionCreatedEvent(partition);
-
- }
+// public static void handlePartitionCreated(Partition partition) {
+//
+// Topology topology = TopologyManager.getInstance().getTopology();
+// if (partition == null) {
+// throw new RuntimeException(String.format("Partition is empty"));
+// }
+// try {
+// TopologyManager.getInstance().acquireWriteLock();
+// topology.addPartition(partition);
+// TopologyManager.getInstance().updateTopology(topology);
+// } finally {
+// TopologyManager.getInstance().releaseWriteLock();
+// }
+// TopologyEventSender.sendPartitionCreatedEvent(partition);
+//
+// }
// public static void handlePartitionUpdated(Partition newPartition, Partition oldPartition) {
//
@@ -241,14 +241,13 @@ public class TopologyBuilder {
member.setIaasNodeId(iaasNodeId);
member.setStatus(MemberStatus.Created);
member.setMemberIp(privateIp);
- member.setPartition(partition);
cluster.addMember(member);
cluster.addMemberToIaasNodeId(member);
TopologyManager.getInstance().updateTopology(topology);
} finally {
TopologyManager.getInstance().releaseWriteLock();
}
- TopologyEventSender.sendInstanceSpawnedEvent(serviceName, clusterId, memberId, iaasNodeId, partition);
+ TopologyEventSender.sendInstanceSpawnedEvent(serviceName, clusterId, memberId, iaasNodeId);
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
index 1ccb4a7..82aa692 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventSender.java
@@ -19,15 +19,14 @@ package org.apache.stratos.cloud.controller.topology;
*/
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.pojo.Cartridge;
import org.apache.stratos.cloud.controller.pojo.ClusterContext;
+import org.apache.stratos.cloud.controller.pojo.PortMapping;
import org.apache.stratos.cloud.controller.pojo.Registrant;
+import org.apache.stratos.cloud.controller.pojo.ServiceContext;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
-import org.apache.stratos.cloud.controller.util.Cartridge;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-import org.apache.stratos.cloud.controller.util.PortMapping;
-import org.apache.stratos.cloud.controller.util.ServiceContext;
import org.apache.stratos.messaging.broker.publish.EventPublisher;
-import org.apache.stratos.messaging.domain.policy.Partition;
import org.apache.stratos.messaging.domain.topology.Port;
import org.apache.stratos.messaging.domain.topology.Topology;
import org.apache.stratos.messaging.event.Event;
@@ -65,15 +64,15 @@ public class TopologyEventSender {
}
}
- public static void sendPartitionCreatedEvent(Partition partition) {
- PartitionCreatedEvent partitionCreatedEvent =
- new PartitionCreatedEvent(partition);
-
- if(log.isInfoEnabled()) {
- log.info(String.format("Publishing partition created event: [partition] %s", partition.getId()));
- }
- publishEvent(partitionCreatedEvent);
- }
+// public static void sendPartitionCreatedEvent(Partition partition) {
+// PartitionCreatedEvent partitionCreatedEvent =
+// new PartitionCreatedEvent(partition);
+//
+// if(log.isInfoEnabled()) {
+// log.info(String.format("Publishing partition created event: [partition] %s", partition.getId()));
+// }
+// publishEvent(partitionCreatedEvent);
+// }
// public static void sendPartitionUpdatedEvent(Partition partition, String oldPartitionId) {
// PartitionUpdatedEvent partitionUpdatedEvent =
@@ -138,13 +137,11 @@ public class TopologyEventSender {
}
- public static void sendInstanceSpawnedEvent(String serviceName, String clusterId, String memberId, String nodeId,
- Partition partition) {
+ public static void sendInstanceSpawnedEvent(String serviceName, String clusterId, String memberId, String nodeId) {
InstanceSpawnedEvent instanceSpawnedEvent = new InstanceSpawnedEvent(serviceName,
clusterId,
memberId,
nodeId);
- instanceSpawnedEvent.setPartition(partition);
if(log.isInfoEnabled()) {
log.info(String.format("Publishing instance spawned event: [service] %s [cluster] %s [member] %s [node] %s", serviceName, clusterId, memberId, nodeId));
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AppType.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AppType.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AppType.java
deleted file mode 100644
index 2ddbe7a..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AppType.java
+++ /dev/null
@@ -1,62 +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.cloud.controller.util;
-
-import java.io.Serializable;
-
-/**
- * domain mapping related data.
- *
- */
-public class AppType implements Serializable{
-
- private static final long serialVersionUID = 3550489774139807168L;
- private String name;
- private boolean appSpecificMapping = true;
-
- public AppType(){
-
- }
-
- public AppType(String name){
- this.setName(name);
- }
-
- public AppType(String name, boolean appSpecificMapping){
- this.setName(name);
- this.setAppSpecificMapping(appSpecificMapping);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public boolean isAppSpecificMapping() {
- return appSpecificMapping;
- }
-
- public void setAppSpecificMapping(boolean appSpecificMapping) {
- this.appSpecificMapping = appSpecificMapping;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Cartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Cartridge.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Cartridge.java
deleted file mode 100644
index fe864b9..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Cartridge.java
+++ /dev/null
@@ -1,288 +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.cloud.controller.util;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-
-/**
- * Holds information regarding a Cartridge.
- */
-public class Cartridge implements Serializable{
-
- private static final long serialVersionUID = 6637409027085059072L;
-
- private String type;
-
- private String hostName;
-
- private String provider;
-
- private String displayName;
-
- private String description;
-
- private String baseDir;
-
- private String version;
-
- private boolean multiTenant;
-
- private List<PortMapping> portMappings = new ArrayList<PortMapping>();
-
- private List<AppType> appTypeMappings = new ArrayList<AppType>();
-
- /**
- * Property map of this Cartridge.
- */
- private Map<String, String> properties = new HashMap<String, String>();
-
- /**
- * A Cartridge can have 1..n {@link IaasProvider}s
- */
- private List<IaasProvider> iaases = new ArrayList<IaasProvider>();
-
- private List<String> deploymentDirs = new ArrayList<String>();
-
- private IaasProvider lastlyUsedIaas;
-
- /**
- * Key - partition id
- * Value - Corresponding IaasProvider.
- */
- private Map<String, IaasProvider> partitionToIaasProvider = new ConcurrentHashMap<String, IaasProvider>();
-
- public Cartridge(){}
-
- public Cartridge(String type, String host, String provider, String version, boolean multiTenant) {
- this.type = type;
- this.hostName = host;
- this.provider = provider;
- this.version = version;
- this.multiTenant = multiTenant;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public void addIaasProvider(String partitionId, IaasProvider iaasProvider) {
- partitionToIaasProvider.put(partitionId, iaasProvider);
- }
-
- public void addIaasProviders(Map<String, IaasProvider> map) {
- for (Iterator<String> iterator = map.keySet().iterator(); iterator.hasNext();) {
- String key = (String) iterator.next();
- IaasProvider value = map.get(key);
-
- partitionToIaasProvider.put(key, value);
- }
- }
-
- public IaasProvider getIaasProviderOfPartition(String partitionId) {
- return partitionToIaasProvider.get(partitionId);
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public String getProperty(String key) {
- return properties.get(key);
- }
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
- public void addIaasProvider(IaasProvider iaas) {
- for (IaasProvider anIaas : iaases) {
- if(anIaas.equals(iaas)){
- int idx = iaases.indexOf(anIaas);
- iaases.remove(idx);
- iaases.add(idx, iaas);
- return;
- }
- }
- this.iaases.add(iaas);
- }
-
- public IaasProvider getIaasProvider(String iaasType){
- for (IaasProvider iaas : iaases) {
- if(iaas.getType().equals(iaasType)){
- return iaas;
- }
- }
-
- return null;
- }
-
- public List<IaasProvider> getIaases() {
- return iaases;
- }
-
- public void setIaases(List<IaasProvider> iaases) {
- this.iaases = iaases;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof Cartridge) {
- return this.type.equals(((Cartridge)obj).getType());
- }
- return false;
- }
-
- public int hashCode() {
- return new HashCodeBuilder(17, 31). // two randomly chosen prime numbers
- append(type).
- toHashCode();
- }
-
- public IaasProvider getLastlyUsedIaas() {
- return lastlyUsedIaas;
- }
-
- public void setLastlyUsedIaas(IaasProvider lastlyUsedIaas) {
- this.lastlyUsedIaas = lastlyUsedIaas;
- }
-
-// public boolean isJcloudsObjectsBuilt() {
-// return isJcloudsObjectsBuilt;
-// }
-//
-// public void setJcloudsObjectsBuilt(boolean isJcloudsObjectsBuilt) {
-// this.isJcloudsObjectsBuilt = isJcloudsObjectsBuilt;
-// }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- public void reset(){
-// lastlyUsedIaas = null;
- }
-
- public List<String> getDeploymentDirs() {
- return deploymentDirs;
- }
-
- public void setDeploymentDirs(List<String> deploymentDirs) {
- this.deploymentDirs = deploymentDirs;
- }
-
- public void addDeploymentDir(String dir){
- deploymentDirs.add(dir);
- }
-
- public void addPortMapping(PortMapping mapping){
- portMappings.add(mapping);
- }
-
- public void addAppType(AppType type){
- appTypeMappings.add(type);
- }
-
- public String getProvider() {
- return provider;
- }
-
- public void setProvider(String provider) {
- this.provider = provider;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public boolean isMultiTenant() {
- return multiTenant;
- }
-
- public void setMultiTenant(boolean multiTenant) {
- this.multiTenant = multiTenant;
- }
-
- public String getBaseDir() {
- return baseDir;
- }
-
- public void setBaseDir(String baseDir) {
- this.baseDir = baseDir;
- }
-
- public List<PortMapping> getPortMappings() {
- return portMappings;
- }
-
- public void setPortMappings(List<PortMapping> portMappings) {
- this.portMappings = portMappings;
- }
-
- public List<AppType> getAppTypeMappings() {
- return appTypeMappings;
- }
-
- public void setAppTypeMappings(List<AppType> appTypeMappings) {
- this.appTypeMappings = appTypeMappings;
- }
-
- public Map<String, IaasProvider> getPartitionToIaasProvider() {
- return partitionToIaasProvider;
- }
-
- public void setPartitionToIaasProvider(Map<String, IaasProvider> partitionToIaasProvider) {
- this.partitionToIaasProvider = partitionToIaasProvider;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CartridgeInfo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CartridgeInfo.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CartridgeInfo.java
deleted file mode 100644
index a9bc054..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CartridgeInfo.java
+++ /dev/null
@@ -1,165 +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.cloud.controller.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.stratos.messaging.util.Property;
-
-/**
- * Holds useful information for externals, regarding a Cartridge.
- */
-public class CartridgeInfo {
-
- private String type;
-
- private String hostName;
-
- private String displayName;
-
- private String description;
-
- private String[] deploymentDirs;
-
- private PortMapping[] portMappings;
-
- private AppType[] appTypes;
-
- private String provider;
-
- private String version;
-
- private boolean multiTenant;
-
- private String baseDir;
-
- private Property[] properties;
-
- public CartridgeInfo(){
-
- }
-
- public CartridgeInfo(String type, String host, String desc, List<String> deploymentDirs, String provider) {
- this.type = type;
- this.hostName = host;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getHostName() {
- return hostName;
- }
-
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- public String[] getDeploymentDirs() {
- return deploymentDirs;
- }
-
- public void setDeploymentDirs(List<String> deploymentDirsList) {
- if(deploymentDirsList == null){
- deploymentDirsList = new ArrayList<String>();
- }
- this.deploymentDirs = new String[deploymentDirsList.size()];
-
- deploymentDirsList.toArray(deploymentDirs);
-
- }
-
- public String getProvider() {
- return provider;
- }
-
- public void setProvider(String provider) {
- this.provider = provider;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public boolean isMultiTenant() {
- return multiTenant;
- }
-
- public void setMultiTenant(boolean multiTenant) {
- this.multiTenant = multiTenant;
- }
-
- public String getBaseDir() {
- return baseDir;
- }
-
- public void setBaseDir(String baseDir) {
- this.baseDir = baseDir;
- }
-
- public PortMapping[] getPortMappings() {
- return portMappings;
- }
-
- public void setPortMappings(PortMapping[] portMappings) {
- this.portMappings = portMappings;
- }
-
- public AppType[] getAppTypes() {
- return appTypes;
- }
-
- public void setAppTypes(AppType[] appTypes) {
- this.appTypes = appTypes;
- }
-
- public Property[] getProperties() {
- return properties;
- }
-
- public void setProperties(Property[] properties) {
- this.properties = properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CartridgeInstanceData.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CartridgeInstanceData.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CartridgeInstanceData.java
deleted file mode 100644
index a3507d3..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CartridgeInstanceData.java
+++ /dev/null
@@ -1,130 +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.cloud.controller.util;
-
-import org.jclouds.compute.domain.NodeMetadata;
-
-/**
- * This class holds the data to be published to BAM.
- */
-public class CartridgeInstanceData {
-
- // Cartridge type
- private String type;
-
- private String nodeId;
-
- private String domain;
-
- private String subDomain;
-
- private String iaas;
-
- private String status;
-
- private String tenantRange;
-
- private String alias;
-
- private boolean isMultiTenant;
-
- private NodeMetadata metaData;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getNodeId() {
- return nodeId;
- }
-
- public void setNodeId(String nodeId) {
- this.nodeId = nodeId;
- }
-
- public String getDomain() {
- return domain;
- }
-
- public void setDomain(String domain) {
- this.domain = domain;
- }
-
- public String getSubDomain() {
- return subDomain;
- }
-
- public void setSubDomain(String subDomain) {
- this.subDomain = subDomain;
- }
-
- public String getIaas() {
- return iaas;
- }
-
- public void setIaas(String iaas) {
- this.iaas = iaas;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public NodeMetadata getMetaData() {
- return metaData;
- }
-
- public void setMetaData(NodeMetadata metaData) {
- this.metaData = metaData;
- }
-
- public String getTenantRange() {
- return tenantRange;
- }
-
- public void setTenantRange(String tenantRange) {
- this.tenantRange = tenantRange;
- }
-
- public boolean isMultiTenant() {
- return isMultiTenant;
- }
-
- public void setMultiTenant(boolean isMultiTenant) {
- this.isMultiTenant = isMultiTenant;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public void setAlias(String alias) {
- this.alias = alias;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/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 8eeef23..4b77fc5 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
@@ -21,7 +21,11 @@ package org.apache.stratos.cloud.controller.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.exception.CloudControllerException;
-import org.apache.stratos.messaging.util.Property;
+import org.apache.stratos.cloud.controller.pojo.AppType;
+import org.apache.stratos.cloud.controller.pojo.Cartridge;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.PortMapping;
+import org.apache.stratos.cloud.controller.pojo.Property;
import java.util.ArrayList;
import java.util.Iterator;
@@ -91,12 +95,12 @@ public class CloudControllerUtil {
* @return java.util.Properties
*/
public static Properties toJavaUtilProperties(
- org.apache.stratos.messaging.util.Properties properties) {
+ org.apache.stratos.cloud.controller.pojo.Properties properties) {
Properties javaProps = new Properties();
if (properties != null && properties.getProperties() != null) {
- for (org.apache.stratos.messaging.util.Property property : properties.getProperties()) {
+ for (org.apache.stratos.cloud.controller.pojo.Property property : properties.getProperties()) {
javaProps.put(property.getName(), property.getValue());
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/DataPublisherConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/DataPublisherConfig.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/DataPublisherConfig.java
deleted file mode 100644
index 3c2a27b..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/DataPublisherConfig.java
+++ /dev/null
@@ -1,80 +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.cloud.controller.util;
-
-/**
- * @author nirmal
- *
- */
-public class DataPublisherConfig {
-
- private String bamUsername = CloudControllerConstants.DEFAULT_BAM_SERVER_USER_NAME;
- private String bamPassword = CloudControllerConstants.DEFAULT_BAM_SERVER_PASSWORD;
- private String dataPublisherCron = CloudControllerConstants.PUB_CRON_EXPRESSION;
- private String cassandraConnUrl = CloudControllerConstants.DEFAULT_CASSANDRA_URL;
- private String cassandraUser = CloudControllerConstants.DEFAULT_CASSANDRA_USER;
- private String cassandraPassword = CloudControllerConstants.DEFAULT_CASSANDRA_PASSWORD;
-
- public String getBamUsername() {
- return bamUsername;
- }
-
- public void setBamUsername(String bamUsername) {
- this.bamUsername = bamUsername;
- }
-
- public String getBamPassword() {
- return bamPassword;
- }
-
- public void setBamPassword(String bamPassword) {
- this.bamPassword = bamPassword;
- }
-
- public String getDataPublisherCron() {
- return dataPublisherCron;
- }
-
- public void setDataPublisherCron(String dataPublisherCron) {
- this.dataPublisherCron = dataPublisherCron;
- }
- public String getCassandraConnUrl() {
- return cassandraConnUrl;
- }
-
- public void setCassandraConnUrl(String cassandraHostAddr) {
- this.cassandraConnUrl = cassandraHostAddr;
- }
-
- public String getCassandraUser() {
- return cassandraUser;
- }
-
- public void setCassandraUser(String cassandraUser) {
- this.cassandraUser = cassandraUser;
- }
-
- public String getCassandraPassword() {
- return cassandraPassword;
- }
-
- public void setCassandraPassword(String cassandraPassword) {
- this.cassandraPassword = cassandraPassword;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Host.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Host.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Host.java
deleted file mode 100644
index 8271042..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Host.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.stratos.cloud.controller.util;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.Template;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class Host extends Zone {
- private String id;
- private String type;
- private Map<String, String> properties = new HashMap<String, String>();
-
- private transient ComputeService computeService;
-
- private transient Template template;
-
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
- public void setProperty(String key, String value) {
-
- if (key != null && value != null) {
- getProperties().put(key, value);
- }
- }
-
- public String getProperty(String key) {
- if(getProperties().get(key) != null) {
- return getProperties().get(key);
- } else {
- return super.getProperty(key);
- }
- }
-
- public ComputeService getComputeService() {
- return computeService;
- }
-
- public void setComputeService(ComputeService computeService) {
- this.computeService = computeService;
- }
-
- public Template getTemplate() {
- return template;
- }
-
- public void setTemplate(Template template) {
- this.template = template;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
deleted file mode 100644
index a82c4e3..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasContext.java
+++ /dev/null
@@ -1,162 +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.cloud.controller.util;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jclouds.compute.domain.NodeMetadata;
-
-/**
- *
- * Holds runtime data of an IaaS
- */
-public class IaasContext implements Serializable{
-
- private static final long serialVersionUID = 3370272526949562217L;
-
- private String type;
-
- private List<String> nodeIds;
-
- /**
- * Key - node id
- * Value - public ip
- */
- private Map<String, String> nodeToPublicIp;
-
- /**
- * Key - node id
- * Value - NodeMetadata object which has information on this node.
- */
- private transient Map<String, NodeMetadata> nodes;
-
- private List<String> toBeRemovedNodeIds;
-
- public IaasContext(String iaasType) {
- this.type = iaasType;
- nodeToPublicIp = new HashMap<String, String>();
- nodeIds = new ArrayList<String>();
- nodes = new HashMap<String, NodeMetadata>();
- toBeRemovedNodeIds = new ArrayList<String>();
- }
-
- public Map<String, String> getNodeToPublicIp() {
- return nodeToPublicIp;
- }
-
- public Map<String, NodeMetadata> getNodes() {
- return nodes;
- }
-
- public void setToBeRemovedNodeIds(List<String> list) {
- this.toBeRemovedNodeIds = list;
- }
-
- public List<String> getAllNodeIds() {
- List<String> allNodeIds = new ArrayList<String>(nodeIds);
- allNodeIds.addAll(toBeRemovedNodeIds);
- return allNodeIds;
- }
-
- public List<String> getNodeIds() {
- return nodeIds;
- }
-
- public List<String> getToBeRemovedNodeIds() {
- return toBeRemovedNodeIds;
- }
-
- public boolean didISpawn(String nodeId) {
- if(nodeIds.contains(nodeId) || toBeRemovedNodeIds.contains(nodeId)){
- return true;
- }
- return false;
- }
-
- public void addNodeId(String nodeId) {
- nodeIds.add(nodeId);
- }
-
- public void addNodeToPublicIp(String nodeId, String publicIp) {
- nodeToPublicIp.put(nodeId, publicIp);
- }
-
- public void addToBeRemovedNodeId(String nodeId) {
- toBeRemovedNodeIds.add(nodeId);
- }
-
- public void removeNodeId(String nodeId) {
- if(nodeIds.remove(nodeId)){
- toBeRemovedNodeIds.add(nodeId);
- }
- }
-
- public void removeToBeRemovedNodeId(String nodeId) {
- toBeRemovedNodeIds.remove(nodeId);
- }
-
- public void setNodeIds(List<String> nodeIds) {
- this.nodeIds = nodeIds;
- }
-
- public String lastlySpawnedNode() {
- return nodeIds.get(nodeIds.size()-1);
- }
-
- public void addNodeMetadata(NodeMetadata node) {
- if(nodes == null){
- nodes = new HashMap<String, NodeMetadata>();
- }
- nodes.put(node.getId(), node);
- }
-
- public void removeNodeMetadata(NodeMetadata node) {
- if (nodes != null) {
- nodes.remove(node.getId());
- }
- }
-
- public void removeNodeIdToPublicIp(String nodeId){
- nodeToPublicIp.remove(nodeId);
- }
-
- public NodeMetadata getNode(String nodeId) {
- if(nodes == null) {
- return null;
- }
- return nodes.get(nodeId);
- }
-
- public String getPublicIp(String nodeId){
- return nodeToPublicIp.get(nodeId);
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasProvider.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasProvider.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasProvider.java
deleted file mode 100644
index 81f4c4b..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/IaasProvider.java
+++ /dev/null
@@ -1,271 +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.cloud.controller.util;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.stratos.cloud.controller.interfaces.Iaas;
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.Template;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This is the basic data structure which holds an IaaS specific details.
- * NOTE: If you add a new attribute, please assign it in the constructor too.
- */
-public class IaasProvider implements Serializable{
-
- private static final long serialVersionUID = -940288190885166118L;
-
- /**
- * Type of the IaasProvider.
- */
- private String type;
-
- private List<Region> listOfRegions;
-
- /**
- * Fully qualified class name of an implementation of {@link org.apache.stratos.cloud.controller.interfaces.Iaas}
- */
- private String className;
-
- /**
- * human description of this IaaS provider
- */
- private String name;
-
- /**
- * Property map of this IaaS provider.
- */
- private Map<String, String> properties = new HashMap<String, String>();
-
- /**
- * Image identifier.
- */
- private String image;
-
-
- /**
- * Scale up order and scale down order of the IaaS.
- */
- private int scaleUpOrder = -1, scaleDownOrder = -1;
-
- private String provider, identity, credential;
-
- private transient ComputeService computeService;
-
- private transient Template template;
-
- private byte[] payload;
-
- /**
- * Corresponding {@link org.apache.stratos.cloud.controller.interfaces.Iaas} implementation
- */
- private transient Iaas iaas;
-
- public IaasProvider(){}
-
- public IaasProvider(IaasProvider anIaasProvider){
- this.type = anIaasProvider.getType();
- this.name = anIaasProvider.getName();
- this.className = anIaasProvider.getClassName();
- this.properties = anIaasProvider.getProperties();
- this.image = anIaasProvider.getImage();
- this.scaleUpOrder = anIaasProvider.getScaleUpOrder();
- this.scaleDownOrder = anIaasProvider.getScaleDownOrder();
- this.provider = anIaasProvider.getProvider();
- this.identity = anIaasProvider.getIdentity();
- this.credential = anIaasProvider.getCredential();
- this.computeService = anIaasProvider.getComputeService();
- this.template = anIaasProvider.getTemplate();
- this.payload = anIaasProvider.getPayload();
- this.iaas = anIaasProvider.getIaas();
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String id) {
- this.type = id;
- }
-
- public String getProperty(String key) {
- return properties.get(key);
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public void setProperty(String key, String value) {
-
- if(key != null && value != null){
- properties.put(key, value);
- }
- }
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
- public String getImage() {
- return image;
- }
-
- public void setImage(String image) {
- this.image = image;
- }
-
- public int getScaleUpOrder() {
- return scaleUpOrder;
- }
-
- public void setScaleUpOrder(int scaleUpOrder) {
- this.scaleUpOrder = scaleUpOrder;
- }
-
- public int getScaleDownOrder() {
- return scaleDownOrder;
- }
-
- public void setScaleDownOrder(int scaleDownOrder) {
- this.scaleDownOrder = scaleDownOrder;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getProvider() {
- return provider;
- }
-
- public void setProvider(String provider) {
- this.provider = provider;
- }
-
- public String getIdentity() {
- return identity;
- }
-
- public void setIdentity(String identity) {
- this.identity = identity;
- }
-
- public String getCredential() {
- return credential;
- }
-
- public void setCredential(String credential) {
- this.credential = credential;
- }
-
- public ComputeService getComputeService() {
- return computeService;
- }
-
- public void setComputeService(ComputeService computeService) {
- this.computeService = computeService;
- }
-
- public Template getTemplate() {
- return template;
- }
-
- public void setTemplate(Template template) {
- this.template = template;
- }
-
-
-
- public boolean equals(Object o) {
- if(o instanceof IaasProvider){
- return ((IaasProvider) o).getType().equals(this.getType());
- }
-
- return false;
- }
-
- public int hashCode() {
- return new HashCodeBuilder(17, 31). // two randomly chosen prime numbers
- append(type).
- toHashCode();
- }
-
- public IaasProvider copy(){
- return new IaasProvider(this);
- }
-
- public String getClassName() {
- return className;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public byte [] getPayload() {
- return payload;
- }
-
- public void setPayload(byte[]payload) {
- this.payload = payload;
- }
-
- public Iaas getIaas() {
- return iaas;
- }
-
- public void setIaas(Iaas iaas) {
- this.iaas = iaas;
- }
-
- public void reset(){
-// nodeIds = new ArrayList<String>();
-// nodes = new HashMap<String, NodeMetadata>();
-// toBeRemovedNodeIds = new ArrayList<String>();
- }
-
- /**
- * Partition the IaaS using different region
- */
- public List<Region> getListOfRegions() {
- return listOfRegions;
- }
-
- public void setListOfRegions(List<Region> listOfRegions) {
- this.listOfRegions = listOfRegions;
- }
-
- public void addRegion(Region region) {
- this.listOfRegions.add(region);
- }
-
- public void removeRegion(Region region) {
- this.listOfRegions.remove(region);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/LocationScope.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/LocationScope.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/LocationScope.java
deleted file mode 100644
index d29ced2..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/LocationScope.java
+++ /dev/null
@@ -1,70 +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.cloud.controller.util;
-
-/**
- * this contains the scope of a IaaS spanned across the geography.
- */
-public class LocationScope {
- private String zone;
- private String network;
- private String host;
- private String region;
- private String cloud;
-
- public String getZone() {
- return zone;
- }
-
- public void setZone(String zone) {
- this.zone = zone;
- }
-
- public String getNetwork() {
- return network;
- }
-
- public void setNetwork(String network) {
- this.network = network;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getRegion() {
- return region;
- }
-
- public void setRegion(String region) {
- this.region = region;
- }
-
- public String getCloud() {
- return cloud;
- }
-
- public void setCloud(String cloud) {
- this.cloud = cloud;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PortMapping.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PortMapping.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PortMapping.java
deleted file mode 100644
index 9f9a0e4..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/PortMapping.java
+++ /dev/null
@@ -1,64 +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.cloud.controller.util;
-
-import java.io.Serializable;
-
-public class PortMapping implements Serializable{
-
- private static final long serialVersionUID = -5387564414633460306L;
- private String protocol;
- private String port;
- private String proxyPort;
-
- public PortMapping(){
-
- }
-
- public PortMapping(String protocol, String port, String proxyPort){
- this.protocol = protocol;
- this.port = port;
- this.proxyPort = proxyPort;
- }
-
- public String getProtocol() {
- return protocol;
- }
-
- public void setProtocol(String protocol) {
- this.protocol = protocol;
- }
-
- public String getPort() {
- return port;
- }
-
- public void setPort(String port) {
- this.port = port;
- }
-
- public String getProxyPort() {
- return proxyPort;
- }
-
- public void setProxyPort(String proxyPort) {
- this.proxyPort = proxyPort;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Region.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Region.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Region.java
deleted file mode 100644
index 561285a..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/Region.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.apache.stratos.cloud.controller.util;
-
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.Template;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class Region extends IaasProvider {
- private String imageId;
- private String identity;
- private String credential;
- private String id;
- private String type;
- private List<Zone> listOfZones;
-
- private transient ComputeService computeService;
-
- private transient Template template;
-
- private Map<String, String> properties = new HashMap<String, String>();
-
- public String getProperty(String key) {
- if(getProperties().get(key) != null) {
- return getProperties().get(key);
- } else {
- return super.getProperty(key);
- }
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public void setProperty(String key, String value) {
-
- if (key != null && value != null) {
- getProperties().put(key, value);
- }
- }
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
-
- public String getImageId() {
- return imageId;
- }
-
- public void setImageId(String imageId) {
- this.imageId = imageId;
- }
-
- public String getIdentity() {
- if(identity == null) {
- return super.getIdentity();
- }
- return identity;
- }
-
- public void setIdentity(String identity) {
- this.identity = identity;
- }
-
- public String getCredential() {
- if(credential == null) {
- return super.getCredential();
- }
- return credential;
- }
-
- public void setCredential(String credential) {
- this.credential = credential;
- }
-
- public ComputeService getComputeService() {
- return computeService;
- }
-
- public void setComputeService(ComputeService computeService) {
- this.computeService = computeService;
- }
-
- public Template getTemplate() {
- return template;
- }
-
- public void setTemplate(Template template) {
- this.template = template;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public List<Zone> getListOfZones() {
- return listOfZones;
- }
-
- public void setListOfZones(List<Zone> listOfZones) {
- this.listOfZones = listOfZones;
- }
-
- public void addZone(Zone zone) {
- this.listOfZones.add(zone);
- }
-
- public void removeZone(Zone zone) {
- this.listOfZones.remove(zone);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/ServiceContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/ServiceContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/ServiceContext.java
deleted file mode 100644
index 0b4c4a2..0000000
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/ServiceContext.java
+++ /dev/null
@@ -1,382 +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.cloud.controller.util;
-
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.cloud.controller.exception.CloudControllerException;
-import org.apache.stratos.messaging.domain.policy.Partition;
-import org.wso2.carbon.utils.CarbonUtils;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-/**
- * We keep information regarding a service (i.e. a cartridge instance)
- * in this object.
- */
-public class ServiceContext implements Serializable{
- private static Log log = LogFactory.getLog(ServiceContext.class);
-
- private static final long serialVersionUID = -6740964802890082678L;
- private File file;
- private String clusterId;
- private String tenantRange;
- private String hostName;
- private String payloadFilePath = "/tmp/" + CloudControllerConstants.PAYLOAD_NAME + ".zip";
- private String cartridgeType;
- private Cartridge cartridge;
- private StringBuilder payload;
- private String autoScalerPolicyName;
- private List<Partition> partitionList = new ArrayList<Partition>();
-
- /**
- * Key - Value pair.
- */
- private Map<String, String> properties = new HashMap<String, String>();
- /**
- * Key - IaaS Type
- * Value - {@link IaasContext} object
- */
- private Map<String, IaasContext> iaasCtxts = new HashMap<String, IaasContext>();
-
- public Map<String, IaasContext> getIaasCtxts() {
- return iaasCtxts;
- }
-
- public String getClusterId() {
- return clusterId;
- }
-
- public boolean setClusterId(String domainName) {
- if (!"".equals(domainName)) {
- this.clusterId = domainName;
- return true;
- }
-
- return false;
- }
-
- public void setProperty(String key, String value) {
- properties.put(key, value);
- }
-
- public String getProperty(String key) {
-
- if(properties.containsKey(key)){
- return properties.get(key);
- }
-
- return "";
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, String> properties) {
- this.properties = properties;
- }
-
-
- public Cartridge getCartridge() {
- return cartridge;
- }
-
- public void setCartridge(Cartridge cartridge) {
- this.cartridge = cartridge;
- }
-
- public String getTenantRange() {
- return tenantRange;
- }
-
- public void setTenantRange(String tenantRange) {
- this.tenantRange = tenantRange;
- }
-
- public IaasContext addIaasContext(String iaasType){
- IaasContext ctxt = new IaasContext(iaasType);
- iaasCtxts.put(iaasType, ctxt);
- return ctxt;
- }
-
- public IaasContext getIaasContext(String type){
- return iaasCtxts.get(type);
- }
-
- public void setIaasContextMap(Map<String, IaasContext> map){
- iaasCtxts = map;
- }
-
- public String getPayloadFile() {
- return payloadFilePath;
- }
-
- public void setPayloadFile(String payloadFile) {
- this.payloadFilePath = payloadFile;
- }
-
- public String getHostName() {
- if(cartridge != null && (hostName == null || hostName.isEmpty())){
- return cartridge.getHostName();
- }
- return hostName;
- }
-
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- public String getCartridgeType() {
- return cartridgeType;
- }
-
- public void setCartridgeType(String cartridgeType) {
- this.cartridgeType = cartridgeType;
- }
-
- public StringBuilder getPayload() {
- return payload;
- }
-
- public void setPayload(StringBuilder payload) {
- this.payload = payload;
- }
-
- public File getFile() {
- return file;
- }
-
- public void setFile(File file) {
- this.file = file;
- }
-
- public String toXml() {
- String str = "<service domain=\"" + clusterId +
- "\" tenantRange=\"" + tenantRange + "\" policyName=\"" + autoScalerPolicyName + "\">\n" +
- "\t<cartridge type=\"" + cartridgeType +
- "\"/>\n" + "\t<host>" + hostName +
- "</host>\n" + "\t<payload>" + payload +
- "</payload>\n" +
- propertiesToXml() +
- "</service>";
- return str;
- }
-
- public String propertiesToXml() {
- StringBuilder builder = new StringBuilder("");
- for (Iterator<Map.Entry<String, String>> iterator = getProperties().entrySet().iterator(); iterator.hasNext();) {
- Map.Entry<String, String> prop = iterator.next();
-
- String key = prop.getKey();
- String value = prop.getValue();
- if (key != null) {
- builder.append("\t<property name=\""+key +"\" value=\"" + (value == null ? "" : value) +"\"/>\n");
- }
-
- }
-
- return builder.toString();
- }
-
- public byte[] generatePayload() {
- String payloadStringTempFile = "launch-params";
-
- FileWriter fstream;
- try {
- fstream = new FileWriter(payloadStringTempFile);
-
- } catch (IOException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
- BufferedWriter out = new BufferedWriter(fstream);
- try {
- out.write(payload.toString());
- out.close();
-
- } catch (IOException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
-
-
- FileInputStream fis;
- try {
- fis = new FileInputStream(payloadStringTempFile);
- } catch (FileNotFoundException e) {
- String msg = "Failed while persisting the payload of clusterId : "
- + clusterId;
- log.error(msg, e);
- throw new CloudControllerException(msg, e);
- }
- FileOutputStream fos = null;
- try {
- fos = new FileOutputStream(this.payloadFilePath);
-
- } catch (FileNotFoundException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
-
- ZipOutputStream zos = new ZipOutputStream(fos);
- addToZipFile(System.getProperty("user.dir"), payloadStringTempFile, zos);
-
- File folder = new File(CarbonUtils.getCarbonHome() + File.separator
- + "repository" + File.separator + "resources" + File.separator
- + "user-data");
-
- if(folder != null && folder.exists()) {
- for (File fileEntry : folder.listFiles()) {
- if (fileEntry != null && !fileEntry.isDirectory()) {
- addToZipFile(folder.getPath(), fileEntry.getName(), zos);
- }
- }
- }
-
- try {
- zos.close();
- fos.close();
-
- } catch (IOException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
- byte [] payloadData = null;
- File file = null;
- FileInputStream fileInputStream = null;
- try {
- file = new File(payloadFilePath);
- payloadData = new byte[(int)file.length()];
- fileInputStream = new FileInputStream(file);
- try {
- fileInputStream.read(payloadData);
- } catch (IOException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
- } catch (FileNotFoundException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
- try {
- fileInputStream.close();
- file.delete();
- } catch (IOException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
-
- return payloadData;
- }
-
- /**
- * Adds content to a zip file
- *
- * @param dir Name of directory
- * @param fileName Name of file to add
- * @param zos ZipOutputStream subscription to write
- * @throws CloudControllerException in an error
- */
- private void addToZipFile(String dir, String fileName, ZipOutputStream zos) throws CloudControllerException {
-
- log.info("Writing '" + fileName + "' to zip file");
-
- File file = new File(dir + File.separator + fileName);
- FileInputStream fis;
- try {
- fis = new FileInputStream(file);
-
- } catch (FileNotFoundException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
-
- ZipEntry zipEntry = new ZipEntry(fileName);
- try {
- zos.putNextEntry(zipEntry);
-
- } catch (IOException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
-
- byte[] bytes = new byte[1024];
- int length;
-
- try {
- while ((length = fis.read(bytes)) >= 0) {
- zos.write(bytes, 0, length);
- }
- } catch (IOException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
-
- try {
- zos.closeEntry();
- fis.close();
-
- } catch (IOException e) {
- log.error(e.getMessage());
- throw new CloudControllerException(e.getMessage(), e);
- }
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof ServiceContext) {
- return this.clusterId.equals(((ServiceContext) obj).getClusterId());
- }
- return false;
- }
-
- public int hashCode() {
- return new HashCodeBuilder(17, 31). // two randomly chosen prime numbers
- append(clusterId).
- toHashCode();
- }
-
- public String getAutoScalerPolicyName() {
- return autoScalerPolicyName;
- }
-
- public void setAutoScalerPolicyName(String autoScalerPolicyName) {
- this.autoScalerPolicyName = autoScalerPolicyName;
- }
-
- public List<Partition> getPartitionList() {
- return partitionList;
- }
-
- public void setPartitionList(List<Partition> partitionList) {
- this.partitionList = partitionList;
- }
-
- public void addPartition(Partition partition) {
- this.partitionList.add(partition);
- }
-
- public void removePartition(Partition partition) {
- this.partitionList.remove(partition);
- }
-}
[5/8] git commit: CC API uses these POJOs, hence they've added to CC
Posted by ni...@apache.org.
CC API uses these POJOs, hence they've added to CC
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/25555e86
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/25555e86
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/25555e86
Branch: refs/heads/master
Commit: 25555e861f71de1ee93d7d990b0772e8b81dd6a8
Parents: 2eaac66
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Nov 28 21:27:33 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Nov 28 21:27:33 2013 +0530
----------------------------------------------------------------------
.../deployment/partition/Partition.java | 130 +++++++++++++++++++
.../deployment/partition/PartitionGroup.java | 87 +++++++++++++
.../deployment/policy/DeploymentPolicy.java | 93 +++++++++++++
.../cloud/controller/pojo/Properties.java | 37 ++++++
.../stratos/cloud/controller/pojo/Property.java | 54 ++++++++
5 files changed, 401 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/Partition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/Partition.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/Partition.java
new file mode 100644
index 0000000..e434a86
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/Partition.java
@@ -0,0 +1,130 @@
+/*
+ * 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.cloud.controller.deployment.partition;
+
+import java.io.Serializable;
+
+import org.apache.stratos.cloud.controller.pojo.Properties;
+
+/**
+ * The model class for Partition definition.
+ */
+public class Partition implements Serializable{
+
+ private static final long serialVersionUID = 3725971214092010720L;
+ private int partitionMax;
+ private int partitionMin;
+ /**
+ * provider should match with an IaasProvider type.
+ */
+ private String provider;
+ private Properties properties = new Properties();
+ private String id;
+
+
+ /**
+ * Gets the value of the partitionMax property.
+ *
+ */
+ public int getPartitionMembersMax() {
+ return partitionMax;
+ }
+
+ /**
+ * Sets the value of the partitionMax property.
+ *
+ */
+ public void setPartitionMax(int value) {
+ this.partitionMax = value;
+ }
+
+ /**
+ * Gets the value of the partitionMin property.
+ *
+ */
+ public int getPartitionMembersMin() {
+ return partitionMin;
+ }
+
+ /**
+ * Sets the value of the partitionMin property.
+ *
+ */
+ public void setPartitionMin(int value) {
+ this.partitionMin = value;
+ }
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public Properties getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Properties properties) {
+ this.properties = properties;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String toString() {
+ return "Partition Id: "+this.id+", Partition Provider: "+this.provider;
+ }
+
+ public boolean equals(Object obj) {
+ if(obj != null && obj instanceof Partition) {
+ return this.id.equals(((Partition) obj).getId());
+ }
+ return false;
+
+ }
+
+ @Override
+ public int hashCode() {
+ return this.id.hashCode();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/PartitionGroup.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/PartitionGroup.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/PartitionGroup.java
new file mode 100644
index 0000000..2a74c0a
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/partition/PartitionGroup.java
@@ -0,0 +1,87 @@
+/*
+ * 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.cloud.controller.deployment.partition;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The model class for PartitionGroup definition.
+ */
+public class PartitionGroup implements Serializable{
+
+ private static final long serialVersionUID = -8043298009352097370L;
+ private String id;
+ private String partitionAlgo;
+ private Partition[] partitions;
+
+ /**
+ * Gets the value of the partitionAlgo property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getPartitionAlgo() {
+ return partitionAlgo;
+ }
+
+ /**
+ * Sets the value of the partitionAlgo property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setPartitionAlgo(String value) {
+ this.partitionAlgo = value;
+ }
+
+ public void setPartitions(Partition[] partitions) {
+ this.partitions = partitions;
+ }
+
+ /**
+ * Gets the value of the partitions.
+ */
+ public Partition[] getPartitions() {
+ if (partitions == null) {
+ partitions = new Partition[0];
+ }
+ return this.partitions;
+ }
+
+ /**
+ * Gets the value of the id.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * sets the value of the id.
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/policy/DeploymentPolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/policy/DeploymentPolicy.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/policy/DeploymentPolicy.java
new file mode 100644
index 0000000..d8f7ff3
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployment/policy/DeploymentPolicy.java
@@ -0,0 +1,93 @@
+/*
+ * 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.cloud.controller.deployment.policy;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.PartitionGroup;
+
+/**
+ * The model class for Deployment-Policy definition.
+ */
+public class DeploymentPolicy implements Serializable{
+
+ private static final long serialVersionUID = 5675507196284400099L;
+ private String id;
+ private PartitionGroup[] partitionGroups;
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ public void setPartitionGroup(PartitionGroup[] groups) {
+ this.partitionGroups = groups;
+ }
+
+ /**
+ * Gets the value of the partition-groups.
+ */
+ public PartitionGroup[] getPartitionGroups() {
+
+ return this.partitionGroups;
+ }
+
+ /**
+ * Returns all the partitions referenced by this policy.
+ * @return List of {@link Partition}
+ */
+ public List<Partition> getAllPartitions() {
+ List<Partition> partitions = new ArrayList<Partition>();
+ for (PartitionGroup group : partitionGroups) {
+ if (group != null) {
+ partitions.addAll(Arrays.asList(group.getPartitions()));
+ }
+ }
+ return partitions;
+ }
+
+ public String toString() {
+ return "Deployment Policy: "+this.id;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Properties.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Properties.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Properties.java
new file mode 100644
index 0000000..a13ad12
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Properties.java
@@ -0,0 +1,37 @@
+/*
+ * 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.cloud.controller.pojo;
+
+/**
+ * Had to wrap {@link Property} array using a class, since there's a bug in current
+ * stub generation.
+ */
+public class Properties {
+
+ private Property[] properties;
+
+ public Property[] getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Property[] properties) {
+ this.properties = properties;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/25555e86/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Property.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Property.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Property.java
new file mode 100644
index 0000000..1ffddad
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Property.java
@@ -0,0 +1,54 @@
+/*
+ * 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.cloud.controller.pojo;
+
+/**
+ * Holds a property
+ */
+public class Property {
+
+ private String name;
+ private String value;
+
+ public Property(){
+
+ }
+
+ public Property(String name, String value){
+ this.setName(name);
+ this.setValue(value);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
[8/8] git commit: changes to autoscaler after CC changes,
now a cluster monitor would make sure to monitor the cluster health
an act accordingly, etc.
Posted by ni...@apache.org.
changes to autoscaler after CC changes, now a cluster monitor would make sure to monitor the cluster health an act accordingly, etc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/530af9eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/530af9eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/530af9eb
Branch: refs/heads/master
Commit: 530af9eb438914f4de09a96bd0979f9ace5e15a3
Parents: 8cb502c
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Nov 28 21:33:11 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Nov 28 21:33:11 2013 +0530
----------------------------------------------------------------------
.../stratos/autoscaler/ClusterContext.java | 14 ++-
.../stratos/autoscaler/ClusterMonitor.java | 15 ++-
.../stratos/autoscaler/PartitionContext.java | 3 +-
.../algorithm/AutoscaleAlgorithm.java | 5 +-
.../autoscaler/algorithm/OneAfterAnother.java | 106 ++++++++--------
.../PartitionGroupOneAfterAnother.java | 120 +++++++++++--------
.../autoscaler/algorithm/RoundRobin.java | 110 +++++++++--------
.../cloud/controller/CloudControllerClient.java | 30 +++--
.../exception/PolicyValidationException.java | 19 +++
.../health/HealthEventMessageDelegator.java | 9 --
.../autoscaler/policy/PolicyManager.java | 2 +-
.../deployers/DeploymentPolicyDeployer.java | 2 +-
.../deployers/DeploymentPolicyReader.java | 39 +++++-
.../rule/AutoscalerRuleEvaluator.java | 5 +-
.../processors/AutoscalerTopologyReceiver.java | 74 +++++++++---
.../stratos/autoscaler/util/AutoscalerUtil.java | 16 ++-
.../stratos/autoscaler/TestKnowledgeBase.java | 4 -
.../policy/DeploymentPolicyDeployerTest.java | 53 ++++++++
.../src/test/resources/deployment-policy.xml | 16 +++
.../resources/test-minimum-autoscaler-rule.drl | 46 ++-----
20 files changed, 448 insertions(+), 240 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterContext.java
index ce3249b..99711ee 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterContext.java
@@ -19,13 +19,15 @@
package org.apache.stratos.autoscaler;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import org.apache.stratos.messaging.domain.policy.DeploymentPolicy;
-import org.apache.stratos.messaging.domain.policy.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.PartitionGroup;
+import org.apache.stratos.cloud.controller.deployment.policy.DeploymentPolicy;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.FactHandle;
@@ -62,13 +64,19 @@ public class ClusterContext {
private Map<String, MemberContext> memberContextMap;
private DeploymentPolicy deploymentPolicy;
+ @SuppressWarnings("unchecked")
public ClusterContext(String clusterId, String serviceId, DeploymentPolicy deploymentPolicy) {
this.clusterId = clusterId;
this.serviceId = serviceId;
this.setDeploymentPolicy(deploymentPolicy);
+ partitionsOfThisCluster = new ArrayList<Partition>();
if (deploymentPolicy != null) {
- this.setPartitionsOfThisCluster(deploymentPolicy.getAllPartitions());
+ for (PartitionGroup group : deploymentPolicy.getPartitionGroup()) {
+ for (Partition partition : group.getPartitions()) {
+ partitionsOfThisCluster.add(partition);
+ }
+ }
}
memberContextMap = new HashMap<String, MemberContext>();
partitionCountMap = new HashMap<String, Integer>();
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterMonitor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterMonitor.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterMonitor.java
index f795baa..40758f7 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterMonitor.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/ClusterMonitor.java
@@ -22,8 +22,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
-import org.apache.stratos.messaging.domain.policy.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.FactHandle;
@@ -36,6 +38,7 @@ import org.drools.runtime.rule.FactHandle;
*/
public class ClusterMonitor implements Runnable{
+ private static final Log log = LogFactory.getLog(ClusterMonitor.class);
private String clusterId;
private ClusterContext clusterCtxt;
private List<MemberContext> memberCtxt;
@@ -112,7 +115,12 @@ public class ClusterMonitor implements Runnable{
public void run() {
while (!isDestroyed()) {
- minInstanceCountCheck();
+ log.info("Cluster monitor is running..");
+ try {
+ minInstanceCountCheck();
+ } catch (Exception e) {
+ log.error("Cluster monitor: min instance count check failed.", e);
+ }
// TODO scale
try {
// TODO make this configurable
@@ -131,8 +139,9 @@ public class ClusterMonitor implements Runnable{
PartitionContext ctxt = partitionCtxts.get(id);
if(ctxt == null) {
ctxt = new PartitionContext(partition);
+ partitionCtxts.put(id, ctxt);
}
- ctxt.setMinimumMemberCount(partition.getPartitionMembersMin());
+ ctxt.setMinimumMemberCount(partition.getPartitionMin());
AutoscalerRuleEvaluator.evaluate(ksession, facthandle, ctxt);
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java
index 3579bcf..c76ac9f 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/PartitionContext.java
@@ -21,7 +21,8 @@ package org.apache.stratos.autoscaler;
import java.util.ArrayList;
import java.util.List;
-import org.apache.stratos.messaging.domain.policy.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+
/**
* @author nirmal
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java
index 3a3fef5..91d20a0 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/AutoscaleAlgorithm.java
@@ -19,8 +19,9 @@
package org.apache.stratos.autoscaler.algorithm;
-import org.apache.stratos.messaging.domain.policy.Partition;
-import org.apache.stratos.messaging.domain.policy.PartitionGroup;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.PartitionGroup;
+
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
index 309c2c9..bbc2438 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/OneAfterAnother.java
@@ -25,8 +25,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.AutoscalerContext;
import org.apache.stratos.autoscaler.ClusterContext;
-import org.apache.stratos.messaging.domain.policy.Partition;
-import org.apache.stratos.messaging.domain.policy.PartitionGroup;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.PartitionGroup;
+
+import edu.emory.mathcs.backport.java.util.Arrays;
/**
* Completes partitions in the order defined in autoscaler policy, go to next if current one reached the max limit
@@ -39,37 +41,38 @@ public class OneAfterAnother implements AutoscaleAlgorithm {
ClusterContext clusterContext = AutoscalerContext.getInstance().getClusterContext(clusterId);
int currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
- List<Partition> partitions = partitionGrp.getPartitions();
+ List<?> partitions = Arrays.asList(partitionGrp.getPartitions());
int noOfPartitions = partitions.size();
for(int i=currentPartitionIndex; i< noOfPartitions; i++)
{
- currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
- Partition currentPartition = partitions.get(currentPartitionIndex);
- String currentPartitionId = currentPartition.getId();
-
- if(clusterContext.partitionCountExists(currentPartitionId)){
- clusterContext.addPartitionCount(currentPartitionId, 0);
- }
-
- if(clusterContext.getMemberCount(currentPartitionId) < currentPartition.getPartitionMembersMax()){
- // current partition is free
- clusterContext.increaseMemberCountInPartitionBy(currentPartitionId, 1);
- if(log.isDebugEnabled())
- log.debug("Free space found in partition " + currentPartition.getId());
-
- return currentPartition;
- }else
- {
- // last partition is reached which is not free
- if(currentPartitionIndex == noOfPartitions - 1){
- if(log.isDebugEnabled())
- log.debug("Last partition also has no space");
- return null;
- }
-
- clusterContext.setCurrentPartitionIndex(currentPartitionIndex + 1);
- }
+ if (partitions.get(currentPartitionIndex) instanceof Partition) {
+ currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
+ Partition currentPartition = (Partition) partitions.get(currentPartitionIndex);
+ String currentPartitionId = currentPartition.getId();
+
+ if (clusterContext.partitionCountExists(currentPartitionId)) {
+ clusterContext.addPartitionCount(currentPartitionId, 0);
+ }
+
+ if (clusterContext.getMemberCount(currentPartitionId) < currentPartition.getPartitionMembersMax()) {
+ // current partition is free
+ clusterContext.increaseMemberCountInPartitionBy(currentPartitionId, 1);
+ if (log.isDebugEnabled())
+ log.debug("Free space found in partition " + currentPartition.getId());
+
+ return currentPartition;
+ } else {
+ // last partition is reached which is not free
+ if (currentPartitionIndex == noOfPartitions - 1) {
+ if (log.isDebugEnabled())
+ log.debug("Last partition also has no space");
+ return null;
+ }
+
+ clusterContext.setCurrentPartitionIndex(currentPartitionIndex + 1);
+ }
+ }
}
if(log.isDebugEnabled())
@@ -82,30 +85,33 @@ public class OneAfterAnother implements AutoscaleAlgorithm {
ClusterContext clusterContext = AutoscalerContext.getInstance().getClusterContext(clusterId);
int currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
- List<Partition> partitions = partitionGrp.getPartitions();
+ List<?> partitions = Arrays.asList(partitionGrp.getPartitions());
for(int i = currentPartitionIndex; i >= 0; i--)
{
- currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
- Partition currentPartition = partitions.get(currentPartitionIndex);
- String currentPartitionId = currentPartition.getId();
-
- // has more than minimum instances.
- if(clusterContext.getMemberCount(currentPartitionId) > currentPartition.getPartitionMembersMin()){
- // current partition is free
- clusterContext.decreaseMemberCountInPartitionBy(currentPartitionId, 1);
- if(log.isDebugEnabled())
- log.debug("A free space found for scale down in partition" + currentPartition.getId());
- return currentPartition;
- }else{
- if (currentPartitionIndex == 0){
- if(log.isDebugEnabled())
- log.debug("First partition reached with no space to scale down");
- return null;
- }
- //Set next partition as current partition in Autoscaler Context
- currentPartitionIndex = currentPartitionIndex - 1;
- clusterContext.setCurrentPartitionIndex(currentPartitionIndex);
+ if (partitions.get(currentPartitionIndex) instanceof Partition) {
+ currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
+ Partition currentPartition = (Partition) partitions.get(currentPartitionIndex);
+ String currentPartitionId = currentPartition.getId();
+
+ // has more than minimum instances.
+ if (clusterContext.getMemberCount(currentPartitionId) > currentPartition.getPartitionMembersMin()) {
+ // current partition is free
+ clusterContext.decreaseMemberCountInPartitionBy(currentPartitionId, 1);
+ if (log.isDebugEnabled())
+ log.debug("A free space found for scale down in partition" +
+ currentPartition.getId());
+ return currentPartition;
+ } else {
+ if (currentPartitionIndex == 0) {
+ if (log.isDebugEnabled())
+ log.debug("First partition reached with no space to scale down");
+ return null;
+ }
+ // Set next partition as current partition in Autoscaler Context
+ currentPartitionIndex = currentPartitionIndex - 1;
+ clusterContext.setCurrentPartitionIndex(currentPartitionIndex);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/PartitionGroupOneAfterAnother.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/PartitionGroupOneAfterAnother.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/PartitionGroupOneAfterAnother.java
index c95d621..ba35131 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/PartitionGroupOneAfterAnother.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/PartitionGroupOneAfterAnother.java
@@ -27,9 +27,11 @@ import org.apache.stratos.autoscaler.AutoscalerContext;
import org.apache.stratos.autoscaler.ClusterContext;
import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
import org.apache.stratos.autoscaler.policy.PolicyManager;
-import org.apache.stratos.messaging.domain.policy.Partition;
-import org.apache.stratos.messaging.domain.policy.PartitionGroup;
import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.PartitionGroup;
+
+import edu.emory.mathcs.backport.java.util.Arrays;
/**
* Completes partitions in the order defined in autoscaler policy, go to next if current one reached the max limit
@@ -46,36 +48,43 @@ public class PartitionGroupOneAfterAnother implements AutoscaleAlgorithm {
//Find relevant policyId using topology
String policyId = TopologyManager.getTopology().getService(serviceId).getCluster(clusterId).getDeploymentPolicyName();
- List<PartitionGroup> partitionGroups = PolicyManager.getInstance().getDeploymentPolicy(policyId).getPartitionGroups();
+ List<?> partitionGroups = Arrays.asList(PolicyManager.getInstance().getDeploymentPolicy(policyId).getPartitionGroups());
int currentPartitionGroupIndex = clusterContext.getCurrentPartitionGroupIndex();
for(int i= currentPartitionGroupIndex; i< partitionGroups.size(); i++)
{
- currentPartitionGroupIndex = clusterContext.getCurrentPartitionGroupIndex();
- PartitionGroup currentPartitionGroup = partitionGroups.get(currentPartitionGroupIndex);
- String alogirthm = currentPartitionGroup.getPartitionAlgo();
-
- if(log.isDebugEnabled())
- log.debug("Trying current partition group " + currentPartitionGroup.getId());
- // search withing the partition group
- Partition partition = AutoscalerRuleEvaluator.getInstance().getAutoscaleAlgorithm(alogirthm).getNextScaleUpPartition(currentPartitionGroup, clusterId);
-
- if(partition != null){
- if(log.isDebugEnabled())
- log.debug("No partition found in partition group" +currentPartitionGroup.getId());
- return partition;
- }else{
- clusterContext.setCurrentPartitionIndex(0);
- //last partition group has reached
- if(currentPartitionGroupIndex == partitionGroups.size() - 1){
- if(log.isDebugEnabled())
- log.debug("First partition group has reached wihtout space ");
- return null;
- }
- // current partition group is filled
- clusterContext.setCurrentPartitionGroupIndex(currentPartitionGroupIndex + 1);
- }
-
+ if (partitionGroups.get(currentPartitionGroupIndex) instanceof PartitionGroup) {
+ currentPartitionGroupIndex = clusterContext.getCurrentPartitionGroupIndex();
+ PartitionGroup currentPartitionGroup =
+ (PartitionGroup) partitionGroups.get(currentPartitionGroupIndex);
+ String alogirthm = currentPartitionGroup.getPartitionAlgo();
+
+ if (log.isDebugEnabled())
+ log.debug("Trying current partition group " + currentPartitionGroup.getId());
+ // search withing the partition group
+ Partition partition =
+ AutoscalerRuleEvaluator.getInstance()
+ .getAutoscaleAlgorithm(alogirthm)
+ .getNextScaleUpPartition(currentPartitionGroup,
+ clusterId);
+
+ if (partition != null) {
+ if (log.isDebugEnabled())
+ log.debug("No partition found in partition group" +
+ currentPartitionGroup.getId());
+ return partition;
+ } else {
+ clusterContext.setCurrentPartitionIndex(0);
+ // last partition group has reached
+ if (currentPartitionGroupIndex == partitionGroups.size() - 1) {
+ if (log.isDebugEnabled())
+ log.debug("First partition group has reached wihtout space ");
+ return null;
+ }
+ // current partition group is filled
+ clusterContext.setCurrentPartitionGroupIndex(currentPartitionGroupIndex + 1);
+ }
+ }
}
return null;
@@ -89,32 +98,41 @@ public class PartitionGroupOneAfterAnother implements AutoscaleAlgorithm {
String policyId = TopologyManager.getTopology().getService(serviceId).getCluster(clusterId).getDeploymentPolicyName();
int currentPartitionGroupIndex = clusterContext.getCurrentPartitionGroupIndex();
- List<PartitionGroup> partitionGroups = PolicyManager.getInstance().getDeploymentPolicy(policyId).getPartitionGroups();
+ List<?> partitionGroups = Arrays.asList(PolicyManager.getInstance().getDeploymentPolicy(policyId).getPartitionGroups());
for(int i = currentPartitionGroupIndex; i >= 0; i--)
{
- currentPartitionGroupIndex = clusterContext.getCurrentPartitionGroupIndex();
- PartitionGroup currentPartitionGroup = partitionGroups.get(currentPartitionGroupIndex);
- String alogirthm = currentPartitionGroup.getPartitionAlgo();
- if(log.isDebugEnabled())
- log.debug("Trying scale down in partition group " + currentPartitionGroup.getId());
- // search within the partition group
- Partition partition = AutoscalerRuleEvaluator.getInstance().getAutoscaleAlgorithm(alogirthm).getNextScaleDownPartition(currentPartitionGroup, clusterId);
-
- if(partition != null){
- if(log.isDebugEnabled())
- log.debug("No free partition in partition group" + currentPartitionGroup.getId());
- return partition;
- }else{
- clusterContext.setCurrentPartitionIndex(0);
- //first partition group has reached. None of the partitions group has less than minimum instance count.
- if(currentPartitionGroupIndex == 0)
- return null;
-
- // current partition group has no extra instances
- clusterContext.setCurrentPartitionGroupIndex(currentPartitionGroupIndex - 1);
- }
-
+ if (partitionGroups.get(currentPartitionGroupIndex) instanceof PartitionGroup) {
+ currentPartitionGroupIndex = clusterContext.getCurrentPartitionGroupIndex();
+ PartitionGroup currentPartitionGroup =
+ (PartitionGroup) partitionGroups.get(currentPartitionGroupIndex);
+ String alogirthm = currentPartitionGroup.getPartitionAlgo();
+ if (log.isDebugEnabled())
+ log.debug("Trying scale down in partition group " +
+ currentPartitionGroup.getId());
+ // search within the partition group
+ Partition partition =
+ AutoscalerRuleEvaluator.getInstance()
+ .getAutoscaleAlgorithm(alogirthm)
+ .getNextScaleDownPartition(currentPartitionGroup,
+ clusterId);
+
+ if (partition != null) {
+ if (log.isDebugEnabled())
+ log.debug("No free partition in partition group" +
+ currentPartitionGroup.getId());
+ return partition;
+ } else {
+ clusterContext.setCurrentPartitionIndex(0);
+ // first partition group has reached. None of the partitions group has less than
+ // minimum instance count.
+ if (currentPartitionGroupIndex == 0)
+ return null;
+
+ // current partition group has no extra instances
+ clusterContext.setCurrentPartitionGroupIndex(currentPartitionGroupIndex - 1);
+ }
+ }
}
// none of the partitions groups are free.
return null;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java
index 47e72d4..78444f6 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/algorithm/RoundRobin.java
@@ -23,8 +23,10 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.AutoscalerContext;
import org.apache.stratos.autoscaler.ClusterContext;
-import org.apache.stratos.messaging.domain.policy.Partition;
-import org.apache.stratos.messaging.domain.policy.PartitionGroup;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.PartitionGroup;
+
+import edu.emory.mathcs.backport.java.util.Arrays;
import java.util.List;
@@ -38,13 +40,14 @@ public class RoundRobin implements AutoscaleAlgorithm{
public Partition getNextScaleUpPartition(PartitionGroup partitionGrp, String clusterId){
ClusterContext clusterContext = AutoscalerContext.getInstance().getClusterContext(clusterId);
- List<Partition> partitions = partitionGrp.getPartitions();
+ List<?> partitions = Arrays.asList(partitionGrp.getPartitions());
int noOfPartitions = partitions.size();
for(int i=0; i < noOfPartitions; i++)
{
- int currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
- Partition currentPartition = partitions.get(currentPartitionIndex);
+ int currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
+ if (partitions.get(currentPartitionIndex) instanceof Partition) {
+ Partition currentPartition = (Partition) partitions.get(currentPartitionIndex);
String currentPartitionId = currentPartition.getId();
// point to next partition
@@ -62,62 +65,75 @@ public class RoundRobin implements AutoscaleAlgorithm{
log.debug("Free space found in partition " + currentPartition.getId());
return currentPartition;
}
- if(log.isDebugEnabled())
+ if(log.isDebugEnabled()) {
log.debug("No free space for a new instance in partition " + currentPartition.getId());
+ }
+ }
}
// none of the partitions were free.
- if(log.isDebugEnabled())
+ if(log.isDebugEnabled()) {
log.debug("No free partition found at partition group " + partitionGrp);
+ }
return null;
}
@Override
- public Partition getNextScaleDownPartition(PartitionGroup partitionGrp , String clusterId) {
-
- ClusterContext clusterContext = AutoscalerContext.getInstance().getClusterContext(clusterId);
-
- List<Partition> partitions = partitionGrp.getPartitions();
- int noOfPartitions = partitions.size();
-
- for(int i=0; i < noOfPartitions; i++)
- {
- int currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
- // point to next partition
- if (currentPartitionIndex == 0) {
+ public Partition getNextScaleDownPartition(PartitionGroup partitionGrp, String clusterId) {
+
+ ClusterContext clusterContext =
+ AutoscalerContext.getInstance()
+ .getClusterContext(clusterId);
+
+ List<?> partitions = Arrays.asList(partitionGrp.getPartitions());
+ int noOfPartitions = partitions.size();
+
+ for (int i = 0; i < noOfPartitions; i++) {
+ int currentPartitionIndex = clusterContext.getCurrentPartitionIndex();
+ // point to next partition
+ if (currentPartitionIndex == 0) {
+
+ currentPartitionIndex = noOfPartitions - 1;
+ } else {
+
+ currentPartitionIndex = currentPartitionIndex - 1;
+ }
+
+ // Set next partition as current partition in Autoscaler Context
+ clusterContext.setCurrentPartitionIndex(currentPartitionIndex);
+
+ if (partitions.get(currentPartitionIndex) instanceof Partition) {
- currentPartitionIndex = noOfPartitions - 1;
- }else {
+ Partition currentPartition = (Partition) partitions.get(currentPartitionIndex);
+ String currentPartitionId = currentPartition.getId();
- currentPartitionIndex = currentPartitionIndex - 1;
+ if (!clusterContext.partitionCountExists(currentPartitionId))
+ AutoscalerContext.getInstance().getClusterContext(clusterId)
+ .addPartitionCount(currentPartitionId, 0);
+ // has more than minimum instances.
+ if (clusterContext.getMemberCount(currentPartitionId) > currentPartition.getPartitionMembersMin()) {
+ // current partition is free
+ clusterContext.decreaseMemberCountInPartitionBy(currentPartitionId, 1);
+ if (log.isDebugEnabled()) {
+ log.debug("Returning partition for scaling down " +
+ currentPartition.getId());
+ }
+ return currentPartition;
}
-
- //Set next partition as current partition in Autoscaler Context
- clusterContext.setCurrentPartitionIndex(currentPartitionIndex);
-
- Partition currentPartition = partitions.get(currentPartitionIndex);
- String currentPartitionId = currentPartition.getId();
-
- if(!clusterContext.partitionCountExists(currentPartitionId))
- AutoscalerContext.getInstance().getClusterContext(clusterId).addPartitionCount(currentPartitionId, 0);
- // has more than minimum instances.
- if(clusterContext.getMemberCount(currentPartitionId) > currentPartition.getPartitionMembersMin()){
- // current partition is free
- clusterContext.decreaseMemberCountInPartitionBy(currentPartitionId, 1);
- if(log.isDebugEnabled())
- log.debug("Returning partition for scaling down " + currentPartition.getId());
- return currentPartition;
- }
- if(log.isDebugEnabled())
- log.debug("Found no members to scale down at partition" + currentPartition.getId());
- }
-
- if(log.isDebugEnabled())
- log.debug("No partition found for scale down at partition group " + partitionGrp.getId());
- // none of the partitions were free.
+ if (log.isDebugEnabled()) {
+ log.debug("Found no members to scale down at partition" +
+ currentPartition.getId());
+ }
+ }
+ }
+
+ if (log.isDebugEnabled())
+ log.debug("No partition found for scale down at partition group " +
+ partitionGrp.getId());
+ // none of the partitions were free.
return null;
- }
+ }
@Override
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java
index 2536007..17ad1c7 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/client/cloud/controller/CloudControllerClient.java
@@ -23,15 +23,18 @@ import org.apache.commons.configuration.XMLConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.Constants;
+import org.apache.stratos.autoscaler.exception.PolicyValidationException;
import org.apache.stratos.autoscaler.exception.SpawningException;
import org.apache.stratos.autoscaler.exception.TerminationException;
import org.apache.stratos.autoscaler.util.ConfUtil;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.policy.DeploymentPolicy;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceIllegalArgumentExceptionException;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceInvalidCartridgeTypeExceptionException;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceInvalidMemberExceptionException;
+import org.apache.stratos.cloud.controller.stub.CloudControllerServiceInvalidPartitionExceptionException;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceStub;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceUnregisteredCartridgeExceptionException;
-import org.apache.stratos.messaging.domain.policy.Partition;
import java.rmi.RemoteException;
@@ -82,15 +85,26 @@ public class CloudControllerClient {
}
}
-
- public static void spawnAnInstance(Partition partition, String clusterId) throws SpawningException {
-
- org.apache.stratos.messaging.domain.policy.xsd.Partition partitionTopology = new
- org.apache.stratos.messaging.domain.policy.xsd.Partition();
- partitionTopology.setId(partition.getId());
+
+ public boolean validateDeploymentPolicy(String cartridgeType, DeploymentPolicy policy) throws PolicyValidationException{
try {
- stub.startInstance(clusterId, partitionTopology);
+ return stub.validateDeploymentPolicy(cartridgeType, policy);
+ } catch (RemoteException e) {
+ log.error(e.getMessage());
+ throw new PolicyValidationException(e);
+ } catch (CloudControllerServiceInvalidPartitionExceptionException e) {
+ log.error(e.getMessage());
+ throw new PolicyValidationException(e);
+ } catch (CloudControllerServiceInvalidCartridgeTypeExceptionException e) {
+ log.error(e.getMessage());
+ throw new PolicyValidationException(e);
+ }
+ }
+
+ public void spawnAnInstance(Partition partition, String clusterId) throws SpawningException {
+ try {
+ stub.startInstance(clusterId, partition);
} catch (CloudControllerServiceIllegalArgumentExceptionException e) {
log.error(e.getMessage());
throw new SpawningException(e);
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/PolicyValidationException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/PolicyValidationException.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/PolicyValidationException.java
new file mode 100644
index 0000000..0d899af
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/exception/PolicyValidationException.java
@@ -0,0 +1,19 @@
+package org.apache.stratos.autoscaler.exception;
+
+/**
+ *
+ */
+public class PolicyValidationException extends Exception {
+
+ private static final long serialVersionUID = -7423800138697480115L;
+
+
+ public PolicyValidationException(String message, Exception exception){
+ super(message, exception);
+ }
+
+
+ public PolicyValidationException(Exception exception){
+ super(exception);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java
index 5c57135..e7a03bd 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/health/HealthEventMessageDelegator.java
@@ -23,16 +23,7 @@ import com.google.gson.stream.JsonReader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.AutoscalerContext;
-import org.apache.stratos.autoscaler.ClusterContext;
import org.apache.stratos.autoscaler.Constants;
-import org.apache.stratos.autoscaler.policy.PolicyManager;
-import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
-import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
-import org.apache.stratos.messaging.domain.policy.DeploymentPolicy;
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.messaging.domain.topology.Service;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-
import javax.jms.TextMessage;
import java.io.BufferedReader;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
index 2630f98..27000f1 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/PolicyManager.java
@@ -29,7 +29,7 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
-import org.apache.stratos.messaging.domain.policy.DeploymentPolicy;
+import org.apache.stratos.cloud.controller.deployment.policy.DeploymentPolicy;
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyDeployer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyDeployer.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyDeployer.java
index a219088..5c126e7 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyDeployer.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyDeployer.java
@@ -29,7 +29,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.policy.InvalidPolicyException;
import org.apache.stratos.autoscaler.policy.PolicyManager;
-import org.apache.stratos.messaging.domain.policy.DeploymentPolicy;
+import org.apache.stratos.cloud.controller.deployment.policy.DeploymentPolicy;
/**
*
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyReader.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyReader.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyReader.java
index 603742b..60a31fd 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyReader.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/policy/deployers/DeploymentPolicyReader.java
@@ -20,7 +20,9 @@
package org.apache.stratos.autoscaler.policy.deployers;
import java.io.File;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import javax.xml.namespace.QName;
@@ -29,9 +31,11 @@ import org.apache.axis2.deployment.DeploymentException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.policy.InvalidPolicyException;
-import org.apache.stratos.messaging.domain.policy.DeploymentPolicy;
-import org.apache.stratos.messaging.domain.policy.PartitionGroup;
-import org.apache.stratos.messaging.domain.policy.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.PartitionGroup;
+import org.apache.stratos.cloud.controller.deployment.policy.DeploymentPolicy;
+import org.apache.stratos.cloud.controller.pojo.Properties;
+import org.apache.stratos.cloud.controller.pojo.Property;
/**
*
@@ -56,6 +60,7 @@ public class DeploymentPolicyReader extends AbstractPolicyReader<DeploymentPoli
//Partition-Groups
Iterator<?> partitionGroupItr = docEle.getChildrenWithLocalName("partitionGroup");
while(partitionGroupItr.hasNext()){
+ List<PartitionGroup> partitionGroups = new ArrayList<PartitionGroup>();
Object nextGroup = partitionGroupItr.next();
if(nextGroup instanceof OMElement){
OMElement groupEle = (OMElement) nextGroup;
@@ -63,6 +68,7 @@ public class DeploymentPolicyReader extends AbstractPolicyReader<DeploymentPoli
group.setId(groupEle.getAttributeValue(new QName("id")));
group.setPartitionAlgo(readValue(groupEle, "partitionAlgo"));
+ List<Partition> partitions = new ArrayList<Partition>() ;
//Partitions
Iterator<?> partitionItr = groupEle.getChildrenWithLocalName("partition");
while(partitionItr.hasNext()){
@@ -70,22 +76,45 @@ public class DeploymentPolicyReader extends AbstractPolicyReader<DeploymentPoli
if(next instanceof OMElement){
OMElement partitionEle = (OMElement) next;
Partition partition = new Partition();
+ Properties props = new Properties();
+ List<Property> propertyList = new ArrayList<Property>();
+
Iterator<?> partitionPropItr = partitionEle.getChildrenWithLocalName("property");
while(partitionPropItr.hasNext())
{
Object nextProperty = partitionPropItr.next();
if(nextProperty instanceof OMElement){
OMElement property = (OMElement)nextProperty;
+ Property prop = new Property();
+ prop.setName(property.getAttributeValue(new QName("name")));
+ prop.setValue(property.getText());
+ propertyList.add(prop);
}
}
+ if(props.getProperties() == null) {
+ props.setProperties(new Property[0]);
+ }
+ props.setProperties(propertyList.toArray(props.getProperties()));
+ partition.setProperties(props);
partition.setId(partitionEle.getAttributeValue(new QName("id")));
partition.setPartitionMax(Integer.valueOf(readValue(partitionEle, "max")));
partition.setPartitionMin(Integer.valueOf(readValue(partitionEle, "min")));
- group.getPartitions().add(partition);
+ partition.setProvider(readValue(partitionEle, "provider"));
+ //TODO partition validation before policy deployment
+// validatePartition();
+ partitions.add(partition);
}
}
- policy.getPartitionGroups().add(group);
+ if(group.getPartitions() == null) {
+ group.setPartitions(new Partition[0]);
+ }
+ group.setPartitions(partitions.toArray(group.getPartitions()));
+ partitionGroups.add(group);
}
+ if(policy.getPartitionGroups() == null) {
+ policy.setPartitionGroups(new PartitionGroup[0]);
+ }
+ policy.setPartitionGroup(partitionGroups.toArray(policy.getPartitionGroups()));
}
} else{
throw new DeploymentException("File is not a valid deployment policy");
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
index a360c52..a53040b 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/rule/AutoscalerRuleEvaluator.java
@@ -31,7 +31,6 @@ import org.apache.stratos.autoscaler.ClusterMonitor;
import org.apache.stratos.autoscaler.PartitionContext;
import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
import org.apache.stratos.autoscaler.policy.PolicyManager;
-import org.apache.stratos.messaging.domain.policy.Partition;
import org.apache.stratos.messaging.domain.topology.Service;
import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
import org.drools.KnowledgeBase;
@@ -48,6 +47,7 @@ import org.apache.stratos.autoscaler.algorithm.RoundRobin;
import org.apache.stratos.autoscaler.util.AutoscalerUtil;
import org.apache.stratos.messaging.domain.topology.Cluster;
import org.apache.stratos.autoscaler.algorithm.PartitionGroupOneAfterAnother;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
import org.drools.runtime.rule.FactHandle;
/**
@@ -82,6 +82,7 @@ public class AutoscalerRuleEvaluator {
ksession.update(handle, obj);
}
ksession.fireAllRules();
+ log.info("fired all rules "+obj);
}
@@ -116,7 +117,7 @@ public class AutoscalerRuleEvaluator {
// if(currentMemberCount < partition.getPartitionMembersMax()) {
// AutoscalerContext.getInstance().getClusterContext(clusterId).increaseMemberCount(1);
- CloudControllerClient.spawnAnInstance(partition, clusterId);
+ CloudControllerClient.getInstance().spawnAnInstance(partition, clusterId);
} catch (Throwable e) {
log.error("Cannot spawn an instance", e);
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/processors/AutoscalerTopologyReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/processors/AutoscalerTopologyReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/processors/AutoscalerTopologyReceiver.java
index ca79578..c44239d 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/processors/AutoscalerTopologyReceiver.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/topology/processors/AutoscalerTopologyReceiver.java
@@ -23,6 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.ClusterContext;
import org.apache.stratos.autoscaler.ClusterMonitor;
+import org.apache.stratos.autoscaler.exception.PolicyValidationException;
import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
import org.apache.stratos.autoscaler.util.AutoscalerUtil;
import org.apache.stratos.messaging.domain.topology.Cluster;
@@ -57,6 +58,11 @@ public class AutoscalerTopologyReceiver implements Runnable {
@Override
public void run() {
+ //FIXME this activated before autoscaler deployer actovated.
+ try {
+ Thread.sleep(30000);
+ } catch (InterruptedException ignore) {
+ }
Thread thread = new Thread(topologyReceiver);
thread.start();
if(log.isInfoEnabled()) {
@@ -80,7 +86,8 @@ public class AutoscalerTopologyReceiver implements Runnable {
TopologyManager.acquireReadLock();
for(Service service : TopologyManager.getTopology().getServices()) {
for(Cluster cluster : service.getClusters()) {
- addClusterToContext(cluster);
+ Thread th = new Thread(new ClusterContextAdder(cluster));
+ th.start();
}
}
}
@@ -106,7 +113,8 @@ public class AutoscalerTopologyReceiver implements Runnable {
TopologyManager.acquireReadLock();
Service service = TopologyManager.getTopology().getService(e.getServiceName());
Cluster cluster = service.getCluster(e.getClusterId());
- addClusterToContext(cluster);
+ Thread th = new Thread(new ClusterContextAdder(cluster));
+ th.start();
}
finally {
TopologyManager.releaseReadLock();
@@ -173,22 +181,58 @@ public class AutoscalerTopologyReceiver implements Runnable {
});
return processorChain;
}
-
- private void addClusterToContext(Cluster cluster) {
- ClusterContext ctxt = AutoscalerUtil.getClusterContext(cluster);
- AutoscalerRuleEvaluator ruleCtxt = AutoscalerRuleEvaluator.getInstance();
- ClusterMonitor monitor =
- new ClusterMonitor(cluster.getClusterId(), ctxt,
- ruleCtxt.getStatefulSession());
- Thread th = new Thread(monitor);
- th.start();
- AutoscalerRuleEvaluator.getInstance().addMonitor(monitor);
- if (log.isDebugEnabled()) {
- log.debug(String.format("Cluster monitor has been added: [cluster] %s",
- cluster.getClusterId()));
+
+ private class ClusterContextAdder implements Runnable {
+ private Cluster cluster;
+
+ public ClusterContextAdder(Cluster cluster) {
+ this.cluster = cluster;
+ }
+ public void run() {
+ ClusterContext ctxt;
+ try {
+ ctxt = AutoscalerUtil.getClusterContext(cluster);
+ } catch (PolicyValidationException e) {
+ String msg = "Cluster monitor creation failed for cluster: "+cluster.getClusterId();
+ log.error(msg, e);
+ throw new RuntimeException(msg, e);
+ }
+ AutoscalerRuleEvaluator ruleCtxt = AutoscalerRuleEvaluator.getInstance();
+ ClusterMonitor monitor =
+ new ClusterMonitor(cluster.getClusterId(), ctxt,
+ ruleCtxt.getStatefulSession());
+ Thread th = new Thread(monitor);
+ th.start();
+ AutoscalerRuleEvaluator.getInstance().addMonitor(monitor);
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Cluster monitor has been added: [cluster] %s",
+ cluster.getClusterId()));
+ }
}
}
+// private void addClusterToContext(Cluster cluster) {
+// ClusterContext ctxt;
+// try {
+// ctxt = AutoscalerUtil.getClusterContext(cluster);
+// } catch (PolicyValidationException e) {
+// String msg = "Cluster monitor creation failed for cluster: "+cluster.getClusterId();
+// log.error(msg, e);
+// throw new RuntimeException(msg, e);
+// }
+// AutoscalerRuleEvaluator ruleCtxt = AutoscalerRuleEvaluator.getInstance();
+// ClusterMonitor monitor =
+// new ClusterMonitor(cluster.getClusterId(), ctxt,
+// ruleCtxt.getStatefulSession());
+// Thread th = new Thread(monitor);
+// th.start();
+// AutoscalerRuleEvaluator.getInstance().addMonitor(monitor);
+// if (log.isDebugEnabled()) {
+// log.debug(String.format("Cluster monitor has been added: [cluster] %s",
+// cluster.getClusterId()));
+// }
+// }
+
private void removeClusterFromContext(String clusterId) {
ClusterMonitor monitor = AutoscalerRuleEvaluator.getInstance().removeMonitor(clusterId);
monitor.destroy();
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
index 3b7cef8..af2841e 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
@@ -19,11 +19,15 @@
package org.apache.stratos.autoscaler.util;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.ClusterContext;
+import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
+import org.apache.stratos.autoscaler.exception.PolicyValidationException;
import org.apache.stratos.autoscaler.policy.PolicyManager;
import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
-import org.apache.stratos.messaging.domain.policy.DeploymentPolicy;
+import org.apache.stratos.cloud.controller.deployment.policy.DeploymentPolicy;
import org.apache.stratos.messaging.domain.topology.Cluster;
@@ -31,6 +35,8 @@ import org.apache.stratos.messaging.domain.topology.Cluster;
* This class contains utility methods used by Autoscaler.
*/
public class AutoscalerUtil {
+
+ private static final Log log = LogFactory.getLog(AutoscalerUtil.class);
private AutoscalerUtil() {
@@ -40,14 +46,18 @@ public class AutoscalerUtil {
* Updates ClusterContext for given cluster
* @param cluster
* @return ClusterContext - Updated ClusterContext
+ * @throws PolicyValidationException
*/
- public static ClusterContext getClusterContext(Cluster cluster) {
+ public static ClusterContext getClusterContext(Cluster cluster) throws PolicyValidationException {
// FIXME fix the following code to correctly update
// AutoscalerContext context = AutoscalerContext.getInstance();
if (null == cluster) {
return null;
}
+ log.info("Deployment policy name: "+cluster.getDeploymentPolicyName());
+ log.info("Autoscaler policy name: "+cluster.getAutoscalePolicyName());
+
AutoscalePolicy policy =
PolicyManager.getInstance()
.getAutoscalePolicy(cluster.getAutoscalePolicyName());
@@ -55,6 +65,8 @@ public class AutoscalerUtil {
PolicyManager.getInstance()
.getDeploymentPolicy(cluster.getDeploymentPolicyName());
+ log.info("Autoscaler policy: "+policy+" Deployment Policy: "+deploymentPolicy);
+ CloudControllerClient.getInstance().validateDeploymentPolicy(cluster.getServiceName(), deploymentPolicy);
ClusterContext clusterContext =
new ClusterContext(cluster.getClusterId(),
cluster.getServiceName(),
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestKnowledgeBase.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestKnowledgeBase.java b/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestKnowledgeBase.java
index cd6476c..0895e44 100644
--- a/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestKnowledgeBase.java
+++ b/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/TestKnowledgeBase.java
@@ -24,10 +24,6 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.autoscaler.policy.PolicyManager;
-import org.apache.stratos.messaging.domain.policy.Partition;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-import org.drools.runtime.rule.FactHandle;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.*;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/deployment/policy/DeploymentPolicyDeployerTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/deployment/policy/DeploymentPolicyDeployerTest.java b/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/deployment/policy/DeploymentPolicyDeployerTest.java
new file mode 100644
index 0000000..aa581e3
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/test/java/org/apache/stratos/autoscaler/deployment/policy/DeploymentPolicyDeployerTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.autoscaler.deployment.policy;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+
+import org.apache.stratos.autoscaler.policy.InvalidPolicyException;
+import org.apache.stratos.autoscaler.policy.deployers.DeploymentPolicyReader;
+import org.apache.stratos.cloud.controller.deployment.policy.DeploymentPolicy;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author nirmal
+ *
+ */
+public class DeploymentPolicyDeployerTest {
+
+ DeploymentPolicyReader reader;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ reader = new DeploymentPolicyReader(new File("src/test/resources/deployment-policy.xml"));
+ }
+
+ @Test
+ public void test() throws InvalidPolicyException {
+
+ DeploymentPolicy policy = reader.read();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/test/resources/deployment-policy.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/test/resources/deployment-policy.xml b/components/org.apache.stratos.autoscaler/src/test/resources/deployment-policy.xml
new file mode 100644
index 0000000..81e7865
--- /dev/null
+++ b/components/org.apache.stratos.autoscaler/src/test/resources/deployment-policy.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<deploymentPolicy id ="economy-deployment">
+ <partitionGroup id="group1" >
+ <partitionAlgo>one-after-another</partitionAlgo>
+ <partition id="P1" >
+ <provider>ec2</provider>
+ <property name="region">ap-southeast-1</property>
+ <max>3</max>
+ <min>1</min>
+ </partition>
+ <!--partition id="P2" >
+ <max>5</max>
+ <min>1</min>
+ </partition-->
+ </partitionGroup>
+</deploymentPolicy>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/530af9eb/components/org.apache.stratos.autoscaler/src/test/resources/test-minimum-autoscaler-rule.drl
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/test/resources/test-minimum-autoscaler-rule.drl b/components/org.apache.stratos.autoscaler/src/test/resources/test-minimum-autoscaler-rule.drl
index c2f2a65..ba3105c 100644
--- a/components/org.apache.stratos.autoscaler/src/test/resources/test-minimum-autoscaler-rule.drl
+++ b/components/org.apache.stratos.autoscaler/src/test/resources/test-minimum-autoscaler-rule.drl
@@ -19,42 +19,16 @@
package org.apache.stratos.autoscaler.rule;
-import org.apache.stratos.messaging.domain.topology.Service;
-import org.apache.stratos.messaging.domain.topology.Cluster;
-import org.apache.stratos.autoscaler.AutoscalerContext;
-import org.apache.stratos.autoscaler.ClusterContext;
-import org.apache.stratos.autoscaler.Constants;
-import org.apache.stratos.autoscaler.policy.PolicyManager;
-import org.apache.stratos.autoscaler.policy.model.AutoscalePolicy;
-import org.apache.stratos.messaging.domain.policy.Partition;
-import org.apache.stratos.messaging.domain.policy.PartitionGroup;
-import org.apache.stratos.messaging.domain.policy.DeploymentPolicy;
-import org.apache.stratos.autoscaler.policy.model.RequestsInFlight;
-import org.apache.stratos.autoscaler.policy.model.LoadThresholds;
-import org.apache.stratos.autoscaler.client.cloud.controller.CloudControllerClient;
-import org.apache.stratos.autoscaler.algorithm.AutoscaleAlgorithm;
-import org.apache.stratos.autoscaler.algorithm.OneAfterAnother;
-import org.apache.stratos.autoscaler.algorithm.RoundRobin;
-import org.apache.stratos.messaging.message.receiver.topology.TopologyManager;
-import org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator;
-import org.apache.commons.logging.Log;
-import java.util.ArrayList;
-global org.apache.stratos.autoscaler.policy.PolicyManager $manager;
-global org.apache.stratos.autoscaler.AutoscalerContext $context;
-global org.apache.commons.logging.Log log;
-global org.apache.stratos.autoscaler.rule.AutoscalerRuleEvaluator $evaluator;
-global org.apache.stratos.messaging.domain.topology.Topology $topology;
-global org.apache.stratos.messaging.domain.policy.Partition pa;
-rule "Minimum Rule"
-dialect "mvel"
- when
- $p : ArrayList()
- $x : String() from $p
- eval(true)
-
- then
- System.out.println($x+ "SSsSS");
-end
\ No newline at end of file
+#rule "Minimum Rule"
+#dialect "mvel"
+# when
+# $p : ArrayList()
+# $x : String() from $p
+# eval(true)
+#
+ # then
+# System.out.println($x+ "SSsSS");
+#end
\ No newline at end of file
[4/8] git commit: more refactoring to CC
Posted by ni...@apache.org.
more refactoring to CC
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/2eaac66e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/2eaac66e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/2eaac66e
Branch: refs/heads/master
Commit: 2eaac66e2aa617048f04829979b25e4089003743
Parents: 99f9951
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Nov 28 21:26:00 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Nov 28 21:26:00 2013 +0530
----------------------------------------------------------------------
.../org.apache.stratos.cloud.controller/pom.xml | 4 +-
.../axiom/parser/CartridgeConfigParser.java | 11 +-
.../parser/CloudControllerConfigParser.java | 6 +-
.../axiom/parser/IaasProviderConfigParser.java | 2 +-
.../axiom/parser/ServiceConfigParser.java | 12 +-
.../controller/deployers/CartridgeDeployer.java | 7 +-
.../deployers/CloudControllerDeployer.java | 2 +-
.../controller/deployers/ServiceDeployer.java | 2 +-
.../exception/InvalidIaasProviderException.java | 2 +-
.../cloud/controller/iaases/AWSEC2Iaas.java | 2 +-
.../controller/iaases/OpenstackNovaIaas.java | 2 +-
.../cloud/controller/iaases/VCloudIaas.java | 2 +-
.../impl/CloudControllerServiceImpl.java | 12 +-
.../interfaces/CloudControllerService.java | 12 +-
.../cloud/controller/interfaces/Iaas.java | 2 +-
.../jcloud/ComputeServiceBuilderUtil.java | 3 +-
.../stratos/cloud/controller/pojo/AppType.java | 62 +++
.../cloud/controller/pojo/Cartridge.java | 288 ++++++++++++++
.../cloud/controller/pojo/CartridgeInfo.java | 163 ++++++++
.../controller/pojo/CartridgeInstanceData.java | 130 +++++++
.../controller/pojo/DataPublisherConfig.java | 82 ++++
.../stratos/cloud/controller/pojo/Host.java | 73 ++++
.../cloud/controller/pojo/IaasContext.java | 162 ++++++++
.../cloud/controller/pojo/IaasProvider.java | 271 +++++++++++++
.../cloud/controller/pojo/LocationScope.java | 70 ++++
.../cloud/controller/pojo/PortMapping.java | 64 ++++
.../stratos/cloud/controller/pojo/Region.java | 125 ++++++
.../cloud/controller/pojo/Registrant.java | 2 -
.../cloud/controller/pojo/ServiceContext.java | 366 ++++++++++++++++++
.../cloud/controller/pojo/TopologyConfig.java | 59 +++
.../stratos/cloud/controller/pojo/Zone.java | 90 +++++
.../CartridgeInstanceDataPublisherTask.java | 5 +
.../runtime/FasterLookUpDataHolder.java | 5 +
.../controller/topology/TopologyBuilder.java | 43 +--
.../topology/TopologyEventSender.java | 29 +-
.../stratos/cloud/controller/util/AppType.java | 62 ---
.../cloud/controller/util/Cartridge.java | 288 --------------
.../cloud/controller/util/CartridgeInfo.java | 165 --------
.../controller/util/CartridgeInstanceData.java | 130 -------
.../controller/util/CloudControllerUtil.java | 10 +-
.../controller/util/DataPublisherConfig.java | 80 ----
.../stratos/cloud/controller/util/Host.java | 73 ----
.../cloud/controller/util/IaasContext.java | 162 --------
.../cloud/controller/util/IaasProvider.java | 271 -------------
.../cloud/controller/util/LocationScope.java | 70 ----
.../cloud/controller/util/PortMapping.java | 64 ----
.../stratos/cloud/controller/util/Region.java | 125 ------
.../cloud/controller/util/ServiceContext.java | 382 -------------------
.../cloud/controller/util/TopologyConfig.java | 59 ---
.../stratos/cloud/controller/util/Zone.java | 90 -----
.../validate/AWSEC2PartitionValidator.java | 2 +-
.../OpenstackNovaPartitionValidator.java | 2 +-
.../validate/interfaces/PartitionValidator.java | 2 +-
.../service/util/ServiceContextTest.java | 3 +-
54 files changed, 2108 insertions(+), 2104 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/pom.xml b/components/org.apache.stratos.cloud.controller/pom.xml
index b9d369b..92bf1ca 100644
--- a/components/org.apache.stratos.cloud.controller/pom.xml
+++ b/components/org.apache.stratos.cloud.controller/pom.xml
@@ -54,7 +54,7 @@
org.apache.stratos.cloud.controller.publisher.*,
org.apache.stratos.cloud.controller.topic.*,
org.apache.stratos.cloud.controller.iaases.*,
- org.apache.stratos.cloud.controller.util.*,
+ org.apache.stratos.cloud.controller.pojo.*,
org.apache.stratos.cloud.controller.deployers.*,
org.apache.stratos.cloud.controller.exception.*,
</Export-Package>
@@ -63,7 +63,7 @@
!org.apache.stratos.cloud.controller.publisher.*,
!org.apache.stratos.cloud.controller.topic.*,
!org.apache.stratos.cloud.controller.iaases.*,
- !org.apache.stratos.cloud.controller.util.*,
+ !org.apache.stratos.cloud.controller.pojo.*,
!org.apache.stratos.cloud.controller.deployers.*,
!org.apache.stratos.cloud.controller.exception.*,
org.apache.stratos.cloud.controller.*,
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CartridgeConfigParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CartridgeConfigParser.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CartridgeConfigParser.java
index 0195fc4..911adc0 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CartridgeConfigParser.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CartridgeConfigParser.java
@@ -21,6 +21,7 @@ package org.apache.stratos.cloud.controller.axiom.parser;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMElement;
@@ -29,12 +30,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.axiom.AxiomXpathParserUtil;
import org.apache.stratos.cloud.controller.exception.MalformedConfigurationFileException;
+import org.apache.stratos.cloud.controller.pojo.AppType;
+import org.apache.stratos.cloud.controller.pojo.Cartridge;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.PortMapping;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
-import org.apache.stratos.cloud.controller.util.AppType;
-import org.apache.stratos.cloud.controller.util.Cartridge;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
-import org.apache.stratos.cloud.controller.util.PortMapping;
/**
* Parse the cartridge definition files.
@@ -322,7 +323,7 @@ public class CartridgeConfigParser {
/**
* @param cartridgeElementString Cartridges section as a {@link String}
- * @param aCartridge {@link org.apache.stratos.cloud.controller.util.Cartridge} instance.
+ * @param aCartridge {@link org.apache.stratos.cloud.controller.pojo.Cartridge} instance.
* @param appTypesNodes nodes of App types.
*/
private static void getAppTypes(final String fileName, String cartridgeElementString, Cartridge aCartridge,
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CloudControllerConfigParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CloudControllerConfigParser.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CloudControllerConfigParser.java
index e90ccd3..9b2cb5e 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CloudControllerConfigParser.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/CloudControllerConfigParser.java
@@ -31,11 +31,11 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.axiom.AxiomXpathParserUtil;
import org.apache.stratos.cloud.controller.exception.MalformedConfigurationFileException;
+import org.apache.stratos.cloud.controller.pojo.DataPublisherConfig;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.TopologyConfig;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.DataPublisherConfig;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
-import org.apache.stratos.cloud.controller.util.TopologyConfig;
import org.wso2.securevault.SecretResolver;
import org.wso2.securevault.SecretResolverFactory;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/IaasProviderConfigParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/IaasProviderConfigParser.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/IaasProviderConfigParser.java
index 4038314..ef759f5 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/IaasProviderConfigParser.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/IaasProviderConfigParser.java
@@ -29,8 +29,8 @@ import org.apache.axiom.om.OMNode;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.exception.MalformedConfigurationFileException;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.wso2.securevault.SecretResolver;
import org.wso2.securevault.SecretResolverFactory;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/ServiceConfigParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/ServiceConfigParser.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/ServiceConfigParser.java
index 2c335ae..540ec2c 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/ServiceConfigParser.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/axiom/parser/ServiceConfigParser.java
@@ -31,13 +31,13 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.axiom.AxiomXpathParserUtil;
import org.apache.stratos.cloud.controller.exception.MalformedConfigurationFileException;
+import org.apache.stratos.cloud.controller.pojo.AppType;
+import org.apache.stratos.cloud.controller.pojo.Cartridge;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.PortMapping;
+import org.apache.stratos.cloud.controller.pojo.ServiceContext;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
-import org.apache.stratos.cloud.controller.util.AppType;
-import org.apache.stratos.cloud.controller.util.Cartridge;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
-import org.apache.stratos.cloud.controller.util.PortMapping;
-import org.apache.stratos.cloud.controller.util.ServiceContext;
/**
* Parse the cartridge definition files.
@@ -504,7 +504,7 @@ public class ServiceConfigParser {
* @param cartridgeElementString
* Cartridges section as a {@link String}
* @param aCartridge
- * {@link org.apache.stratos.cloud.controller.util.Cartridge} instance.
+ * {@link org.apache.stratos.cloud.controller.pojo.Cartridge} instance.
* @param appTypesNodes
* nodes of App types.
*/
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CartridgeDeployer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CartridgeDeployer.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CartridgeDeployer.java
index 863d508..d2c50fa 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CartridgeDeployer.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CartridgeDeployer.java
@@ -32,6 +32,11 @@ import org.apache.stratos.cloud.controller.concurrent.ThreadExecutor;
import org.apache.stratos.cloud.controller.exception.CloudControllerException;
import org.apache.stratos.cloud.controller.exception.MalformedConfigurationFileException;
import org.apache.stratos.cloud.controller.interfaces.Iaas;
+import org.apache.stratos.cloud.controller.pojo.Cartridge;
+import org.apache.stratos.cloud.controller.pojo.Host;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.Region;
+import org.apache.stratos.cloud.controller.pojo.Zone;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
import org.apache.stratos.cloud.controller.topology.TopologyBuilder;
import org.apache.stratos.cloud.controller.util.*;
@@ -44,7 +49,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
- * All the {@link org.apache.stratos.cloud.controller.util.Cartridge}s will get deployed / undeployed / updated via this class.
+ * All the {@link org.apache.stratos.cloud.controller.pojo.Cartridge}s will get deployed / undeployed / updated via this class.
*/
public class CartridgeDeployer extends AbstractDeployer{
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CloudControllerDeployer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CloudControllerDeployer.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CloudControllerDeployer.java
index 34b652a..82ffddb 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CloudControllerDeployer.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/CloudControllerDeployer.java
@@ -28,8 +28,8 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.axiom.AxiomXpathParser;
import org.apache.stratos.cloud.controller.axiom.AxiomXpathParserUtil;
import org.apache.stratos.cloud.controller.axiom.parser.CloudControllerConfigParser;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
import java.util.ArrayList;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/ServiceDeployer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/ServiceDeployer.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/ServiceDeployer.java
index a0418ae..2875ce5 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/ServiceDeployer.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/deployers/ServiceDeployer.java
@@ -30,8 +30,8 @@ import org.apache.stratos.cloud.controller.axiom.AxiomXpathParserUtil;
import org.apache.stratos.cloud.controller.axiom.parser.ServiceConfigParser;
import org.apache.stratos.cloud.controller.exception.MalformedConfigurationFileException;
import org.apache.stratos.cloud.controller.topology.TopologyBuilder;
+import org.apache.stratos.cloud.controller.pojo.ServiceContext;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
-import org.apache.stratos.cloud.controller.util.ServiceContext;
import org.wso2.carbon.utils.CarbonUtils;
import java.io.File;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/InvalidIaasProviderException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/InvalidIaasProviderException.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/InvalidIaasProviderException.java
index ee98f0e..be61028 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/InvalidIaasProviderException.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/exception/InvalidIaasProviderException.java
@@ -18,7 +18,7 @@
*/
package org.apache.stratos.cloud.controller.exception;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
/**
* Throws when a {@link IaasProvider} is evaluated to be invalid.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/AWSEC2Iaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/AWSEC2Iaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/AWSEC2Iaas.java
index a591607..d79c266 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/AWSEC2Iaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/AWSEC2Iaas.java
@@ -30,9 +30,9 @@ import org.apache.stratos.cloud.controller.exception.InvalidRegionException;
import org.apache.stratos.cloud.controller.exception.InvalidZoneException;
import org.apache.stratos.cloud.controller.interfaces.Iaas;
import org.apache.stratos.cloud.controller.jcloud.ComputeServiceBuilderUtil;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.apache.stratos.cloud.controller.validate.AWSEC2PartitionValidator;
import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
import org.jclouds.aws.ec2.AWSEC2ApiMetadata;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java
index 07f7aff..6e445a3 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/OpenstackNovaIaas.java
@@ -31,9 +31,9 @@ import org.apache.stratos.cloud.controller.exception.InvalidRegionException;
import org.apache.stratos.cloud.controller.exception.InvalidZoneException;
import org.apache.stratos.cloud.controller.interfaces.Iaas;
import org.apache.stratos.cloud.controller.jcloud.ComputeServiceBuilderUtil;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.apache.stratos.cloud.controller.validate.OpenstackNovaPartitionValidator;
import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
import org.jclouds.compute.ComputeServiceContext;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java
index 6b2951a..ec5d69d 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java
@@ -24,7 +24,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.exception.CloudControllerException;
import org.apache.stratos.cloud.controller.interfaces.Iaas;
import org.apache.stratos.cloud.controller.jcloud.ComputeServiceBuilderUtil;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Template;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
index c259f73..b6aed38 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
@@ -24,6 +24,9 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.concurrent.ThreadExecutor;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.partition.PartitionGroup;
+import org.apache.stratos.cloud.controller.deployment.policy.DeploymentPolicy;
import org.apache.stratos.cloud.controller.exception.CloudControllerException;
import org.apache.stratos.cloud.controller.exception.InvalidCartridgeTypeException;
import org.apache.stratos.cloud.controller.exception.InvalidClusterException;
@@ -34,9 +37,14 @@ import org.apache.stratos.cloud.controller.exception.UnregisteredClusterExceptio
import org.apache.stratos.cloud.controller.interfaces.CloudControllerService;
import org.apache.stratos.cloud.controller.interfaces.Iaas;
import org.apache.stratos.cloud.controller.persist.Deserializer;
+import org.apache.stratos.cloud.controller.pojo.Cartridge;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
import org.apache.stratos.cloud.controller.pojo.ClusterContext;
+import org.apache.stratos.cloud.controller.pojo.IaasContext;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.pojo.MemberContext;
import org.apache.stratos.cloud.controller.pojo.Registrant;
+import org.apache.stratos.cloud.controller.pojo.ServiceContext;
import org.apache.stratos.cloud.controller.publisher.CartridgeInstanceDataPublisherTask;
import org.apache.stratos.cloud.controller.registry.RegistryManager;
import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder;
@@ -46,9 +54,6 @@ import org.apache.stratos.cloud.controller.topology.TopologyEventMessageDelegato
import org.apache.stratos.cloud.controller.topology.TopologyManager;
import org.apache.stratos.cloud.controller.util.*;
import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
-import org.apache.stratos.messaging.domain.policy.DeploymentPolicy;
-import org.apache.stratos.messaging.domain.policy.Partition;
-import org.apache.stratos.messaging.domain.policy.PartitionGroup;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.domain.ComputeMetadata;
import org.jclouds.compute.domain.NodeMetadata;
@@ -1378,7 +1383,6 @@ public class CloudControllerServiceImpl implements CloudControllerService {
validator.setIaasProvider(iaasProvider);
validator.validate(partition.getId(),
CloudControllerUtil.toJavaUtilProperties(partition.getProperties()));
- TopologyBuilder.handlePartitionCreated(partition);
return true;
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/CloudControllerService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/CloudControllerService.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/CloudControllerService.java
index 9494007..bae0922 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/CloudControllerService.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/CloudControllerService.java
@@ -18,16 +18,16 @@
*/
package org.apache.stratos.cloud.controller.interfaces;
+import org.apache.stratos.cloud.controller.deployment.partition.Partition;
+import org.apache.stratos.cloud.controller.deployment.policy.DeploymentPolicy;
import org.apache.stratos.cloud.controller.exception.InvalidCartridgeTypeException;
import org.apache.stratos.cloud.controller.exception.InvalidClusterException;
import org.apache.stratos.cloud.controller.exception.InvalidMemberException;
import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
import org.apache.stratos.cloud.controller.exception.UnregisteredCartridgeException;
import org.apache.stratos.cloud.controller.exception.UnregisteredClusterException;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
import org.apache.stratos.cloud.controller.pojo.Registrant;
-import org.apache.stratos.cloud.controller.util.CartridgeInfo;
-import org.apache.stratos.messaging.domain.policy.DeploymentPolicy;
-import org.apache.stratos.messaging.domain.policy.Partition;
/**
* This API provides a way to communicate with underline
@@ -177,7 +177,7 @@ public interface CloudControllerService {
*
* @param cartridgeType
* type of the cartridge.
- * @return {@link org.apache.stratos.cloud.controller.util.CartridgeInfo} of the given cartridge type or <code>null</code>.
+ * @return {@link org.apache.stratos.cloud.controller.pojo.CartridgeInfo} of the given cartridge type or <code>null</code>.
* @throws UnregisteredCartridgeException if there is no registered cartridge with this type.
*/
public CartridgeInfo getCartridgeInfo(String cartridgeType) throws UnregisteredCartridgeException;
@@ -194,10 +194,10 @@ public interface CloudControllerService {
// public int getPendingInstanceCount(String clusterId);
/**
- * Calling this method will result in returning the types of {@link org.apache.stratos.cloud.controller.util.Cartridge}s
+ * Calling this method will result in returning the types of {@link org.apache.stratos.cloud.controller.pojo.Cartridge}s
* registered in Cloud Controller.
*
- * @return String array containing types of registered {@link org.apache.stratos.cloud.controller.util.Cartridge}s.
+ * @return String array containing types of registered {@link org.apache.stratos.cloud.controller.pojo.Cartridge}s.
*/
public String[] getRegisteredCartridges();
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/Iaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/Iaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/Iaas.java
index e652cf2..31b2ca4 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/Iaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/interfaces/Iaas.java
@@ -24,7 +24,7 @@ import org.jclouds.compute.domain.Template;
import org.apache.stratos.cloud.controller.exception.InvalidHostException;
import org.apache.stratos.cloud.controller.exception.InvalidRegionException;
import org.apache.stratos.cloud.controller.exception.InvalidZoneException;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
/**
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/jcloud/ComputeServiceBuilderUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/jcloud/ComputeServiceBuilderUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/jcloud/ComputeServiceBuilderUtil.java
index 7b27f9a..0beba42 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/jcloud/ComputeServiceBuilderUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/jcloud/ComputeServiceBuilderUtil.java
@@ -20,11 +20,12 @@ package org.apache.stratos.cloud.controller.jcloud;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.cloud.controller.exception.CloudControllerException;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.jclouds.ContextBuilder;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/AppType.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/AppType.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/AppType.java
new file mode 100644
index 0000000..135a695
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/AppType.java
@@ -0,0 +1,62 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import java.io.Serializable;
+
+/**
+ * domain mapping related data.
+ *
+ */
+public class AppType implements Serializable{
+
+ private static final long serialVersionUID = 3550489774139807168L;
+ private String name;
+ private boolean appSpecificMapping = true;
+
+ public AppType(){
+
+ }
+
+ public AppType(String name){
+ this.setName(name);
+ }
+
+ public AppType(String name, boolean appSpecificMapping){
+ this.setName(name);
+ this.setAppSpecificMapping(appSpecificMapping);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isAppSpecificMapping() {
+ return appSpecificMapping;
+ }
+
+ public void setAppSpecificMapping(boolean appSpecificMapping) {
+ this.appSpecificMapping = appSpecificMapping;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Cartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Cartridge.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Cartridge.java
new file mode 100644
index 0000000..0062403
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Cartridge.java
@@ -0,0 +1,288 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+/**
+ * Holds information regarding a Cartridge.
+ */
+public class Cartridge implements Serializable{
+
+ private static final long serialVersionUID = 6637409027085059072L;
+
+ private String type;
+
+ private String hostName;
+
+ private String provider;
+
+ private String displayName;
+
+ private String description;
+
+ private String baseDir;
+
+ private String version;
+
+ private boolean multiTenant;
+
+ private List<PortMapping> portMappings = new ArrayList<PortMapping>();
+
+ private List<AppType> appTypeMappings = new ArrayList<AppType>();
+
+ /**
+ * Property map of this Cartridge.
+ */
+ private Map<String, String> properties = new HashMap<String, String>();
+
+ /**
+ * A Cartridge can have 1..n {@link IaasProvider}s
+ */
+ private List<IaasProvider> iaases = new ArrayList<IaasProvider>();
+
+ private List<String> deploymentDirs = new ArrayList<String>();
+
+ private IaasProvider lastlyUsedIaas;
+
+ /**
+ * Key - partition id
+ * Value - Corresponding IaasProvider.
+ */
+ private Map<String, IaasProvider> partitionToIaasProvider = new ConcurrentHashMap<String, IaasProvider>();
+
+ public Cartridge(){}
+
+ public Cartridge(String type, String host, String provider, String version, boolean multiTenant) {
+ this.type = type;
+ this.hostName = host;
+ this.provider = provider;
+ this.version = version;
+ this.multiTenant = multiTenant;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void addIaasProvider(String partitionId, IaasProvider iaasProvider) {
+ partitionToIaasProvider.put(partitionId, iaasProvider);
+ }
+
+ public void addIaasProviders(Map<String, IaasProvider> map) {
+ for (Iterator<String> iterator = map.keySet().iterator(); iterator.hasNext();) {
+ String key = (String) iterator.next();
+ IaasProvider value = map.get(key);
+
+ partitionToIaasProvider.put(key, value);
+ }
+ }
+
+ public IaasProvider getIaasProviderOfPartition(String partitionId) {
+ return partitionToIaasProvider.get(partitionId);
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public String getProperty(String key) {
+ return properties.get(key);
+ }
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+ public void addIaasProvider(IaasProvider iaas) {
+ for (IaasProvider anIaas : iaases) {
+ if(anIaas.equals(iaas)){
+ int idx = iaases.indexOf(anIaas);
+ iaases.remove(idx);
+ iaases.add(idx, iaas);
+ return;
+ }
+ }
+ this.iaases.add(iaas);
+ }
+
+ public IaasProvider getIaasProvider(String iaasType){
+ for (IaasProvider iaas : iaases) {
+ if(iaas.getType().equals(iaasType)){
+ return iaas;
+ }
+ }
+
+ return null;
+ }
+
+ public List<IaasProvider> getIaases() {
+ return iaases;
+ }
+
+ public void setIaases(List<IaasProvider> iaases) {
+ this.iaases = iaases;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof Cartridge) {
+ return this.type.equals(((Cartridge)obj).getType());
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder(17, 31). // two randomly chosen prime numbers
+ append(type).
+ toHashCode();
+ }
+
+ public IaasProvider getLastlyUsedIaas() {
+ return lastlyUsedIaas;
+ }
+
+ public void setLastlyUsedIaas(IaasProvider lastlyUsedIaas) {
+ this.lastlyUsedIaas = lastlyUsedIaas;
+ }
+
+// public boolean isJcloudsObjectsBuilt() {
+// return isJcloudsObjectsBuilt;
+// }
+//
+// public void setJcloudsObjectsBuilt(boolean isJcloudsObjectsBuilt) {
+// this.isJcloudsObjectsBuilt = isJcloudsObjectsBuilt;
+// }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public void reset(){
+// lastlyUsedIaas = null;
+ }
+
+ public List<String> getDeploymentDirs() {
+ return deploymentDirs;
+ }
+
+ public void setDeploymentDirs(List<String> deploymentDirs) {
+ this.deploymentDirs = deploymentDirs;
+ }
+
+ public void addDeploymentDir(String dir){
+ deploymentDirs.add(dir);
+ }
+
+ public void addPortMapping(PortMapping mapping){
+ portMappings.add(mapping);
+ }
+
+ public void addAppType(AppType type){
+ appTypeMappings.add(type);
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public boolean isMultiTenant() {
+ return multiTenant;
+ }
+
+ public void setMultiTenant(boolean multiTenant) {
+ this.multiTenant = multiTenant;
+ }
+
+ public String getBaseDir() {
+ return baseDir;
+ }
+
+ public void setBaseDir(String baseDir) {
+ this.baseDir = baseDir;
+ }
+
+ public List<PortMapping> getPortMappings() {
+ return portMappings;
+ }
+
+ public void setPortMappings(List<PortMapping> portMappings) {
+ this.portMappings = portMappings;
+ }
+
+ public List<AppType> getAppTypeMappings() {
+ return appTypeMappings;
+ }
+
+ public void setAppTypeMappings(List<AppType> appTypeMappings) {
+ this.appTypeMappings = appTypeMappings;
+ }
+
+ public Map<String, IaasProvider> getPartitionToIaasProvider() {
+ return partitionToIaasProvider;
+ }
+
+ public void setPartitionToIaasProvider(Map<String, IaasProvider> partitionToIaasProvider) {
+ this.partitionToIaasProvider = partitionToIaasProvider;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeInfo.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeInfo.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeInfo.java
new file mode 100644
index 0000000..1121c4e
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeInfo.java
@@ -0,0 +1,163 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Holds useful information for externals, regarding a Cartridge.
+ */
+public class CartridgeInfo {
+
+ private String type;
+
+ private String hostName;
+
+ private String displayName;
+
+ private String description;
+
+ private String[] deploymentDirs;
+
+ private PortMapping[] portMappings;
+
+ private AppType[] appTypes;
+
+ private String provider;
+
+ private String version;
+
+ private boolean multiTenant;
+
+ private String baseDir;
+
+ private Property[] properties;
+
+ public CartridgeInfo(){
+
+ }
+
+ public CartridgeInfo(String type, String host, String desc, List<String> deploymentDirs, String provider) {
+ this.type = type;
+ this.hostName = host;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public String[] getDeploymentDirs() {
+ return deploymentDirs;
+ }
+
+ public void setDeploymentDirs(List<String> deploymentDirsList) {
+ if(deploymentDirsList == null){
+ deploymentDirsList = new ArrayList<String>();
+ }
+ this.deploymentDirs = new String[deploymentDirsList.size()];
+
+ deploymentDirsList.toArray(deploymentDirs);
+
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public boolean isMultiTenant() {
+ return multiTenant;
+ }
+
+ public void setMultiTenant(boolean multiTenant) {
+ this.multiTenant = multiTenant;
+ }
+
+ public String getBaseDir() {
+ return baseDir;
+ }
+
+ public void setBaseDir(String baseDir) {
+ this.baseDir = baseDir;
+ }
+
+ public PortMapping[] getPortMappings() {
+ return portMappings;
+ }
+
+ public void setPortMappings(PortMapping[] portMappings) {
+ this.portMappings = portMappings;
+ }
+
+ public AppType[] getAppTypes() {
+ return appTypes;
+ }
+
+ public void setAppTypes(AppType[] appTypes) {
+ this.appTypes = appTypes;
+ }
+
+ public Property[] getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Property[] properties) {
+ this.properties = properties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeInstanceData.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeInstanceData.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeInstanceData.java
new file mode 100644
index 0000000..a08d032
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeInstanceData.java
@@ -0,0 +1,130 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import org.jclouds.compute.domain.NodeMetadata;
+
+/**
+ * This class holds the data to be published to BAM.
+ */
+public class CartridgeInstanceData {
+
+ // Cartridge type
+ private String type;
+
+ private String nodeId;
+
+ private String domain;
+
+ private String subDomain;
+
+ private String iaas;
+
+ private String status;
+
+ private String tenantRange;
+
+ private String alias;
+
+ private boolean isMultiTenant;
+
+ private NodeMetadata metaData;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ public void setNodeId(String nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public void setDomain(String domain) {
+ this.domain = domain;
+ }
+
+ public String getSubDomain() {
+ return subDomain;
+ }
+
+ public void setSubDomain(String subDomain) {
+ this.subDomain = subDomain;
+ }
+
+ public String getIaas() {
+ return iaas;
+ }
+
+ public void setIaas(String iaas) {
+ this.iaas = iaas;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public NodeMetadata getMetaData() {
+ return metaData;
+ }
+
+ public void setMetaData(NodeMetadata metaData) {
+ this.metaData = metaData;
+ }
+
+ public String getTenantRange() {
+ return tenantRange;
+ }
+
+ public void setTenantRange(String tenantRange) {
+ this.tenantRange = tenantRange;
+ }
+
+ public boolean isMultiTenant() {
+ return isMultiTenant;
+ }
+
+ public void setMultiTenant(boolean isMultiTenant) {
+ this.isMultiTenant = isMultiTenant;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/DataPublisherConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/DataPublisherConfig.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/DataPublisherConfig.java
new file mode 100644
index 0000000..9e35926
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/DataPublisherConfig.java
@@ -0,0 +1,82 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
+
+/**
+ * @author nirmal
+ *
+ */
+public class DataPublisherConfig {
+
+ private String bamUsername = CloudControllerConstants.DEFAULT_BAM_SERVER_USER_NAME;
+ private String bamPassword = CloudControllerConstants.DEFAULT_BAM_SERVER_PASSWORD;
+ private String dataPublisherCron = CloudControllerConstants.PUB_CRON_EXPRESSION;
+ private String cassandraConnUrl = CloudControllerConstants.DEFAULT_CASSANDRA_URL;
+ private String cassandraUser = CloudControllerConstants.DEFAULT_CASSANDRA_USER;
+ private String cassandraPassword = CloudControllerConstants.DEFAULT_CASSANDRA_PASSWORD;
+
+ public String getBamUsername() {
+ return bamUsername;
+ }
+
+ public void setBamUsername(String bamUsername) {
+ this.bamUsername = bamUsername;
+ }
+
+ public String getBamPassword() {
+ return bamPassword;
+ }
+
+ public void setBamPassword(String bamPassword) {
+ this.bamPassword = bamPassword;
+ }
+
+ public String getDataPublisherCron() {
+ return dataPublisherCron;
+ }
+
+ public void setDataPublisherCron(String dataPublisherCron) {
+ this.dataPublisherCron = dataPublisherCron;
+ }
+ public String getCassandraConnUrl() {
+ return cassandraConnUrl;
+ }
+
+ public void setCassandraConnUrl(String cassandraHostAddr) {
+ this.cassandraConnUrl = cassandraHostAddr;
+ }
+
+ public String getCassandraUser() {
+ return cassandraUser;
+ }
+
+ public void setCassandraUser(String cassandraUser) {
+ this.cassandraUser = cassandraUser;
+ }
+
+ public String getCassandraPassword() {
+ return cassandraPassword;
+ }
+
+ public void setCassandraPassword(String cassandraPassword) {
+ this.cassandraPassword = cassandraPassword;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Host.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Host.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Host.java
new file mode 100644
index 0000000..f8d586b
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Host.java
@@ -0,0 +1,73 @@
+package org.apache.stratos.cloud.controller.pojo;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.Template;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Host extends Zone {
+ private String id;
+ private String type;
+ private Map<String, String> properties = new HashMap<String, String>();
+
+ private transient ComputeService computeService;
+
+ private transient Template template;
+
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+ public void setProperty(String key, String value) {
+
+ if (key != null && value != null) {
+ getProperties().put(key, value);
+ }
+ }
+
+ public String getProperty(String key) {
+ if(getProperties().get(key) != null) {
+ return getProperties().get(key);
+ } else {
+ return super.getProperty(key);
+ }
+ }
+
+ public ComputeService getComputeService() {
+ return computeService;
+ }
+
+ public void setComputeService(ComputeService computeService) {
+ this.computeService = computeService;
+ }
+
+ public Template getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(Template template) {
+ this.template = template;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/IaasContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/IaasContext.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/IaasContext.java
new file mode 100644
index 0000000..b5d8e95
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/IaasContext.java
@@ -0,0 +1,162 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.compute.domain.NodeMetadata;
+
+/**
+ *
+ * Holds runtime data of an IaaS
+ */
+public class IaasContext implements Serializable{
+
+ private static final long serialVersionUID = 3370272526949562217L;
+
+ private String type;
+
+ private List<String> nodeIds;
+
+ /**
+ * Key - node id
+ * Value - public ip
+ */
+ private Map<String, String> nodeToPublicIp;
+
+ /**
+ * Key - node id
+ * Value - NodeMetadata object which has information on this node.
+ */
+ private transient Map<String, NodeMetadata> nodes;
+
+ private List<String> toBeRemovedNodeIds;
+
+ public IaasContext(String iaasType) {
+ this.type = iaasType;
+ nodeToPublicIp = new HashMap<String, String>();
+ nodeIds = new ArrayList<String>();
+ nodes = new HashMap<String, NodeMetadata>();
+ toBeRemovedNodeIds = new ArrayList<String>();
+ }
+
+ public Map<String, String> getNodeToPublicIp() {
+ return nodeToPublicIp;
+ }
+
+ public Map<String, NodeMetadata> getNodes() {
+ return nodes;
+ }
+
+ public void setToBeRemovedNodeIds(List<String> list) {
+ this.toBeRemovedNodeIds = list;
+ }
+
+ public List<String> getAllNodeIds() {
+ List<String> allNodeIds = new ArrayList<String>(nodeIds);
+ allNodeIds.addAll(toBeRemovedNodeIds);
+ return allNodeIds;
+ }
+
+ public List<String> getNodeIds() {
+ return nodeIds;
+ }
+
+ public List<String> getToBeRemovedNodeIds() {
+ return toBeRemovedNodeIds;
+ }
+
+ public boolean didISpawn(String nodeId) {
+ if(nodeIds.contains(nodeId) || toBeRemovedNodeIds.contains(nodeId)){
+ return true;
+ }
+ return false;
+ }
+
+ public void addNodeId(String nodeId) {
+ nodeIds.add(nodeId);
+ }
+
+ public void addNodeToPublicIp(String nodeId, String publicIp) {
+ nodeToPublicIp.put(nodeId, publicIp);
+ }
+
+ public void addToBeRemovedNodeId(String nodeId) {
+ toBeRemovedNodeIds.add(nodeId);
+ }
+
+ public void removeNodeId(String nodeId) {
+ if(nodeIds.remove(nodeId)){
+ toBeRemovedNodeIds.add(nodeId);
+ }
+ }
+
+ public void removeToBeRemovedNodeId(String nodeId) {
+ toBeRemovedNodeIds.remove(nodeId);
+ }
+
+ public void setNodeIds(List<String> nodeIds) {
+ this.nodeIds = nodeIds;
+ }
+
+ public String lastlySpawnedNode() {
+ return nodeIds.get(nodeIds.size()-1);
+ }
+
+ public void addNodeMetadata(NodeMetadata node) {
+ if(nodes == null){
+ nodes = new HashMap<String, NodeMetadata>();
+ }
+ nodes.put(node.getId(), node);
+ }
+
+ public void removeNodeMetadata(NodeMetadata node) {
+ if (nodes != null) {
+ nodes.remove(node.getId());
+ }
+ }
+
+ public void removeNodeIdToPublicIp(String nodeId){
+ nodeToPublicIp.remove(nodeId);
+ }
+
+ public NodeMetadata getNode(String nodeId) {
+ if(nodes == null) {
+ return null;
+ }
+ return nodes.get(nodeId);
+ }
+
+ public String getPublicIp(String nodeId){
+ return nodeToPublicIp.get(nodeId);
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/IaasProvider.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/IaasProvider.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/IaasProvider.java
new file mode 100644
index 0000000..bffd6cf
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/IaasProvider.java
@@ -0,0 +1,271 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.stratos.cloud.controller.interfaces.Iaas;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.Template;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This is the basic data structure which holds an IaaS specific details.
+ * NOTE: If you add a new attribute, please assign it in the constructor too.
+ */
+public class IaasProvider implements Serializable{
+
+ private static final long serialVersionUID = -940288190885166118L;
+
+ /**
+ * Type of the IaasProvider.
+ */
+ private String type;
+
+ private List<Region> listOfRegions;
+
+ /**
+ * Fully qualified class name of an implementation of {@link org.apache.stratos.cloud.controller.interfaces.Iaas}
+ */
+ private String className;
+
+ /**
+ * human description of this IaaS provider
+ */
+ private String name;
+
+ /**
+ * Property map of this IaaS provider.
+ */
+ private Map<String, String> properties = new HashMap<String, String>();
+
+ /**
+ * Image identifier.
+ */
+ private String image;
+
+
+ /**
+ * Scale up order and scale down order of the IaaS.
+ */
+ private int scaleUpOrder = -1, scaleDownOrder = -1;
+
+ private String provider, identity, credential;
+
+ private transient ComputeService computeService;
+
+ private transient Template template;
+
+ private byte[] payload;
+
+ /**
+ * Corresponding {@link org.apache.stratos.cloud.controller.interfaces.Iaas} implementation
+ */
+ private transient Iaas iaas;
+
+ public IaasProvider(){}
+
+ public IaasProvider(IaasProvider anIaasProvider){
+ this.type = anIaasProvider.getType();
+ this.name = anIaasProvider.getName();
+ this.className = anIaasProvider.getClassName();
+ this.properties = anIaasProvider.getProperties();
+ this.image = anIaasProvider.getImage();
+ this.scaleUpOrder = anIaasProvider.getScaleUpOrder();
+ this.scaleDownOrder = anIaasProvider.getScaleDownOrder();
+ this.provider = anIaasProvider.getProvider();
+ this.identity = anIaasProvider.getIdentity();
+ this.credential = anIaasProvider.getCredential();
+ this.computeService = anIaasProvider.getComputeService();
+ this.template = anIaasProvider.getTemplate();
+ this.payload = anIaasProvider.getPayload();
+ this.iaas = anIaasProvider.getIaas();
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String id) {
+ this.type = id;
+ }
+
+ public String getProperty(String key) {
+ return properties.get(key);
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public void setProperty(String key, String value) {
+
+ if(key != null && value != null){
+ properties.put(key, value);
+ }
+ }
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+ public String getImage() {
+ return image;
+ }
+
+ public void setImage(String image) {
+ this.image = image;
+ }
+
+ public int getScaleUpOrder() {
+ return scaleUpOrder;
+ }
+
+ public void setScaleUpOrder(int scaleUpOrder) {
+ this.scaleUpOrder = scaleUpOrder;
+ }
+
+ public int getScaleDownOrder() {
+ return scaleDownOrder;
+ }
+
+ public void setScaleDownOrder(int scaleDownOrder) {
+ this.scaleDownOrder = scaleDownOrder;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getProvider() {
+ return provider;
+ }
+
+ public void setProvider(String provider) {
+ this.provider = provider;
+ }
+
+ public String getIdentity() {
+ return identity;
+ }
+
+ public void setIdentity(String identity) {
+ this.identity = identity;
+ }
+
+ public String getCredential() {
+ return credential;
+ }
+
+ public void setCredential(String credential) {
+ this.credential = credential;
+ }
+
+ public ComputeService getComputeService() {
+ return computeService;
+ }
+
+ public void setComputeService(ComputeService computeService) {
+ this.computeService = computeService;
+ }
+
+ public Template getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(Template template) {
+ this.template = template;
+ }
+
+
+
+ public boolean equals(Object o) {
+ if(o instanceof IaasProvider){
+ return ((IaasProvider) o).getType().equals(this.getType());
+ }
+
+ return false;
+ }
+
+ public int hashCode() {
+ return new HashCodeBuilder(17, 31). // two randomly chosen prime numbers
+ append(type).
+ toHashCode();
+ }
+
+ public IaasProvider copy(){
+ return new IaasProvider(this);
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public byte [] getPayload() {
+ return payload;
+ }
+
+ public void setPayload(byte[]payload) {
+ this.payload = payload;
+ }
+
+ public Iaas getIaas() {
+ return iaas;
+ }
+
+ public void setIaas(Iaas iaas) {
+ this.iaas = iaas;
+ }
+
+ public void reset(){
+// nodeIds = new ArrayList<String>();
+// nodes = new HashMap<String, NodeMetadata>();
+// toBeRemovedNodeIds = new ArrayList<String>();
+ }
+
+ /**
+ * Partition the IaaS using different region
+ */
+ public List<Region> getListOfRegions() {
+ return listOfRegions;
+ }
+
+ public void setListOfRegions(List<Region> listOfRegions) {
+ this.listOfRegions = listOfRegions;
+ }
+
+ public void addRegion(Region region) {
+ this.listOfRegions.add(region);
+ }
+
+ public void removeRegion(Region region) {
+ this.listOfRegions.remove(region);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/LocationScope.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/LocationScope.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/LocationScope.java
new file mode 100644
index 0000000..777cf3b
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/LocationScope.java
@@ -0,0 +1,70 @@
+/*
+ * 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.cloud.controller.pojo;
+
+/**
+ * this contains the scope of a IaaS spanned across the geography.
+ */
+public class LocationScope {
+ private String zone;
+ private String network;
+ private String host;
+ private String region;
+ private String cloud;
+
+ public String getZone() {
+ return zone;
+ }
+
+ public void setZone(String zone) {
+ this.zone = zone;
+ }
+
+ public String getNetwork() {
+ return network;
+ }
+
+ public void setNetwork(String network) {
+ this.network = network;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public String getCloud() {
+ return cloud;
+ }
+
+ public void setCloud(String cloud) {
+ this.cloud = cloud;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/PortMapping.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/PortMapping.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/PortMapping.java
new file mode 100644
index 0000000..65b52f7
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/PortMapping.java
@@ -0,0 +1,64 @@
+/*
+ * 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.cloud.controller.pojo;
+
+import java.io.Serializable;
+
+public class PortMapping implements Serializable{
+
+ private static final long serialVersionUID = -5387564414633460306L;
+ private String protocol;
+ private String port;
+ private String proxyPort;
+
+ public PortMapping(){
+
+ }
+
+ public PortMapping(String protocol, String port, String proxyPort){
+ this.protocol = protocol;
+ this.port = port;
+ this.proxyPort = proxyPort;
+ }
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public String getPort() {
+ return port;
+ }
+
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public String getProxyPort() {
+ return proxyPort;
+ }
+
+ public void setProxyPort(String proxyPort) {
+ this.proxyPort = proxyPort;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Region.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Region.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Region.java
new file mode 100644
index 0000000..fb1558f
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Region.java
@@ -0,0 +1,125 @@
+package org.apache.stratos.cloud.controller.pojo;
+
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.Template;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Region extends IaasProvider {
+ private String imageId;
+ private String identity;
+ private String credential;
+ private String id;
+ private String type;
+ private List<Zone> listOfZones;
+
+ private transient ComputeService computeService;
+
+ private transient Template template;
+
+ private Map<String, String> properties = new HashMap<String, String>();
+
+ public String getProperty(String key) {
+ if(getProperties().get(key) != null) {
+ return getProperties().get(key);
+ } else {
+ return super.getProperty(key);
+ }
+ }
+
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+
+ public void setProperty(String key, String value) {
+
+ if (key != null && value != null) {
+ getProperties().put(key, value);
+ }
+ }
+
+ public void setProperties(Map<String, String> properties) {
+ this.properties = properties;
+ }
+
+
+ public String getImageId() {
+ return imageId;
+ }
+
+ public void setImageId(String imageId) {
+ this.imageId = imageId;
+ }
+
+ public String getIdentity() {
+ if(identity == null) {
+ return super.getIdentity();
+ }
+ return identity;
+ }
+
+ public void setIdentity(String identity) {
+ this.identity = identity;
+ }
+
+ public String getCredential() {
+ if(credential == null) {
+ return super.getCredential();
+ }
+ return credential;
+ }
+
+ public void setCredential(String credential) {
+ this.credential = credential;
+ }
+
+ public ComputeService getComputeService() {
+ return computeService;
+ }
+
+ public void setComputeService(ComputeService computeService) {
+ this.computeService = computeService;
+ }
+
+ public Template getTemplate() {
+ return template;
+ }
+
+ public void setTemplate(Template template) {
+ this.template = template;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public List<Zone> getListOfZones() {
+ return listOfZones;
+ }
+
+ public void setListOfZones(List<Zone> listOfZones) {
+ this.listOfZones = listOfZones;
+ }
+
+ public void addZone(Zone zone) {
+ this.listOfZones.add(zone);
+ }
+
+ public void removeZone(Zone zone) {
+ this.listOfZones.remove(zone);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2eaac66e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Registrant.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Registrant.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Registrant.java
index 812abaf..4ef14cc 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Registrant.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Registrant.java
@@ -18,8 +18,6 @@
*/
package org.apache.stratos.cloud.controller.pojo;
-import org.apache.stratos.messaging.util.Properties;
-
/**
* Upon a new subscription, Stratos Manager would send this POJO.
* @author nirmal
[7/8] git commit: changes to SM, according to CC changes
Posted by ni...@apache.org.
changes to SM, according to CC changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/8cb502cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/8cb502cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/8cb502cd
Branch: refs/heads/master
Commit: 8cb502cd57dd815c3a6021805d49c7b75a9c70f8
Parents: f942c24
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Nov 28 21:29:24 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Nov 28 21:29:24 2013 +0530
----------------------------------------------------------------------
.../adc/mgt/client/CloudControllerServiceClient.java | 14 +++++++-------
.../adc/mgt/manager/CartridgeSubscriptionManager.java | 4 ++--
.../stratos/adc/mgt/payload/NonCarbonPayload.java | 6 +++---
.../apache/stratos/adc/mgt/payload/PayloadArg.java | 2 +-
.../persistence/DatabaseBasedPersistenceManager.java | 2 +-
.../adc/mgt/service/ApplicationManagementService.java | 2 +-
.../stratos/adc/mgt/service/RepositoryInfoBean.java | 3 +--
.../adc/mgt/subscription/CartridgeSubscription.java | 2 +-
.../mgt/subscription/DataCartridgeSubscription.java | 2 +-
.../MultiTenantCartridgeSubscription.java | 2 +-
.../SingleTenantCartridgeSubscription.java | 2 +-
.../factory/CartridgeSubscriptionFactory.java | 2 +-
.../adc/mgt/utils/ApplicationManagementUtil.java | 14 ++++++++------
.../adc/mgt/test/CartridgeSubscriptionTest.java | 3 ++-
.../org/apache/stratos/adc/mgt/test/PayloadTest.java | 5 +++--
15 files changed, 34 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
index 7141467..703f467 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/client/CloudControllerServiceClient.java
@@ -26,12 +26,12 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.adc.mgt.exception.UnregisteredCartridgeException;
import org.apache.stratos.adc.mgt.internal.DataHolder;
import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
-import org.apache.stratos.cloud.controller.pojo.xsd.Registrant;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.Registrant;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceIllegalArgumentExceptionException;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceStub;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceUnregisteredCartridgeExceptionException;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
-import org.apache.stratos.messaging.util.xsd.Property;
+import org.apache.stratos.cloud.controller.pojo.Property;
import java.rmi.RemoteException;
import java.util.Iterator;
@@ -83,7 +83,7 @@ public class CloudControllerServiceClient {
registrant.setCartridgeType(cartridgeType);
registrant.setTenantRange(tenantRange);
registrant.setHostName(hostName);
- org.apache.stratos.messaging.util.xsd.Properties props = extractProperties(properties);
+ org.apache.stratos.cloud.controller.pojo.Properties props = extractProperties(properties);
registrant.setProperties(props);
registrant.setPayload(payload);
registrant.setAutoScalerPolicyName(autoscalorPolicyName);
@@ -91,10 +91,10 @@ public class CloudControllerServiceClient {
}
- private org.apache.stratos.messaging.util.xsd.Properties
+ private org.apache.stratos.cloud.controller.pojo.Properties
extractProperties(Properties properties) {
- org.apache.stratos.messaging.util.xsd.Properties props =
- new org.apache.stratos.messaging.util.xsd.Properties();
+ org.apache.stratos.cloud.controller.pojo.Properties props =
+ new org.apache.stratos.cloud.controller.pojo.Properties();
if (properties != null) {
for (Iterator iterator = properties.keySet().iterator(); iterator.hasNext();) {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
index d846764..d58defb 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/manager/CartridgeSubscriptionManager.java
@@ -41,8 +41,8 @@ import org.apache.stratos.adc.mgt.utils.ApplicationManagementUtil;
import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
import org.apache.stratos.adc.mgt.utils.PersistenceManager;
import org.apache.stratos.adc.mgt.utils.PolicyHolder;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
-import org.apache.stratos.messaging.util.xsd.Property;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.Property;
import org.wso2.carbon.context.CarbonContext;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/NonCarbonPayload.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/NonCarbonPayload.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/NonCarbonPayload.java
index e0df759..5ee8c29 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/NonCarbonPayload.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/NonCarbonPayload.java
@@ -21,7 +21,7 @@ package org.apache.stratos.adc.mgt.payload;
import org.apache.stratos.adc.mgt.dto.Policy;
import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
import java.text.DecimalFormat;
@@ -69,8 +69,8 @@ public class NonCarbonPayload extends Payload {
private String createPortMappingPayloadString(CartridgeInfo cartridgeInfo) {
// port mappings
StringBuilder portMapBuilder = new StringBuilder();
- org.apache.stratos.cloud.controller.util.xsd.PortMapping[] portMappings = cartridgeInfo.getPortMappings();
- for (org.apache.stratos.cloud.controller.util.xsd.PortMapping portMapping : portMappings) {
+ org.apache.stratos.cloud.controller.pojo.PortMapping[] portMappings = cartridgeInfo.getPortMappings();
+ for (org.apache.stratos.cloud.controller.pojo.PortMapping portMapping : portMappings) {
String port = portMapping.getPort();
portMapBuilder.append(port).append("|");
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/PayloadArg.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/PayloadArg.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/PayloadArg.java
index b7aed36..5729ee7 100755
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/PayloadArg.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/payload/PayloadArg.java
@@ -20,7 +20,7 @@
package org.apache.stratos.adc.mgt.payload;
import org.apache.stratos.adc.mgt.dto.Policy;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
public class PayloadArg {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/persistence/DatabaseBasedPersistenceManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/persistence/DatabaseBasedPersistenceManager.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/persistence/DatabaseBasedPersistenceManager.java
index eb8ebb0..3059df2 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/persistence/DatabaseBasedPersistenceManager.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/persistence/DatabaseBasedPersistenceManager.java
@@ -37,7 +37,7 @@ import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
import org.apache.stratos.adc.mgt.utils.PolicyHolder;
import org.apache.stratos.adc.mgt.utils.RepoPasswordMgtUtil;
import org.apache.stratos.adc.mgt.utils.StratosDBUtils;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
import org.wso2.carbon.context.CarbonContext;
import java.sql.*;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/ApplicationManagementService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/ApplicationManagementService.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/ApplicationManagementService.java
index 771ed4b..62a1adb 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/ApplicationManagementService.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/ApplicationManagementService.java
@@ -35,7 +35,7 @@ import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
import org.apache.stratos.adc.mgt.utils.PersistenceManager;
import org.apache.stratos.adc.mgt.utils.PolicyHolder;
import org.apache.stratos.adc.topology.mgt.service.TopologyManagementService;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.core.AbstractAdmin;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/RepositoryInfoBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/RepositoryInfoBean.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/RepositoryInfoBean.java
index 27203f5..53a6f6b 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/RepositoryInfoBean.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/service/RepositoryInfoBean.java
@@ -24,10 +24,9 @@ package org.apache.stratos.adc.mgt.service;
*/
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
/**
- * @author wso2
*
*/
public class RepositoryInfoBean {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/CartridgeSubscription.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/CartridgeSubscription.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/CartridgeSubscription.java
index 618b3f7..e1a48ce 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/CartridgeSubscription.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/CartridgeSubscription.java
@@ -35,7 +35,7 @@ import org.apache.stratos.adc.mgt.service.RepositoryInfoBean;
import org.apache.stratos.adc.mgt.subscriber.Subscriber;
import org.apache.stratos.adc.mgt.utils.*;
import org.apache.stratos.adc.topology.mgt.service.TopologyManagementService;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
import java.util.ArrayList;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/DataCartridgeSubscription.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/DataCartridgeSubscription.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/DataCartridgeSubscription.java
index 20df7ab..786450c 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/DataCartridgeSubscription.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/DataCartridgeSubscription.java
@@ -28,7 +28,7 @@ import org.apache.stratos.adc.mgt.repository.Repository;
import org.apache.stratos.adc.mgt.subscriber.Subscriber;
import org.apache.stratos.adc.mgt.utils.ApplicationManagementUtil;
import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
import java.util.Properties;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/MultiTenantCartridgeSubscription.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/MultiTenantCartridgeSubscription.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/MultiTenantCartridgeSubscription.java
index d9705ef..d14d18b 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/MultiTenantCartridgeSubscription.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/MultiTenantCartridgeSubscription.java
@@ -33,7 +33,7 @@ import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
import org.apache.stratos.adc.mgt.utils.PersistenceManager;
import org.apache.stratos.adc.topology.mgt.service.TopologyManagementService;
import org.apache.stratos.adc.topology.mgt.serviceobjects.DomainContext;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
import java.util.Properties;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/SingleTenantCartridgeSubscription.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/SingleTenantCartridgeSubscription.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/SingleTenantCartridgeSubscription.java
index 0f17804..830deea 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/SingleTenantCartridgeSubscription.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/SingleTenantCartridgeSubscription.java
@@ -31,7 +31,7 @@ import org.apache.stratos.adc.mgt.repository.Repository;
import org.apache.stratos.adc.mgt.subscriber.Subscriber;
import org.apache.stratos.adc.mgt.utils.ApplicationManagementUtil;
import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
import java.util.Properties;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/factory/CartridgeSubscriptionFactory.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/factory/CartridgeSubscriptionFactory.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/factory/CartridgeSubscriptionFactory.java
index 70be3ef..a3883d4 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/factory/CartridgeSubscriptionFactory.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/subscription/factory/CartridgeSubscriptionFactory.java
@@ -25,7 +25,7 @@ import org.apache.stratos.adc.mgt.subscription.DataCartridgeSubscription;
import org.apache.stratos.adc.mgt.subscription.MultiTenantCartridgeSubscription;
import org.apache.stratos.adc.mgt.subscription.SingleTenantCartridgeSubscription;
import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
public class CartridgeSubscriptionFactory {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/ApplicationManagementUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/ApplicationManagementUtil.java b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/ApplicationManagementUtil.java
index 15ab57c..55ba560 100644
--- a/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/ApplicationManagementUtil.java
+++ b/components/org.apache.stratos.adc.mgt/src/main/java/org/apache/stratos/adc/mgt/utils/ApplicationManagementUtil.java
@@ -22,6 +22,7 @@ package org.apache.stratos.adc.mgt.utils;
import com.google.gson.Gson;
+
import org.apache.axis2.clustering.ClusteringAgent;
import org.apache.axis2.clustering.Member;
import org.apache.axis2.clustering.management.GroupManagementAgent;
@@ -44,10 +45,10 @@ import org.apache.stratos.adc.mgt.repository.Repository;
import org.apache.stratos.adc.mgt.service.RepositoryInfoBean;
import org.apache.stratos.adc.topology.mgt.service.TopologyManagementService;
import org.apache.stratos.adc.topology.mgt.serviceobjects.DomainContext;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.Property;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceIllegalArgumentExceptionException;
import org.apache.stratos.cloud.controller.stub.CloudControllerServiceUnregisteredCartridgeExceptionException;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
-import org.apache.stratos.messaging.util.xsd.Property;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.LsRemoteCommand;
import org.eclipse.jgit.api.errors.GitAPIException;
@@ -62,6 +63,7 @@ import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
+
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
@@ -454,8 +456,8 @@ public class ApplicationManagementUtil {
private static String createPortMappingPayloadString(CartridgeInfo cartridgeInfo) {
// port mappings
StringBuilder portMapBuilder = new StringBuilder();
- org.apache.stratos.cloud.controller.util.xsd.PortMapping[] portMappings = cartridgeInfo.getPortMappings();
- for (org.apache.stratos.cloud.controller.util.xsd.PortMapping portMapping : portMappings) {
+ org.apache.stratos.cloud.controller.pojo.PortMapping[] portMappings = cartridgeInfo.getPortMappings();
+ for (org.apache.stratos.cloud.controller.pojo.PortMapping portMapping : portMappings) {
String port = portMapping.getPort();
String protocol = portMapping.getProtocol();
String proxyPort = portMapping.getProxyPort();
@@ -581,7 +583,7 @@ public class ApplicationManagementUtil {
List<PortMapping> portMappings = new ArrayList<PortMapping>();
if (cartridgeInfo.getPortMappings() != null) {
- for (org.apache.stratos.cloud.controller.util.xsd.PortMapping portMapping : cartridgeInfo.getPortMappings()) {
+ for (org.apache.stratos.cloud.controller.pojo.PortMapping portMapping : cartridgeInfo.getPortMappings()) {
PortMapping portMap = new PortMapping();
portMap.setPrimaryPort(portMapping.getPort());
portMap.setProxyPort(portMapping.getProxyPort());
@@ -1018,7 +1020,7 @@ public class ApplicationManagementUtil {
List<String> accessURLs = new ArrayList<String>();
if (cartridgeInfo.getPortMappings() != null) {
- for (org.apache.stratos.cloud.controller.util.xsd.PortMapping portMapping : cartridgeInfo
+ for (org.apache.stratos.cloud.controller.pojo.PortMapping portMapping : cartridgeInfo
.getPortMappings()) {
if (portMapping != null) {
try {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/CartridgeSubscriptionTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/CartridgeSubscriptionTest.java b/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/CartridgeSubscriptionTest.java
index e13ba10..9471635 100644
--- a/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/CartridgeSubscriptionTest.java
+++ b/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/CartridgeSubscriptionTest.java
@@ -20,10 +20,11 @@
package org.apache.stratos.adc.mgt.test;
import junit.framework.TestCase;
+
import org.apache.stratos.adc.mgt.exception.ADCException;
import org.apache.stratos.adc.mgt.subscription.CartridgeSubscription;
import org.apache.stratos.adc.mgt.subscription.factory.CartridgeSubscriptionFactory;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
public class CartridgeSubscriptionTest extends TestCase {
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8cb502cd/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/PayloadTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/PayloadTest.java b/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/PayloadTest.java
index 564f8d3..a8c81a7 100644
--- a/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/PayloadTest.java
+++ b/components/org.apache.stratos.adc.mgt/src/test/java/org/apache/stratos/adc/mgt/test/PayloadTest.java
@@ -20,14 +20,15 @@
package org.apache.stratos.adc.mgt.test;
import junit.framework.TestCase;
+
import org.apache.stratos.adc.mgt.dto.Policy;
import org.apache.stratos.adc.mgt.exception.ADCException;
import org.apache.stratos.adc.mgt.payload.Payload;
import org.apache.stratos.adc.mgt.payload.PayloadArg;
import org.apache.stratos.adc.mgt.payload.PayloadFactory;
import org.apache.stratos.adc.mgt.utils.CartridgeConstants;
-import org.apache.stratos.cloud.controller.util.xsd.CartridgeInfo;
-import org.apache.stratos.cloud.controller.util.xsd.PortMapping;
+import org.apache.stratos.cloud.controller.pojo.CartridgeInfo;
+import org.apache.stratos.cloud.controller.pojo.PortMapping;
import java.math.BigDecimal;
[6/8] git commit: changes to WSDL with latest CC changes and change
POM to map namespaces correctly to CC packages
Posted by ni...@apache.org.
changes to WSDL with latest CC changes and change POM to map namespaces correctly to CC packages
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/f942c242
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/f942c242
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/f942c242
Branch: refs/heads/master
Commit: f942c24257e2bdc30bc8a9f9b291d8cdc56eb58c
Parents: 25555e8
Author: Nirmal Fernando <ni...@apache.org>
Authored: Thu Nov 28 21:28:49 2013 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Thu Nov 28 21:28:49 2013 +0530
----------------------------------------------------------------------
.../pom.xml | 13 +-
.../main/resources/CloudControllerService.wsdl | 122 ++++++++++---------
2 files changed, 70 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f942c242/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml b/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml
index 985e3ab..dc6fae7 100644
--- a/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml
+++ b/service-stubs/org.apache.stratos.cloud.controller.service.stub/pom.xml
@@ -47,7 +47,7 @@
<configuration>
<tasks>
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
- <arg line="-uri src/main/resources/CloudControllerService.wsdl -u -uw -o target/generated-code -p org.apache.stratos.cloud.controller.stub"/>
+ <arg line="-uri src/main/resources/CloudControllerService.wsdl -u -uw -o target/generated-code -p org.apache.stratos.cloud.controller.stub -ns2p http://policy.deployment.controller.cloud.stratos.apache.org/xsd=org.apache.stratos.cloud.controller.deployment.policy,http://partition.deployment.controller.cloud.stratos.apache.org/xsd=org.apache.stratos.cloud.controller.deployment.partition,http://exception.controller.cloud.stratos.apache.org/xsd=org.apache.stratos.cloud.controller.exception,http://pojo.controller.cloud.stratos.apache.org/xsd=org.apache.stratos.cloud.controller.pojo"/>
<classpath refid="maven.dependency.classpath"/>
<classpath refid="maven.compile.classpath"/>
<classpath refid="maven.runtime.classpath"/>
@@ -87,12 +87,11 @@
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Export-Package>
- org.apache.stratos.cloud.controller.exception.xsd.*; version=${project.version},
- org.apache.stratos.cloud.controller.stub.*; version=${project.version},
- org.apache.stratos.cloud.controller.pojo.xsd.*; version=${project.version},
- org.apache.stratos.cloud.controller.util.xsd.*; version=${project.version},
- org.apache.stratos.messaging.domain.policy.xsd.*; version=${project.version},
- org.apache.stratos.messaging.util.xsd.*; version=${project.version}
+ org.apache.stratos.cloud.controller.exception.*; version=${project.version},
+ org.apache.stratos.cloud.controller.deployment.policy.*; version=${project.version},
+ org.apache.stratos.cloud.controller.deployment.partition.*; version=${project.version},
+ org.apache.stratos.cloud.controller.pojo.*; version=${project.version},
+ org.apache.stratos.cloud.controller.stub.*; version=${project.version}
</Export-Package>
<Import-Package>
*;resolution:=optional
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f942c242/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl b/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
index 6726178..61e2f5e 100644
--- a/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
+++ b/service-stubs/org.apache.stratos.cloud.controller.service.stub/src/main/resources/CloudControllerService.wsdl
@@ -1,26 +1,6 @@
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ax29="http://pojo.controller.cloud.stratos.apache.org/xsd" xmlns:ns="http://impl.controller.cloud.stratos.apache.org" xmlns:ax25="http://policy.domain.messaging.stratos.apache.org/xsd" xmlns:ax26="http://util.messaging.stratos.apache.org/xsd" xmlns:ax23="http://exception.controller.cloud.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ax212="http://util.controller.cloud.stratos.apache.org/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.controller.cloud.stratos.apache.org">
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ax29="http://policy.deployment.controller.cloud.stratos.apache.org/xsd" xmlns:ns="http://impl.controller.cloud.stratos.apache.org" xmlns:ax25="http://partition.deployment.controller.cloud.stratos.apache.org/xsd" xmlns:ax26="http://pojo.controller.cloud.stratos.apache.org/xsd" xmlns:ax23="http://exception.controller.cloud.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.controller.cloud.stratos.apache.org">
<wsdl:documentation>CloudControllerService</wsdl:documentation>
<wsdl:types>
- <xs:schema xmlns:ax27="http://util.messaging.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://policy.domain.messaging.stratos.apache.org/xsd">
- <xs:import namespace="http://util.messaging.stratos.apache.org/xsd"/>
- <xs:complexType name="Partition">
- <xs:sequence>
- <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="partitionMax" type="xs:int"/>
- <xs:element minOccurs="0" name="partitionMembersMax" type="xs:int"/>
- <xs:element minOccurs="0" name="partitionMembersMin" type="xs:int"/>
- <xs:element minOccurs="0" name="partitionMin" type="xs:int"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax27:Properties"/>
- <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="DeploymentPolicy">
- <xs:sequence>
- <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="partitionGroups" nillable="true" type="xs:anyType"/>
- </xs:sequence>
- </xs:complexType>
- </xs:schema>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://exception.controller.cloud.stratos.apache.org/xsd">
<xs:complexType name="InvalidPartitionException">
<xs:sequence/>
@@ -41,11 +21,11 @@
<xs:sequence/>
</xs:complexType>
</xs:schema>
- <xs:schema xmlns:ax214="http://util.controller.cloud.stratos.apache.org/xsd" xmlns:ax28="http://policy.domain.messaging.stratos.apache.org/xsd" xmlns:ax211="http://pojo.controller.cloud.stratos.apache.org/xsd" xmlns:ax24="http://exception.controller.cloud.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.controller.cloud.stratos.apache.org">
+ <xs:schema xmlns:ax212="http://pojo.controller.cloud.stratos.apache.org/xsd" xmlns:ax28="http://partition.deployment.controller.cloud.stratos.apache.org/xsd" xmlns:ax211="http://policy.deployment.controller.cloud.stratos.apache.org/xsd" xmlns:ax24="http://exception.controller.cloud.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.controller.cloud.stratos.apache.org">
<xs:import namespace="http://exception.controller.cloud.stratos.apache.org/xsd"/>
- <xs:import namespace="http://policy.domain.messaging.stratos.apache.org/xsd"/>
+ <xs:import namespace="http://partition.deployment.controller.cloud.stratos.apache.org/xsd"/>
+ <xs:import namespace="http://policy.deployment.controller.cloud.stratos.apache.org/xsd"/>
<xs:import namespace="http://pojo.controller.cloud.stratos.apache.org/xsd"/>
- <xs:import namespace="http://util.controller.cloud.stratos.apache.org/xsd"/>
<xs:element name="CloudControllerServiceInvalidPartitionException">
<xs:complexType>
<xs:sequence>
@@ -78,7 +58,7 @@
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax28:DeploymentPolicy"/>
+ <xs:element minOccurs="0" name="deploymentPolicy" nillable="true" type="ax29:DeploymentPolicy"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -163,7 +143,7 @@
<xs:element name="registerService">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="registrant" nillable="true" type="ax29:Registrant"/>
+ <xs:element minOccurs="0" name="registrant" nillable="true" type="ax212:Registrant"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -210,24 +190,56 @@
<xs:element name="getCartridgeInfoResponse">
<xs:complexType>
<xs:sequence>
- <xs:element minOccurs="0" name="return" nillable="true" type="ax214:CartridgeInfo"/>
+ <xs:element minOccurs="0" name="return" nillable="true" type="ax212:CartridgeInfo"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
- <xs:schema xmlns:ax213="http://util.messaging.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://util.controller.cloud.stratos.apache.org/xsd">
- <xs:import namespace="http://util.messaging.stratos.apache.org/xsd"/>
+ <xs:schema xmlns:ax210="http://partition.deployment.controller.cloud.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://policy.deployment.controller.cloud.stratos.apache.org/xsd">
+ <xs:import namespace="http://partition.deployment.controller.cloud.stratos.apache.org/xsd"/>
+ <xs:complexType name="DeploymentPolicy">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="allPartitions" nillable="true" type="xs:anyType"/>
+ <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="partitionGroup" nillable="true" type="ax210:PartitionGroup"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="partitionGroups" nillable="true" type="ax210:PartitionGroup"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pojo.controller.cloud.stratos.apache.org/xsd">
+ <xs:complexType name="Properties">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax26:Property"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Property">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="value" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="Registrant">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="autoScalerPolicyName" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="payload" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax26:Properties"/>
+ <xs:element minOccurs="0" name="tenantRange" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="CartridgeInfo">
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="appTypes" nillable="true" type="ax212:AppType"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="appTypes" nillable="true" type="ax26:AppType"/>
<xs:element minOccurs="0" name="baseDir" nillable="true" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="deploymentDirs" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="description" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="displayName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="multiTenant" type="xs:boolean"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="portMappings" nillable="true" type="ax212:PortMapping"/>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax213:Property"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="portMappings" nillable="true" type="ax26:PortMapping"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax26:Property"/>
<xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="type" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="version" nillable="true" type="xs:string"/>
@@ -247,30 +259,24 @@
</xs:sequence>
</xs:complexType>
</xs:schema>
- <xs:schema xmlns:ax210="http://util.messaging.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pojo.controller.cloud.stratos.apache.org/xsd">
- <xs:import namespace="http://util.messaging.stratos.apache.org/xsd"/>
- <xs:complexType name="Registrant">
- <xs:sequence>
- <xs:element minOccurs="0" name="autoScalerPolicyName" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="cartridgeType" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="payload" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="properties" nillable="true" type="ax210:Properties"/>
- <xs:element minOccurs="0" name="tenantRange" nillable="true" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
- </xs:schema>
- <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://util.messaging.stratos.apache.org/xsd">
- <xs:complexType name="Properties">
+ <xs:schema xmlns:ax27="http://pojo.controller.cloud.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://partition.deployment.controller.cloud.stratos.apache.org/xsd">
+ <xs:import namespace="http://pojo.controller.cloud.stratos.apache.org/xsd"/>
+ <xs:complexType name="Partition">
<xs:sequence>
- <xs:element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="ax26:Property"/>
+ <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="partitionMax" type="xs:int"/>
+ <xs:element minOccurs="0" name="partitionMembersMax" type="xs:int"/>
+ <xs:element minOccurs="0" name="partitionMembersMin" type="xs:int"/>
+ <xs:element minOccurs="0" name="partitionMin" type="xs:int"/>
+ <xs:element minOccurs="0" name="properties" nillable="true" type="ax27:Properties"/>
+ <xs:element minOccurs="0" name="provider" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="Property">
+ <xs:complexType name="PartitionGroup">
<xs:sequence>
- <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="value" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="partitionAlgo" nillable="true" type="xs:string"/>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="partitions" nillable="true" type="ax25:Partition"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
@@ -738,22 +744,22 @@
</wsdl:binding>
<wsdl:service name="CloudControllerService">
<wsdl:port name="CloudControllerServiceHttpSoap11Endpoint" binding="ns:CloudControllerServiceSoap11Binding">
- <soap:address location="http://10.148.149.181:9764/services/CloudControllerService.CloudControllerServiceHttpSoap11Endpoint/"/>
+ <soap:address location="http://192.168.1.2:9764/services/CloudControllerService.CloudControllerServiceHttpSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="CloudControllerServiceHttpsSoap11Endpoint" binding="ns:CloudControllerServiceSoap11Binding">
- <soap:address location="https://10.148.149.181:9444/services/CloudControllerService.CloudControllerServiceHttpsSoap11Endpoint/"/>
+ <soap:address location="https://192.168.1.2:9444/services/CloudControllerService.CloudControllerServiceHttpsSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="CloudControllerServiceHttpSoap12Endpoint" binding="ns:CloudControllerServiceSoap12Binding">
- <soap12:address location="http://10.148.149.181:9764/services/CloudControllerService.CloudControllerServiceHttpSoap12Endpoint/"/>
+ <soap12:address location="http://192.168.1.2:9764/services/CloudControllerService.CloudControllerServiceHttpSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="CloudControllerServiceHttpsSoap12Endpoint" binding="ns:CloudControllerServiceSoap12Binding">
- <soap12:address location="https://10.148.149.181:9444/services/CloudControllerService.CloudControllerServiceHttpsSoap12Endpoint/"/>
+ <soap12:address location="https://192.168.1.2:9444/services/CloudControllerService.CloudControllerServiceHttpsSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="CloudControllerServiceHttpEndpoint" binding="ns:CloudControllerServiceHttpBinding">
- <http:address location="http://10.148.149.181:9764/services/CloudControllerService.CloudControllerServiceHttpEndpoint/"/>
+ <http:address location="http://192.168.1.2:9764/services/CloudControllerService.CloudControllerServiceHttpEndpoint/"/>
</wsdl:port>
<wsdl:port name="CloudControllerServiceHttpsEndpoint" binding="ns:CloudControllerServiceHttpBinding">
- <http:address location="https://10.148.149.181:9444/services/CloudControllerService.CloudControllerServiceHttpsEndpoint/"/>
+ <http:address location="https://192.168.1.2:9444/services/CloudControllerService.CloudControllerServiceHttpsEndpoint/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
\ No newline at end of file