You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by sa...@apache.org on 2014/01/17 08:17:02 UTC
[1/2] git commit: Fixing deployment paths for tenants
Updated Branches:
refs/heads/master b48bfcd96 -> 69ccd8803
Fixing deployment paths for tenants
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/8e417ad7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/8e417ad7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/8e417ad7
Branch: refs/heads/master
Commit: 8e417ad7c8020bbcbd61e9c5edf0f4b06ead06e3
Parents: ec878b3
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Fri Jan 17 12:46:29 2014 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Fri Jan 17 12:46:29 2014 +0530
----------------------------------------------------------------------
.../git/impl/GitBasedArtifactRepository.java | 41 +++++++++++++++++++-
1 file changed, 39 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8e417ad7/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java
index fcd6a83..e8934ad 100644
--- a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java
+++ b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java
@@ -53,6 +53,8 @@ public class GitBasedArtifactRepository {
//Map to keep track of git context per tenant (remote urls, jgit git objects, etc.)
private static ConcurrentHashMap<Integer, RepositoryContext>
tenantToRepoContextMap = new ConcurrentHashMap<Integer, RepositoryContext>();
+ private static String SUPER_TENANT_APP_PATH = "/repository/deployment/server/";
+ private static String TENANT_PATH = "/repository/tenants/";
private GitBasedArtifactRepository () {
@@ -81,8 +83,8 @@ public class GitBasedArtifactRepository {
log.info("tenant " + tenantId);
gitRepoCtx.setTenantId(tenantId);
- gitRepoCtx.setGitLocalRepoPath(gitLocalRepoPath);
- gitRepoCtx.setGitRemoteRepoUrl(gitRemoteRepoUrl);
+ gitRepoCtx.setGitLocalRepoPath(getRepoPathForTenantId(tenantId,gitLocalRepoPath));
+ gitRepoCtx.setGitRemoteRepoUrl(gitRemoteRepoUrl);
gitRepoCtx.setRepoUsername(repositoryInformation.getRepoUsername());
gitRepoCtx.setRepoPassword(repositoryInformation.getRepoPassword());
@@ -113,6 +115,41 @@ public class GitBasedArtifactRepository {
cacheGitRepoContext(tenantId, gitRepoCtx);
}
+
+
+ // If tenant id is "-1234", then its super tenant, else tenant
+ private static String getRepoPathForTenantId(int tenantId,
+ String gitLocalRepoPath) {
+
+ StringBuilder repoPathBuilder = new StringBuilder();
+
+ if(tenantId == -1234) {
+ repoPathBuilder.append(gitLocalRepoPath).append(SUPER_TENANT_APP_PATH);
+ } else {
+ // create folder with tenant id
+ createTenantDir(tenantId, gitLocalRepoPath);
+ repoPathBuilder.append(gitLocalRepoPath).append(TENANT_PATH).append(tenantId);
+ }
+
+ String repoPath = repoPathBuilder.toString();
+ log.info("Repo path returned : " + repoPath);
+ return repoPath;
+ }
+
+ private static void createTenantDir(int tenantId, String path) {
+ String dirPathName = path+TENANT_PATH+tenantId;
+ boolean dirStatus = new File(dirPathName).mkdir();
+ if(dirStatus){
+ log.info("Successfully created directory ["+dirPathName+"] ");
+ }else {
+ log.error("Directory creating failed in ["+dirPathName+"] ");
+ }
+ }
+
+
+
+
+
/**
* Checks if key based authentication (SSH) is required
*
Fwd: [1/2] git commit: Fixing deployment paths for tenants
Posted by Isuru Perera <is...@wso2.com>.
Sajith,
I guess you can use a constant in WSO2 Carbon for -1234 (Super Tenant ID),
right?
---------- Forwarded message ----------
From: <sa...@apache.org>
Date: Fri, Jan 17, 2014 at 12:47 PM
Subject: [1/2] git commit: Fixing deployment paths for tenants
To: commits@stratos.incubator.apache.org
Updated Branches:
refs/heads/master b48bfcd96 -> 69ccd8803
Fixing deployment paths for tenants
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/8e417ad7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/8e417ad7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/8e417ad7
Branch: refs/heads/master
Commit: 8e417ad7c8020bbcbd61e9c5edf0f4b06ead06e3
Parents: ec878b3
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Fri Jan 17 12:46:29 2014 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Fri Jan 17 12:46:29 2014 +0530
----------------------------------------------------------------------
.../git/impl/GitBasedArtifactRepository.java | 41 +++++++++++++++++++-
1 file changed, 39 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/8e417ad7/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java
----------------------------------------------------------------------
diff --git
a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java
b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java
index fcd6a83..e8934ad 100644
---
a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java
+++
b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/artifact/deployment/synchronizer/git/impl/GitBasedArtifactRepository.java
@@ -53,6 +53,8 @@ public class GitBasedArtifactRepository {
//Map to keep track of git context per tenant (remote urls, jgit git
objects, etc.)
private static ConcurrentHashMap<Integer, RepositoryContext>
tenantToRepoContextMap = new
ConcurrentHashMap<Integer, RepositoryContext>();
+ private static String SUPER_TENANT_APP_PATH =
"/repository/deployment/server/";
+ private static String TENANT_PATH = "/repository/tenants/";
private GitBasedArtifactRepository () {
@@ -81,8 +83,8 @@ public class GitBasedArtifactRepository {
log.info("tenant " + tenantId);
gitRepoCtx.setTenantId(tenantId);
- gitRepoCtx.setGitLocalRepoPath(gitLocalRepoPath);
- gitRepoCtx.setGitRemoteRepoUrl(gitRemoteRepoUrl);
+
gitRepoCtx.setGitLocalRepoPath(getRepoPathForTenantId(tenantId,gitLocalRepoPath));
+ gitRepoCtx.setGitRemoteRepoUrl(gitRemoteRepoUrl);
gitRepoCtx.setRepoUsername(repositoryInformation.getRepoUsername());
gitRepoCtx.setRepoPassword(repositoryInformation.getRepoPassword());
@@ -113,6 +115,41 @@ public class GitBasedArtifactRepository {
cacheGitRepoContext(tenantId, gitRepoCtx);
}
+
+
+ // If tenant id is "-1234", then its super tenant, else tenant
+ private static String getRepoPathForTenantId(int tenantId,
+ String gitLocalRepoPath) {
+
+ StringBuilder repoPathBuilder = new StringBuilder();
+
+ if(tenantId == -1234) {
+
repoPathBuilder.append(gitLocalRepoPath).append(SUPER_TENANT_APP_PATH);
+ } else {
+ // create folder with tenant id
+ createTenantDir(tenantId, gitLocalRepoPath);
+
repoPathBuilder.append(gitLocalRepoPath).append(TENANT_PATH).append(tenantId);
+ }
+
+ String repoPath = repoPathBuilder.toString();
+ log.info("Repo path returned : " + repoPath);
+ return repoPath;
+ }
+
+ private static void createTenantDir(int tenantId, String path) {
+ String dirPathName = path+TENANT_PATH+tenantId;
+ boolean dirStatus = new File(dirPathName).mkdir();
+ if(dirStatus){
+ log.info("Successfully created directory
["+dirPathName+"] ");
+ }else {
+ log.error("Directory creating failed in
["+dirPathName+"] ");
+ }
+ }
+
+
+
+
+
/**
* Checks if key based authentication (SSH) is required
*
--
Isuru Perera
Senior Software Engineer | WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware
about.me/chrishantha
[2/2] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-stratos
Posted by sa...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-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/69ccd880
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/69ccd880
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/69ccd880
Branch: refs/heads/master
Commit: 69ccd88039a5484185cbbaa47cef6257b03e011d
Parents: 8e417ad b48bfcd
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Fri Jan 17 12:46:43 2014 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Fri Jan 17 12:46:43 2014 +0530
----------------------------------------------------------------------
.../autoscaler/NetworkPartitionContext.java | 19 ++++
.../console/themes/theme1/partials/header.hbs | 12 ++-
.../console/themes/theme1/renderers/index.js | 6 +-
.../console/themes/theme1/theme.js | 43 +++++++--
.../distribution/src/main/conf/scaling.drl | 95 +++++++++++---------
5 files changed, 117 insertions(+), 58 deletions(-)
----------------------------------------------------------------------