[jboss-svn-commits] JBL Code SVN: r18651 - in labs/jbosslabs/labs-3.0-build: core/core-api/src/main/java/org/jboss/labs/email and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Mar 1 15:25:11 EST 2008
Author: unibrew
Date: 2008-03-01 15:25:11 -0500 (Sat, 01 Mar 2008)
New Revision: 18651
Added:
labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/email/
labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/email/service/
labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/email/service/EmailService.java
labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/events/EmailEvents.java
labs/jbosslabs/labs-3.0-build/services/events-service/src/main/java/org/jboss/labs/events/EmailEventsConsumer.java
Log:
[JBLAB-912] Email notification service interfaces.
Added: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/email/service/EmailService.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/email/service/EmailService.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/email/service/EmailService.java 2008-03-01 20:25:11 UTC (rev 18651)
@@ -0,0 +1,50 @@
+/*
+* JBoss Labs. http://labs.jboss.com/jbosslabs
+*
+* Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+*
+* This copyrighted material is made available to anyone wishing to use,
+* modify, copy, or redistribute it subject to the terms and conditions
+* of the GNU Lesser General Public License, v. 2.1.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT A WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License, v.2.1 along with this distribution; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+* 02110-1301, USA.
+*
+* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+* Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+*/
+
+package org.jboss.labs.email.service;
+
+import java.util.Set;
+
+import org.jboss.labs.core.model.auth.User;
+
+/**
+ * Interface for an EmailService MBean.
+ *
+ * @author <a href="mailto:rkozmik at redhat.com">Ryszard Kozmik</a>
+ */
+public interface EmailService
+{
+
+ /**
+ * This method sends an email with a given message and subject to all users in a given Set.
+ *
+ * @param users a Set of users to which email will be sent
+ * @param subject a subject of the email
+ * @param message a text content of the email
+ *
+ * @throws Exception - if something will go wrong with JMS EventService an Exception will be thrown
+ *
+ */
+ public void sendEmailToUsers ( Set<User> users , String subject , String message ) throws Exception;
+
+}
Added: labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/events/EmailEvents.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/events/EmailEvents.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/core/core-api/src/main/java/org/jboss/labs/events/EmailEvents.java 2008-03-01 20:25:11 UTC (rev 18651)
@@ -0,0 +1,43 @@
+/*
+* JBoss Labs. http://labs.jboss.com/jbosslabs
+*
+* Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+*
+* This copyrighted material is made available to anyone wishing to use,
+* modify, copy, or redistribute it subject to the terms and conditions
+* of the GNU Lesser General Public License, v. 2.1.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT A WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License, v.2.1 along with this distribution; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+* 02110-1301, USA.
+*
+* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+* Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+*/
+
+package org.jboss.labs.events;
+
+import java.util.EventListener;
+
+import org.jboss.annotation.ejb.Producer;
+import org.jboss.labs.core.model.auth.User;
+
+/**
+ * This interface defines possible email events.
+ *
+ * @author <a href="ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ *
+ */
+ at Producer
+public interface EmailEvents extends EventListener
+{
+
+ public void emailUser(User user, String subject, String message);
+
+}
Added: labs/jbosslabs/labs-3.0-build/services/events-service/src/main/java/org/jboss/labs/events/EmailEventsConsumer.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/services/events-service/src/main/java/org/jboss/labs/events/EmailEventsConsumer.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/services/events-service/src/main/java/org/jboss/labs/events/EmailEventsConsumer.java 2008-03-01 20:25:11 UTC (rev 18651)
@@ -0,0 +1,59 @@
+/*
+* JBoss Labs. http://labs.jboss.com/jbosslabs
+*
+* Copyright © 2008 Red Hat Middleware, LLC. All rights reserved.
+*
+* This copyrighted material is made available to anyone wishing to use,
+* modify, copy, or redistribute it subject to the terms and conditions
+* of the GNU Lesser General Public License, v. 2.1.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT A WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License, v.2.1 along with this distribution; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+* 02110-1301, USA.
+*
+* Red Hat Author(s): Bob McWhirter, Przemyslaw Dej, Ryszard Kozmik,
+* Tomasz Szymanski, Adam Warski, Pawel Wrzeszcz
+*/
+
+package org.jboss.labs.events;
+
+import java.util.List;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.EJB;
+
+import org.jboss.annotation.ejb.Consumer;
+import org.jboss.labs.core.model.auth.User;
+import org.jboss.labs.events.service.EventListenersStorageServiceInterface;
+
+/**
+ * This class consumes all email events and delegates them to the listeners.
+ *
+ * @author <a href="ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ *
+ */
+ at Consumer(activationConfig =
+{
+ @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName="destination", propertyValue="queue/emailEvents")
+})
+public class EmailEventsConsumer implements EmailEvents
+{
+
+ @EJB EventListenersStorageServiceInterface storage;
+
+ public void emailUser(User user, String subject, String message)
+ {
+ List<EmailEvents> list = storage.findAllListeners (this.getClass().getInterfaces()[0]);
+ for ( EmailEvents listener : list ) {
+ listener.emailUser(user, subject, message);
+ }
+ }
+
+}
More information about the jboss-svn-commits
mailing list