You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2013/08/12 15:47:07 UTC
[01/10] git commit: Moved jclouds.version to root pom.xml
Updated Branches:
refs/heads/master 9ef2a45a3 -> 84dc901f9
Moved jclouds.version to root pom.xml
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/8e7f4ace
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/8e7f4ace
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/8e7f4ace
Branch: refs/heads/master
Commit: 8e7f4ace485a4463db1ca4740ec0a212d35e1d56
Parents: cc34c5f
Author: Isuru Perera <is...@apache.org>
Authored: Thu Aug 8 15:13:20 2013 +0530
Committer: Isuru Perera <is...@apache.org>
Committed: Thu Aug 8 15:13:20 2013 +0530
----------------------------------------------------------------------
components/pom.xml | 1 -
features/pom.xml | 1 -
pom.xml | 1 +
3 files changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8e7f4ace/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 305fcc6..13b2596 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -275,7 +275,6 @@
<junit.version>4.11</junit.version>
<synapse.core.version>2.1.1-wso2v4</synapse.core.version>
<google.guava.wso2.version>12.0.0.wso2v1</google.guava.wso2.version>
- <jclouds.version>1.5.0-beta.5</jclouds.version>
<carbon.platform.version>4.1.0</carbon.platform.version>
<version.equinox.osgi.services>3.3.100.v20120522-1822</version.equinox.osgi.services>
<version.equinox.osgi>3.8.1.v20120830-144521</version.equinox.osgi>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8e7f4ace/features/pom.xml
----------------------------------------------------------------------
diff --git a/features/pom.xml b/features/pom.xml
index 38ec35a..d15af34 100644
--- a/features/pom.xml
+++ b/features/pom.xml
@@ -92,7 +92,6 @@
<carbon.patch.version.4.1.1>4.1.1</carbon.patch.version.4.1.1>
<carbon.p2.plugin.version>1.5.2</carbon.p2.plugin.version>
<synapse.wso2.version>2.1.1-wso2v4</synapse.wso2.version>
- <jclouds.version>1.5.0-beta.5</jclouds.version>
<google.guava.wso2.version>12.0.0.wso2v1</google.guava.wso2.version>
<google.guice.wso2.version>3.0.wso2v1</google.guice.wso2.version>
<com.google.guice.assistedinject.wso2.version>3.0.wso2v1</com.google.guice.assistedinject.wso2.version>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8e7f4ace/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 44c3fdd..963d5a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -169,5 +169,6 @@
<carbon.platform.package.import.version.range>[4.1.0, 4.2.0)</carbon.platform.package.import.version.range>
<carbon.platform.package.export.version>4.1.0</carbon.platform.package.export.version>
<axis2.osgi.version>1.6.1.wso2v9</axis2.osgi.version>
+ <jclouds.version>1.5.0-beta.5</jclouds.version>
</properties>
</project>
[06/10] git commit: Removed jclouds.version commented property
Posted by is...@apache.org.
Removed jclouds.version commented property
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/f04cb4a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/f04cb4a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/f04cb4a4
Branch: refs/heads/master
Commit: f04cb4a4234fc741be50a008fbe30ecc8b4f77b7
Parents: 3f2308f
Author: Isuru Perera <is...@apache.org>
Authored: Thu Aug 8 18:25:35 2013 +0530
Committer: Isuru Perera <is...@apache.org>
Committed: Thu Aug 8 18:25:35 2013 +0530
----------------------------------------------------------------------
components/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f04cb4a4/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 62abe5b..3157e0d 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -375,7 +375,7 @@
<antlr-runtime.orbit.version>3.2.0.wso2v1</antlr-runtime.orbit.version>
<siddhi.orbit.version>1.0.0.wso2v1</siddhi.orbit.version>
<gson.version>2.1</gson.version>
- <jclouds.version>1.5.0-beta.5</jclouds.version-->
+ -->
</properties>
</project>
[09/10] git commit: STRATOS-41: Upgraded jclouds version to
1.6.1-incubating
Posted by is...@apache.org.
STRATOS-41: Upgraded jclouds version to 1.6.1-incubating
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/3a2cdccf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/3a2cdccf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/3a2cdccf
Branch: refs/heads/master
Commit: 3a2cdccf3bbe0e46bb7bddb7795d1d209d9b6ba2
Parents: 4ceeb87
Author: Isuru Perera <is...@apache.org>
Authored: Sat Aug 10 21:05:34 2013 +0530
Committer: Isuru Perera <is...@apache.org>
Committed: Sat Aug 10 21:05:34 2013 +0530
----------------------------------------------------------------------
.../org.apache.stratos.cloud.controller/pom.xml | 69 ++++----------------
.../pom.xml | 60 ++++++++---------
pom.xml | 2 +-
3 files changed, 45 insertions(+), 86 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a2cdccf/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 2696030..e7ba800 100644
--- a/components/org.apache.stratos.cloud.controller/pom.xml
+++ b/components/org.apache.stratos.cloud.controller/pom.xml
@@ -35,47 +35,6 @@
<build>
<plugins>
- <!--plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>1.7.1</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes>
- <include>org.jclouds:*</include>
- <include>org.jclouds.*:*</include>
- </includes>
- </artifactSet>
- <filtering>true</filtering>
- <filters>
- <filter>
- <artifact>org.jclouds*:*</artifact>
- <includes>
- <include>META-INF/services/org.jclouds.apis.ApiMetadata</include>
- <include>META-INF/services/org.jclouds.providers.ProviderMetadata</include>
- </includes>
- </filter>
- </filters>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer">
- </transformer>
- </transformers>
- </configuration>
- </execution>
- </executions>
- </plugin-->
- <!--plugin>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-aar-maven-plugin</artifactId>
- <version>1.4</version>
- <extensions>true</extensions>
- </plugin-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
@@ -106,8 +65,8 @@
!org.apache.commons.logging,
org.apache.commons.logging; version=0.0.0,
org.wso2.carbon.utils.*,
- <!--org.jclouds.compute*;version="${jclouds.version}";resolution:=optional,
- org.jclouds*;version="${jclouds.version}",-->
+ org.jclouds.compute*;version="${jclouds.version}";resolution:=optional,
+ org.jclouds*;version="${jclouds.version}",
*; resolution:=optional
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
@@ -181,17 +140,17 @@
<!-- jclouds dependencies -->
<dependency>
- <groupId>org.jclouds</groupId>
+ <groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds</groupId>
+ <groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.driver</groupId>
+ <groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-bouncycastle</artifactId>
<version>${jclouds.version}</version>
<exclusions>
@@ -202,47 +161,47 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.jclouds.driver</groupId>
+ <groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.driver</groupId>
+ <groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.driver</groupId>
+ <groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-enterprise</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.api</groupId>
+ <groupId>org.apache.jclouds.api</groupId>
<artifactId>ec2</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.provider</groupId>
+ <groupId>org.apache.jclouds.provider</groupId>
<artifactId>aws-ec2</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.api</groupId>
+ <groupId>org.apache.jclouds.api</groupId>
<artifactId>openstack-nova</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.api</groupId>
+ <groupId>org.apache.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds</groupId>
+ <groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-scriptbuilder</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.api</groupId>
+ <groupId>org.apache.jclouds.api</groupId>
<artifactId>vcloud</artifactId>
<version>${jclouds.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a2cdccf/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
----------------------------------------------------------------------
diff --git a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
index d030400..b918b49 100644
--- a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
+++ b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
@@ -40,17 +40,17 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds</groupId>
+ <groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds</groupId>
+ <groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.driver</groupId>
+ <groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-bouncycastle</artifactId>
<version>${jclouds.version}</version>
<exclusions>
@@ -61,49 +61,49 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.jclouds.driver</groupId>
+ <groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.driver</groupId>
+ <groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.driver</groupId>
+ <groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-enterprise</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.api</groupId>
+ <groupId>org.apache.jclouds.api</groupId>
<artifactId>ec2</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.provider</groupId>
+ <groupId>org.apache.jclouds.provider</groupId>
<artifactId>aws-ec2</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.api</groupId>
+ <groupId>org.apache.jclouds.api</groupId>
<artifactId>openstack-nova</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.api</groupId>
+ <groupId>org.apache.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds</groupId>
+ <groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-scriptbuilder</artifactId>
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.api</groupId>
+ <groupId>org.apache.jclouds.api</groupId>
<artifactId>sts</artifactId>
<version>${jclouds.version}</version>
</dependency>
@@ -119,7 +119,7 @@
<version>0.4.wso2v1</version>
</dependency>
<dependency>
- <groupId>org.jclouds.api</groupId>
+ <groupId>org.apache.jclouds.api</groupId>
<artifactId>vcloud</artifactId>
<version>${jclouds.version}</version>
</dependency>
@@ -221,42 +221,42 @@
<bundles>
<bundleDef>org.apache.stratos:org.apache.stratos.cartridge.messages:${project.version}</bundleDef>
<bundleDef>org.apache.stratos:org.apache.stratos.cloud.controller:${project.version}</bundleDef>
- <bundleDef>org.jclouds.driver:jclouds-bouncycastle:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds.driver:jclouds-sshj:${jclouds.version}</bundleDef>
- <!--bundleDef>org.jclouds.driver:jclouds-log4j:${jclouds.version}</bundleDef-->
- <bundleDef>org.jclouds.driver:jclouds-enterprise:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds:jclouds-core:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds:jclouds-compute:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds.api:ec2:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds.api:openstack-nova:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds.api:vcloud:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.driver:jclouds-bouncycastle:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.driver:jclouds-sshj:${jclouds.version}</bundleDef>
+ <!--bundleDef>org.apache.jclouds.driver:jclouds-log4j:${jclouds.version}</bundleDef-->
+ <bundleDef>org.apache.jclouds.driver:jclouds-enterprise:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds:jclouds-core:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds:jclouds-compute:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.api:ec2:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.api:openstack-nova:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.api:vcloud:${jclouds.version}</bundleDef>
<bundleDef>com.jamesmurty.utils.wso2:java-xmlbuilder:0.4.wso2v1</bundleDef>
- <bundleDef>org.jclouds.common:openstack-common:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds.api:openstack-keystone:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds.provider:aws-ec2:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.common:openstack-common:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.api:openstack-keystone:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.provider:aws-ec2:${jclouds.version}</bundleDef>
<bundleDef>com.google.guava:guava:14.0.1</bundleDef>
<bundleDef>com.google.code.gson:gson:${gson2.version}</bundleDef>
<bundleDef>com.google.guice.wso2:guice:${google.guice.wso2.version}</bundleDef>
<bundleDef>com.google.guice.assistedinject.wso2:guice-assistedinject:${com.google.guice.assistedinject.wso2.version}</bundleDef>
<bundleDef>com.sun.jersey:jersey-core:${sun.jersey.version}</bundleDef>
- <bundleDef>org.jclouds:jclouds-scriptbuilder:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds:jclouds-scriptbuilder:${jclouds.version}</bundleDef>
<bundleDef>org.apache.shindig.wso2:shindig:1.1.0.wso2v6</bundleDef>
<bundleDef>org.99soft.guice.wso2:rocoto:6.1.wso2v1</bundleDef>
<bundleDef>org.bouncycastle.wso2:bcprov-jdk16:1.45.wso2v1</bundleDef>
<bundleDef>net.schmizz:sshj:0.8.0</bundleDef>
- <bundleDef>org.jclouds.driver:jclouds-joda:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.driver:jclouds-joda:${jclouds.version}</bundleDef>
<bundleDef>com.jcraft.wso2:jzlib:1.0.7.wso2v1</bundleDef>
- <bundleDef>org.jclouds.driver:jclouds-netty:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.driver:jclouds-netty:${jclouds.version}</bundleDef>
<bundleDef>io.netty:netty:3.3.0.Final</bundleDef>
<bundleDef>commons-io.wso2:commons-io:2.0.0.wso2v1</bundleDef>
<bundleDef>org.slf4j:slf4j-api:1.6.4</bundleDef>
<bundleDef>org.slf4j:slf4j-log4j12:1.6.4</bundleDef>
- <bundleDef>org.jclouds.driver:jclouds-slf4j:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.driver:jclouds-slf4j:${jclouds.version}</bundleDef>
<bundleDef>com.google.common.wso2:google-collect:${google.collect.osgi.version}</bundleDef>
<bundleDef>jdom.wso2:jdom:1.0.0.wso2v1</bundleDef>
<bundleDef>org.json.wso2:json:1.0.0.wso2v1</bundleDef>
<!--bundleDef>org.jaggeryjs:0.9.0.ALPHA2-wso2v2</bundleDef-->
- <bundleDef>org.jclouds.api:sts:${jclouds.version}</bundleDef>
+ <bundleDef>org.apache.jclouds.api:sts:${jclouds.version}</bundleDef>
<bundleDef>javax.ws.rs:jsr311-api:1.1.1</bundleDef>
</bundles>
<importBundles>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a2cdccf/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 210e13a..f395fe6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -169,6 +169,6 @@
<carbon.platform.package.import.version.range>[4.1.0, 4.2.0)</carbon.platform.package.import.version.range>
<carbon.platform.package.export.version>4.1.0</carbon.platform.package.export.version>
<axis2.osgi.version>1.6.1.wso2v9</axis2.osgi.version>
- <jclouds.version>1.6.0</jclouds.version>
+ <jclouds.version>1.6.1-incubating</jclouds.version>
</properties>
</project>
[05/10] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos into
jclouds-upgrade
Posted by is...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos into jclouds-upgrade
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/3f2308f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/3f2308f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/3f2308f2
Branch: refs/heads/master
Commit: 3f2308f25239383b0bd0c7441f40a48659355ebb
Parents: 2490db0 6f2c5ce
Author: Isuru Perera <is...@apache.org>
Authored: Thu Aug 8 16:42:54 2013 +0530
Committer: Isuru Perera <is...@apache.org>
Committed: Thu Aug 8 16:42:54 2013 +0530
----------------------------------------------------------------------
.../src/main/resources/META-INF/services.xml | 2 +-
.../stratos-agent/modules/distribution/pom.xml | 15 ----
.../distribution/src/main/assembly/bin.xml | 14 +++-
.../distribution/src/main/assembly/dist.xml | 39 -----------
.../distribution/src/main/assembly/src.xml | 74 --------------------
5 files changed, 14 insertions(+), 130 deletions(-)
----------------------------------------------------------------------
[08/10] git commit: Upgraded jclouds to 1.6.0 and fixed API issues.
Related to STRATOS-41
Posted by is...@apache.org.
Upgraded jclouds to 1.6.0 and fixed API issues. Related to STRATOS-41
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/4ceeb87a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/4ceeb87a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/4ceeb87a
Branch: refs/heads/master
Commit: 4ceeb87a9e11e3ce5a7325b29252c76e3bdaf4fa
Parents: dc1a21e
Author: Isuru Perera <is...@apache.org>
Authored: Sat Aug 10 20:36:54 2013 +0530
Committer: Isuru Perera <is...@apache.org>
Committed: Sat Aug 10 20:36:54 2013 +0530
----------------------------------------------------------------------
.../org.apache.stratos.cloud.controller/pom.xml | 160 +++++++++----------
.../cloud/controller/iaases/AWSEC2Iaas.java | 33 ++--
.../controller/iaases/OpenstackNovaIaas.java | 64 +++-----
.../impl/CloudControllerServiceImpl.java | 2 +-
.../pom.xml | 47 +++---
features/cloud-controller/pom.xml | 4 -
.../distribution/src/main/resources/launch.ini | 1 +
7 files changed, 141 insertions(+), 170 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4ceeb87a/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 4cd23ae..2696030 100644
--- a/components/org.apache.stratos.cloud.controller/pom.xml
+++ b/components/org.apache.stratos.cloud.controller/pom.xml
@@ -28,7 +28,6 @@
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.stratos</groupId>
<artifactId>org.apache.stratos.cloud.controller</artifactId>
<packaging>bundle</packaging>
<name>Apache Stratos - Cloud Controller</name>
@@ -128,13 +127,11 @@
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
- <version>4.1.0</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
- <version>4.1.0</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.stratos</groupId>
@@ -160,11 +157,11 @@
</exclusions>
</dependency>
-<dependency>
- <groupId>com.google.guava.wso2</groupId>
- <artifactId>guava</artifactId>
- <version>${google.guava.wso2.version}</version>
-</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>14.0.1</version>
+ </dependency>
<dependency>
<groupId>org.wso2.andes.wso2</groupId>
<artifactId>andes-client</artifactId>
@@ -182,85 +179,79 @@
<version>4.1.0</version>
</dependency>
-<!-- Jclouds dependencies -->
- <dependency>
- <groupId>org.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
-<!--
- <dependency>
- <groupId>org.jclouds.api</groupId>
- <artifactId>vcloud</artifactId>
- <version>1.6.0-wso2v1</version>
- </dependency>
--->
- <dependency>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-bouncycastle</artifactId>
- <version>${jclouds.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk16</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-sshj</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-enterprise</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.api</groupId>
- <artifactId>ec2</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.provider</groupId>
- <artifactId>aws-ec2</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.api</groupId>
- <artifactId>openstack-nova</artifactId>
- <version>${jclouds.wso2.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.api</groupId>
- <artifactId>openstack-keystone</artifactId>
- <version>${jclouds.wso2.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds</groupId>
- <artifactId>jclouds-scriptbuilder</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
+ <!-- jclouds dependencies -->
+ <dependency>
+ <groupId>org.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds.driver</groupId>
+ <artifactId>jclouds-bouncycastle</artifactId>
+ <version>${jclouds.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk16</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds.driver</groupId>
+ <artifactId>jclouds-enterprise</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds.api</groupId>
+ <artifactId>ec2</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds.provider</groupId>
+ <artifactId>aws-ec2</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds.api</groupId>
+ <artifactId>openstack-nova</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds.api</groupId>
+ <artifactId>openstack-keystone</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds</groupId>
+ <artifactId>jclouds-scriptbuilder</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jclouds.api</groupId>
+ <artifactId>vcloud</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+
<dependency>
<groupId>com.jamesmurty.utils.wso2</groupId>
<artifactId>java-xmlbuilder</artifactId>
<version>0.4.wso2v1</version>
</dependency>
- <dependency>
- <groupId>org.jclouds.api</groupId>
- <artifactId>vcloud</artifactId>
- <version>1.6.0-wso2v1</version>
- </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
@@ -314,7 +305,6 @@
</dependencies>
<properties>
<gson2.version>2.2</gson2.version>
- <jclouds.wso2.version>1.5.0-beta.5.wso2v1</jclouds.wso2.version>
<com.google.guice.assistedinject.wso2.version>3.0.wso2v1</com.google.guice.assistedinject.wso2.version>
<sun.jersey.version>1.12</sun.jersey.version>
</properties>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4ceeb87a/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 aa08bb3..7a31a45 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
@@ -21,9 +21,16 @@ package org.apache.stratos.cloud.controller.iaases;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jclouds.aws.ec2.AWSEC2AsyncClient;
+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.CloudControllerConstants;
+import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
+import org.apache.stratos.cloud.controller.util.IaasProvider;
+import org.jclouds.aws.ec2.AWSEC2ApiMetadata;
import org.jclouds.aws.ec2.AWSEC2Client;
import org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions;
import org.jclouds.aws.ec2.domain.RegionNameAndPublicKeyMaterial;
@@ -35,13 +42,6 @@ import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.ec2.domain.KeyPair;
import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
-import org.jclouds.rest.RestContext;
-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.CloudControllerConstants;
-import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.wso2.carbon.utils.CarbonUtils;
import com.google.common.base.Predicate;
@@ -160,10 +160,7 @@ public class AWSEC2Iaas extends Iaas {
ComputeServiceContext context = iaasInfo.getComputeService()
.getContext();
- @SuppressWarnings("unchecked")
- RestContext<AWSEC2Client, AWSEC2AsyncClient> restContext = context
- .unwrap(RestContext.class);
- AWSEC2Client ec2Client = restContext.getApi();
+ AWSEC2Client ec2Client = context.unwrap(AWSEC2ApiMetadata.CONTEXT_TOKEN).getApi();
ImportOrReturnExistingKeypair importer = new ImportOrReturnExistingKeypair(
ec2Client);
@@ -192,12 +189,9 @@ public class AWSEC2Iaas extends Iaas {
ComputeServiceContext context = iaasInfo.getComputeService()
.getContext();
- @SuppressWarnings("unchecked")
- RestContext<AWSEC2Client, AWSEC2AsyncClient> restContext = context
- .unwrap(RestContext.class);
- AWSEC2Client ec2Client = restContext.getApi();
+ AWSEC2Client ec2Client = context.unwrap(AWSEC2ApiMetadata.CONTEXT_TOKEN).getApi();
String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);
-
+
String ip = null;
// first try to find an unassigned IP.
@@ -284,10 +278,7 @@ public class AWSEC2Iaas extends Iaas {
ComputeServiceContext context = iaasInfo.getComputeService()
.getContext();
- @SuppressWarnings("unchecked")
- RestContext<AWSEC2Client, AWSEC2AsyncClient> restContext = context
- .unwrap(RestContext.class);
- AWSEC2Client ec2Client = restContext.getApi();
+ AWSEC2Client ec2Client = context.unwrap(AWSEC2ApiMetadata.CONTEXT_TOKEN).getApi();
String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);
ec2Client.getElasticIPAddressServices().disassociateAddressInRegion(
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4ceeb87a/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 9f524ba..1af9e20 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
@@ -22,29 +22,27 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
+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.interfaces.Iaas;
import org.apache.stratos.cloud.controller.jcloud.ComputeServiceBuilderUtil;
import org.apache.stratos.cloud.controller.util.CloudControllerConstants;
import org.apache.stratos.cloud.controller.util.CloudControllerUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.util.IaasProvider;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.openstack.nova.v2_0.NovaAsyncClient;
-import org.jclouds.openstack.nova.v2_0.NovaClient;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.NovaApiMetadata;
import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
import org.jclouds.openstack.nova.v2_0.domain.FloatingIP;
import org.jclouds.openstack.nova.v2_0.domain.KeyPair;
-import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPClient;
-import org.jclouds.openstack.nova.v2_0.extensions.KeyPairClient;
-import org.jclouds.rest.InsufficientResourcesException;
-import org.jclouds.rest.RestContext;
-import org.apache.stratos.cloud.controller.util.IaasProvider;
+import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
+import org.jclouds.openstack.nova.v2_0.extensions.KeyPairApi;
import org.wso2.carbon.utils.CarbonUtils;
import com.google.common.base.Predicate;
@@ -165,15 +163,11 @@ public class OpenstackNovaIaas extends Iaas {
ComputeServiceContext context = iaasInfo.getComputeService()
.getContext();
- @SuppressWarnings("unchecked")
- RestContext<NovaClient, NovaAsyncClient> restContext = context
- .unwrap(RestContext.class);
+ NovaApi novaApi = context.unwrap(NovaApiMetadata.CONTEXT_TOKEN).getApi();
- KeyPairClient api = restContext.getApi()
- .getKeyPairExtensionForZone(region).get();
+ KeyPairApi api = novaApi.getKeyPairExtensionForZone(region).get();
- KeyPair keyPair = api
- .createKeyPairWithPublicKey(keyPairName, publicKey);
+ KeyPair keyPair = api.createWithPublicKey(keyPairName, publicKey);
if (keyPair != null) {
@@ -195,20 +189,17 @@ public class OpenstackNovaIaas extends Iaas {
ComputeServiceContext context = iaasInfo.getComputeService()
.getContext();
- @SuppressWarnings("unchecked")
- RestContext<NovaClient, NovaAsyncClient> restContext = context
- .unwrap(RestContext.class);
- NovaClient novaClient = restContext.getApi();
+ NovaApi novaClient = context.unwrap(NovaApiMetadata.CONTEXT_TOKEN).getApi();
String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);
- FloatingIPClient floatingIp = novaClient.getFloatingIPExtensionForZone(
+ FloatingIPApi floatingIp = novaClient.getFloatingIPExtensionForZone(
region).get();
String ip = null;
// first try to find an unassigned IP.
ArrayList<FloatingIP> unassignedIps = Lists.newArrayList(Iterables
- .filter(floatingIp.listFloatingIPs(),
+ .filter(floatingIp.list(),
new Predicate<FloatingIP>() {
@Override
@@ -228,15 +219,13 @@ public class OpenstackNovaIaas extends Iaas {
// if no unassigned IP is available, we'll try to allocate an IP.
if (ip == null || ip.isEmpty()) {
-
- try {
- ip = floatingIp.allocate().getIp();
-
- } catch (InsufficientResourcesException e) {
- String msg = "Failed to allocate an IP address. All IP addresses are in use.";
- log.error(msg, e);
- throw new CloudControllerException(msg, e);
+ FloatingIP allocatedFloatingIP = floatingIp.create();
+ if (allocatedFloatingIP == null) {
+ String msg = "Failed to allocate an IP address.";
+ log.error(msg);
+ throw new CloudControllerException(msg);
}
+ ip = allocatedFloatingIP.getIp();
}
// wait till the fixed IP address gets assigned - this is needed before
@@ -269,28 +258,25 @@ public class OpenstackNovaIaas extends Iaas {
ComputeServiceContext context = iaasInfo.getComputeService()
.getContext();
- @SuppressWarnings("unchecked")
- RestContext<NovaClient, NovaAsyncClient> restContext = context
- .unwrap(RestContext.class);
- NovaClient novaClient = restContext.getApi();
+ NovaApi novaApi = context.unwrap(NovaApiMetadata.CONTEXT_TOKEN).getApi();
String region = ComputeServiceBuilderUtil.extractRegion(iaasInfo);
- FloatingIPClient floatingIpClient = novaClient
+ FloatingIPApi floatingIPApi = novaApi
.getFloatingIPExtensionForZone(region).get();
- for (FloatingIP floatingIP : floatingIpClient.listFloatingIPs()) {
+ for (FloatingIP floatingIP : floatingIPApi.list()) {
if (floatingIP.getIp().equals(ip)) {
- floatingIpClient.deallocate(floatingIP.getId());
+ floatingIPApi.delete(floatingIP.getId());
break;
}
}
}
- private boolean associateIp(FloatingIPClient client, String ip, String id) {
+ private boolean associateIp(FloatingIPApi api, String ip, String id) {
try {
- client.addFloatingIPToServer(ip, id);
+ api.addToServer(ip, id);
return true;
} catch (RuntimeException ex) {
return false;
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4ceeb87a/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 c55e1b3..1afe141 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
@@ -383,7 +383,7 @@ public class CloudControllerServiceImpl implements CloudControllerService {
.getProperty(CloudControllerConstants.AUTO_ASSIGN_IP_PROPERTY);
// acquire the lock
- lock.tryLock();
+ lock.lock();
try {
// reset ip
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4ceeb87a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
----------------------------------------------------------------------
diff --git a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
index 025cb35..d030400 100644
--- a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
+++ b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
@@ -78,23 +78,23 @@
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>ec2</artifactId>
- <version>${jclouds.wso2.version}</version>
+ <version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.provider</groupId>
<artifactId>aws-ec2</artifactId>
- <version>${jclouds.wso2.version}</version>
+ <version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-nova</artifactId>
- <version>${jclouds.wso2.version}</version>
+ <version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
- <version>${jclouds.wso2.version}</version>
+ <version>${jclouds.version}</version>
</dependency>
<dependency>
@@ -103,9 +103,15 @@
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>com.google.guava.wso2</groupId>
+ <groupId>org.jclouds.api</groupId>
+ <artifactId>sts</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <version>${google.guava.wso2.version}</version>
+ <version>14.0.1</version>
</dependency>
<dependency>
<groupId>com.jamesmurty.utils.wso2</groupId>
@@ -115,7 +121,7 @@
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>vcloud</artifactId>
- <version>1.6.0-wso2v1</version>
+ <version>${jclouds.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
@@ -157,6 +163,11 @@
<artifactId>org.apache.stratos.cartridge.messages</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.1.1</version>
+ </dependency>
</dependencies>
<build>
@@ -212,18 +223,18 @@
<bundleDef>org.apache.stratos:org.apache.stratos.cloud.controller:${project.version}</bundleDef>
<bundleDef>org.jclouds.driver:jclouds-bouncycastle:${jclouds.version}</bundleDef>
<bundleDef>org.jclouds.driver:jclouds-sshj:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds.driver:jclouds-log4j:${jclouds.version}</bundleDef>
+ <!--bundleDef>org.jclouds.driver:jclouds-log4j:${jclouds.version}</bundleDef-->
<bundleDef>org.jclouds.driver:jclouds-enterprise:${jclouds.version}</bundleDef>
<bundleDef>org.jclouds:jclouds-core:${jclouds.version}</bundleDef>
<bundleDef>org.jclouds:jclouds-compute:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds.api:ec2:${jclouds.wso2.version}</bundleDef>
- <bundleDef>org.jclouds.api:openstack-nova:${jclouds.wso2.version}</bundleDef>
- <bundleDef>org.jclouds.api:vcloud:1.6.0-wso2v1</bundleDef>
+ <bundleDef>org.jclouds.api:ec2:${jclouds.version}</bundleDef>
+ <bundleDef>org.jclouds.api:openstack-nova:${jclouds.version}</bundleDef>
+ <bundleDef>org.jclouds.api:vcloud:${jclouds.version}</bundleDef>
<bundleDef>com.jamesmurty.utils.wso2:java-xmlbuilder:0.4.wso2v1</bundleDef>
<bundleDef>org.jclouds.common:openstack-common:${jclouds.version}</bundleDef>
- <bundleDef>org.jclouds.api:openstack-keystone:${jclouds.wso2.version}</bundleDef>
- <bundleDef>org.jclouds.provider:aws-ec2:${jclouds.wso2.version}</bundleDef>
- <bundleDef>com.google.guava.wso2:guava:${google.guava.wso2.version}</bundleDef>
+ <bundleDef>org.jclouds.api:openstack-keystone:${jclouds.version}</bundleDef>
+ <bundleDef>org.jclouds.provider:aws-ec2:${jclouds.version}</bundleDef>
+ <bundleDef>com.google.guava:guava:14.0.1</bundleDef>
<bundleDef>com.google.code.gson:gson:${gson2.version}</bundleDef>
<bundleDef>com.google.guice.wso2:guice:${google.guice.wso2.version}</bundleDef>
<bundleDef>com.google.guice.assistedinject.wso2:guice-assistedinject:${com.google.guice.assistedinject.wso2.version}</bundleDef>
@@ -245,7 +256,8 @@
<bundleDef>jdom.wso2:jdom:1.0.0.wso2v1</bundleDef>
<bundleDef>org.json.wso2:json:1.0.0.wso2v1</bundleDef>
<!--bundleDef>org.jaggeryjs:0.9.0.ALPHA2-wso2v2</bundleDef-->
-
+ <bundleDef>org.jclouds.api:sts:${jclouds.version}</bundleDef>
+ <bundleDef>javax.ws.rs:jsr311-api:1.1.1</bundleDef>
</bundles>
<importBundles>
</importBundles>
@@ -279,9 +291,4 @@
</plugin-->
</plugins>
</build>
-
- <properties>
- <jclouds.wso2.version>1.5.0-beta.5.wso2v1</jclouds.wso2.version>
- </properties>
-
</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4ceeb87a/features/cloud-controller/pom.xml
----------------------------------------------------------------------
diff --git a/features/cloud-controller/pom.xml b/features/cloud-controller/pom.xml
index 94ecede..5a414bf 100644
--- a/features/cloud-controller/pom.xml
+++ b/features/cloud-controller/pom.xml
@@ -39,9 +39,5 @@
<module>org.apache.stratos.cloud.controller.feature</module>
</modules>
- <properties>
- <wso2carbon.version.cc.mgt>2.1.1</wso2carbon.version.cc.mgt>
- </properties>
-
</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/4ceeb87a/products/cloud-controller/modules/distribution/src/main/resources/launch.ini
----------------------------------------------------------------------
diff --git a/products/cloud-controller/modules/distribution/src/main/resources/launch.ini b/products/cloud-controller/modules/distribution/src/main/resources/launch.ini
index f05201c..8cf9c14 100644
--- a/products/cloud-controller/modules/distribution/src/main/resources/launch.ini
+++ b/products/cloud-controller/modules/distribution/src/main/resources/launch.ini
@@ -28,6 +28,7 @@ osgi.clean=true
# Following system property allows us to control the public JDK packages exported through the system bundle.
org.osgi.framework.system.packages=javax.accessibility,\
+javax.lang.model.type, \
javax.activity,\
javax.crypto,\
javax.crypto.interfaces,\
[07/10] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos into
jclouds-upgrade
Posted by is...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos into jclouds-upgrade
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/dc1a21ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/dc1a21ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/dc1a21ef
Branch: refs/heads/master
Commit: dc1a21eff5e047f4c2e21b9367f2675cff3dc811
Parents: f04cb4a a08913f
Author: Isuru Perera <is...@apache.org>
Authored: Fri Aug 9 14:41:28 2013 +0530
Committer: Isuru Perera <is...@apache.org>
Committed: Fri Aug 9 14:41:28 2013 +0530
----------------------------------------------------------------------
products/cloud-controller/LICENSE.txt | 1102 ++++++++++--------
products/cloud-controller/NOTICE | 5 +
.../src/main/conf/loadbalancer.conf | 64 +-
.../init_scripts/tomcat/stratos.pem | 16 -
.../init_scripts/tomcat/wso2.pem | 16 +
tools/ec2-demo-setup/config.sh | 5 +-
tools/ec2-demo-setup/tempconfigs/nodes.pp | 465 --------
7 files changed, 632 insertions(+), 1041 deletions(-)
----------------------------------------------------------------------
[04/10] git commit: Removed org.apache.stratos.autoscaler.service
component as it is not used in Apache Stratos
Posted by is...@apache.org.
Removed org.apache.stratos.autoscaler.service component as it is not used in Apache Stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/2490db07
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/2490db07
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/2490db07
Branch: refs/heads/master
Commit: 2490db07fce54f927a91aea64ca1113a7f4df75c
Parents: 51ffb59
Author: Isuru Perera <is...@apache.org>
Authored: Thu Aug 8 15:47:48 2013 +0530
Committer: Isuru Perera <is...@apache.org>
Committed: Thu Aug 8 15:47:48 2013 +0530
----------------------------------------------------------------------
.../dependency-reduced-pom.xml | 112 --
.../pom.xml | 208 ---
.../autoscaler/service/IAutoscalerService.java | 112 --
.../exception/AutoscalerServiceException.java | 33 -
.../exception/DeserializationException.java | 33 -
.../MalformedConfigurationFileException.java | 33 -
.../exception/NoInstanceFoundException.java | 39 -
.../exception/SerializationException.java | 33 -
.../service/impl/AutoscalerServiceImpl.java | 1389 ------------------
.../internal/AutoscalerServiceDSComponent.java | 48 -
.../autoscaler/service/io/Deserializer.java | 68 -
.../autoscaler/service/io/Serializer.java | 61 -
.../service/jcloud/ComputeServiceBuilder.java | 65 -
.../service/util/AutoscalerConstant.java | 73 -
.../autoscaler/service/util/IaasContext.java | 391 -----
.../autoscaler/service/util/IaasProvider.java | 141 --
.../service/util/InstanceContext.java | 93 --
.../service/util/ServiceTemplate.java | 84 --
.../xml/ElasticScalerConfigFileReader.java | 557 -------
.../src/main/resources/META-INF/services.xml | 9 -
.../service/util/IaasContextComparatorTest.java | 98 --
.../service/util/IaasContextTest.java | 113 --
.../xml/ElasticScalerConfigFileReaderTest.java | 60 -
.../test/resources/elastic-scaler-config.xml | 71 -
components/pom.xml | 1 -
25 files changed, 3925 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/dependency-reduced-pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/dependency-reduced-pom.xml b/components/org.apache.stratos.autoscaler.service/dependency-reduced-pom.xml
deleted file mode 100644
index 3e67132..0000000
--- a/components/org.apache.stratos.autoscaler.service/dependency-reduced-pom.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>stratos-components-parent</artifactId>
- <groupId>org.apache.stratos</groupId>
- <version>3.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.autoscaler.service</artifactId>
- <packaging>aar</packaging>
- <name>Apache Stratos - Autoscaler Service</name>
- <url>http://apache.org</url>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-shade-plugin</artifactId>
- <version>1.7.1</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes>
- <include>org.jclouds:*</include>
- <include>org.jclouds.*:*</include>
- </includes>
- </artifactSet>
- <filtering>true</filtering>
- <filters>
- <filter>
- <artifact>org.jclouds*:*</artifact>
- <includes>
- <include>META-INF/services/org.jclouds.apis.ApiMetadata</include>
- <include>META-INF/services/org.jclouds.providers.ProviderMetadata</include>
- </includes>
- </filter>
- </filters>
- <transformers>
- <transformer />
- </transformers>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-aar-maven-plugin</artifactId>
- <version>1.4</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.0</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Export-Package>org.apache.stratos.autoscaler.service</Export-Package>
- <Private-Package>org.apache.stratos.autoscaler.service.*, !org.apache.stratos.autoscaler.service</Private-Package>
- <Import-Package>!org.apache.commons.logging,
- org.apache.commons.logging; version=0.0.0,
- org.wso2.carbon.utils.*,
- org.jclouds.compute*;version="${jclouds.version}";resolution:=optional,
- org.jclouds*;version="${jclouds.version}",
- *; resolution:=optional</Import-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.core</artifactId>
- <version>4.1.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.utils</artifactId>
- <version>4.1.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.lb.common</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.securevault</artifactId>
- <version>4.1.0</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
- <properties>
- <jclouds.version>1.5.0-beta.5</jclouds.version>
- </properties>
-</project>
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/pom.xml b/components/org.apache.stratos.autoscaler.service/pom.xml
deleted file mode 100644
index ba0e8a9..0000000
--- a/components/org.apache.stratos.autoscaler.service/pom.xml
+++ /dev/null
@@ -1,208 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ 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.
- ~
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.stratos</groupId>
- <artifactId>stratos-components-parent</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.autoscaler.service</artifactId>
- <packaging>aar</packaging>
- <name>Apache Stratos - Autoscaler Service</name>
- <url>http://apache.org</url>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <version>1.7.1</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- <configuration>
- <artifactSet>
- <includes>
- <include>org.jclouds:*</include>
- <include>org.jclouds.*:*</include>
- </includes>
- </artifactSet>
- <filtering>true</filtering>
- <filters>
- <filter>
- <artifact>org.jclouds*:*</artifact>
- <includes>
- <include>META-INF/services/org.jclouds.apis.ApiMetadata</include>
- <include>META-INF/services/org.jclouds.providers.ProviderMetadata</include>
- </includes>
- </filter>
- </filters>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer">
- </transformer>
- </transformers>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-aar-maven-plugin</artifactId>
- <version>1.4</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.0</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Export-Package>
- org.apache.stratos.autoscaler.service
- </Export-Package>
- <Private-Package>
- org.apache.stratos.autoscaler.service.*, !org.apache.stratos.autoscaler.service
- </Private-Package>
- <Import-Package>
- !org.apache.commons.logging,
- org.apache.commons.logging; version=0.0.0,
- org.wso2.carbon.utils.*,
- org.jclouds.compute*;version="${jclouds.version}";resolution:=optional,
- org.jclouds*;version="${jclouds.version}",
- *; resolution:=optional
- </Import-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.utils</artifactId>
- <version>${wso2carbon.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.stratos</groupId>
- <artifactId>org.apache.stratos.lb.common</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.wso2.carbon</groupId>
- <artifactId>org.wso2.carbon.securevault</artifactId>
- <version>4.1.0</version>
- <!--version>${wso2carbon.version}</version-->
- </dependency>
- <!--dependency>
- <groupId>org.apache.synapse</groupId>
- <artifactId>synapse-core</artifactId>
- <version>${synapse.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.synapse</groupId>
- <artifactId>synapse-commons</artifactId>
- <version>${synapse.version}</version>
- </dependency-->
-
- <!-- Jclouds dependencies -->
- <dependency>
- <groupId>org.jclouds</groupId>
- <artifactId>jclouds-allcompute</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds</groupId>
- <artifactId>jclouds-compute</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-bouncycastle</artifactId>
- <version>${jclouds.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk16</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-sshj</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-enterprise</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <!--dependency>
- <groupId>org.jclouds.api</groupId>
- <artifactId>ec2</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.provider</groupId>
- <artifactId>aws-ec2</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds.api</groupId>
- <artifactId>openstack-nova</artifactId>
- <version>${jclouds.version}</version>
- </dependency-->
-
- </dependencies>
-
- <properties>
- <jclouds.version>1.5.0-beta.5</jclouds.version>
- </properties>
-
-</project>
-
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/IAutoscalerService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/IAutoscalerService.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/IAutoscalerService.java
deleted file mode 100644
index 9bf06fc..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/IAutoscalerService.java
+++ /dev/null
@@ -1,112 +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.autoscaler.service;
-
-import org.apache.stratos.lb.common.conf.util.Constants;
-
-/**
- * This Interface provides a way for a component, to communicate with an underline
- * Infrastructure which are supported by <i>JClouds</i>.
- *
- */
-public interface IAutoscalerService {
-
- /**
- * Initialize the service.
- * @param isSpi if this service is to be used by SPI, this parameter should be set to
- * true. When this is true, you should specify an image id, each time you
- * are starting an instance i.e. you should use {@link #startSpiInstance(String, String)}
- * method, instead of using {@link #startInstance(String)}.
- * @return
- */
- public boolean initAutoscaler(boolean isSpi);
-
-
- /**
- * Calling this method will result in an instance startup, which is belong
- * to the provided service domain. This method is non-blocking, means we do not
- * wait till the instance is started up. Also note that the instance that is starting up
- * belongs to the group whose name is derived from its service domain, replacing <i>.</i>
- * by a hyphen (<i>-</i>).
- * @param domainName service clustering domain of the instance to be started up.
- * @param sudDomainName service clustering sub domain of the instance to be started up.
- * If this is null, the default value will be used. Default value is
- * {@link Constants}.DEFAULT_SUB_DOMAIN.
- * @return whether the starting up is successful or not.
- */
- public boolean startInstance(String domainName, String sudDomainName);
-
- /**
- * Calling this method will result in an instance startup, which is belong
- * to the provided service domain. This method will return the public IP address of
- * the instance that is started. Thus, this method is blocking, since we need to
- * return the IP Address and for that we have to wait till the instance started up.
- * @param domainName should be in following format.
- * <code>${service-domain}\t\${tenant-id}</code>.
- * @param imageId starting instance will be an instance of this image. Image id should
- * be a valid one.
- * @param sudDomainName service clustering sub domain of the instance to be started up.
- * If this is null, the default value will be used. Default value is
- * {@link Constants}.DEFAULT_SUB_DOMAIN.
- * @return public IP address of the instance in String format. If instance failed to
- * start, this will return an empty String.
- */
- public String startSpiInstance(String domainName, String subDomainName, String imageId);
-
-
- /**
- * Calling this method will result in termination of an instance which is belong
- * to the provided service domain.
- * @param domainName service domain of the instance to be terminated.
- * @param sudDomainName service clustering sub domain of the instance to be started up.
- * If this is null, the default value will be used. Default value is {@link Constants}.DEFAULT_SUB_DOMAIN.
- * @return whether an instance terminated successfully or not.
- */
- public boolean terminateInstance(String domainName, String subDomainName);
-
- /**
- * Calling this method will result in termination of the lastly spawned instance which is
- * belong to the provided service domain.
- * @param domainName service domain of the instance to be terminated.
- * @param sudDomainName service clustering sub domain of the instance to be started up.
- * If this is null, the default value will be used. Default value is {@link Constants}.DEFAULT_SUB_DOMAIN.
- * @return whether the termination is successful or not.
- */
- public boolean terminateLastlySpawnedInstance(String domainName, String subDomainName);
-
- /**
- * Calling this method will result in termination of an instance which has the
- * provided public IP address.
- * @param publicIp public IP address of the instance to be terminated.
- * @return whether the instance terminated successfully or not.
- */
- public boolean terminateSpiInstance(String publicIp);
-
- /**
- * Calling this method will result in returning the pending instances
- * count of a particular domain.
- * @param domainName service domain
- * @param sudDomainName service clustering sub domain of the instance to be started up.
- * If this is null, the default value will be used. Default value is {@link Constants}.DEFAULT_SUB_DOMAIN.
- * @return number of pending instances for this domain. If no instances of this
- * domain is present, this will return zero.
- */
- public int getPendingInstanceCount(String domainName, String subDomainName);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/AutoscalerServiceException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/AutoscalerServiceException.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/AutoscalerServiceException.java
deleted file mode 100644
index 70e82c8..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/AutoscalerServiceException.java
+++ /dev/null
@@ -1,33 +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.autoscaler.service.exception;
-
-public class AutoscalerServiceException extends RuntimeException {
-
- private static final long serialVersionUID = -6326227079367867222L;
-
- public AutoscalerServiceException(String msg) {
- super(msg);
- }
-
- public AutoscalerServiceException(String msg, Exception ex) {
- super(msg, ex);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/DeserializationException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/DeserializationException.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/DeserializationException.java
deleted file mode 100644
index 01819d1..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/DeserializationException.java
+++ /dev/null
@@ -1,33 +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.autoscaler.service.exception;
-
-public class DeserializationException extends RuntimeException {
-
- private static final long serialVersionUID = -2426068347954381831L;
-
- public DeserializationException(String msg) {
- super(msg);
- }
-
- public DeserializationException(String msg, Exception ex) {
- super(msg, ex);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/MalformedConfigurationFileException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/MalformedConfigurationFileException.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/MalformedConfigurationFileException.java
deleted file mode 100644
index 090e931..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/MalformedConfigurationFileException.java
+++ /dev/null
@@ -1,33 +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.autoscaler.service.exception;
-
-public class MalformedConfigurationFileException extends RuntimeException {
-
- private static final long serialVersionUID = -1662095377704279326L;
-
- public MalformedConfigurationFileException(String msg) {
- super(msg);
- }
-
- public MalformedConfigurationFileException(String msg, Exception ex) {
- super(msg, ex);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/NoInstanceFoundException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/NoInstanceFoundException.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/NoInstanceFoundException.java
deleted file mode 100644
index be9356f..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/NoInstanceFoundException.java
+++ /dev/null
@@ -1,39 +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.autoscaler.service.exception;
-
-/**
- * This will throw when no instance is found
- */
-public class NoInstanceFoundException extends Exception {
-
- /**
- * For serializing requirement
- */
- private static final long serialVersionUID = -435060299292679892L;
-
-
- public NoInstanceFoundException(String msg) {
- super(msg);
- }
-
- public NoInstanceFoundException(String msg, Exception ex) {
- super(msg, ex);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/SerializationException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/SerializationException.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/SerializationException.java
deleted file mode 100644
index 0ccbd61..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/exception/SerializationException.java
+++ /dev/null
@@ -1,33 +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.autoscaler.service.exception;
-
-public class SerializationException extends RuntimeException {
-
- private static final long serialVersionUID = -3701458642228072331L;
-
- public SerializationException(String msg) {
- super(msg);
- }
-
- public SerializationException(String msg, Exception ex) {
- super(msg, ex);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/impl/AutoscalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/impl/AutoscalerServiceImpl.java
deleted file mode 100644
index b87cb50..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/impl/AutoscalerServiceImpl.java
+++ /dev/null
@@ -1,1389 +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.autoscaler.service.impl;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseException;
-import org.jclouds.aws.ec2.compute.AWSEC2TemplateOptions;
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.RunNodesException;
-import org.jclouds.compute.domain.ComputeMetadata;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadata.Status;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.domain.TemplateBuilder;
-import org.jclouds.compute.domain.internal.NodeMetadataImpl;
-import org.jclouds.compute.options.TemplateOptions;
-import org.jclouds.openstack.nova.v2_0.compute.options.NovaTemplateOptions;
-import org.apache.stratos.autoscaler.service.IAutoscalerService;
-import org.apache.stratos.autoscaler.service.exception.AutoscalerServiceException;
-import org.apache.stratos.autoscaler.service.exception.DeserializationException;
-import org.apache.stratos.autoscaler.service.exception.SerializationException;
-import org.apache.stratos.autoscaler.service.io.Deserializer;
-import org.apache.stratos.autoscaler.service.io.Serializer;
-import org.apache.stratos.autoscaler.service.jcloud.ComputeServiceBuilder;
-import org.apache.stratos.autoscaler.service.util.AutoscalerConstant;
-import org.apache.stratos.autoscaler.service.util.IaasContext;
-import org.apache.stratos.autoscaler.service.util.IaasProvider;
-import org.apache.stratos.autoscaler.service.util.InstanceContext;
-import org.apache.stratos.autoscaler.service.util.ServiceTemplate;
-import org.apache.stratos.autoscaler.service.xml.ElasticScalerConfigFileReader;
-import org.apache.stratos.lb.common.conf.util.Constants;
-import org.wso2.carbon.utils.CarbonUtils;
-
-/**
- * Autoscaler Service is responsible for starting up new server instances, terminating already
- * started instances, providing pending instance count.
- *
- */
-public class AutoscalerServiceImpl implements IAutoscalerService {
-
-
- private static final Log log = LogFactory.getLog(AutoscalerServiceImpl.class);
-
- /**
- * pointer to Carbon Home directory.
- */
- private static final String CARBON_HOME = CarbonUtils.getCarbonHome();
-
- /**
- * pointer to Carbon Temp directory.
- */
- private static final String CARBON_TEMP = CarbonUtils.getTmpDir();
-
- /**
- * Tenant id Delimiter
- */
- private static final String TENANT_ID_DELIMITER = "/t/";
-
- /**
- * This directory will be used to store serialized objects.
- */
- private String serializationDir;
-
- /**
- * List of all <code>IaaSProviders</code> specified in the config file.
- */
- private List<IaasProvider> iaasProviders;
-
- /**
- * List of all <code>ServiceTemplate</code> objects.
- */
- private List<ServiceTemplate> serviceTemps;
-
- /**
- * We keep an enum which contains all supported IaaSes.
- */
- public enum Iaases {
- ec2, openstack
- };
-
- /**
- * List which keeps <code>IaasContext</code> objects.
- */
- private List<IaasContext> iaasContextList = new ArrayList<IaasContext>();
-
- /**
- * We keep track of the IaaS where the last instance of a domain and a sub domain combination is spawned.
- * This is required when there are multiple <code>IaasProvider</code>s defined.
- * Key - domain
- * Value - a map which has a Key - sub domain and Value - name of the {@link IaasProvider}.
- */
- private Map<String, Map<String, String>> lastlyUsedIaasMap = new HashMap<String, Map<String, String>>();
-
- /**
- * To track whether the {@link #initAutoscaler(boolean)} method has been called.
- */
- boolean isInitialized = false;
-
- @Override
- public boolean initAutoscaler(boolean isSpi) {
-
- if (!isInitialized) {
-
- log.debug("InitAutoscaler has started ... IsSPI : " + isSpi);
-
- // load configuration file
- ElasticScalerConfigFileReader configReader = new ElasticScalerConfigFileReader();
-
- // read serialization directory from config file if specified, else will use the
- // default.
- if ("".equals(serializationDir = configReader.getSerializationDir())) {
- serializationDir = CARBON_TEMP;
-
- log.debug("Directory to be used to serialize objects: " + serializationDir);
- }
-
- // let's deserialize and load the serialized objects.
- deserialize();
-
- // from config file, we grab the details unique to IaaS providers.
- iaasProviders = configReader.getIaasProvidersList();
-
- // from config file, we grab the details related to each service domain.
- serviceTemps = configReader.getTemplates();
-
- // we iterate through each IaaSProvider which is loaded from the config file.
- for (IaasProvider iaas : iaasProviders) {
-
- // build the JClouds specific ComputeService object
- ComputeService computeService = ComputeServiceBuilder.buildComputeService(iaas);
- IaasContext entity;
-
- // let's see whether there's a serialized entity
- entity = findIaasContext(iaas.getType());
-
- if (entity != null) {
-
- log.debug("Serializable object is loaded for IaaS " + iaas.getType());
-
- // ComputeService isn't serializable, hence we need to set it in the
- // deserialized
- // object.
- entity.setComputeService(computeService);
- }
-
- // build JClouds Template objects according to different IaaSes
- if (iaas.getType().equalsIgnoreCase(Iaases.ec2.toString())) {
-
- // initiate the IaasContext object, if it is null.
- entity =
- (entity == null) ? (entity =
- new IaasContext(Iaases.ec2,
- computeService)) : entity;
-
- // we should build the templates only if this is not SPI stuff
- if (!isSpi) {
- // Build the Template
- buildEC2Templates(entity, iaas.getTemplate(), isSpi);
-
- } else {
- // add to data structure
- iaasContextList.add(entity);
- }
-
- } else if (iaas.getType().equalsIgnoreCase(Iaases.openstack.toString())) {
-
- // initiate the IaasContext object, if it is null.
- entity =
- (entity == null) ? (entity =
- new IaasContext(Iaases.openstack,
- computeService)) : entity;
-
- // we should build the templates only if this is not SPI stuff
- if (!isSpi) {
- // Build the Template
- buildLXCTemplates(entity, iaas.getTemplate(), isSpi, null);
-
- } else {
- // add to data structure
- iaasContextList.add(entity);
- }
-
- } else {
- // unsupported IaaS detected. We only complain, since there could be other
- // IaaSes.
- String msg =
- "Unsupported IaasProvider is specified in the config file: " +
- iaas.getType() + ". Supported IaasProviders are " +
- print(Iaases.values());
- log.warn(msg);
- continue;
- }
-
- // populate scale up order
- fillInScaleUpOrder();
-
- // populate scale down order
- fillInScaleDownOrder();
-
- // serialize the objects
- serialize();
- }
-
- // we couldn't locate any valid IaaS providers from config file, thus shouldn't proceed.
- if (iaasContextList.size() == 0) {
- String msg = "No valid IaaS provider specified in the config file!";
- log.error(msg);
- throw new AutoscalerServiceException(msg);
- }
-
- // initialization completed.
- isInitialized = true;
-
- log.info("Autoscaler service initialized successfully!!");
-
- return true;
- }
-
- log.debug("Autoscaler Service is already initialized!");
- return false;
- }
-
-
- @Override
- public boolean startInstance(String domainName, String subDomainName) {
-
- // initialize the service, if it's not already initialized.
- initAutoscaler(false);
-
- ComputeService computeService;
- Template template;
-
- subDomainName = checkSubDomain(subDomainName);
-
- log.info("Starting new instance of domain : " + domainName+" and sub domain : "+subDomainName);
-
- // sort the IaasContext entities according to scale up order
- Collections.sort(iaasContextList,
- IaasContextComparator.ascending(IaasContextComparator.getComparator(IaasContextComparator.SCALE_UP_SORT)));
-
- // traverse through IaasContext object instances in scale up order
- for (IaasContext iaasCtxt : iaasContextList) {
-
- // get the ComputeService
- computeService = iaasCtxt.getComputeService();
-
- // from the list grab the Template corresponds to this domain
- template = iaasCtxt.getTemplate(domainName, subDomainName);
-
- if(template == null){
- String msg = "Failed to start an instance in " + iaasCtxt.getName().toString() +
- ". Reason : Template is null. You have not specify a matching service " +
- "element in the configuration file of Autoscaler.\n Hence, will try to " +
- "start in another IaaS if available.";
- log.error(msg);
- continue;
- }
-
- // generate the group id from domain name and sub domain name.
- // Should have lower-case ASCII letters, numbers, or dashes.
- String str = domainName.concat("-"+subDomainName);
- String group = str.replaceAll("[^a-z0-9-]", "");
-
- try {
- // create and start a node
- Set<? extends NodeMetadata> nodes = computeService.createNodesInGroup(group,
- 1,
- template);
-
- NodeMetadata node = nodes.iterator().next();
-
-// // add the details of the started node to maps
-// iaasCtxt.addNodeIdToDomainMap(node.getId(), domainName);
-
- String ip="";
-
- // set public Ip, if it's available
- if (node.getPublicAddresses().size() > 0) {
- ip = node.getPublicAddresses().iterator().next();
-// iaasCtxt.addPublicIpToDomainMap(publicIp, domainName);
-// iaasCtxt.addPublicIpToNodeIdMap(publicIp, node.getId());
- } else if(node.getPrivateAddresses().size() > 0) { // set private IPs if no public IP s are returned
- ip = node.getPrivateAddresses().iterator().next();
-// iaasCtxt.addPublicIpToDomainMap(privateIp, domainName);
-// iaasCtxt.addPublicIpToNodeIdMap(privateIp, node.getId());
- } else{
- log.debug("Public IP of the node : "+node.getId()+" cannot be found.");
- }
-
-
- if (iaasCtxt.getInstanceContext(domainName, subDomainName) == null) {
- String msg = "Failed to start an instance in " + iaasCtxt.getName().toString() +
- ". Reason : InstanceContext is null. Hence, will try to start in another IaaS if available.";
- log.error(msg);
- continue;
- }
-
- if(node.getId() == null){
- String msg = "Node id of the starting instance is null.\n"+ node.toString();
- log.fatal(msg);
- throw new AutoscalerServiceException(msg);
- }
-
- // add run time data to InstanceContext
- iaasCtxt.addNodeDetails(domainName, subDomainName, node.getId(), ip);
-
- // since we modified the IaasContext instance, let's replace it.
- replaceIaasContext(iaasCtxt);
-
- // update the lastlyUsedIaasMap
- addToLastlyUsedIaasMap(domainName, subDomainName, iaasCtxt.getName().toString());
-// lastlyUsedIaasMap.put(domainName, iaasCtxt.getName().toString());
-
- if (log.isDebugEnabled()) {
- log.debug("Node details: \n" + node.toString() +
- "\n***************\n");
- }
-
- } catch (RunNodesException e) {
- log.warn("Failed to start an instance in " + iaasCtxt.getName().toString() +
- ". Hence, will try to start in another IaaS if available.", e);
- continue;
- }
-
- log.info("Instance is successfully starting up in IaaS " + iaasCtxt.getName()
- .toString() + " ...");
-
- // serialize the objects
- serialize();
-
- return true;
- }
-
- log.info("Failed to start instance, in any available IaaS.");
-
- return false;
-
- }
-
- private String checkSubDomain(String subDomainName) {
- // if sub domain is null, we assume it as default one.
- if (subDomainName == null || "null".equalsIgnoreCase(subDomainName)) {
- subDomainName = Constants.DEFAULT_SUB_DOMAIN;
- log.debug("Sub domain is null, hence using the default value : " + subDomainName);
- }
-
- return subDomainName;
- }
-
-
- private void addToLastlyUsedIaasMap(String domainName, String subDomainName, String iaasName) {
-
- Map<String, String> map;
-
- if(lastlyUsedIaasMap.get(domainName) == null){
- map = new HashMap<String, String>();
-
- } else{
- map = lastlyUsedIaasMap.get(domainName);
- }
-
- map.put(subDomainName, iaasName);
- lastlyUsedIaasMap.put(domainName, map);
-
- }
-
-
- @Override
- public String startSpiInstance(String domainName, String subDomainName, String imageId) {
-
- log.debug("Starting an SPI instance ... | domain: " + domainName + " | sub domain: " +
- subDomainName + " | ImageId: " + imageId);
-
- // initialize the service, if it's not already initialized.
- initAutoscaler(true);
-
- String tenantId = null;
- String spiDomainName = null;
-
- if(domainName != null) {
- // domainName will have the pattern <domainName>/t/<tenantId>
- String[] arr = domainName.split(TENANT_ID_DELIMITER);
- if(arr.length != 2) {
- String msg = "Domain name does not match with the expected pattern. Expected " +
- "pattern is <domainName>/t/<tenantId>";
- log.error(msg);
- throw new AutoscalerServiceException(msg);
- }
- spiDomainName = arr[0];
- tenantId = arr[1];
- }
-
- IaasContext entry;
-
- // FIXME: Build the Templates, for now we're doing a hack here. I don't know whether
- // there's a proper fix.
- // handle openstack case
- if (imageId.startsWith("nova") && ((entry = findIaasContext(Iaases.openstack)) != null)) {
-
- buildLXCTemplates(entry, imageId, true, tenantId);
-
- } else if (((entry = findIaasContext(Iaases.ec2)) != null)) {
-
- buildEC2Templates(entry, imageId, true);
-
- } else {
- String msg = "Invalid image id: " + imageId;
- log.error(msg);
- throw new AutoscalerServiceException(msg);
- }
-
- // let's start the instance
- if (startInstance(spiDomainName, subDomainName)) {
-
- // if it's successful, get the public IP of the started instance.
- // FIXME remove --> String publicIP =
- // findIaasContext(iaas).getLastMatchingPublicIp(domainName);
- String publicIP = entry.getLastMatchingPublicIp(spiDomainName, subDomainName);
-
- // if public IP is null, return an empty string, else return public IP.
- return (publicIP == null) ? "" : publicIP;
-
- }
-
- return "";
-
- }
-
- @Override
- public boolean terminateInstance(String domainName, String subDomainName) {
-
- // initialize the service, if it's not already initialized.
- initAutoscaler(false);
-
- subDomainName = checkSubDomain(subDomainName);
-
- log.info("Starting to terminate an instance of domain : " + domainName + " and sub domain : "+subDomainName);
-
- // sort the IaasContext entities according to scale down order.
- Collections.sort(iaasContextList,
- IaasContextComparator.ascending(IaasContextComparator.getComparator(IaasContextComparator.SCALE_DOWN_SORT)));
-
- // traverse in scale down order
- for (IaasContext iaasTemp : iaasContextList) {
-
- String msg = "Failed to terminate an instance in " + iaasTemp.getName().toString() +
- ". Hence, will try to terminate an instance in another IaaS if possible.";
-
- String nodeId = null;
-
- // grab the node ids related to the given domain and traverse
- for (String id : iaasTemp.getNodeIds(domainName, subDomainName)) {
- if (id != null) {
- nodeId = id;
- break;
- }
- }
-
- // if no matching node id can be found.
- if (nodeId == null) {
-
- log.warn(msg + " : Reason- No matching instance found for domain: " +
- domainName + " and sub domain: "+subDomainName+
- ".");
- continue;
- }
-
- // terminate it!
- terminate(iaasTemp, nodeId);
-
- return true;
-
- }
-
- log.info("Termination of an instance which is belong to domain '" + domainName +
- "' and sub domain '"+subDomainName+"' , failed!\n Reason: No matching " +
- "running instance found in any available IaaS.");
-
- return false;
-
- }
-
- @Override
- public boolean terminateLastlySpawnedInstance(String domainName, String subDomainName) {
-
- // initialize the service, if it's not already initialized.
- initAutoscaler(false);
-
- subDomainName = checkSubDomain(subDomainName);
-
- // see whether there is a matching IaaS, where we spawn an instance belongs to given domain.
- if (lastlyUsedIaasMap.containsKey(domainName)) {
-
- // grab the name of the IaaS
- String iaas = lastlyUsedIaasMap.get(domainName).get(subDomainName);
-
- // find the corresponding IaasContext
- IaasContext iaasTemp = findIaasContext(iaas);
-
- String msg = "Failed to terminate the lastly spawned instance of '" + domainName +
- "' service domain.";
-
- if (iaasTemp == null) {
- log.error(msg + " : Reason- Iaas' data cannot be located!");
- return false;
- }
-
- // find the instance spawned at last of this IaasContext
- String nodeId = iaasTemp.getLastMatchingNode(domainName, subDomainName);
-
- if (nodeId == null) {
- log.error(msg + " : Reason- No matching instance found for domain: " +
- domainName + " and sub domain: "+subDomainName+
- ".");
- return false;
- }
-
- // terminate it!
- terminate(iaasTemp, nodeId);
-
- return true;
-
- }
-
- log.info("Termination of an instance which is belong to domain '" + domainName +
- "' and sub domain '"+subDomainName+"' , failed!\n Reason: No matching instance found.");
-
- return false;
- }
-
- @Override
- public boolean terminateSpiInstance(String publicIp) {
-
- // initialize the service, if it's not already initialized.
- initAutoscaler(true);
-
- // sort the IaasContext entities according to scale down order.
- Collections.sort(iaasContextList,
- IaasContextComparator.ascending(IaasContextComparator.getComparator(IaasContextComparator.SCALE_DOWN_SORT)));
-
- // traverse in scale down order
- for (IaasContext iaasTemp : iaasContextList) {
-
- String msg = "Failed to terminate an instance in " + iaasTemp.getName().toString() +
- "" +
- ". Hence, will try to terminate an instance in another IaaS if possible.";
-
- // grab the node maps with the given public IP address
- String nodeId = iaasTemp.getNodeWithPublicIp(publicIp);
-
- if (nodeId == null) {
- log.warn(msg + " : Reason- No matching instance found for public ip '" +
- publicIp +
- "'.");
- continue;
- }
-
- // terminate it!
- terminate(iaasTemp, nodeId);
-
- return true;
- }
-
- log.info("Termination of an instance which has the public IP '" + publicIp + "', failed!");
-
- return false;
- }
-
- @Override
- public int getPendingInstanceCount(String domainName, String subDomain) {
-
- // initialize the service, if it's not already initialized.
- initAutoscaler(false);
-
- subDomain = checkSubDomain(subDomain);
-
- int pendingInstanceCount = 0;
-
- // traverse through IaasContexts
- for (IaasContext entry : iaasContextList) {
-
- ComputeService computeService = entry.getComputeService();
-
- // get list of node Ids which are belong to the requested domain
- List<String> nodeIds = entry.getNodeIds(domainName, subDomain);
-
- if(nodeIds.isEmpty()){
- log.debug("Zero nodes spawned in the IaaS "+entry.getName()+
- " of domain: "+domainName+" and sub domain: "+subDomain);
- continue;
- }
-
- // get all the nodes spawned by this IaasContext
- Set<? extends ComputeMetadata> set = computeService.listNodes();
-
- Iterator<? extends ComputeMetadata> iterator = set.iterator();
-
- // traverse through all nodes of this ComputeService object
- while (iterator.hasNext()) {
- NodeMetadataImpl nodeMetadata = (NodeMetadataImpl) iterator.next();
-
- // if this node belongs to the requested domain
- if (nodeIds.contains(nodeMetadata.getId())) {
-
- // get the status of the node
- Status nodeStatus = nodeMetadata.getStatus();
-
- // count nodes that are in pending state
- if (nodeStatus.toString().equalsIgnoreCase("PENDING")) {
- pendingInstanceCount++;
- }
- }
-
- }
- }
-
- log.info("Pending instance count of domain '" + domainName + "' and sub domain '"+
- subDomain+"' is " + pendingInstanceCount);
-
- return pendingInstanceCount;
-
- }
-
- /**
- * Returns matching IaasContext for the given {@link Iaases} entry.
- */
- private IaasContext findIaasContext(Enum<Iaases> iaas) {
-
- for (IaasContext entry : iaasContextList) {
- if (entry.getName().equals(iaas)) {
- return entry;
- }
- }
-
- return null;
- }
-
- /**
- * Returns matching IaasContext for the given iaas type.
- */
- private IaasContext findIaasContext(String iaasType) {
-
- for (IaasContext entry : iaasContextList) {
- if (entry.getName().toString().equals(iaasType)) {
- return entry;
- }
- }
-
- return null;
- }
-
- private void fillInScaleDownOrder() {
-
- for (IaasProvider iaas : iaasProviders) {
- if (findIaasContext(iaas.getType()) != null) {
- findIaasContext(iaas.getType()).setScaleDownOrder(iaas.getScaleDownOrder());
- }
- }
-
- }
-
- private void fillInScaleUpOrder() {
-
- for (IaasProvider iaas : iaasProviders) {
- if (findIaasContext(iaas.getType()) != null) {
- findIaasContext(iaas.getType()).setScaleUpOrder(iaas.getScaleUpOrder());
- }
- }
-
- }
-
- private byte[] getUserData(String payloadFileName, String tenantId) {
-
- byte[] bytes = null;
- File outputFile = null;
- String tempfilename = UUID.randomUUID().toString();
- try {
- File file = new File(payloadFileName);
- if (!file.exists()) {
- handleException("Payload file " + payloadFileName + " does not exist");
- }
- if (!file.canRead()) {
- handleException("Payload file " + payloadFileName + " does cannot be read");
- }
- if(tenantId != null) {
- // Tenant Id is available. This is an spi scenario. Edit the payload content
- editPayload(tenantId,file,tempfilename);
- outputFile = new File(CARBON_HOME + File.separator + AutoscalerConstant.RESOURCES_DIR + File.separator + tempfilename+".zip");
- } else {
- outputFile = file;
- }
- bytes = getBytesFromFile(outputFile);
-
- } catch (IOException e) {
- handleException("Cannot read data from payload file " + payloadFileName, e);
- }
-
- // Remove temporary payload file
- if (tenantId != null) {
- outputFile.delete();
- }
-
- return bytes;
- }
-
-
- private void editPayload(String tenantName, File file, String tempfileName) {
-
- unzipFile(file, tempfileName);
- editContent(tenantName, file, tempfileName);
- zipPayloadFile(tempfileName);
- }
-
-
- /**
- * unzips the payload file
- *
- * @param file
- * @param tempfileName
- */
- private void unzipFile(File file, String tempfileName) {
-
- int buffer = 2048;
- BufferedOutputStream dest = null;
- ZipInputStream zis = null;
-
- try {
- FileInputStream fis = new FileInputStream(file);
- zis = new ZipInputStream(new BufferedInputStream(fis));
- ZipEntry entry;
-
- while ((entry = zis.getNextEntry()) != null) {
-
- log.debug("Extracting: " + entry);
-
- int count;
- byte data[] = new byte[buffer];
- String outputFilename = tempfileName + File.separator + entry.getName();
- createDirIfNeeded(tempfileName, entry);
-
- // write the files to the disk
- if (!entry.isDirectory()) {
- FileOutputStream fos = new FileOutputStream(outputFilename);
- dest = new BufferedOutputStream(fos, buffer);
- while ((count = zis.read(data, 0, buffer)) != -1) {
- dest.write(data, 0, count);
- }
- dest.flush();
- dest.close();
- }
- }
-
- } catch (Exception e) {
- log.error("Exception is occurred in unzipping payload file. Reason:" + e.getMessage());
- throw new AutoscalerServiceException(e.getMessage(), e);
- } finally {
- closeStream(zis);
- closeStream(dest);
- }
- }
-
-
- private void closeStream(Closeable stream) {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- log.error(" Exception is occurred when closing stream. Reason :" + e.getMessage());
- }
- }
- }
-
- /**
- *
- * Modify contents (tenantName) of the debian_cron_script.sh file
- *
- * @param tenantName
- * @param file
- */
- private void editContent(String tenantName, File file, String tempfileName) {
-
- File f = new File(CARBON_HOME + File.separator + tempfileName
- + File.separator + AutoscalerConstant.PAYLOAD_DIR + File.separator
- + AutoscalerConstant.PARAMS_FILE_NAME);
-
- FileInputStream fs = null;
- InputStreamReader in = null;
- BufferedReader br = null;
-
- StringBuffer sb = new StringBuffer();
-
- String textinLine;
-
- try {
- fs = new FileInputStream(f);
- in = new InputStreamReader(fs);
- br = new BufferedReader(in);
-
- while (true) {
-
- textinLine=br.readLine();
- if(textinLine==null)
- break;
- sb.append(editLine(textinLine, tenantName));
- }
- } catch (Exception e) {
- log.error("Exception is occurred in editing payload content. Reason: "+e.getMessage());
- throw new AutoscalerServiceException(e.getMessage(), e);
- } finally {
- closeStream(fs);
- closeStream(in);
- closeStream(br);
- }
-
- writeChangesBackToFile(f, sb);
- }
-
-
- private String editLine(String textinLine, String tenantName) {
-
- // Format of the line will be <IP>=<IPvalue>,<Path>=<PathValue>..
-
- StringBuffer outputBuffer = new StringBuffer();
- Map<String, String> paramMap = new HashMap<String, String>();
- String[] params = textinLine.split(AutoscalerConstant.ENTRY_SEPARATOR);
-
- for (int i = 0; i < params.length; i++) {
-
- // split the params one by one
- String param = params[i];
- String[] values = param.split(AutoscalerConstant.VALUE_SEPARATOR);
-
- if(values.length != 2) {
- throw new AutoscalerServiceException("Incorrect format in parameters file");
- }
-
- String key = values[0];
- String value = values[1];
-
- String updatedValue = value;
-
- if (AutoscalerConstant.TENANT_KEY.equals(key)) {
- updatedValue = tenantName;
- } else if (AutoscalerConstant.APP_PATH_KEY.equals(key)) {
- updatedValue = getAppPathForTenant(tenantName,value);
- }
- paramMap.put(key, updatedValue);
- }
-
- // Loop through the map and put values into a string
- reOrganizeContent(outputBuffer, paramMap);
-
- // cleanup output buffer
- if (outputBuffer.substring(0, 1).equals(AutoscalerConstant.ENTRY_SEPARATOR)) {
- outputBuffer.delete(0, 1);
- }
-
- return outputBuffer.toString();
- }
-
-
- private void reOrganizeContent(StringBuffer outputBuffer, Map<String, String> paramMap) {
-
- for (Map.Entry<String, String> entry : paramMap.entrySet()) {
- outputBuffer.append(AutoscalerConstant.ENTRY_SEPARATOR).append(entry.getKey()).append(AutoscalerConstant.VALUE_SEPARATOR)
- .append(entry.getValue());
- }
- }
-
-
- private String getAppPathForTenant(String tenantName, String appPath) {
- // Assumes app path is /opt/wso2-app/repository/
- StringBuffer updatedAppPath = new StringBuffer();
- if(tenantName.equals(AutoscalerConstant.SUPER_TENANT_ID)){
- updatedAppPath.append(appPath).append("deployment").append(File.separator).append("server")
- .append(File.separator).append("phpapps");
- }else{
- updatedAppPath.append(appPath).append(tenantName).append(File.separator).append("phpapps");
- }
- return updatedAppPath.toString();
- }
-
-
- private void writeChangesBackToFile(File f, StringBuffer sb) {
- FileWriter fstream = null;
- BufferedWriter outobj = null;
-
- try {
- fstream = new FileWriter(f);
- outobj = new BufferedWriter(fstream);
- outobj.write(sb.toString());
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- closeStream(outobj);
- }
- }
-
- /**
- *
- * Compress the modified files back into payload.zip
- * @param tempfileName
- *
- */
- private void zipPayloadFile(String tempfileName) {
-
- int buffer = 2048;
- BufferedInputStream origin = null;
- ZipOutputStream out = null;
-
- try {
-
- FileOutputStream dest = new
- FileOutputStream(CARBON_HOME + File.separator + AutoscalerConstant.RESOURCES_DIR + File.separator + tempfileName+".zip");
- out = new ZipOutputStream(new BufferedOutputStream(dest));
- byte data[] = new byte[buffer];
-
- File f = new File(CARBON_HOME + File.separator + tempfileName + File.separator + AutoscalerConstant.PAYLOAD_DIR);
- String files[] = f.list();
-
- for (int i=0; i<files.length; i++) {
- FileInputStream fi = new FileInputStream(CARBON_HOME + File.separator + tempfileName
- + File.separator + AutoscalerConstant.PAYLOAD_DIR + File.separator + files[i]);
- origin = new BufferedInputStream(fi, buffer);
- ZipEntry entry = new ZipEntry(AutoscalerConstant.PAYLOAD_DIR + File.separator + files[i]);
- out.putNextEntry(entry);
-
- int count;
- while((count = origin.read(data, 0, buffer)) != -1) {
- out.write(data, 0, count);
- }
- origin.close();
- }
-
- // delete temp files
- deleteDir(f);
- File fl = new File(CARBON_HOME + File.separator + tempfileName);
- fl.delete();
-
- } catch(Exception e) {
- log.error("Exception is occurred in zipping payload file after modification. Reason:" + e.getMessage());
- throw new AutoscalerServiceException(e.getMessage(),e);
- } finally {
- closeStream(origin);
- closeStream(out);
- }
- }
-
- private static boolean deleteDir(File dir) {
- if (dir.isDirectory()) {
- String[] children = dir.list();
- for (int i=0; i<children.length; i++) {
- boolean success = deleteDir(new File(dir, children[i]));
- if (!success) {
- return false;
- }
- }
- }
-
- // The directory is now empty so delete it
- return dir.delete();
- }
-
- private void createDirIfNeeded(String destDirectory, ZipEntry entry) {
-
- String name = entry.getName();
-
- if(name.contains("/"))
- {
- log.debug("directory will need to be created");
-
- int index = name.lastIndexOf("/");
- String dirSequence = name.substring(0, index);
-
- File newDirs = new File(destDirectory + File.separator + dirSequence);
-
- //create the directory
- newDirs.mkdirs();
- }
-
- }
-
-
- /**
- * Returns the contents of the file in a byte array
- *
- * @param file
- * - Input File
- * @return Bytes from the file
- * @throws java.io.IOException
- * , if retrieving the file contents failed.
- */
- private byte[] getBytesFromFile(File file) throws IOException {
- if (!file.exists()) {
- log.error("Payload file " + file.getAbsolutePath() + " does not exist");
- return null;
- }
- InputStream is = new FileInputStream(file);
- byte[] bytes;
-
- try {
- // Get the size of the file
- long length = file.length();
-
- // You cannot create an array using a long type.
- // It needs to be an int type.
- // Before converting to an int type, check
- // to ensure that file is not larger than Integer.MAX_VALUE.
- if (length > Integer.MAX_VALUE) {
- if (log.isDebugEnabled()) {
- log.debug("File is too large");
- }
- }
-
- // Create the byte array to hold the data
- bytes = new byte[(int) length];
-
- // Read in the bytes
- int offset = 0;
- int numRead;
- while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
- offset += numRead;
- }
-
- // Ensure all the bytes have been read in
- if (offset < bytes.length) {
- throw new IOException("Could not completely read file " + file.getName());
- }
- } finally {
- // Close the input stream and return bytes
- is.close();
- }
-
- return bytes;
- }
-
- /**
- * handles the exception
- *
- * @param msg
- * exception message
- */
- private void handleException(String msg) {
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- /**
- * handles the exception
- *
- * @param msg
- * exception message
- * @param e
- * exception
- */
- private static void handleException(String msg, Exception e) {
- log.error(msg, e);
- throw new SynapseException(msg, e);
- }
-
-
- /**
- * This will replace an existing entry in iaasEntities list, if there's such.
- * If not this will add the replacement value to the list.
- *
- * @param replacement
- * IaasContext entry to be added.
- */
- private void replaceIaasContext(IaasContext replacement) {
- for (IaasContext entry : iaasContextList) {
- if (entry.equals(replacement)) {
- int idx = iaasContextList.indexOf(entry);
- iaasContextList.remove(idx);
- iaasContextList.add(idx, replacement);
- return;
- }
- }
- iaasContextList.add(replacement);
-
- }
-
- /**
- * Builds the LXC Template object.
- */
- private void buildLXCTemplates(IaasContext entity, String imageId, boolean blockUntilRunning, String tenantId) {
-
- if (entity.getComputeService() == null) {
- throw new AutoscalerServiceException("Compute service is null for IaaS provider: " + entity.getName());
- }
-
-// // if domain to template map is null
-// if (entity.getDomainToTemplateMap() == null) {
-// // we initialize it
-// entity.setDomainToTemplateMap(new HashMap<String, Template>());
-// }
-
- TemplateBuilder templateBuilder = entity.getComputeService().templateBuilder();
- templateBuilder.imageId(imageId);
-
- // to avoid creation of template objects in each and every time, we create all
- // at once!
- for (ServiceTemplate temp : serviceTemps) {
-
- String instanceType;
-
- // set instance type
- if (((instanceType = temp.getProperty("instanceType." + Iaases.openstack.toString())) != null) ) {
-
- templateBuilder.hardwareId(instanceType);
- }
-
- Template template = templateBuilder.build();
-
- template.getOptions().as(TemplateOptions.class).blockUntilRunning(blockUntilRunning);
-
- template.getOptions()
- .as(NovaTemplateOptions.class)
- .securityGroupNames(temp.getProperty("securityGroups").split(AutoscalerConstant.ENTRY_SEPARATOR));
-
- if (temp.getProperty(AutoscalerConstant.PAYLOAD_DIR) != null) {
- template.getOptions()
- .as(NovaTemplateOptions.class)
- .userData(getUserData(CARBON_HOME + File.separator +
- temp.getProperty(AutoscalerConstant.PAYLOAD_DIR), tenantId));
- }
-
- template.getOptions()
- .as(NovaTemplateOptions.class)
- .keyPairName(temp.getProperty("keyPair"));
-
- // add to the data structure
- if (entity.getInstanceContext(temp.getDomainName(), temp.getSubDomainName()) == null) {
- entity.addInstanceContext(new InstanceContext(temp.getDomainName(),
- temp.getSubDomainName(), template));
- }
- else{
- entity.getInstanceContext(temp.getDomainName(), temp.getSubDomainName()).setTemplate(template);
- }
-
- }
-
- // since we modified the Context, we need to replace
- replaceIaasContext(entity);
- }
-
- /**
- * Builds EC2 Template object
- *
- */
- private void buildEC2Templates(IaasContext entity, String imageId, boolean blockUntilRunning) {
-
- if (entity.getComputeService() == null) {
- throw new AutoscalerServiceException("Compute service is null for IaaS provider: " + entity.getName());
- }
-
-// // if domain to template map is null
-// if (entity.getDomainToTemplateMap() == null) {
-// // we initialize it
-// entity.setDomainToTemplateMap(new HashMap<String, Template>());
-// }
-
- TemplateBuilder templateBuilder = entity.getComputeService().templateBuilder();
-
- // set image id specified
- templateBuilder.imageId(imageId);
-
- // to avoid creation of template objects in each and every time, we create all
- // at once! FIXME we could use caching and lazy loading
- for (ServiceTemplate temp : serviceTemps) {
-
- if (temp.getProperty("instanceType." + Iaases.ec2.toString()) != null) {
- // set instance type eg: m1.large
- templateBuilder.hardwareId(temp.getProperty("instanceType." + Iaases.ec2.toString()));
- }
-
- // build the Template
- Template template = templateBuilder.build();
-
- // make it non blocking
- template.getOptions().as(TemplateOptions.class).blockUntilRunning(blockUntilRunning);
-
- // set EC2 specific options
- template.getOptions()
- .as(AWSEC2TemplateOptions.class)
- .placementGroup(temp.getProperty("availabilityZone"));
-
- template.getOptions()
- .as(AWSEC2TemplateOptions.class)
- .securityGroups(temp.getProperty("securityGroups").split(AutoscalerConstant.ENTRY_SEPARATOR));
-
- if (temp.getProperty(AutoscalerConstant.PAYLOAD_DIR) != null) {
- template.getOptions()
- .as(AWSEC2TemplateOptions.class)
- .userData(getUserData(CARBON_HOME + File.separator +
- temp.getProperty(AutoscalerConstant.PAYLOAD_DIR), null));
- }
-
- template.getOptions()
- .as(AWSEC2TemplateOptions.class)
- .keyPair(temp.getProperty("keyPair"));
-
- // add to the data structure
- if (entity.getInstanceContext(temp.getDomainName(), temp.getSubDomainName()) == null) {
- entity.addInstanceContext(new InstanceContext(temp.getDomainName(),
- temp.getSubDomainName(), template));
- }
- else{
- entity.getInstanceContext(temp.getDomainName(), temp.getSubDomainName()).setTemplate(template);
- }
-
- }
-
- // since we modified the Context, we need to replace
- replaceIaasContext(entity);
-
- }
-
- private String print(Iaases[] values) {
- String str = "";
- for (Iaases iaases : values) {
- str = iaases.name() + ", ";
- }
- str = str.trim();
- return str.endsWith(AutoscalerConstant.ENTRY_SEPARATOR) ? str.substring(0, str.length() - 1) : str;
- }
-
- @SuppressWarnings("unchecked")
- private void deserialize() {
-
- String path;
-
- try {
- path = serializationDir + File.separator +
- AutoscalerConstant.IAAS_CONTEXT_LIST_SERIALIZING_FILE;
-
- Object obj = Deserializer.deserialize(path);
- if (obj != null) {
- iaasContextList = (List<IaasContext>) obj;
- log.debug("Deserialization was successful from file: " + path);
- }
-
- path = serializationDir + File.separator +
- AutoscalerConstant.LASTLY_USED_IAAS_MAP_SERIALIZING_FILE;
-
- obj = Deserializer.deserialize(path);
-
- if (obj != null) {
- lastlyUsedIaasMap = (Map<String, Map<String, String>>) obj;
- log.debug("Deserialization was successful from file: " + path);
- }
-
- } catch (Exception e) {
- String msg = "Deserialization of objects failed!";
- log.fatal(msg, e);
- throw new DeserializationException(msg, e);
- }
-
- }
-
- /**
- * Does all the serialization stuff!
- */
- private void serialize() {
-
- try {
- Serializer.serialize(iaasContextList,
- serializationDir + File.separator +
- AutoscalerConstant.IAAS_CONTEXT_LIST_SERIALIZING_FILE);
-
- Serializer.serialize(lastlyUsedIaasMap,
- serializationDir + File.separator +
- AutoscalerConstant.LASTLY_USED_IAAS_MAP_SERIALIZING_FILE);
-
- } catch (IOException e) {
- String msg = "Serialization of objects failed!";
- log.fatal(msg, e);
- throw new SerializationException(msg, e);
- }
- }
-
- /**
- * A helper method to terminate an instance.
- */
- private void terminate(IaasContext iaasTemp, String nodeId) {
-
- // this is just to be safe
- if (iaasTemp.getComputeService() == null) {
- String msg = "Unexpeced error occured! IaasContext's ComputeService is null!";
- log.error(msg);
- throw new AutoscalerServiceException(msg);
- }
-
- // destroy the node
- iaasTemp.getComputeService().destroyNode(nodeId);
-
- // remove the node id from the Context
- iaasTemp.removeNodeId(nodeId);
-
- // replace this IaasContext instance, as it reflects the new changes.
- replaceIaasContext(iaasTemp);
-
- // serialize the objects
- serialize();
-
- log.info("Node with Id: '" + nodeId + "' is terminated!");
- }
-
- /**
- * Comparator to compare IaasContexts on different attributes.
- */
- public enum IaasContextComparator implements Comparator<IaasContext> {
- SCALE_UP_SORT {
- public int compare(IaasContext o1, IaasContext o2) {
- return Integer.valueOf(o1.getScaleUpOrder()).compareTo(o2.getScaleUpOrder());
- }
- },
- SCALE_DOWN_SORT {
- public int compare(IaasContext o1, IaasContext o2) {
- return Integer.valueOf(o1.getScaleDownOrder()).compareTo(o2.getScaleDownOrder());
- }
- };
-
- public static Comparator<IaasContext> ascending(final Comparator<IaasContext> other) {
- return new Comparator<IaasContext>() {
- public int compare(IaasContext o1, IaasContext o2) {
- return other.compare(o1, o2);
- }
- };
- }
-
- public static Comparator<IaasContext>
- getComparator(final IaasContextComparator... multipleOptions) {
- return new Comparator<IaasContext>() {
- public int compare(IaasContext o1, IaasContext o2) {
- for (IaasContextComparator option : multipleOptions) {
- int result = option.compare(o1, o2);
- if (result != 0) {
- return result;
- }
- }
- return 0;
- }
- };
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/internal/AutoscalerServiceDSComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/internal/AutoscalerServiceDSComponent.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/internal/AutoscalerServiceDSComponent.java
deleted file mode 100644
index 71df23c..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/internal/AutoscalerServiceDSComponent.java
+++ /dev/null
@@ -1,48 +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.autoscaler.service.internal;
-
-import org.apache.stratos.autoscaler.service.impl.AutoscalerServiceImpl;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.apache.stratos.autoscaler.service.IAutoscalerService;
-
-/**
- * Registering Autoscaler Service.
- * @scr.component name="org.apache.stratos.autoscaler.service" immediate="true"
- */
-public class AutoscalerServiceDSComponent {
-
- private static final Log log = LogFactory.getLog(AutoscalerServiceDSComponent.class);
-
- protected void activate(ComponentContext context) {
- try {
- BundleContext bundleContext = context.getBundleContext();
- bundleContext.registerService(IAutoscalerService.class.getName(),
- new AutoscalerServiceImpl(), null);
-
- log.debug("******* Autoscaler Service bundle is activated ******* ");
- } catch (Exception e) {
- log.error("******* Autoscaler Service bundle is failed to activate ****", e);
- }
- }
-}
\ No newline at end of file
[02/10] git commit: Changed jclouds version to 1.6.0 and removed
aws-common artifact dependency
Posted by is...@apache.org.
Changed jclouds version to 1.6.0 and removed aws-common artifact dependency
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/51ffb59a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/51ffb59a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/51ffb59a
Branch: refs/heads/master
Commit: 51ffb59a004124abf7387f6ae7192cd5e288af2a
Parents: 8e7f4ac
Author: Isuru Perera <is...@apache.org>
Authored: Thu Aug 8 15:31:35 2013 +0530
Committer: Isuru Perera <is...@apache.org>
Committed: Thu Aug 8 15:31:35 2013 +0530
----------------------------------------------------------------------
components/org.apache.stratos.cloud.controller/pom.xml | 6 ------
.../org.apache.stratos.cloud.controller.feature/pom.xml | 6 ------
pom.xml | 2 +-
3 files changed, 1 insertion(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/51ffb59a/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 7e660aa..4cd23ae 100644
--- a/components/org.apache.stratos.cloud.controller/pom.xml
+++ b/components/org.apache.stratos.cloud.controller/pom.xml
@@ -252,11 +252,6 @@
<version>${jclouds.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.common</groupId>
- <artifactId>aws-common</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
<groupId>com.jamesmurty.utils.wso2</groupId>
<artifactId>java-xmlbuilder</artifactId>
<version>0.4.wso2v1</version>
@@ -319,7 +314,6 @@
</dependencies>
<properties>
<gson2.version>2.2</gson2.version>
- <jclouds.version>1.5.0-beta.5</jclouds.version>
<jclouds.wso2.version>1.5.0-beta.5.wso2v1</jclouds.wso2.version>
<com.google.guice.assistedinject.wso2.version>3.0.wso2v1</com.google.guice.assistedinject.wso2.version>
<sun.jersey.version>1.12</sun.jersey.version>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/51ffb59a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
----------------------------------------------------------------------
diff --git a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
index 2649c44..025cb35 100644
--- a/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
+++ b/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
@@ -108,11 +108,6 @@
<version>${google.guava.wso2.version}</version>
</dependency>
<dependency>
- <groupId>org.jclouds.common</groupId>
- <artifactId>aws-common</artifactId>
- <version>${jclouds.version}</version>
- </dependency>
- <dependency>
<groupId>com.jamesmurty.utils.wso2</groupId>
<artifactId>java-xmlbuilder</artifactId>
<version>0.4.wso2v1</version>
@@ -229,7 +224,6 @@
<bundleDef>org.jclouds.api:openstack-keystone:${jclouds.wso2.version}</bundleDef>
<bundleDef>org.jclouds.provider:aws-ec2:${jclouds.wso2.version}</bundleDef>
<bundleDef>com.google.guava.wso2:guava:${google.guava.wso2.version}</bundleDef>
- <bundleDef>org.jclouds.common:aws-common:${jclouds.version}</bundleDef>
<bundleDef>com.google.code.gson:gson:${gson2.version}</bundleDef>
<bundleDef>com.google.guice.wso2:guice:${google.guice.wso2.version}</bundleDef>
<bundleDef>com.google.guice.assistedinject.wso2:guice-assistedinject:${com.google.guice.assistedinject.wso2.version}</bundleDef>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/51ffb59a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 963d5a4..210e13a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -169,6 +169,6 @@
<carbon.platform.package.import.version.range>[4.1.0, 4.2.0)</carbon.platform.package.import.version.range>
<carbon.platform.package.export.version>4.1.0</carbon.platform.package.export.version>
<axis2.osgi.version>1.6.1.wso2v9</axis2.osgi.version>
- <jclouds.version>1.5.0-beta.5</jclouds.version>
+ <jclouds.version>1.6.0</jclouds.version>
</properties>
</project>
[03/10] Removed org.apache.stratos.autoscaler.service component as it
is not used in Apache Stratos
Posted by is...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/io/Deserializer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/io/Deserializer.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/io/Deserializer.java
deleted file mode 100644
index 8732094..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/io/Deserializer.java
+++ /dev/null
@@ -1,68 +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.autoscaler.service.io;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class Deserializer {
-
- private static final Log log = LogFactory.getLog(Deserializer.class);
-
- /**
- * We deserialize only if the path to the serialized object file is exists.
- * @param filePath path to the serialized object file
- * @return the object obtained after deserialization or null if file isn't valid.
- * @throws Exception
- */
- public static Object deserialize(String filePath) throws Exception {
-
- ObjectInputStream objIn = null;
- Object obj = null;
-
- if(!new File(filePath).isFile()){
- return obj;
- }
-
- try {
-
- objIn = new ObjectInputStream(new FileInputStream(filePath));
- obj = objIn.readObject();
-
- } catch (IOException e) {
- log.error("Failed to deserialize the file at "+filePath , e);
- throw e;
-
- } catch (ClassNotFoundException e) {
- log.error("Failed to deserialize the file at "+filePath , e);
- throw e;
-
- } finally{
- objIn.close();
- }
-
- return obj;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/io/Serializer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/io/Serializer.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/io/Serializer.java
deleted file mode 100644
index 16f27c4..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/io/Serializer.java
+++ /dev/null
@@ -1,61 +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.autoscaler.service.io;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class Serializer {
-
- private static final Log log = LogFactory.getLog(Serializer.class);
-
- public static void serialize(Object serializableObj, String filePath) throws IOException {
-
- File outFile = new File(filePath);
- ObjectOutput ObjOut = null;
-
- try {
-
- if(outFile.createNewFile()){
- log.debug("Serialization file is created at "+filePath);
- } else{
- log.debug("Serialization file is already existing at "+filePath);
- }
-
- ObjOut = new ObjectOutputStream(new FileOutputStream(outFile));
- ObjOut.writeObject(serializableObj);
-
- } catch (IOException e) {
- log.error("Failed to serialize the object "+serializableObj.toString()
- + " to file "+filePath , e);
- throw e;
-
- } finally{
- ObjOut.close();
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/jcloud/ComputeServiceBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/jcloud/ComputeServiceBuilder.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/jcloud/ComputeServiceBuilder.java
deleted file mode 100644
index b8d5615..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/jcloud/ComputeServiceBuilder.java
+++ /dev/null
@@ -1,65 +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.autoscaler.service.jcloud;
-
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.stratos.autoscaler.service.util.IaasProvider;
-import org.jclouds.ContextBuilder;
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.ComputeServiceContext;
-import org.jclouds.enterprise.config.EnterpriseConfigurationModule;
-import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
-import org.jclouds.sshj.config.SshjSshClientModule;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- * This class is responsible for creating a JClouds specific ComputeService object instances.
- */
-public class ComputeServiceBuilder {
-
- public static ComputeService buildComputeService(IaasProvider iaas) {
-
- Properties properties = new Properties();
-
- // load properties
- for (Map.Entry<String, String> entry : iaas.getProperties().entrySet()) {
- properties.put(entry.getKey(), entry.getValue());
- }
-
- // set modules
- Iterable<Module> modules =
- ImmutableSet.<Module> of(new SshjSshClientModule(), new SLF4JLoggingModule(),
- new EnterpriseConfigurationModule());
-
- // build context
- ContextBuilder builder =
- ContextBuilder.newBuilder(iaas.getProvider())
- .credentials(iaas.getIdentity(), iaas.getCredential()).modules(modules)
- .overrides(properties);
-
- // return the compute service object
- return builder.buildView(ComputeServiceContext.class).getComputeService();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/AutoscalerConstant.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/AutoscalerConstant.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/AutoscalerConstant.java
deleted file mode 100644
index ba07a0b..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/AutoscalerConstant.java
+++ /dev/null
@@ -1,73 +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.autoscaler.service.util;
-
-public final class AutoscalerConstant {
-
- /**
- * elastic-scaler-config XML file's elements
- */
- public static final String SERIALIZATION_DIR_ELEMENT = "serializationDir";
- public static final String IAAS_PROVIDER_ELEMENT = "iaasProvider";
- public static final String IAAS_PROVIDER_TYPE_ATTR = "type";
- public static final String IAAS_PROVIDER_NAME_ATTR = "name";
- public static final String PROPERTY_ELEMENT = "property";
- public static final String PROPERTY_NAME_ATTR= "name";
- public static final String PROPERTY_VALUE_ATTR = "value";
- public static final String IMAGE_ID_ELEMENT = "imageId";
- public static final String SCALE_DOWN_ORDER_ELEMENT = "scaleDownOrder";
- public static final String SCALE_UP_ORDER_ELEMENT = "scaleUpOrder";
- public static final String PROVIDER_ELEMENT = "provider";
- public static final String IDENTITY_ELEMENT = "identity";
- public static final String CREDENTIAL_ELEMENT = "credential";
- public static final String DEFAULT_SERVICE_ELEMENT = "default";
- public static final String SERVICE_ELEMENT = "service";
- public static final String SERVICE_DOMAIN_ATTR = "domain";
- public static final String SERVICE_SUB_DOMAIN_ATTR = "subDomain";
-
- /**
- * Secret Manager related aliases.
- */
- public static final String EC2_IDENTITY_ALIAS = "elastic.scaler.ec2.identity";
- public static final String EC2_CREDENTIAL_ALIAS = "elastic.scaler.ec2.credential";
- public static final String OPENSTACK_IDENTITY_ALIAS = "elastic.scaler.openstack.identity";
- public static final String OPENSTACK_CREDENTIAL_ALIAS = "elastic.scaler.openstack.credential";
-
- /**
- * Serializer related constants
- */
- public static final String IAAS_CONTEXT_LIST_SERIALIZING_FILE = "iaas-context-list.txt";
- public static final String LASTLY_USED_IAAS_MAP_SERIALIZING_FILE = "lastly-used-iaas.txt";
-
- /**
- * Payload related constants
- */
- public static final String PAYLOAD_DIR = "payload";
- public static final String PARAMS_FILE_NAME = "launch-params";
- public static final String RESOURCES_DIR = "resources";
- public static final String VALUE_SEPARATOR = "=";
- public static final String ENTRY_SEPARATOR = ",";
- public static final String APP_PATH_KEY = "APP_PATH";
- public static final String TENANT_KEY = "TENANT";
-
- /**
- * Super tenant id
- */
- public static final String SUPER_TENANT_ID = "-1234";
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/IaasContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/IaasContext.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/IaasContext.java
deleted file mode 100644
index 82f5473..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/IaasContext.java
+++ /dev/null
@@ -1,391 +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.autoscaler.service.util;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.apache.stratos.autoscaler.service.impl.AutoscalerServiceImpl;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.domain.Template;
-
-/**
- * This object holds all IaaS related runtime data.
- */
-public class IaasContext implements Serializable{
-
- private static final long serialVersionUID = -922284976926131383L;
-
- // name of the IaaS
- private Enum<AutoscalerServiceImpl.Iaases> name;
-
- /* We keep following maps in order to make the look up time, low.*/
-
- /**
- * Key - domain
- * Value - is another map
- * key - sub domain
- * value - <code>InstanceContext</code>
- */
- private Map<String, Map<String, InstanceContext>> instanceCtxts;
-
- /**
- * Key - public IP
- * Value - <code>InstanceContext</code>
- */
- private Map<String, InstanceContext> publicIpToInstanceCtxt;
-
- /**
- * Key - node id
- * Value - <code>InstanceContext</code>
- */
- private Map<String, InstanceContext> nodeIdToInstanceCtxt;
-
-
-// private transient Map<String, Template> domainToTemplateMap;
- private transient ComputeService computeService;
-
- // Since Jclouds' NodeMetadata object contains unserializable objects, I had to use 3 maps.
-// private Map<String, String> nodeIdToDomainMap = new LinkedHashMap<String, String>();
-// private Map<String, String> publicIpToDomainMap = new LinkedHashMap<String, String>();
-// private Map<String, String> publicIpToNodeIdMap = new LinkedHashMap<String, String>();
-
- private int scaleUpOrder, scaleDownOrder;
-
- public IaasContext(Enum<AutoscalerServiceImpl.Iaases> name, ComputeService computeService) {
- this.name = name;
- this.computeService = computeService;
- instanceCtxts = new LinkedHashMap<String, Map<String,InstanceContext>>();
- publicIpToInstanceCtxt = new LinkedHashMap<String, InstanceContext>();
- nodeIdToInstanceCtxt = new LinkedHashMap<String, InstanceContext>();
- }
-
- public Enum<AutoscalerServiceImpl.Iaases> getName() {
- return name;
- }
-
- public void addInstanceContext(InstanceContext ctx) {
-
- if(ctx == null){
- return;
- }
-
- String domain = ctx.getDomain();
- String subDomain = ctx.getSubDomain();
-
- if(domain != null && subDomain != null){
- addToInstanceCtxts(domain, subDomain, ctx);
- }
-
- }
-
- public void addNodeDetails(String domain, String subDomain, String nodeId, String ip) {
-
- if(getInstanceContext(domain, subDomain) != null){
- getInstanceContext(domain, subDomain).addNode(nodeId, ip);
-
- nodeIdToInstanceCtxt.put(nodeId, getInstanceContext(domain, subDomain));
- publicIpToInstanceCtxt.put(ip, getInstanceContext(domain, subDomain));
- }
- }
-
- private void addToInstanceCtxts(String domainName, String subDomainName, InstanceContext ctx) {
-
- Map<String, InstanceContext> map;
-
- if(instanceCtxts.get(domainName) == null){
- map = new HashMap<String, InstanceContext>();
-
- } else{
- map = instanceCtxts.get(domainName);
- }
-
- map.put(subDomainName, ctx);
- instanceCtxts.put(domainName, map);
-
- }
-
-// public void addToDomainToTemplateMap(String key, Template value) {
-// domainToTemplateMap.put(key, value);
-// }
-
- public Template getTemplate(String domain, String subDomain) {
- if(getInstanceContext(domain, subDomain) == null){
- return null;
- }
- return getInstanceContext(domain, subDomain).getTemplate();
- }
-
- public InstanceContext getInstanceContext(String domain, String subDomain) {
- if (instanceCtxts.get(domain) != null) {
- return instanceCtxts.get(domain).get(subDomain);
- }
- return null;
- }
-
- public ComputeService getComputeService() {
- return computeService;
- }
-
- public void setComputeService(ComputeService computeService) {
- this.computeService = computeService;
- }
-
-// public void addNodeIdToDomainMap(String nodeId, String domain) {
-// nodeIdToDomainMap.put(nodeId, domain);
-// }
-//
-// public void addPublicIpToDomainMap(String ip, String domain) {
-// publicIpToDomainMap.put(ip, domain);
-// }
-//
-// public void addPublicIpToNodeIdMap(String ip, String nodeId) {
-// publicIpToNodeIdMap.put(ip, nodeId);
-// }
-
- /**
- * This will return the node id of the node which is belong to the
- * requesting domain, sub domain and which is the most recently created. If it cannot find a
- * matching node id, this will return <code>null</code>.
- * @param domain service domain.
- * @param subDomain service sub domain.
- * @return the node Id of the node
- */
- public String getLastMatchingNode(String domain, String subDomain) {
-
- InstanceContext ctx = getInstanceContext(domain, subDomain);
-
- if(ctx == null){
- return null;
- }
-
- // iterate in reverse order
- ListIterator<String> iter =
- new ArrayList<String>(ctx.getNodeIdToIpMap().keySet()).
- listIterator(ctx.getNodeIdToIpMap().size());
-
- if (iter.hasPrevious()) {
- return iter.previous();
- }
-
- return null;
- }
-
- /**
- * This will return the public IP of the node which is belong to the
- * requesting domain, sub domain and which is the most recently created. If it cannot find a
- * matching public IP, this will return <code>null</code>.
- * @param domain service domain.
- * @param subDomain service sub domain.
- * @return the public IP of the node
- */
- public String getLastMatchingPublicIp(String domain, String subDomain) {
-
- InstanceContext ctx = getInstanceContext(domain, subDomain);
-
- if(ctx == null){
- return null;
- }
-
- // iterate in reverse order
- ListIterator<String> iter =
- new ArrayList<String>(ctx.getNodeIdToIpMap().keySet()).
- listIterator(ctx.getNodeIdToIpMap().size());
-
- while (iter.hasPrevious()) {
- return ctx.getNodeIdToIpMap().get(iter.previous());
- }
-
- return null;
-
-// // traverse from the last entry of the map
-// ListIterator<Map.Entry<String, String>> iter =
-// new ArrayList<Entry<String, String>>(publicIpToDomainMap.entrySet()).
-// listIterator(publicIpToDomainMap.size());
-//
-// while (iter.hasPrevious()) {
-// Map.Entry<String, String> entry = iter.previous();
-// if (entry.getValue().equals(domain)) {
-// return entry.getKey();
-// }
-// }
-//
-// return null;
- }
-
- /**
- * This will return the node id of the node which is belong to the
- * requesting domain, sub domain and which is created at first. If it cannot find a
- * matching node id, this will return <code>null</code>.
- * @param domain service domain.
- * @param subDomain service sub domain.
- * @return node id of the node
- */
- public String getFirstMatchingNode(String domain, String subDomain) {
-
- InstanceContext ctx = getInstanceContext(domain, subDomain);
-
- if(ctx == null){
- return null;
- }
-
- // iterate in added order
- ListIterator<String> iter =
- new ArrayList<String>(ctx.getNodeIdToIpMap().keySet()).
- listIterator(0);
-
- while (iter.hasNext()) {
- return iter.next();
- }
-
- return null;
-
-// for (Entry<String, String> entry : nodeIdToDomainMap.entrySet()) {
-// if (entry.getValue().equals(domain)) {
-// return entry.getKey();
-// }
-// }
-// return null;
- }
-
- /**
- * This will return the node id of the node which has the given public IP.
- * If it cannot find a matching node id, this will return
- * <code>null</code>.
- * @param publicIp public IP of a node.
- * @return node id of the matching node.
- */
- public String getNodeWithPublicIp(String publicIp) {
-
- InstanceContext ctx;
-
- for (String ip : publicIpToInstanceCtxt.keySet()) {
-
- if (ip.equals(publicIp)) {
-
- ctx = publicIpToInstanceCtxt.get(ip);
-
- for (String nodeId : nodeIdToInstanceCtxt.keySet()) {
- if (ctx.equals(nodeIdToInstanceCtxt.get(nodeId))) {
- return nodeId;
- }
- }
- }
- }
-
- return null;
- }
-
- /**
- * This will return a list of node Ids that are started in this IaaS and that are
- * belong to the given domain, sub domain.
- * @param domain service domain.
- * @param subDomain service sub domain.
- * @return List of node Ids.
- */
- public List<String> getNodeIds(String domain, String subDomain) {
-
- InstanceContext ctx = getInstanceContext(domain, subDomain);
-
- if(ctx == null){
- return new ArrayList<String>();
- }
-
- return new ArrayList<String>(ctx.getNodeIdToIpMap().keySet());
-
-
-// List<String> nodeIds = new ArrayList<String>();
-//
-// for (Entry<String, String> entry : nodeIdToDomainMap.entrySet()) {
-// if (entry.getValue().equals(domain)) {
-// nodeIds.add(entry.getKey());
-// }
-// }
-//
-// return nodeIds;
- }
-
- /**
- * Removes a specific node id and related entries.
- * @param node id of the node to be removed.
- */
- public void removeNodeId(String nodeId) {
-
- InstanceContext ctx;
-
- if(nodeIdToInstanceCtxt.containsKey(nodeId)){
- // remove from node id map
- ctx = nodeIdToInstanceCtxt.remove(nodeId);
-
- // remove from public ip map
- publicIpToInstanceCtxt.remove(ctx.getNodeIdToIpMap().get(nodeId));
-
- // remove from main map
- instanceCtxts.get(ctx.getDomain()).get(ctx.getSubDomain()).removeNode(nodeId);
-
- }
- }
-
- public boolean equals(Object obj) {
-
- if (obj instanceof IaasContext) {
- return new EqualsBuilder().append(getName(), ((IaasContext) obj).getName()).isEquals();
- }
- return false;
-
- }
-
- public int hashCode() {
- return new HashCodeBuilder(17, 31). // two randomly chosen prime numbers
- append(name).
- toHashCode();
- }
-
- public int getScaleDownOrder() {
- return scaleDownOrder;
- }
-
- public void setScaleDownOrder(int scaleDownOrder) {
- this.scaleDownOrder = scaleDownOrder;
- }
-
- public int getScaleUpOrder() {
- return scaleUpOrder;
- }
-
- public void setScaleUpOrder(int scaleUpOrder) {
- this.scaleUpOrder = scaleUpOrder;
- }
-
-// public void setDomainToTemplateMap(Map<String, Template> map) {
-// domainToTemplateMap = map;
-// }
-//
-// public Map<String, Template> getDomainToTemplateMap() {
-// return domainToTemplateMap;
-// }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/IaasProvider.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/IaasProvider.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/IaasProvider.java
deleted file mode 100644
index aa123ac..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/IaasProvider.java
+++ /dev/null
@@ -1,141 +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.autoscaler.service.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * This is the basic data structure which holds an IaaS specific details.
- */
-public class IaasProvider {
-
- /**
- * Unique id to identify this IaaS provider.
- */
- private String type;
-
- /**
- * human description of this IaaS provider
- */
- private String name;
-
- /**
- * Property map for this IaaS provider.
- */
- private Map<String, String> properties = new HashMap<String, String>();
-
- /**
- * Image identifier.
- */
- private String template;
-
- /**
- * Scale up order and scale down order of the IaaS.
- */
- private int scaleUpOrder, scaleDownOrder;
-
- private String provider, identity, credential;
-
-// public enum SortParameter {
-// SCALE_UP, SCALE_DOWN
-// }
-
-
- public String getType() {
- return type;
- }
-
- public void setType(String id) {
- this.type = id;
- }
-
- 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 getTemplate() {
- return template;
- }
-
- public void setTemplate(String template) {
- this.template = template;
- }
-
- 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;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/InstanceContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/InstanceContext.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/InstanceContext.java
deleted file mode 100644
index a1544bf..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/InstanceContext.java
+++ /dev/null
@@ -1,93 +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.autoscaler.service.util;
-
-import java.io.Serializable;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.jclouds.compute.domain.Template;
-
-/**
- * This will hold the run-time data related to an instance.
- * Instance can be an EC2 one, Openstack one etc.
- */
-public class InstanceContext implements Serializable {
-
- private static final long serialVersionUID = -2604902942512629140L;
- private String domain;
- private String subDomain;
- private transient Template template;
-
- /**
- * Key - node Id
- * Value - IP
- */
- private Map<String, String> nodeIdToIpMap;
-
- public InstanceContext(String domain, String subDomain, Template temp) {
- this.domain = domain;
- this.subDomain = subDomain;
- this.template = temp;
- nodeIdToIpMap = new LinkedHashMap<String, String>();
- }
-//
-// public InstanceContext(String domain, String subDomain, Template temp, String nodeId, String publicIp) {
-// this.domain = domain;
-// this.subDomain = subDomain;
-// this.template = temp;
-// this.nodeId = nodeId;
-// this.publicIp = publicIp;
-// }
-
-
- public String getDomain() {
- return domain;
- }
-
- public String getSubDomain() {
- return subDomain;
- }
-
- public Template getTemplate() {
- return template;
- }
-
- public void setTemplate(Template temp) {
- this.template = temp;
- }
-
- public void addNode(String nodeId, String ip) {
- if("".equals(ip)){
- ip = null;
- }
- nodeIdToIpMap.put(nodeId, ip);
- }
-
- public void removeNode(String nodeId) {
- nodeIdToIpMap.remove(nodeId);
- }
-
-
- public Map<String, String> getNodeIdToIpMap() {
- return nodeIdToIpMap;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/ServiceTemplate.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/ServiceTemplate.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/ServiceTemplate.java
deleted file mode 100644
index fc1569b..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/util/ServiceTemplate.java
+++ /dev/null
@@ -1,84 +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.autoscaler.service.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.stratos.lb.common.conf.util.Constants;
-
-/**
- * We keep details under a service element of jcoluds configuration file,
- * in this object.
- */
-public class ServiceTemplate implements Cloneable {
-
- private String domainName;
- private String subDomainName = Constants.DEFAULT_SUB_DOMAIN;
- private Map<String, String> properties = new HashMap<String, String>();
-
- public String getDomainName() {
- return domainName;
- }
-
- public boolean setDomainName(String domainName) {
- if (!"".equals(domainName)) {
- this.domainName = 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 String getSubDomainName() {
- return subDomainName;
- }
-
- public void setSubDomainName(String subDomainName) {
- if(subDomainName == null || "".equals(subDomainName)){
- return;
- }
- this.subDomainName = subDomainName;
- }
-
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/xml/ElasticScalerConfigFileReader.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/xml/ElasticScalerConfigFileReader.java b/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/xml/ElasticScalerConfigFileReader.java
deleted file mode 100644
index a40cf41..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/java/org/apache/stratos/autoscaler/service/xml/ElasticScalerConfigFileReader.java
+++ /dev/null
@@ -1,557 +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.autoscaler.service.xml;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.apache.stratos.autoscaler.service.exception.MalformedConfigurationFileException;
-import org.apache.stratos.autoscaler.service.util.AutoscalerConstant;
-import org.apache.stratos.autoscaler.service.util.IaasProvider;
-import org.apache.stratos.autoscaler.service.util.ServiceTemplate;
-import org.wso2.carbon.utils.CarbonUtils;
-import org.wso2.securevault.SecretResolver;
-import org.wso2.securevault.SecretResolverFactory;
-
-/**
- * Responsible for reading the Elastic scaler configuration file.
- * Following is a sample XML.
- *
- * <elasticScalerConfig>
- * <iaasProviders>
- * <iaasProvider name="ec2">
- * <provider>aws-ec2</provider>
- * <identity>aaa</identity>
- * <credential>aaaa</credential>
- * <scaleUpOrder>1</scaleUpOrder>
- * <scaleDownOrder>2</scaleDownOrder>
- * <property name="A" value="a"/>
- * <property name="B" value="b"/>
- * <template>temp1</template>
- * </iaasProvider>
- *
- * <iaasProvider name="lxc">
- * <provider>aws-ec2</provider>
- * <identity>aaa</identity>
- * <credential>aaaa</credential>
- * <scaleUpOrder>2</scaleUpOrder>
- * <scaleDownOrder>1</scaleDownOrder>
- * <property name="X" value="x"/>
- * <property name="Y" value="y"/>
- * <template>temp2</template>
- * </iaasProvider>
- * </iaasProviders>
- * $lt;services>
- * $lt;default>
- * $lt;property name="availabilityZone" value="us-east-1c"/>
- * $lt;property name="securityGroups" value="manager,cep,mb,default"/>
- * $lt;property name="instanceType" value="m1.large"/>
- * $lt;property name="keyPair" value="aa"/>
- * $lt;/default>
- * $lt;service domain="wso2.as.domain">
- * $lt;property name="securityGroups" value="manager,default"/>
- * $lt;property name="payload" value="resources/as.zip"/>
- * $lt;/service>
- * $lt;/services>
- * </elasticScalerConfig>
- */
-public class ElasticScalerConfigFileReader {
-
- private static final Log log = LogFactory.getLog(ElasticScalerConfigFileReader.class);
-
- //get the factory
- private DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- private Document dom;
- private Element docEle;
-
- /**
- * Path to elastic-scaler-config XML file, which specifies the Iaas specific details and
- * services related details.
- */
- private String elasticScalerConfigFile;
-
-
- public ElasticScalerConfigFileReader(){
-
- elasticScalerConfigFile = CarbonUtils.getCarbonConfigDirPath() +
- File.separator + "elastic-scaler-config.xml";
-
- /**
- * Parse the configuration file.
- */
- try {
- //Using factory, get an instance of document builder
- DocumentBuilder db = dbf.newDocumentBuilder();
-
- //parse using builder to get DOM representation of the XML file
- dom = db.parse(elasticScalerConfigFile);
-
-
- }catch(Exception ex) {
- String msg = "Error occurred while parsing the "+elasticScalerConfigFile+".";
- handleException(msg, ex);
- }
- }
-
- /**
- * Constructor to be used in the test cases.
- * @param file path to elastic-scaler-config xml file.
- */
- public ElasticScalerConfigFileReader(String file) {
-
- /**
- * Parse the configuration file.
- */
- try {
- //Using factory, get an instance of document builder
- DocumentBuilder db = dbf.newDocumentBuilder();
-
- //parse using builder to get DOM representation of the XML file
- dom = db.parse(file);
-
-
- }catch(Exception ex) {
- String msg = "Error occurred when parsing the "+file+".";
- handleException(msg, ex);
- }
- }
-
- /**
- * Returns the serialization directory specified in the configuration file.
- * @return the path to the directory or an empty string if element cannot be found.
- */
- public String getSerializationDir() {
-
- docEle = dom.getDocumentElement();
- NodeList nl = docEle.getElementsByTagName(AutoscalerConstant.SERIALIZATION_DIR_ELEMENT);
-
- // there should be only one serializationDir element, we neglect all the others
- if (nl != null && nl.getLength() > 0) {
-
- if (nl.item(0).getNodeType() == Node.ELEMENT_NODE) {
- Element prop = (Element) nl.item(0);
-
- return prop.getTextContent();
-
- }
- }
-
- return "";
- }
-
- /**
- * Load all IaasProviders from the configuration file and returns a list.
- * @return a list of IaasProvider instances.
- */
- public List<IaasProvider> getIaasProvidersList() {
- List<IaasProvider> iaasProviders = new ArrayList<IaasProvider>();
-
- docEle = dom.getDocumentElement();
- NodeList nl = docEle.getElementsByTagName(AutoscalerConstant.IAAS_PROVIDER_ELEMENT);
-
- if (nl != null && nl.getLength() > 0) {
-
- for(int i=0; i< nl.getLength() ; i++){
- iaasProviders.add(getIaasProvider(nl.item(i)));
- }
-
- }
- else{
- String msg = "Essential '"+AutoscalerConstant.IAAS_PROVIDER_ELEMENT+"' element cannot" +
- " be found in "+elasticScalerConfigFile;
- handleException(msg);
- }
-
- return iaasProviders;
-
- }
-
- private IaasProvider getIaasProvider(Node item) {
-
- IaasProvider iaas = new IaasProvider();
-
- if (item.getNodeType() == Node.ELEMENT_NODE) {
- Element iaasElt = (Element) item;
- iaas.setType(iaasElt.getAttribute(AutoscalerConstant.IAAS_PROVIDER_TYPE_ATTR));
-
- if("".equals(iaas.getType())){
- String msg = "'"+AutoscalerConstant.IAAS_PROVIDER_ELEMENT+"' element's '"+
- AutoscalerConstant.IAAS_PROVIDER_TYPE_ATTR+"' attribute should be specified!";
-
- handleException(msg);
-
- }
-
- // this is not mandatory
- iaas.setName(iaasElt.getAttribute(AutoscalerConstant.IAAS_PROVIDER_NAME_ATTR));
-
- iaas.setProperties(loadProperties(iaasElt));
- loadTemplate(iaas, iaasElt);
- loadScalingOrders(iaas, iaasElt);
- loadProvider(iaas, iaasElt);
- loadIdentity(iaas, iaasElt);
- loadCredentials(iaas, iaasElt);
- }
-
-
- return iaas;
- }
-
- /**
- * Load all ServiceTemplates from the configuration file and returns a list.
- * @return a list of ServiceTemplate instances.
- */
- public List<ServiceTemplate> getTemplates() {
-
- List<ServiceTemplate> templates = new ArrayList<ServiceTemplate>();
-
- // build default template object
- ServiceTemplate template = new ServiceTemplate();
-
- Element docEle = dom.getDocumentElement();
- NodeList nl = docEle.getElementsByTagName(AutoscalerConstant.DEFAULT_SERVICE_ELEMENT);
-
- if (nl != null && nl.getLength() > 0) {
-
- Node item = nl.item(0);
-
- if (item.getNodeType() == Node.ELEMENT_NODE) {
- Element defaultElt = (Element) item;
- template.setProperties(loadProperties(defaultElt));
- }
-
- }
-
- // append / overwrite the default template object with values in each domain
- nl = docEle.getElementsByTagName(AutoscalerConstant.SERVICE_ELEMENT);
-
- if (nl != null && nl.getLength() > 0) {
-
- for (int i = 0; i < nl.getLength(); i++) {
- Node item = nl.item(i);
-
- // clone the default template to an independent object
- try {
- ServiceTemplate temp = (ServiceTemplate) template.clone();
-
- if (item.getNodeType() == Node.ELEMENT_NODE) {
- Element imageElt = (Element) item;
-
- if ("".equals(imageElt.getAttribute(
- AutoscalerConstant.SERVICE_DOMAIN_ATTR))) {
- String msg =
- "Essential '"+AutoscalerConstant.SERVICE_DOMAIN_ATTR+"' " +
- "attribute of '"+AutoscalerConstant.SERVICE_ELEMENT+
- "' element cannot be found in " + elasticScalerConfigFile;
-
- handleException(msg);
- }
-
- // set domain name
- temp.setDomainName(imageElt.getAttribute(AutoscalerConstant.SERVICE_DOMAIN_ATTR));
-
- // set sub domain
- temp.setSubDomainName(imageElt.getAttribute(
- AutoscalerConstant.SERVICE_SUB_DOMAIN_ATTR));
-
- // load custom properties
- Map<String, String> customProperties = loadProperties(imageElt);
-
- // add custom properties (overwrite default properties where necessary)
- for (Entry<String, String> pair : customProperties.entrySet()) {
- temp.setProperty(pair.getKey(), pair.getValue());
- }
-
- }
-
- // add each domain specific template to list
- templates.add(temp);
-
- } catch (CloneNotSupportedException e) {
- String msg = "This is extraordinary!! ";
- handleException(msg, e);
- }
- }
- }
-
- return templates;
- }
-
- private void loadCredentials(IaasProvider iaas, Element iaasElt) {
-
- NodeList nl = iaasElt.getElementsByTagName(AutoscalerConstant.CREDENTIAL_ELEMENT);
-
- // there should be only one credential element, we neglect all the others
- if (nl != null && nl.getLength() > 0) {
-
- if (nl.getLength() > 1){
- log.warn(elasticScalerConfigFile +" contains more than one "+
- AutoscalerConstant.CREDENTIAL_ELEMENT+" elements!" +
- " Elements other than the first will be neglected.");
- }
-
- if (nl.item(0).getNodeType() == Node.ELEMENT_NODE) {
-
- // retrieve the value using secure vault
- SecretResolver secretResolver = SecretResolverFactory.create(docEle, false);
- String alias;
-
- // FIXME following is a hack to find the correct alias.
- if (iaas.getProvider().contains("ec2")) {
- alias = AutoscalerConstant.EC2_CREDENTIAL_ALIAS;
- } else {
- alias = AutoscalerConstant.OPENSTACK_CREDENTIAL_ALIAS;
- }
-
- // retrieve the secured password
- if (secretResolver != null && secretResolver.isInitialized() &&
- secretResolver.isTokenProtected(alias)) {
-
- iaas.setCredential(secretResolver.resolve(alias));
-
- }
-
- }
- }
- else{
- String msg = "Essential '"+AutoscalerConstant.CREDENTIAL_ELEMENT+"' element" +
- " has not specified in "+elasticScalerConfigFile;
- handleException(msg);
- }
- }
-
- private void loadIdentity(IaasProvider iaas, Element iaasElt) {
-
- NodeList nl = iaasElt.getElementsByTagName(AutoscalerConstant.IDENTITY_ELEMENT);
-
- // there should be only one identity element, we neglect all the others
- if (nl != null && nl.getLength() > 0) {
-
- if (nl.getLength() > 1){
- log.warn(elasticScalerConfigFile +" contains more than one "+
- AutoscalerConstant.IDENTITY_ELEMENT+" elements!" +
- " Elements other than the first will be neglected.");
- }
-
- if (nl.item(0).getNodeType() == Node.ELEMENT_NODE) {
-
- // retrieve the value using secure vault
- SecretResolver secretResolver = SecretResolverFactory.create(docEle, false);
- String alias;
-
- //FIXME following is a hack to find the correct alias.
- if(iaas.getProvider().contains("ec2")){
- alias = AutoscalerConstant.EC2_IDENTITY_ALIAS;
- }
- else{
- alias = AutoscalerConstant.OPENSTACK_IDENTITY_ALIAS;
- }
-
- // retrieve the secured password
- if (secretResolver != null && secretResolver.isInitialized() &&
- secretResolver.isTokenProtected(alias)) {
-
- iaas.setIdentity(secretResolver.resolve(alias));
-
- }
-
- }
- }
- else{
- String msg = "Essential '"+AutoscalerConstant.IDENTITY_ELEMENT+"' element" +
- " has not specified in "+elasticScalerConfigFile;
- handleException(msg);
- }
- }
-
- private void loadProvider(IaasProvider iaas, Element iaasElt) {
-
- NodeList nl = iaasElt.getElementsByTagName(AutoscalerConstant.PROVIDER_ELEMENT);
-
- // there should be only one provider element, we neglect all the others
- if (nl != null && nl.getLength() > 0) {
-
- if (nl.getLength() > 1){
- log.warn(elasticScalerConfigFile +" contains more than one "+
- AutoscalerConstant.PROVIDER_ELEMENT+" elements!" +
- " Elements other than the first will be neglected.");
- }
-
- if (nl.item(0).getNodeType() == Node.ELEMENT_NODE) {
- Element prop = (Element) nl.item(0);
-
- iaas.setProvider(prop.getTextContent());
-
- }
- }
- else{
- String msg = "Essential '"+AutoscalerConstant.PROVIDER_ELEMENT+"' element " +
- "has not specified in "+elasticScalerConfigFile;
- handleException(msg);
- }
- }
-
- private void loadScalingOrders(IaasProvider iaas, Element iaasElt) {
-
- NodeList nl = iaasElt.getElementsByTagName(AutoscalerConstant.SCALE_UP_ORDER_ELEMENT);
-
- // there should be only one scaleUpOrder element, we neglect all the others
- if (nl != null && nl.getLength() > 0) {
-
- if (nl.getLength() > 1){
- log.warn(elasticScalerConfigFile +" contains more than one "+
- AutoscalerConstant.SCALE_UP_ORDER_ELEMENT+" elements!" +
- " Elements other than the first will be neglected.");
- }
-
- if (nl.item(0).getNodeType() == Node.ELEMENT_NODE) {
- Element prop = (Element) nl.item(0);
-
- try {
- iaas.setScaleUpOrder(Integer.parseInt(prop.getTextContent()));
- }catch (NumberFormatException e) {
- String msg = AutoscalerConstant.SCALE_UP_ORDER_ELEMENT+" element contained" +
- " in "+elasticScalerConfigFile +"" +
- " has a value which is not an Integer value.";
- handleException(msg, e);
- }
-
- }
- }
- else{
- String msg = "Essential '"+AutoscalerConstant.SCALE_UP_ORDER_ELEMENT+"' element" +
- " has not specified in "+elasticScalerConfigFile;
- handleException(msg);
- }
-
-
- nl = iaasElt.getElementsByTagName(AutoscalerConstant.SCALE_DOWN_ORDER_ELEMENT);
-
- // there should be only one scaleDownOrder element, we neglect all the others
- if (nl != null && nl.getLength() > 0) {
-
- if (nl.getLength() > 1){
- log.warn(elasticScalerConfigFile +" contains more than one "+
- AutoscalerConstant.SCALE_DOWN_ORDER_ELEMENT+" elements!" +
- " Elements other than the first will be neglected.");
- }
-
- if (nl.item(0).getNodeType() == Node.ELEMENT_NODE) {
- Element prop = (Element) nl.item(0);
-
- try {
- iaas.setScaleDownOrder(Integer.parseInt(prop.getTextContent()));
- }catch (NumberFormatException e) {
- String msg = AutoscalerConstant.SCALE_DOWN_ORDER_ELEMENT+" element contained" +
- " in "+elasticScalerConfigFile +"" +
- " has a value which is not an Integer value.";
- handleException(msg, e);
- }
-
- }
- }
- else{
- String msg = "Essential '"+AutoscalerConstant.SCALE_DOWN_ORDER_ELEMENT+"' element" +
- " has not specified in "+elasticScalerConfigFile;
- handleException(msg);
- }
- }
-
- private void loadTemplate(IaasProvider iaas, Element iaasElt) {
-
- NodeList nl = iaasElt.getElementsByTagName(AutoscalerConstant.IMAGE_ID_ELEMENT);
-
- // there should be only one imageId element, we neglect all the others
- if (nl != null && nl.getLength() > 0) {
-
- if (nl.getLength() > 1){
- log.warn(elasticScalerConfigFile +" contains more than one "+
- AutoscalerConstant.IMAGE_ID_ELEMENT+" elements!" +
- " Elements other than the first will be neglected.");
- }
-
- if (nl.item(0).getNodeType() == Node.ELEMENT_NODE) {
- Element prop = (Element) nl.item(0);
-
- iaas.setTemplate(prop.getTextContent());
-
- }
- }
- else{
- String msg = "Essential '"+AutoscalerConstant.IMAGE_ID_ELEMENT+"' element" +
- " has not specified in "+elasticScalerConfigFile;
- handleException(msg);
- }
- }
-
- private Map<String, String> loadProperties(Element iaasElt) {
-
- Map<String, String> propertyMap = new HashMap<String, String>();
-
- NodeList nl = iaasElt.getElementsByTagName(AutoscalerConstant.PROPERTY_ELEMENT);
-
- if (nl != null && nl.getLength() > 0) {
- for(int i=0; i< nl.getLength() ; i++){
-
- if (nl.item(i).getNodeType() == Node.ELEMENT_NODE) {
- Element prop = (Element) nl.item(i);
-
- if("".equals(prop.getAttribute(AutoscalerConstant.PROPERTY_NAME_ATTR)) ||
- "".equals(prop.getAttribute(AutoscalerConstant.PROPERTY_VALUE_ATTR))){
-
- String msg ="Property element's, name and value attributes should be specified " +
- "in "+elasticScalerConfigFile;
-
- handleException(msg);
- }
- propertyMap.put(prop.getAttribute(AutoscalerConstant.PROPERTY_NAME_ATTR),
- prop.getAttribute(AutoscalerConstant.PROPERTY_VALUE_ATTR));
-
- }
- }
- }
-
- return propertyMap;
- }
-
- private void handleException(String msg){
- log.error(msg);
- throw new MalformedConfigurationFileException(msg);
- }
-
- private void handleException(String msg, Exception e) {
- log.error(msg, e);
- throw new MalformedConfigurationFileException(msg, e);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/main/resources/META-INF/services.xml b/components/org.apache.stratos.autoscaler.service/src/main/resources/META-INF/services.xml
deleted file mode 100644
index 04dd8d8..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/main/resources/META-INF/services.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<serviceGroup>
- <service name="AutoscalerService" scope="application">
- <parameter name="ServiceClass">org.apache.stratos.autoscaler.service.impl.AutoscalerServiceImplpl</parameter>
- <messageReceivers>
- <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
- <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
- </messageReceivers>
- </service>
-</serviceGroup>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/util/IaasContextComparatorTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/util/IaasContextComparatorTest.java b/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/util/IaasContextComparatorTest.java
deleted file mode 100644
index 9a742ee..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/util/IaasContextComparatorTest.java
+++ /dev/null
@@ -1,98 +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.autoscaler.service.util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.stratos.autoscaler.service.impl.AutoscalerServiceImpl.IaasContextComparator;
-import org.apache.stratos.autoscaler.service.impl.AutoscalerServiceImpl.Iaases;
-
-import junit.framework.TestCase;
-
-public class IaasContextComparatorTest extends TestCase {
-
- List<IaasContext> iaasContexts = new ArrayList<IaasContext>();
-
- @Override
- protected void setUp() throws Exception {
- IaasContext a = new IaasContext(Iaases.ec2, null);
- a.setScaleUpOrder(1);
- a.setScaleDownOrder(5);
-
- IaasContext b = new IaasContext(Iaases.openstack, null);
- b.setScaleUpOrder(3);
- b.setScaleDownOrder(0);
-
- iaasContexts.add(a);
- iaasContexts.add(b);
-
- super.setUp();
- }
-
- public void testSort() {
-
- // scale up order sort test
- Collections.sort(iaasContexts,
- IaasContextComparator.ascending(
- IaasContextComparator.getComparator(
- IaasContextComparator.SCALE_UP_SORT)));
-
- assertEquals("ec2", iaasContexts.get(0).getName().toString());
- assertEquals("openstack", iaasContexts.get(1).getName().toString());
-
- // scale down order sort test
- Collections.sort(iaasContexts,
- IaasContextComparator.ascending(
- IaasContextComparator.getComparator(
- IaasContextComparator.SCALE_DOWN_SORT)));
-
- assertEquals("openstack", iaasContexts.get(0).getName().toString());
- assertEquals("ec2", iaasContexts.get(1).getName().toString());
-
-
- IaasContext c = new IaasContext(Iaases.ec2, null);
- c.setScaleUpOrder(0);
- c.setScaleDownOrder(4);
-
- iaasContexts.add(c);
-
- // scale up order sort test
- Collections.sort(iaasContexts,
- IaasContextComparator.ascending(
- IaasContextComparator.getComparator(
- IaasContextComparator.SCALE_UP_SORT)));
-
- assertEquals("ec2", iaasContexts.get(0).getName().toString());
- assertEquals("ec2", iaasContexts.get(1).getName().toString());
-
- // scale down order sort test
- Collections.sort(iaasContexts,
- IaasContextComparator.ascending(
- IaasContextComparator.getComparator(
- IaasContextComparator.SCALE_DOWN_SORT)));
-
- assertEquals("openstack", iaasContexts.get(0).getName().toString());
- assertEquals("ec2", iaasContexts.get(1).getName().toString());
-
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/util/IaasContextTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/util/IaasContextTest.java b/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/util/IaasContextTest.java
deleted file mode 100644
index 2297a6f..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/util/IaasContextTest.java
+++ /dev/null
@@ -1,113 +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.autoscaler.service.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.NodeMetadataBuilder;
-import org.apache.stratos.autoscaler.service.impl.AutoscalerServiceImpl.Iaases;
-import org.apache.stratos.lb.common.conf.util.Constants;
-
-import junit.framework.TestCase;
-
-public class IaasContextTest extends TestCase {
-
- IaasContext ctx;
- NodeMetadata node1, node2, node3, node4;
-
- String[] domains = {"wso2.a", "wso2.b", "wso2.c"};
- String[] subDomains = {"mgt", "worker"};
- String[] nodeIds = {"1", "2", "3", "4", "5"};
- String[] ips = {"192.168.1.2", "192.168.1.3", "192.168.1.4"};
-
- public IaasContextTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
-
- node1 = new NodeMetadataBuilder().id("1")
- .status(org.jclouds.compute.domain.NodeMetadata.Status.RUNNING)
- .publicAddresses(new ArrayList<String>(Arrays.asList("192.168.1.2")))
- .build();
- node2 = new NodeMetadataBuilder().id("2")
- .status(org.jclouds.compute.domain.NodeMetadata.Status.RUNNING)
- .build();
- node3 = new NodeMetadataBuilder().id("3")
- .status(org.jclouds.compute.domain.NodeMetadata.Status.RUNNING)
- .build();
- node4 = new NodeMetadataBuilder().id("4")
- .status(org.jclouds.compute.domain.NodeMetadata.Status.RUNNING)
- .build();
-
- ctx = new IaasContext(Iaases.ec2, null);
-
-
- ctx.addInstanceContext(new InstanceContext(domains[0], subDomains[0], null));
- ctx.addInstanceContext(new InstanceContext(domains[1], subDomains[1], null));
- ctx.addInstanceContext(new InstanceContext(domains[2], subDomains[0], null));
- ctx.addInstanceContext(new InstanceContext(domains[2], Constants.DEFAULT_SUB_DOMAIN, null));
-
- ctx.addNodeDetails(domains[0], subDomains[0], nodeIds[0], "");
- ctx.addNodeDetails(domains[0], subDomains[0], nodeIds[1], ips[0]);
- ctx.addNodeDetails(domains[1], subDomains[1], nodeIds[2], ips[1]);
- ctx.addNodeDetails(domains[2], subDomains[0], nodeIds[3], ips[2]);
- ctx.addNodeDetails(domains[2], Constants.DEFAULT_SUB_DOMAIN, nodeIds[4], "");
-
-
-// ctx.addNodeIdToDomainMap(node1.getId(), "wso2.a");
-// ctx.addPublicIpToDomainMap("192.168.1.2", "wso2.a");
-// ctx.addPublicIpToNodeIdMap("192.168.1.2", node1.getId());
-// ctx.addNodeIdToDomainMap(node2.getId(), "wso2.b");
-// ctx.addNodeIdToDomainMap(node3.getId(), "wso2.a");
-// ctx.addPublicIpToDomainMap("192.168.1.3", "wso2.a");
-// ctx.addPublicIpToNodeIdMap("192.168.1.3", node3.getId());
-// ctx.addNodeIdToDomainMap(node4.getId(), "wso2.c");
- }
-
- public final void testGetLastMatchingNode() {
-
- assertEquals(nodeIds[1], ctx.getLastMatchingNode(domains[0], subDomains[0]));
- ctx.removeNodeId(nodeIds[1]);
- assertEquals(nodeIds[0], ctx.getLastMatchingNode(domains[0], subDomains[0]));
- ctx.addNodeDetails(domains[0], subDomains[0], nodeIds[1], ips[0]);
- }
-
- public final void testGetFirstMatchingNode() {
- assertEquals(nodeIds[0], ctx.getFirstMatchingNode(domains[0], subDomains[0]));
- }
-
- public final void testGetLastMatchingPublicIp() {
- assertEquals(ips[0], ctx.getLastMatchingPublicIp(domains[0], subDomains[0]));
- assertEquals(null, ctx.getLastMatchingPublicIp(domains[2], Constants.DEFAULT_SUB_DOMAIN));
- }
-
- public final void testGetNodeWithPublicIp() {
- assertEquals(nodeIds[3], ctx.getNodeWithPublicIp(ips[2]));
- }
-
- public final void testGetNodeIds() {
- assertEquals(new ArrayList<String>(Arrays.asList(nodeIds[0], nodeIds[1])), ctx.getNodeIds(domains[0], subDomains[0]));
- assertEquals(new ArrayList<String>(Arrays.asList(nodeIds[2])), ctx.getNodeIds(domains[1], subDomains[1]));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/xml/ElasticScalerConfigFileReaderTest.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/xml/ElasticScalerConfigFileReaderTest.java b/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/xml/ElasticScalerConfigFileReaderTest.java
deleted file mode 100644
index 54502b7..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/test/java/org/apache/stratos/autoscaler/service/xml/ElasticScalerConfigFileReaderTest.java
+++ /dev/null
@@ -1,60 +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.autoscaler.service.xml;
-
-import java.util.List;
-import org.apache.stratos.autoscaler.service.util.IaasProvider;
-import junit.framework.TestCase;
-
-public class ElasticScalerConfigFileReaderTest extends TestCase {
-
- public void testGetIaasProvidersListy() throws Exception {
-
- String file = "src/test/resources/elastic-scaler-config.xml";
- ElasticScalerConfigFileReader reader = new ElasticScalerConfigFileReader(file);
-
- List<IaasProvider> list =reader.getIaasProvidersList();
-
- assertEquals(2, list.size());
-
- assertEquals("ec2", list.get(0).getType());
- //assertEquals("cdcd", list.get(0).getIdentity());
- assertEquals(2, list.get(0).getScaleDownOrder());
- assertEquals(1, list.get(0).getScaleUpOrder());
- assertEquals("a", list.get(0).getProperties().get("A.x"));
- assertEquals("b", list.get(0).getProperties().get("B"));
- assertEquals(null, list.get(0).getProperties().get("AA"));
-
- assertEquals("openstack", list.get(1).getType());
- //assertEquals("bebbe", list.get(1).getIdentity());
- assertEquals(1, list.get(1).getScaleDownOrder());
- assertEquals(2, list.get(1).getScaleUpOrder());
- assertEquals("x", list.get(1).getProperties().get("X"));
- assertEquals("y", list.get(1).getProperties().get("Y"));
- assertEquals(null, list.get(1).getProperties().get("x"));
-
-
- List<org.apache.stratos.autoscaler.service.util.ServiceTemplate> temps =reader.getTemplates();
-
- assertEquals("wso2.as.domain", temps.get(0).getDomainName());
- assertEquals("manager,default", temps.get(0).getProperty("securityGroups"));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/org.apache.stratos.autoscaler.service/src/test/resources/elastic-scaler-config.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler.service/src/test/resources/elastic-scaler-config.xml b/components/org.apache.stratos.autoscaler.service/src/test/resources/elastic-scaler-config.xml
deleted file mode 100644
index d05bb14..0000000
--- a/components/org.apache.stratos.autoscaler.service/src/test/resources/elastic-scaler-config.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-
-<!--
-/**
- * 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.
- */
- -->
-
-<elasticScalerConfig xmlns:svns="http://org.wso2.securevault/configuration">
-
-<svns:secureVault provider="org.wso2.securevault.secret.handler.SecretManagerSecretCallbackHandler"/>
- <iaasProviders>
- <iaasProvider type="ec2" name="EC2 specific details">
- <provider>aws-ec2</provider>
- <identity svns:secretAlias="elastic.scaler.ec2.identity">cdcd</identity>
- <credential svns:secretAlias="elastic.scaler.ec2.credential">cdccdc</credential>
- <scaleUpOrder>1</scaleUpOrder>
- <scaleDownOrder>2</scaleDownOrder>
- <property name="A.x" value="a"/>
- <property name="B" value="b"/>
- <imageId>tempEC2</imageId>
- </iaasProvider>
- <iaasProvider type="openstack" >
- <provider>lxc</provider>
- <identity svns:secretAlias="elastic.scaler.openstack.identity">bebbe</identity>
- <credential svns:secretAlias="elastic.scaler.openstack.credential">bebebe</credential>
- <scaleUpOrder>2</scaleUpOrder>
- <scaleDownOrder>1</scaleDownOrder>
- <property name="X" value="x"/>
- <property name="Y" value="y"/>
- <imageId>tempLXC</imageId>
- </iaasProvider>
- </iaasProviders>
-
- <services>
- <default>
- <property name="availabilityZone" value="us-east-1c"/>
- <property name="securityGroups" value="manager,cep,mb,default"/>
- <property name="instanceType.ec2" value="m1.large"/>
- <property name="instanceType.openstack" value="1"/>
- <property name="minAppInstances" value="1"/>
- <property name="maxAppInstances" value="5"/>
- <property name="queueLengthPerNode" value="50"/>
- <property name="roundsToAverage" value="100"/>
- <property name="instancesPerScaleUp" value="1"/>
- <property name="messageExpiryTime" value="60000"/>
- <property name="keyPair" value="aa"/>
- </default>
- <service domain="wso2.as.domain" subDomain="mgt">
- <property name="securityGroups" value="manager,default"/>
- <property name="availabilityZone" value="us-east-1c"/>
- <property name="payload" value="resources/as.zip"/>
- </service>
- </services>
-
-</elasticScalerConfig>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/2490db07/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index 13b2596..62abe5b 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -61,7 +61,6 @@
<module>org.apache.stratos.lb.endpoint</module>
<module>org.apache.stratos.lb.agent</module>
<module>org.apache.stratos.mediator.autoscale</module>
- <module>org.apache.stratos.autoscaler.service</module>
<!-- Tenant Mgt -->
<module>org.apache.stratos.register.ui</module>
<module>org.apache.stratos.tenant.mgt.core</module>
[10/10] git commit: Upgraded jclouds version to 1.6.1-incubating
Posted by is...@apache.org.
Upgraded jclouds version to 1.6.1-incubating
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/84dc901f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/84dc901f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/84dc901f
Branch: refs/heads/master
Commit: 84dc901f9e38cdf2f9926e943734e028b018acfb
Parents: 9ef2a45 3a2cdcc
Author: Isuru Perera <is...@apache.org>
Authored: Mon Aug 12 19:16:33 2013 +0530
Committer: Isuru Perera <is...@apache.org>
Committed: Mon Aug 12 19:16:33 2013 +0530
----------------------------------------------------------------------
.../dependency-reduced-pom.xml | 111 --
.../pom.xml | 207 ---
.../autoscaler/service/IAutoscalerService.java | 112 --
.../exception/AutoscalerServiceException.java | 33 -
.../exception/DeserializationException.java | 33 -
.../MalformedConfigurationFileException.java | 33 -
.../exception/NoInstanceFoundException.java | 39 -
.../exception/SerializationException.java | 33 -
.../service/impl/AutoscalerServiceImpl.java | 1389 ------------------
.../internal/AutoscalerServiceDSComponent.java | 48 -
.../autoscaler/service/io/Deserializer.java | 68 -
.../autoscaler/service/io/Serializer.java | 61 -
.../service/jcloud/ComputeServiceBuilder.java | 65 -
.../service/util/AutoscalerConstant.java | 73 -
.../autoscaler/service/util/IaasContext.java | 391 -----
.../autoscaler/service/util/IaasProvider.java | 141 --
.../service/util/InstanceContext.java | 93 --
.../service/util/ServiceTemplate.java | 84 --
.../xml/ElasticScalerConfigFileReader.java | 557 -------
.../src/main/resources/META-INF/services.xml | 9 -
.../service/util/IaasContextComparatorTest.java | 98 --
.../service/util/IaasContextTest.java | 113 --
.../xml/ElasticScalerConfigFileReaderTest.java | 60 -
.../test/resources/elastic-scaler-config.xml | 71 -
.../org.apache.stratos.cloud.controller/pom.xml | 210 +--
.../cloud/controller/iaases/AWSEC2Iaas.java | 33 +-
.../controller/iaases/OpenstackNovaIaas.java | 64 +-
.../impl/CloudControllerServiceImpl.java | 2 +-
components/pom.xml | 4 +-
.../pom.xml | 95 +-
features/cloud-controller/pom.xml | 4 -
features/pom.xml | 1 -
pom.xml | 1 +
.../distribution/src/main/resources/launch.ini | 1 +
34 files changed, 166 insertions(+), 4171 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/84dc901f/components/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/84dc901f/features/cloud-controller/org.apache.stratos.cloud.controller.feature/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/84dc901f/features/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/84dc901f/pom.xml
----------------------------------------------------------------------