You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ma...@apache.org on 2014/03/13 06:28:49 UTC

[1/4] git commit: Git repo notification

Repository: incubator-stratos
Updated Branches:
  refs/heads/master d239ec945 -> ac6d6e73c


Git repo notification


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

Branch: refs/heads/master
Commit: 7747702624144794984431b83de923c223fee729
Parents: 9694fa2
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Thu Mar 13 10:38:14 2014 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Thu Mar 13 10:38:14 2014 +0530

----------------------------------------------------------------------
 .../rest/endpoint/services/ServiceUtils.java    | 28 ++++++++++++++++++++
 .../rest/endpoint/services/StratosAdmin.java    | 13 +++++++++
 .../main/webapp/stratos/WEB-INF/cxf-servlet.xml |  4 +++
 3 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/77477026/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
index 1f70896..e26ec4d 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
@@ -40,6 +40,7 @@ import org.apache.stratos.manager.dto.Cartridge;
 import org.apache.stratos.manager.dto.SubscriptionInfo;
 import org.apache.stratos.manager.exception.*;
 import org.apache.stratos.manager.manager.CartridgeSubscriptionManager;
+import org.apache.stratos.manager.reponotification.RepoNotificationServiceClient;
 import org.apache.stratos.manager.subscription.CartridgeSubscription;
 import org.apache.stratos.manager.subscription.DataCartridgeSubscription;
 import org.apache.stratos.manager.subscription.PersistenceContext;
@@ -59,6 +60,8 @@ import org.apache.stratos.rest.endpoint.bean.autoscaler.partition.PartitionGroup
 import org.apache.stratos.rest.endpoint.bean.autoscaler.policy.autoscale.AutoscalePolicy;
 import org.apache.stratos.rest.endpoint.bean.cartridge.definition.CartridgeDefinitionBean;
 import org.apache.stratos.rest.endpoint.bean.cartridge.definition.ServiceDefinitionBean;
+import org.apache.stratos.rest.endpoint.bean.repositoryNotificationInfoBean.Payload;
+import org.apache.stratos.rest.endpoint.bean.repositoryNotificationInfoBean.Repository;
 import org.apache.stratos.rest.endpoint.bean.util.converter.PojoConverter;
 import org.apache.stratos.rest.endpoint.exception.RestAPIException;
 
@@ -1159,4 +1162,29 @@ public class ServiceUtils {
         stratosAdminResponse.setMessage("Successfully undeployed service cluster definition for service type " + serviceType);
         return stratosAdminResponse;
     }
+
+    static void getGitRepositoryNotification(Payload payload) throws RestAPIException {
+        try {
+
+            RepoNotificationServiceClient repoNotificationServiceClient = getRepoNotificationServiceClient();
+            repoNotificationServiceClient.getPayload(payload.getRepository().getUrl());
+
+        } catch (Exception e) {
+            String msg = "Failed to get git repository notifications. Cause : " + e.getMessage();
+            log.error(msg, e);
+            throw new RestAPIException(msg, e);
+        }
+    }
+
+    private static RepoNotificationServiceClient getRepoNotificationServiceClient () throws RestAPIException {
+
+        try {
+            return RepoNotificationServiceClient.getServiceClient();
+
+        } catch (AxisFault axisFault) {
+            String errorMsg = "Error while getting Reponotification service client. Cause : " + axisFault.getMessage();
+            log.error(errorMsg, axisFault);
+            throw new RestAPIException(errorMsg, axisFault);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/77477026/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
index f330af1..86a06e5 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/StratosAdmin.java
@@ -38,6 +38,8 @@ import org.apache.stratos.rest.endpoint.bean.autoscaler.policy.autoscale.Autosca
 import org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy;
 import org.apache.stratos.rest.endpoint.bean.cartridge.definition.CartridgeDefinitionBean;
 import org.apache.stratos.rest.endpoint.bean.cartridge.definition.ServiceDefinitionBean;
+import org.apache.stratos.rest.endpoint.bean.repositoryNotificationInfoBean.Payload;
+import org.apache.stratos.rest.endpoint.bean.repositoryNotificationInfoBean.Repository;
 import org.apache.stratos.rest.endpoint.bean.topology.Cluster;
 import org.apache.stratos.rest.endpoint.exception.RestAPIException;
 import org.apache.stratos.tenant.mgt.core.TenantPersistor;
@@ -996,4 +998,15 @@ public class StratosAdmin extends AbstractAdmin {
         }
         return tenantList;
     }
+
+    // Repo notification
+    @POST
+    @Path("/reponotification")
+    @Produces("application/json")
+    @Consumes("application/json")
+    @AuthorizationAction("/permission/protected/manage/monitor/tenants")
+    public void getRepoNotification(Payload payload) throws RestAPIException {
+
+        ServiceUtils.getGitRepositoryNotification(payload);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/77477026/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
index 29d8ab9..f15be4f 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
+++ b/components/org.apache.stratos.rest.endpoint/src/main/webapp/stratos/WEB-INF/cxf-servlet.xml
@@ -31,6 +31,10 @@
         </jaxrs:serviceBeans>
 
         <jaxrs:providers>
+            <bean class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
+                <property name="dropRootElement" value="true"/>
+                <property name="supportUnwrapped" value="true"/>
+            </bean>>
             <ref bean="jsonProvider"/>
             <ref bean="exceptionHandler"/>
             <ref bean="basicAuthenticationFilter"/>


[4/4] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by ma...@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/ac6d6e73
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/ac6d6e73
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/ac6d6e73

Branch: refs/heads/master
Commit: ac6d6e73cc283b62dc5facf5c5e5052de4b57116
Parents: 69949cf d239ec9
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Thu Mar 13 10:58:18 2014 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Thu Mar 13 10:58:18 2014 +0530

----------------------------------------------------------------------
 .../manager/lookup/LookupDataHolder.java        |  13 ++-
 .../lookup/RepoUrlToCartridgeSubscriptions.java | 116 +++++++++++++++++++
 .../DataInsertionAndRetrievalManager.java       |  23 +++-
 3 files changed, 148 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[3/4] git commit: Git Repo Notification

Posted by ma...@apache.org.
Git Repo Notification


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

Branch: refs/heads/master
Commit: 69949cf0c06b0d6e9ef4519cb8c94b0be9904b88
Parents: ed01671
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Thu Mar 13 10:57:24 2014 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Thu Mar 13 10:57:24 2014 +0530

----------------------------------------------------------------------
 .../RepoNotificationServiceClient.java          | 45 ++++++++++++++++++++
 .../repositoryNotificationInfoBean/Payload.java | 16 +++++++
 .../Repository.java                             | 25 +++++++++++
 3 files changed, 86 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/69949cf0/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/reponotification/RepoNotificationServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/reponotification/RepoNotificationServiceClient.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/reponotification/RepoNotificationServiceClient.java
new file mode 100644
index 0000000..6ec885f
--- /dev/null
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/reponotification/RepoNotificationServiceClient.java
@@ -0,0 +1,45 @@
+/*
+*  Copyright (c) 2005-2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+*
+*  WSO2 Inc. 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.manager.reponotification;
+
+import org.apache.axis2.AxisFault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class RepoNotificationServiceClient {
+
+    private static final Log log = LogFactory.getLog(RepoNotificationServiceClient.class);
+    private static volatile RepoNotificationServiceClient serviceClient;
+
+    public static RepoNotificationServiceClient getServiceClient() throws AxisFault {
+        if (serviceClient == null) {
+            synchronized (RepoNotificationServiceClient.class) {
+                if (serviceClient == null) {
+                    serviceClient = new RepoNotificationServiceClient();
+                }
+            }
+        }
+        return serviceClient;
+    }
+
+    public void getPayload(String url) {
+        System.out.println("Repo URL : " + url);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/69949cf0/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/repositoryNotificationInfoBean/Payload.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/repositoryNotificationInfoBean/Payload.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/repositoryNotificationInfoBean/Payload.java
new file mode 100644
index 0000000..0ffe0e7
--- /dev/null
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/repositoryNotificationInfoBean/Payload.java
@@ -0,0 +1,16 @@
+package org.apache.stratos.rest.endpoint.bean.repositoryNotificationInfoBean;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "payload")
+public class Payload {
+    private Repository repository;
+
+    public Repository getRepository() {
+        return repository;
+    }
+
+    public void setRepository(Repository repository) {
+        this.repository = repository;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/69949cf0/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/repositoryNotificationInfoBean/Repository.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/repositoryNotificationInfoBean/Repository.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/repositoryNotificationInfoBean/Repository.java
new file mode 100644
index 0000000..228f531
--- /dev/null
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/repositoryNotificationInfoBean/Repository.java
@@ -0,0 +1,25 @@
+package org.apache.stratos.rest.endpoint.bean.repositoryNotificationInfoBean;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "repository")
+public class Repository {
+    private String url;
+    private String description;
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+}


[2/4] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-stratos

Posted by ma...@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/ed016716
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/ed016716
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/ed016716

Branch: refs/heads/master
Commit: ed016716d7ce2a59cff244cd3a2b3adbfc0e2e1b
Parents: 7747702 d84622f
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Thu Mar 13 10:38:49 2014 +0530
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Thu Mar 13 10:38:49 2014 +0530

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     |  12 +-
 .../apache/stratos/cli/StratosApplication.java  |   6 +-
 .../stratos/cli/beans/cartridge/Cartridge.java  |   6 +-
 .../stratos/cli/commands/CartridgesCommand.java |  67 ---
 .../cli/commands/ListCartridgeInfoCommand.java  | 127 -----
 .../cli/commands/ListCartridgesCommand.java     |  67 +++
 .../stratos/cli/commands/ListCommand.java       | 120 ----
 .../ListSubscribedCartridgesCommand.java        | 120 ++++
 .../stratos/cli/commands/SubscribeCommand.java  |   2 +-
 .../SubscribedCartridgeInfoCommand.java         | 127 +++++
 .../lb/category/LoadBalancerCategory.java       |  84 +++
 .../manager/CartridgeSubscriptionManager.java   |  27 +-
 .../RegistryBasedPersistenceManager.java        |   5 +-
 .../manager/subscription/SubscriptionData.java  |   9 -
 .../utils/CartridgeSubscriptionUtils.java       |   4 +-
 .../model/TopologyClusterInformationModel.java  | 554 ++++++-------------
 .../StratosManagerTopologyReceiver.java         | 149 ++---
 .../rest/endpoint/services/ServiceUtils.java    |  15 +-
 18 files changed, 658 insertions(+), 843 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ed016716/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
----------------------------------------------------------------------