Updated Branches: refs/heads/master 173167ba5 -> 9de52a223
Updated topology domain model and added Cloud, Region and Zone Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/9de52a22 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/9de52a22 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/9de52a22 Branch: refs/heads/master Commit: 9de52a223b2184d24665da294d8ec507793740e8 Parents: 173167b Author: Imesh Gunaratne <[email protected]> Authored: Mon Oct 14 23:38:10 2013 +0530 Committer: Imesh Gunaratne <[email protected]> Committed: Mon Oct 14 23:38:10 2013 +0530 ---------------------------------------------------------------------- .../messaging/domain/topology/Cloud.java | 84 ++++++++++++++++++++ .../messaging/domain/topology/Cluster.java | 51 +++++------- .../messaging/domain/topology/Member.java | 34 ++------ .../messaging/domain/topology/MemberStatus.java | 2 +- .../stratos/messaging/domain/topology/Port.java | 14 ++-- .../messaging/domain/topology/Region.java | 79 ++++++++++++++++++ .../messaging/domain/topology/Service.java | 30 +++---- .../messaging/domain/topology/Topology.java | 12 +-- .../stratos/messaging/domain/topology/Zone.java | 55 +++++++++++++ 9 files changed, 276 insertions(+), 85 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9de52a22/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cloud.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cloud.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cloud.java new file mode 100644 index 0000000..8c3856a --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cloud.java @@ -0,0 +1,84 @@ +/* + * 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.topology; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +/** + * Defines an IaaS cloud. + */ +public class Cloud { + private String cloudId; + private String cloudName; + private Properties properties; + private Map<String, Region> regionMap; + + public Cloud() { + this.regionMap = new HashMap<String, Region>(); + } + + public String getCloudId() { + return cloudId; + } + + public void setCloudId(String cloudId) { + this.cloudId = cloudId; + } + + public String getCloudName() { + return cloudName; + } + + public void setCloudName(String cloudName) { + this.cloudName = cloudName; + } + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } + + public Collection<Region> getRegions() { + return regionMap.values(); + } + + public void addRegion(Region region) { + regionMap.put(region.getRegionId(), region); + } + + public void removeRegion(Region region) { + regionMap.remove(region.getRegionId()); + } + + public void removeRegion(String regionId) { + regionMap.remove(regionId); + } + + public Region getRegion(String regionId) { + return regionMap.get(regionId); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9de52a22/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java index 8b4cc47..8f11579 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Cluster.java @@ -22,24 +22,23 @@ package org.apache.stratos.messaging.domain.topology; import org.apache.stratos.messaging.util.Util; import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Defines a cluster of a service. */ public class Cluster implements Serializable { private String clusterId; - private String domainName; private String tenantRange; - private String cartridgeType; + private Cloud cloud; + private Region region; + private Zone zone; // Key: Member.memberId - private Map<String, Member> members; + private Map<String, Member> memberMap; + private Properties properties; public Cluster() { - this.members = new HashMap<String, Member>(); + this.memberMap = new HashMap<String, Member>(); } public String getClusterId() { @@ -50,14 +49,6 @@ public class Cluster implements Serializable { this.clusterId = clusterId; } - public String getDomainName() { - return domainName; - } - - public void setDomainName(String domainName) { - this.domainName = domainName; - } - public String getTenantRange() { return tenantRange; } @@ -67,32 +58,32 @@ public class Cluster implements Serializable { this.tenantRange = tenantRange; } - public String getCartridgeType() { - return cartridgeType; - } - - public void setCartridgeType(String cartridgeType) { - this.cartridgeType = cartridgeType; - } - - public Map<String, Member> getMembers() { - return members; + public Collection<Member> getMembers() { + return memberMap.values(); } public void addMember(Member member) { - members.put(member.getMemberId(), member); + memberMap.put(member.getMemberId(), member); } public void removeMember(Member member) { - members.remove(member.getMemberId()); + memberMap.remove(member.getMemberId()); } public void removeMember(String memberId) { - members.remove(memberId); + memberMap.remove(memberId); } public Member getMember(String memberId) { - return members.get(memberId); + return memberMap.get(memberId); + } + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; } } http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9de52a22/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 fc6a417..8fd27b9 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 @@ -31,8 +31,6 @@ import java.util.Properties; public class Member implements Serializable { private String memberId; private String hostName; - private String cloud; - private String region; private MemberStatus status; private Map<String, Port> portMap; private Properties properties; @@ -57,22 +55,6 @@ public class Member implements Serializable { this.hostName = hostName; } - public String getCloud() { - return cloud; - } - - public void setCloud(String cloud) { - this.cloud = cloud; - } - - public String getRegion() { - return region; - } - - public void setRegion(String region) { - this.region = region; - } - public MemberStatus getStatus() { return status; } @@ -82,7 +64,7 @@ public class Member implements Serializable { } public boolean isActive() { - return (this.status == MemberStatus.Active); + return (this.status == MemberStatus.Activated); } public Collection<Port> getPorts() { @@ -90,7 +72,7 @@ public class Member implements Serializable { } public void addPort(Port port) { - this.portMap.put(port.getName(), port); + this.portMap.put(port.getProtocol(), port); } public void addPorts(Collection<Port> ports) { @@ -100,19 +82,19 @@ public class Member implements Serializable { } public void removePort(Port port) { - this.portMap.remove(port.getName()); + this.portMap.remove(port.getProtocol()); } - public void removePort(String portName) { - this.portMap.remove(portName); + public void removePort(String protocol) { + this.portMap.remove(protocol); } public boolean portExists(Port port) { - return this.portMap.containsKey(port.getName()); + return this.portMap.containsKey(port.getProtocol()); } - public Port getPort(String portName) { - return this.portMap.get(portName); + public Port getPort(String protocol) { + return this.portMap.get(protocol); } public Properties getProperties() { http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9de52a22/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/MemberStatus.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/MemberStatus.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/MemberStatus.java index 2c303fb..5bd24ee 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/MemberStatus.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/MemberStatus.java @@ -23,5 +23,5 @@ package org.apache.stratos.messaging.domain.topology; * Represents status of a member during its lifecycle. */ public enum MemberStatus { - Subscribed, Starting, Active, Suspended, UnSubscribed + Starting, Activated, Suspended, Terminated } http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9de52a22/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Port.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Port.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Port.java index 58464b0..1b7e2a5 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Port.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Port.java @@ -23,22 +23,22 @@ package org.apache.stratos.messaging.domain.topology; * Defines an application port. */ public class Port { - private String name; + private String protocol; private int value; private int proxy; - public Port(String name, int value, int proxy) { - setName(name); + public Port(String protocol, int value, int proxy) { + setProtocol(protocol); setValue(value); setProxy(proxy); } - public String getName() { - return name; + public String getProtocol() { + return protocol; } - public void setName(String name) { - this.name = name; + public void setProtocol(String protocol) { + this.protocol = protocol; } public int getValue() { http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9de52a22/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Region.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Region.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Region.java new file mode 100644 index 0000000..24cc2b4 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Region.java @@ -0,0 +1,79 @@ +/* + * 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.topology; + +import java.util.Collection; +import java.util.Map; +import java.util.Properties; + +/** + * Defines a geographical region of IaaS cloud. + */ +public class Region { + private String regionId; + private String regionName; + private Properties properties; + private Map<String, Zone> zoneMap; + + public String getRegionId() { + return regionId; + } + + public void setRegionId(String regionId) { + this.regionId = regionId; + } + + public String getRegionName() { + return regionName; + } + + public void setRegionName(String regionName) { + this.regionName = regionName; + } + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } + + public Collection<Zone> getZones() { + return zoneMap.values(); + } + + public void addZone(Zone zone) { + zoneMap.put(zone.getZoneId(), zone); + } + + public void removeZone(Zone zone) { + zoneMap.remove(zone.getZoneId()); + } + + public void removeZone(String zoneId) { + zoneMap.remove(zoneId); + } + + public Zone getZone(String zoneId) { + return zoneMap.get(zoneId); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9de52a22/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java index 37a975d..cc5b2dd 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Service.java @@ -25,22 +25,22 @@ import java.util.*; * Defines a service in the topology. A service represents a cartridge type. */ public class Service { - private String serviceId; + private String serviceName; private String domainName; - private String name; // Key: Cluster.clusterId private Map<String, Cluster> clusterMap; + private Properties properties; public Service() { this.clusterMap = new HashMap<String, Cluster>(); } - public String getServiceId() { - return serviceId; + public String getServiceName() { + return serviceName; } - public void setServiceId(String serviceId) { - this.serviceId = serviceId; + public void setServiceName(String serviceName) { + this.serviceName = serviceName; } public String getDomainName() { @@ -51,14 +51,6 @@ public class Service { this.domainName = domainName; } - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - public Collection<Cluster> getClusterMap() { return clusterMap.values(); } @@ -76,10 +68,18 @@ public class Service { } public boolean clusterExists(Cluster cluster) { - return this.clusterMap.containsKey(cluster.getDomainName()); + return this.clusterMap.containsKey(cluster.getClusterId()); } public Cluster getCluster(String clusterId) { return this.clusterMap.get(clusterId); } + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } } http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9de52a22/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 be8f0e4..df4bb02 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 @@ -26,7 +26,7 @@ import java.util.*; * Defines a topology of serviceMap in Stratos. */ public class Topology implements Serializable { - // Key: Service.serviceId + // Key: Service.serviceName private Map<String, Service> serviceMap; public Topology() { @@ -38,7 +38,7 @@ public class Topology implements Serializable { } public void addService(Service service) { - this.serviceMap.put(service.getServiceId(), service); + this.serviceMap.put(service.getServiceName(), service); } public void addServices(Collection<Service> services) { @@ -51,15 +51,15 @@ public class Topology implements Serializable { this.serviceMap.remove(service.getDomainName()); } - public void removeService(String serviceId) { - this.serviceMap.remove(serviceId); + public void removeService(String serviceName) { + this.serviceMap.remove(serviceName); } public boolean serviceExists(Service service) { return this.serviceMap.containsKey(service.getDomainName()); } - public Service getService(String serviceId) { - return this.serviceMap.get(serviceId); + public Service getService(String serviceName) { + return this.serviceMap.get(serviceName); } } http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/9de52a22/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Zone.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Zone.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Zone.java new file mode 100644 index 0000000..67d6e47 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Zone.java @@ -0,0 +1,55 @@ +/* + * 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.topology; + +import java.util.Properties; + +/** + * Defines a zone in IaaS cloud region. + */ +public class Zone { + private String zoneId; + private String zoneName; + private Properties properties; + + public String getZoneId() { + return zoneId; + } + + public void setZoneId(String zoneId) { + this.zoneId = zoneId; + } + + public String getZoneName() { + return zoneName; + } + + public void setZoneName(String zoneName) { + this.zoneName = zoneName; + } + + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties properties) { + this.properties = properties; + } +}
