Repository: stratos
Updated Branches:
  refs/heads/master 34726f2da -> ba1d6f381


instance context initial impl.


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ba1d6f38
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ba1d6f38
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ba1d6f38

Branch: refs/heads/master
Commit: ba1d6f3815afe3636bea02ccb76faa06cdc083bb
Parents: 34726f2
Author: Isuru Haththotuwa <isu...@apache.org>
Authored: Fri Nov 21 11:10:36 2014 +0530
Committer: Isuru Haththotuwa <isu...@apache.org>
Committed: Fri Nov 21 11:11:33 2014 +0530

----------------------------------------------------------------------
 .../domain/applications/ParentComponent.java    | 54 +++++++++++++++++++-
 .../context/ClusterInstanceContext.java         | 24 +++++++++
 .../instance/context/GroupInstanceContext.java  | 24 +++++++++
 .../instance/context/InstanceContext.java       | 51 ++++++++++++++++++
 4 files changed, 152 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/ba1d6f38/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/ParentComponent.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/ParentComponent.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/ParentComponent.java
index 0ede0f1..b92a854 100644
--- 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/ParentComponent.java
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/ParentComponent.java
@@ -19,6 +19,9 @@
 
 package org.apache.stratos.messaging.domain.applications;
 
+import 
org.apache.stratos.messaging.domain.applications.scaling.instance.context.GroupInstanceContext;
+import 
org.apache.stratos.messaging.domain.applications.scaling.instance.context.InstanceContext;
+
 import java.io.Serializable;
 import java.util.*;
 
@@ -35,11 +38,14 @@ public abstract class ParentComponent implements 
Serializable {
     private Map<String, Group> aliasToGroupMap;
     // Cluster Id map, key = subscription alias for the cartridge type
     private Map<String, ClusterDataHolder> aliasToClusterDataMap;
-    // Application status
+    // Group/Cluster Instance Context map
+    private Map<AliasAndGroupInstanceId, InstanceContext> 
aliasAndGroupInstanceIdInstanceContextMap;
 
     public ParentComponent () {
         aliasToGroupMap = new HashMap<String, Group>();
         aliasToClusterDataMap = new HashMap<String, ClusterDataHolder>();
+        aliasAndGroupInstanceIdInstanceContextMap =
+                new HashMap<AliasAndGroupInstanceId, InstanceContext>();
     }
 
     /**
@@ -209,4 +215,50 @@ public abstract class ParentComponent implements 
Serializable {
             }
         }
     }
+
+    private class AliasAndGroupInstanceId {
+
+        private String groupAlias;
+        private String groupInstanceId;
+
+        public AliasAndGroupInstanceId (String groupAlias, String 
groupInstanceId) {
+            this.groupAlias = groupAlias;
+            this.groupInstanceId = groupInstanceId;
+        }
+
+
+        public String getGroupAlias() {
+            return groupAlias;
+        }
+
+        public void setGroupAlias(String groupAlias) {
+            this.groupAlias = groupAlias;
+        }
+
+        public String getGroupInstanceId() {
+            return groupInstanceId;
+        }
+
+        public void setGroupInstanceId(String groupInstanceId) {
+            this.groupInstanceId = groupInstanceId;
+        }
+
+        public boolean equals(Object other) {
+            if(other == null || !(other instanceof AliasAndGroupInstanceId)) {
+                return false;
+            }
+
+            if(this == other) {
+                return true;
+            }
+
+            AliasAndGroupInstanceId that = (AliasAndGroupInstanceId)other;
+            return this.groupAlias.equals(that.groupAlias) &&
+                    this.groupInstanceId.equals(that.groupInstanceId);
+        }
+
+        public int hashCode () {
+            return groupAlias.hashCode() + groupInstanceId.hashCode();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/ba1d6f38/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/ClusterInstanceContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/ClusterInstanceContext.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/ClusterInstanceContext.java
new file mode 100644
index 0000000..e6a810d
--- /dev/null
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/ClusterInstanceContext.java
@@ -0,0 +1,24 @@
+/*
+ * 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.applications.scaling.instance.context;
+
+public class ClusterInstanceContext extends InstanceContext {
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ba1d6f38/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/GroupInstanceContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/GroupInstanceContext.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/GroupInstanceContext.java
new file mode 100644
index 0000000..6d452d3
--- /dev/null
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/GroupInstanceContext.java
@@ -0,0 +1,24 @@
+/*
+ * 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.applications.scaling.instance.context;
+
+public class GroupInstanceContext extends InstanceContext {
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ba1d6f38/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/InstanceContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/InstanceContext.java
 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/InstanceContext.java
new file mode 100644
index 0000000..3a45308
--- /dev/null
+++ 
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/applications/scaling/instance/context/InstanceContext.java
@@ -0,0 +1,51 @@
+/*
+ * 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.applications.scaling.instance.context;
+
+import org.apache.stratos.messaging.domain.topology.lifecycle.LifeCycleState;
+
+import java.util.Properties;
+
+public abstract class InstanceContext {
+
+    private LifeCycleState state;
+
+    private Properties instanceProperties;
+
+    public InstanceContext () {
+        this.instanceProperties = new Properties();
+    }
+
+    public LifeCycleState getState() {
+        return state;
+    }
+
+    public void setState(LifeCycleState state) {
+        this.state = state;
+    }
+
+    public void addProperty (String name, String value) {
+        instanceProperties.put(name, value);
+    }
+
+    public String getProperty (String name) {
+        return instanceProperties.getProperty(name);
+    }
+}

Reply via email to