You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mu...@apache.org on 2012/12/11 18:49:39 UTC

[2/2] git commit: event notification service and API

event notification service and API


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

Branch: refs/heads/events-framework
Commit: 7d9381edd3b02166b1ddc7303e3f9093bb22c7a4
Parents: 900c8b2
Author: Murali Reddy <mu...@citrix.com>
Authored: Tue Dec 11 16:53:55 2012 +0530
Committer: Murali Reddy <mu...@citrix.com>
Committed: Tue Dec 11 16:53:55 2012 +0530

----------------------------------------------------------------------
 client/pom.xml                                     |    5 +
 client/tomcatconf/components.xml.in                |    1 +
 .../event-notification-service.properties.in       |   25 ++++++
 plugins/pom.xml                                    |    3 +-
 .../Notifications/EventNotificationManager.java    |    2 +-
 .../EventNotificationManagerImpl.java              |   32 +------
 .../Notifications/EventNotificationService.java    |    3 +-
 .../cloudstack/api/CreateEventSubscriptionCmd.java |   66 +++++++++++++++
 .../cloudstack/api/DeleteEventSubscriptionCmd.java |   52 +++++++++++
 .../cloudstack/api/EventSubscriptionResponse.java  |   49 +++++++++++
 .../cloudstack/api/ListEventSubscriptionCmd.java   |   42 +++++++++
 .../cloudstack/api/UpdateEventSubscriptionCmd.java |   52 +++++++++++
 12 files changed, 302 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index cf1e852..afbd4f8 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -107,6 +107,11 @@
       <version>${project.version}</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.cloudstack</groupId>
+      <artifactId>cloud-plugin-event-notification-service</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
       <version>5.1.21</version>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/client/tomcatconf/components.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in
index b540aeb..5169671 100755
--- a/client/tomcatconf/components.xml.in
+++ b/client/tomcatconf/components.xml.in
@@ -184,6 +184,7 @@ under the License.
         <manager name="ElasticLoadBalancerManager" key="com.cloud.network.lb.ElasticLoadBalancerManager" class="com.cloud.network.lb.ElasticLoadBalancerManagerImpl"/>
         <pluggableservice name="VirtualRouterElementService" key="com.cloud.network.element.VirtualRouterElementService" class="com.cloud.network.element.VirtualRouterElement"/>
         <pluggableservice name="NiciraNvpElementService" key="com.cloud.network.element.NiciraNvpElementService" class="com.cloud.network.element.NiciraNvpElement"/>
+        <pluggableservice name="EventNotificationService" key="org.apache.cloudstack.Events.Notifications.EventNotificationService" class="org.apache.cloudstack.Events.Notifications.EventNotificationManagerImpl"/>
         <dao name="OvsTunnelInterfaceDao" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" singleton="false"/>
         <dao name="OvsTunnelAccountDao" class="com.cloud.network.ovs.dao.OvsTunnelNetworkDaoImpl" singleton="false"/>
         <dao name="NiciraNvpDao" class="com.cloud.network.dao.NiciraNvpDaoImpl" singleton="false"/>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/client/tomcatconf/event-notification-service.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/event-notification-service.properties.in b/client/tomcatconf/event-notification-service.properties.in
new file mode 100644
index 0000000..00f96fe
--- /dev/null
+++ b/client/tomcatconf/event-notification-service.properties.in
@@ -0,0 +1,25 @@
+# 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.
+
+### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
+### Please standardize naming conventions to camel-case (even for acronyms).
+
+#### Event Notification service commands
+createEventSubscription = org.apache.cloudstack.api.CreateEventSubscriptionCmd;15
+listEventSubscription   = org.apache.cloudstack.api.ListEventSubscriptionCmd;15
+deleteEventSubscription = org.apache.cloudstack.api.DeleteEventSubscriptionCmd;15
+updateEventSubscription = org.apache.cloudstack.api.UpdateEventSubscriptionCmd;15

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 220b065..49960e4 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -38,7 +38,7 @@
     <module>hypervisors/ovm</module>
     <module>hypervisors/xen</module>
     <module>hypervisors/kvm</module>
-    <module>message-brokers/rabbitmq</module>
+    <module>event-bus/rabbitmq</module>
     <module>network-elements/elastic-loadbalancer</module>
     <module>network-elements/ovs</module>
     <module>network-elements/nicira-nvp</module>
@@ -47,6 +47,7 @@
     <module>user-authenticators/md5</module>
     <module>user-authenticators/plain-text</module>
     <module>user-authenticators/sha256salted</module>
+    <module>services/event-notification</module>
   </modules>
 
   <dependencies>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManager.java
----------------------------------------------------------------------
diff --git a/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManager.java b/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManager.java
index 8c7e0b2..20750f4 100644
--- a/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManager.java
+++ b/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManager.java
@@ -19,6 +19,6 @@
 
 package org.apache.cloudstack.Events.Notifications;
 
-public interface EventNotificationManager {
+public interface EventNotificationManager extends EventNotificationService {
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManagerImpl.java b/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManagerImpl.java
index d8901f6..f8ec5dc 100644
--- a/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManagerImpl.java
+++ b/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationManagerImpl.java
@@ -19,39 +19,17 @@
 
 package org.apache.cloudstack.Events.Notifications;
 
-import com.cloud.utils.component.Manager;
-import com.cloud.utils.component.PluggableService;
 import org.apache.cloudstack.framework.events.EventTopic;
 
-import javax.naming.ConfigurationException;
-import java.util.Map;
+import javax.ejb.Local;
 import java.util.List;
 
-public class EventNotificationManagerImpl implements EventNotificationManager, EventNotificationService, PluggableService, Manager {
-
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        return false;
-    }
-
-    @Override
-    public boolean start() {
-        return false;
-    }
-
-    @Override
-    public boolean stop() {
-        return false;
-    }
-
-    @Override
-    public String getName() {
-        return null;
-    }
+@Local(value = EventNotificationService.class)
+public class EventNotificationManagerImpl implements EventNotificationManager, EventNotificationService {
 
     @Override
     public String getPropertiesFile() {
-        return null;
+        return "event-notification-service.properties";
     }
 
     @Override
@@ -66,6 +44,6 @@ public class EventNotificationManagerImpl implements EventNotificationManager, E
 
     @Override
     public List<EventTopic> listSubscribedTopics() {
-
+        return null;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationService.java
----------------------------------------------------------------------
diff --git a/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationService.java b/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationService.java
index 14e655b..78cb3e2 100644
--- a/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationService.java
+++ b/plugins/services/event-notification/src/org/apache/cloudstack/Events/Notifications/EventNotificationService.java
@@ -19,11 +19,12 @@
 
 package org.apache.cloudstack.Events.Notifications;
 
+import com.cloud.utils.component.PluggableService;
 import org.apache.cloudstack.framework.events.EventTopic;
 
 import java.util.List;
 
-public interface EventNotificationService {
+public interface EventNotificationService extends PluggableService {
 
     void subscribe(EventTopic topic, Endpoint endpoint);
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/plugins/services/event-notification/src/org/apache/cloudstack/api/CreateEventSubscriptionCmd.java
----------------------------------------------------------------------
diff --git a/plugins/services/event-notification/src/org/apache/cloudstack/api/CreateEventSubscriptionCmd.java b/plugins/services/event-notification/src/org/apache/cloudstack/api/CreateEventSubscriptionCmd.java
new file mode 100644
index 0000000..054affc
--- /dev/null
+++ b/plugins/services/event-notification/src/org/apache/cloudstack/api/CreateEventSubscriptionCmd.java
@@ -0,0 +1,66 @@
+// 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.cloudstack.api;
+
+import com.cloud.api.BaseAsyncCreateCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.*;
+import org.apache.log4j.Logger;
+
+@Implementation(description="Registers a subscriber for the events", responseObject=EventSubscriptionResponse.class)
+public class CreateEventSubscriptionCmd extends BaseAsyncCreateCmd {
+
+    public static final Logger s_logger = Logger.getLogger(CreateEventSubscriptionCmd.class);
+    private static final String s_name =  "eventsubscriptionresponse";
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
+
+    }
+
+    @Override
+    public String getCommandName() {
+       return null;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return 0;
+    }
+
+    @Override
+    public String getEventType() {
+        return null;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return null;
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getEntityTable() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/plugins/services/event-notification/src/org/apache/cloudstack/api/DeleteEventSubscriptionCmd.java
----------------------------------------------------------------------
diff --git a/plugins/services/event-notification/src/org/apache/cloudstack/api/DeleteEventSubscriptionCmd.java b/plugins/services/event-notification/src/org/apache/cloudstack/api/DeleteEventSubscriptionCmd.java
new file mode 100644
index 0000000..da2fdfb
--- /dev/null
+++ b/plugins/services/event-notification/src/org/apache/cloudstack/api/DeleteEventSubscriptionCmd.java
@@ -0,0 +1,52 @@
+// 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.cloudstack.api;
+
+import com.cloud.api.BaseAsyncCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.*;
+
+@Implementation(description="Deletes a subscriber for the events", responseObject=EventSubscriptionResponse.class)
+public class DeleteEventSubscriptionCmd extends BaseAsyncCmd {
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
+
+    }
+
+    @Override
+    public String getCommandName() {
+        return null;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return 0;
+    }
+
+    @Override
+    public String getEventType() {
+        return null;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return null;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/plugins/services/event-notification/src/org/apache/cloudstack/api/EventSubscriptionResponse.java
----------------------------------------------------------------------
diff --git a/plugins/services/event-notification/src/org/apache/cloudstack/api/EventSubscriptionResponse.java b/plugins/services/event-notification/src/org/apache/cloudstack/api/EventSubscriptionResponse.java
new file mode 100644
index 0000000..58ebbf4
--- /dev/null
+++ b/plugins/services/event-notification/src/org/apache/cloudstack/api/EventSubscriptionResponse.java
@@ -0,0 +1,49 @@
+// 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.cloudstack.api;
+
+import com.cloud.api.response.BaseResponse;
+import com.cloud.api.response.ControlledEntityResponse;
+
+public class EventSubscriptionResponse extends BaseResponse implements ControlledEntityResponse {
+
+    @Override
+    public void setAccountName(String accountName) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void setProjectId(Long projectId) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void setProjectName(String projectName) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void setDomainId(Long domainId) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public void setDomainName(String domainName) {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/plugins/services/event-notification/src/org/apache/cloudstack/api/ListEventSubscriptionCmd.java
----------------------------------------------------------------------
diff --git a/plugins/services/event-notification/src/org/apache/cloudstack/api/ListEventSubscriptionCmd.java b/plugins/services/event-notification/src/org/apache/cloudstack/api/ListEventSubscriptionCmd.java
new file mode 100644
index 0000000..0435587
--- /dev/null
+++ b/plugins/services/event-notification/src/org/apache/cloudstack/api/ListEventSubscriptionCmd.java
@@ -0,0 +1,42 @@
+// 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.cloudstack.api;
+
+import com.cloud.api.BaseListCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.*;
+
+@Implementation(description="Lists registerd subscriberd for the events", responseObject=EventSubscriptionResponse.class)
+public class ListEventSubscriptionCmd extends BaseListCmd {
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public String getCommandName() {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7d9381ed/plugins/services/event-notification/src/org/apache/cloudstack/api/UpdateEventSubscriptionCmd.java
----------------------------------------------------------------------
diff --git a/plugins/services/event-notification/src/org/apache/cloudstack/api/UpdateEventSubscriptionCmd.java b/plugins/services/event-notification/src/org/apache/cloudstack/api/UpdateEventSubscriptionCmd.java
new file mode 100644
index 0000000..1cc7ae7
--- /dev/null
+++ b/plugins/services/event-notification/src/org/apache/cloudstack/api/UpdateEventSubscriptionCmd.java
@@ -0,0 +1,52 @@
+// 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.cloudstack.api;
+
+import com.cloud.api.BaseAsyncCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.*;
+
+@Implementation(description="Deletes a subscriber for the events", responseObject=EventSubscriptionResponse.class)
+public class UpdateEventSubscriptionCmd extends BaseAsyncCmd {
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
+
+    }
+
+    @Override
+    public String getCommandName() {
+        return null;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return 0;
+    }
+
+    @Override
+    public String getEventType() {
+        return null;
+    }
+
+    @Override
+    public String getEventDescription() {
+        return null;
+    }
+}
\ No newline at end of file