]> git.mxchange.org Git - pizzaservice-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sat, 8 Jul 2017 17:15:04 +0000 (19:15 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 8 Jul 2017 19:03:47 +0000 (21:03 +0200)
- this message-driven bean has been moved to new project
- also the mailer's initialization and config properties

Signed-off-by: Roland Häder <roland@mxchange.org>
nbproject/build-impl.xml
nbproject/project.properties
nbproject/project.xml
src/java/org/mxchange/jmailee/model/delivery/PizzaEmailDeliveryMessageBean.java [deleted file]
src/java/org/mxchange/jmailer/config.properties [deleted file]

index 2a4528f566071cb5c3ec7e52cd17f05a9207e742..68097ec256cd74f5507499268ff10c8b4a9031a9 100644 (file)
@@ -812,7 +812,7 @@ exists or setup the property manually. For example like this:
         <ant antfile="${project.pizzaservice-lib}/build.xml" inheritall="false" target="jar">
             <property name="deploy.on.save" value="false"/>
         </ant>
-        <ant antfile="${project.pizzaservice-mailer}/build.xml" inheritall="false" target="jar">
+        <ant antfile="${project.pizzaservice-mailer-lib}/build.xml" inheritall="false" target="jar">
             <property name="deploy.on.save" value="false"/>
         </ant>
         <ant antfile="${project.juser-core}/build.xml" inheritall="false" target="jar">
@@ -826,7 +826,7 @@ exists or setup the property manually. For example like this:
         <ant antfile="${project.pizzaservice-lib}/build.xml" inheritall="false" target="jar">
             <property name="deploy.on.save" value="false"/>
         </ant>
-        <ant antfile="${project.pizzaservice-mailer}/build.xml" inheritall="false" target="jar">
+        <ant antfile="${project.pizzaservice-mailer-lib}/build.xml" inheritall="false" target="jar">
             <property name="deploy.on.save" value="false"/>
         </ant>
         <ant antfile="${project.juser-core}/build.xml" inheritall="false" target="jar">
@@ -866,7 +866,7 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${libs.GNU_JPDF_1.7.0.classpath}" todir="${build.classes.dir}"/>
         <copyfiles files="${reference.pizzaservice-core.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${reference.pizzaservice-lib.jar}" todir="${build.classes.dir}"/>
-        <copyfiles files="${reference.pizzaservice-mailer.jar}" todir="${build.classes.dir}"/>
+        <copyfiles files="${reference.pizzaservice-mailer-lib.jar}" todir="${build.classes.dir}"/>
         <copyfiles files="${file.reference.cdi-api.jar}" todir="${build.classes.dir}"/>
     </target>
     <target if="is.server.weblogic" name="-library-inclusion-in-archive-weblogic">
@@ -892,7 +892,7 @@ exists or setup the property manually. For example like this:
         <basename file="${libs.GNU_JPDF_1.7.0.classpath}" property="manifest.libs.GNU_JPDF_1.7.0.classpath"/>
         <basename file="${reference.pizzaservice-core.jar}" property="manifest.reference.pizzaservice-core.jar"/>
         <basename file="${reference.pizzaservice-lib.jar}" property="manifest.reference.pizzaservice-lib.jar"/>
-        <basename file="${reference.pizzaservice-mailer.jar}" property="manifest.reference.pizzaservice-mailer.jar"/>
+        <basename file="${reference.pizzaservice-mailer-lib.jar}" property="manifest.reference.pizzaservice-mailer-lib.jar"/>
         <basename file="${file.reference.cdi-api.jar}" property="manifest.file.reference.cdi-api.jar"/>
         <manifest file="${build.ear.classes.dir}/META-INF/MANIFEST.MF" mode="update">
             <attribute name="Extension-List" value="jar-1 jar-2 jar-3 jar-4 jar-5 jar-6 jar-7 jar-8 jar-9 jar-10 jar-11 jar-12 jar-13 jar-14 jar-15 jar-16 jar-17 jar-18 jar-19 jar-20 jar-21 jar-22 jar-23 jar-24 "/>
@@ -918,8 +918,8 @@ exists or setup the property manually. For example like this:
             <attribute name="jar-20-Extension-Name" value="${manifest.libs.GNU_JPDF_1.7.0.classpath}"/>
             <attribute name="jar-21-Extension-Name" value="${manifest.reference.pizzaservice-core.jar}"/>
             <attribute name="jar-22-Extension-Name" value="${manifest.reference.pizzaservice-lib.jar}"/>
-            <attribute name="jar-23-Extension-Name" value="${manifest.reference.pizzaservice-mailer.jar}"/>
-            <attribute name="jar-24-Extension-Name" value="${manifest.file.reference.cdi-api.jar}"/>
+            <attribute name="jar-23-Extension-Name" value="${manifest.reference.pizzaservice-mailer-jar.jar}"/>
+            <attribute name="jar-17-Extension-Name" value="${manifest.file.reference.cdi-api.jar}"/>
         </manifest>
     </target>
     <target depends="compile" name="library-inclusion-in-manifest">
@@ -945,7 +945,7 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${libs.GNU_JPDF_1.7.0.classpath}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${reference.pizzaservice-core.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${reference.pizzaservice-lib.jar}" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${reference.pizzaservice-mailer.jar}" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${reference.pizzaservice-mailer-lib.jar}" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.cdi-api.jar}" todir="${dist.ear.dir}/lib"/>
         <manifest file="${build.ear.classes.dir}/META-INF/MANIFEST.MF" mode="update"/>
     </target>
@@ -1332,7 +1332,7 @@ exists or setup the property manually. For example like this:
     <target depends="init" name="deps-clean" unless="no.deps">
         <ant antfile="${project.pizzaservice-core}/build.xml" inheritall="false" target="clean"/>
         <ant antfile="${project.pizzaservice-lib}/build.xml" inheritall="false" target="clean"/>
-        <ant antfile="${project.pizzaservice-mailer}/build.xml" inheritall="false" target="clean"/>
+        <ant antfile="${project.pizzaservice-mailer-lib}/build.xml" inheritall="false" target="clean"/>
         <ant antfile="${project.juser-core}/build.xml" inheritall="false" target="clean"/>
     </target>
     <target depends="init" name="-do-clean">
index 478e55f300a7d6596e0b4533284f43bdee9dce19..61e07f84ccc1f2bc6a8a1f079ea6061b9d416213 100644 (file)
@@ -41,7 +41,7 @@ file.reference.juser-core.jar=lib/juser-core.jar
 file.reference.juser-lib.jar=lib/juser-lib.jar
 file.reference.juser-activity-core.jar=lib/juser-activity-core.jar
 file.reference.juser-activity-lib.jar=lib/juser-activity-lib.jar
-file.reference.pizzaservice-mailer.jar=lib/pizzaservice-mailer.jar
+file.reference.pizzaservice-mailer-lib.jar=lib/pizzaservice-mailer-lib.jar
 includes=**
 j2ee.compile.on.save=true
 j2ee.deploy.on.save=true
@@ -79,7 +79,7 @@ javac.classpath=\
     ${libs.GNU_JPDF_1.7.0.classpath}:\
     ${reference.pizzaservice-core.jar}:\
     ${reference.pizzaservice-lib.jar}:\
-    ${reference.pizzaservice-mailer.jar}:\
+    ${reference.pizzaservice-mailer-lib.jar}:\
     ${file.reference.cdi-api.jar}
 javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
 javac.debug=true
@@ -111,12 +111,11 @@ platform.active=default_platform
 project.license=agpl30
 project.pizzaservice-core=../pizzaservice-core
 project.pizzaservice-lib=../pizzaservice-lib
-project.pizzaservice-mailer=../pizzaservice-mailer
-project.serviceLocator.class=org.mxchange.pizzaapplication.mailer.model.delivery.PizzaMailer
+project.pizzaservice-mailer-lib=../pizzaservice-mailer-lib
 project.juser-core=../juser-core
 reference.pizzaservice-core.jar=${project.pizzaservice-core}/dist/pizzaservice-core.jar
 reference.pizzaservice-lib.jar=${project.pizzaservice-lib}/dist/pizzaservice-lib.jar
-reference.pizzaservice-mailer.jar=${project.pizzaservice-mailer}/dist/pizzaservice-mailer.jar
+reference.pizzaservice-mailer-lib.jar=${project.pizzaservice-mailer-lib}/dist/pizzaservice-mailer-lib.jar
 resource.dir=setup
 run.test.classpath=\
     ${javac.test.classpath}:\
@@ -144,7 +143,7 @@ source.reference.juser-core.jar=../juser-core/src/
 source.reference.juser-lib.jar=../juser-lib/src/
 source.reference.juser-activity-core.jar=../juser-activity-core/src/
 source.reference.juser-activity-lib.jar=../juser-activity-lib/src/
-source.reference.pizzaservice-mailer.jar=../pizzaservice-mailer/src/
+source.reference.pizzaservice-mailer-lib.jar=../pizzaservice-mailer-lib/src/
 source.root=src
 src.dir=${source.root}/java
 test.src.dir=test
index 06b9cc46f0d7dcba9ae31ab93fe975b555cbd3a7..682fb3a7287dda9ba9f5b2b8ff92f7c7f44b88b6 100644 (file)
@@ -27,7 +27,7 @@
             <included-library dirs="200">libs.GNU_JPDF_1.7.0.classpath</included-library>
             <included-library dirs="200">reference.pizzaservice-core.jar</included-library>
             <included-library dirs="200">reference.pizzaservice-lib.jar</included-library>
-            <included-library dirs="200">reference.pizzaservice-mailer.jar</included-library>
+            <included-library dirs="200">reference.pizzaservice-mailer-lib.jar</included-library>
             <included-library dirs="200">file.reference.cdi-api.jar</included-library>
             <source-roots>
                 <root id="src.dir"/>
@@ -57,7 +57,7 @@
                 <id>jar</id>
             </reference>
             <reference>
-                <foreign-project>pizzaservice-mailer</foreign-project>
+                <foreign-project>pizzaservice-mailer-lib</foreign-project>
                 <artifact-type>jar</artifact-type>
                 <script>build.xml</script>
                 <target>jar</target>
diff --git a/src/java/org/mxchange/jmailee/model/delivery/PizzaEmailDeliveryMessageBean.java b/src/java/org/mxchange/jmailee/model/delivery/PizzaEmailDeliveryMessageBean.java
deleted file mode 100644 (file)
index 6a56ec5..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jmailee.model.delivery;
-
-import java.io.Serializable;
-import java.text.MessageFormat;
-import java.util.Properties;
-import java.util.ResourceBundle;
-import javax.annotation.PostConstruct;
-import javax.ejb.ActivationConfigProperty;
-import javax.ejb.MessageDriven;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.ObjectMessage;
-import javax.mail.MessagingException;
-import javax.naming.NamingException;
-import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
-import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean;
-import org.mxchange.pizzaapplication.mailer.model.delivery.DeliverablePizzaEmail;
-import org.mxchange.pizzaapplication.mailer.model.delivery.PizzaMailer;
-
-/**
- * A message queue for sending out emails
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@MessageDriven (
-               name = "pizzaEmailDelivery",
-               description = "A message bean for email delivery",
-               activationConfig = {
-                       @ActivationConfigProperty (propertyName = "destinationLookup", propertyValue = "jms/pizzaservice-email-queue"),
-                       @ActivationConfigProperty (propertyName = "destinationType", propertyValue = "javax.jms.Queue")
-               }
-)
-public class PizzaEmailDeliveryMessageBean extends BasePizzaDatabaseBean implements MessageListener {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 190_586_572_658_143L;
-
-       /**
-        * Configuration file
-        */
-       private final String configFile = "org.mxchange.jmailer.config"; //NOI18N
-
-       /**
-        * Mailer instance
-        */
-       private final DeliverablePizzaEmail mailer;
-
-       /**
-        * Default constructor
-        * <p>
-        * @throws javax.naming.NamingException If a JNDI name could not be found
-        */
-       public PizzaEmailDeliveryMessageBean () throws NamingException {
-               // Call super constructor
-               super();
-
-               // Init mailer instance
-               this.mailer = new PizzaMailer();
-       }
-
-       /**
-        * Post-construction
-        */
-       @PostConstruct
-       public void init () {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.init: CALLED!", this.getClass().getSimpleName())); //NOI18N
-
-               // Try to load bundle
-               ResourceBundle bundle = ResourceBundle.getBundle(this.configFile);
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.init: bundle={1}", this.getClass().getSimpleName(), bundle)); //NOI18N
-
-               // The bunble should be valid
-               if (null == bundle) {
-                       // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("bundle is null, maybe file {0} does not exist?", this.configFile)); //NOI18N
-               }
-
-               // Init Properties
-               Properties properties = new Properties();
-
-               // Is the bundle not empty?
-               if (!bundle.keySet().isEmpty()) {
-                       // Loop through all
-                       for (final String key : bundle.keySet()) {
-                               // Log debug message
-                               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.init: key={1}", this.getClass().getSimpleName(), key)); //NOI18N
-
-                               // Get string from bundle and set it in properties
-                               properties.put(key, bundle.getString(key));
-                       }
-               }
-
-               // Handle it over to the mailer
-               this.mailer.init(properties);
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.init: EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-       @Override
-       public void onMessage (final Message message) {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.onMessage: message={1} - CALLED!", this.getClass().getSimpleName(), message)); //NOI18N
-
-               // The parameter should be valid
-               if (null == message) {
-                       // Throw NPE
-                       throw new NullPointerException("message is null"); //NOI18N
-               } else if (!(message instanceof ObjectMessage)) {
-                       // Not implementing right interface
-                       throw new IllegalArgumentException(MessageFormat.format("message={0} does not implemented ObjectMessage", message)); //NOI18N
-               }
-
-               // Securely cast it
-               ObjectMessage objectMessage = (ObjectMessage) message;
-
-               // Init variable
-               Serializable serializable;
-
-               try {
-                       // Get object from message
-                       serializable = objectMessage.getObject();
-               } catch (final JMSException ex) {
-                       // Log it and don't continue any further
-                       this.getLoggerBeanLocal().logException(ex);
-                       return;
-               }
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.onMessage: serializable={1}", this.getClass().getSimpleName(), serializable)); //NOI18N
-
-               // Okay, is it the right interface?
-               if (null == serializable) {
-                       // Throw NPE
-                       throw new NullPointerException("serializable is null"); //NOI18N
-               } else if (!(serializable instanceof WrapableEmailDelivery)) {
-                       // Not correct object send
-                       throw new IllegalArgumentException(MessageFormat.format("serializable={0} does not implement WrapableEmailDelivery", serializable)); //NOI18N
-               }
-
-               // Securely cast it
-               WrapableEmailDelivery wrapper = (WrapableEmailDelivery) serializable;
-
-               // Is all required set?
-               if (wrapper.getLocale() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("wrapper.locale is null"); //NOI18N
-               } else if (wrapper.getRecipientAddress()== null) {
-                       // Throw again ...
-                       throw new NullPointerException("wrapper.recipientAddress is null"); //NOI18N
-               } else if (wrapper.getSubjectLine() == null) {
-                       // ... and again
-                       throw new NullPointerException("wrapper.subjectLine is null"); //NOI18N
-               } else if (wrapper.getSubjectLine().isEmpty()) {
-                       // Is empty
-                       throw new IllegalArgumentException("wrapper.subjectLine is empty"); //NOI18N
-               } else if (wrapper.getTemplateName() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("wrapper.templateName is null"); //NOI18N
-               } else if (wrapper.getTemplateName().isEmpty()) {
-                       // Is empty
-                       throw new IllegalArgumentException("wrapper.templateName is empty"); //NOI18N
-               } else if (wrapper.getTemplateVariables() == null) {
-                       // No template variables set, should not happen
-                       throw new NullPointerException("wrapper.templateVariables is null"); //NOI18N
-               }
-
-               try {
-                       // Send email out
-                       this.mailer.sendDeliverableMail(wrapper);
-               } catch (final MessagingException ex) {
-                       // Opps, something went wrong
-                       this.getLoggerBeanLocal().logException(ex);
-                       return;
-               }
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.onMessage - EXIT!", this.getClass().getSimpleName())); //NOI18N
-       }
-
-}
diff --git a/src/java/org/mxchange/jmailer/config.properties b/src/java/org/mxchange/jmailer/config.properties
deleted file mode 100644 (file)
index 5a02e31..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2016, 2017 Roland H\u00e4der
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Email address for "Errors-To" header
-mailer.errorsto=you@foo.example
-# Email address for "Bounces-To" header
-mailer.bouncesto=you@foo.example
-# Email address for "X-Loop" header
-mailer.xloop=you@foo.example