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 <[email protected]> Authored: Thu Nov 28 15:47:49 2013 +0530 Committer: Nirmal Fernando <[email protected]> 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()) {
