All the products and materials by OOP-Research are developed and published based on your feed back. While you are using our products or reading our articles, you may have questions or difficulties. Whenever this is true for you, don't hesitate to contact us. Please share your opinion with us. Then, you will get the better products. (We offer 1 year FREE upgrade!) Or the new articles or examples may be published and they may shed the light on your Java development.
The more you talk, the more you get!
Based on your feed back, OOP-Research will continue to publish the new examples, sample source codes and articles for MailScheduler. You will find the links to them on our web site at the URL of:
On the upper part of this web page, there is the section titled Related Pages. And the links to the new resources will be listed in this section. So, please visit the above URL periodically.
In this distribution, you will find the following files and directories:
| README.html | This file. |
| LICENSE | The license agreement of this product. Please read this file before using this product. |
| conf |
The directory for the configuration files. You need to edit:
You will also find the SQL statement for creating the required SQL tables. Please run this script. |
| apiDoc | The directory for the API documentation (Java Doc). This Java Doc describes the details about the classes and their methods of this API. Please read it while you develop your web application using this API. |
| scheduler_x_y.jar | The binary file of this API. In case of the trial version, it will be scheduler_x_y_try.jar. Please put it under WEB-INF/lib directory will be enough. |
| oop_util_x_y.jar | Another binary file of this API, which includes the class files shared with other APIs by OOP-Research. Please put it under WEB-INF/lib directory will be enough. |
You need to install:
By the help of OOP SimpleDaoHelper, MailScheduler can get the JDBC Connection in the various way. If the JNDI DataSource is available in your J2EE environment, MailScheduler can depend on it to query the JDBC Connection. Otherwise, MailScheduler can create the JDBC Connection from the JDBC driver. In any case, you also need to install the JDBC driver for your SQL database. The available JDBC drivers are listed at the URL below:
Optionally, MailScheduler can take the full advantage of PooledStatement, another Java API from OOP-Research.
This API implements the pooling mechanism for the JDBC PreparedStatement and ensures the Thread Safety of your web application.
Because there are the 3 ways to get the JDBC Connection, the configuration depends on your strategy.
But, in any case, you need to edit MailScheduler.properties. In the next section, we will describe about this property file.
Under conf directory of the distribution, you will find MailScheduler.properties. Please edit it and specify the property values suitable for your environment. Then, please place it under WEB-INF/classes directory.
All the required properties are listed below:
| dao_class |
The fully qualified class name of the implementation of SimpleDaoHelper interface.
It should be either of:
|
| sleep | MailScheduler queries all the queued e-mails at the specified time interval, repeatedly. And it selects the e-mails which should be sent at that time. This property specifies this time interval in milliseconds. Only the value which equals to or is greater than 60000(=60 seconds) can be accepted. For example, if you specify 120000(=120 seconds) here, the back-ground Thread selects the e-mails every 2 miuntes. |
| smtp | The HOST name of your SMTP server. |
| try_count | In case of the error while talking with SMTP server, how many time would you like to re-try? Must be less than 10000. |
| time_pattern | Will be used to generate the instance of MessageList. The instance of MessageList lists the information about the e-mails, such as when each e-mail will be sent. This pattern will be applied to the time representation of these information. |
| ttl | The old records for e-mails that were sent successfully or canceled will be deleted from the SQL table. This value specifies how long these records will remain in the SQL table, in hours. For example, if you set this value to 48, the records will remain for at least 48 hours after the e-mails are sent or canceled. |
| user | Your serial ID, which is shown at the time of download. Required only in case you use the trial version. For the trial version, the correct serial ID must be specified for this property. Otherwise, you will get the exception stating that you are not verified. |
The rest of the properties are the SQL statements used by MailScheduler. Unless you change the table names and/or column names specified in conf/scheduler.sql, you need not modify these SQL statement.
To make this property file loadable by the class-loader of your web application, please put it under WEB-INF/classes directory.
As described above, MailScheduler can get the JDBC Connection in the various ways.
And the different configuration will be required for your strategy.
Please go to the section suitable for your strategy:
If you specify:
SimpleDaoHelper will look up the JNDI DataSource within your J2EE environment and will ask it the JDBC Connection. To make it possible, the intended JNDI DataSource must be found by:
within your J2EE environment.
And the res-auth element of this JNDI DataSource must be Container.
Then, SimpleDaoHelper can look up the intended JNDI DataSource and can obtain the JDBC Connection from it.
As an example, let's look into the required configuration for Tomcat 4.1.x and Tomcat 5.1.x .
To make the JNDI DataSource available for your web application, you will need to insert the elements like below into the intended <Context> element in your server.xml.
<Resource name="jdbc/DaoHelperDataSource"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/DaoHelperDataSource">
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost/somedb?autoReconnect=true</value>
</parameter>
<parameter>
<name>username</name>
<value>foo</value>
</parameter>
<parameter>
<name>password</name>
<value>bar</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<value>60</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
</ResourceParams>
|
In case of Tomcat 5.5.x, the definition of JDBC DataSource will look like this:
<Resource name="jdbc/DaoHelperDataSource"
auth="Container"
type="javax.sql.DataSource"
maxActive="40"
maxIdle="10"
maxWait="10000"
username="foo"
password="bar"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/somedb?autoReconnect=true"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="false"
/>
|
In addition, you also need to edit web.xml for the intended web application context. After <welcome-file-list> element, please insert the elements like:
<resource-ref>
<description>
JNDI DataSource for MailScheduler.
</description>
<res-ref-name>jdbc/DaoHelperDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
|
For details, please consult:
On any JSP/Servlet server, the docBase directory of your web applications will include the following JAR files and property files:
Be sure to give the Read permission for these files.
NOTE for oop_util_x_y.jar:
If you have the older version oop_util_x_y.jar, please replace it with the new one. In other words, please be sure to find only the latest version of oop_util_x_y.jar under WEB-INF/lib directory.
If you specify:
SimpleDaoHelper will get the JDBC Connection from the specified JDBC driver. To make it possible, the JDBC driver must be available to your web application. Please place the JAR file of your JDBC driver under:
or other directory if several web applications share the same JDBC driver. In addition, you need to edit:
and specify the following properties:
| Property name | Value |
|---|---|
| jdbc_drv | The fully qualified class name of your JDBC driver |
| jdbc_url | The URL for the intended database |
| jdbc_usr | The user name for the specified database |
| jdbc_pss | The password for the specified database |
The template of DaoHelperForJdbc.properties is included in the distribution of SimpleDaoHelper.
Based on the properties in this file, MailScheduler can establish the JDBC Connection to your data base and create PreparedStatement from the JDBC Connection.
The docBase directory of your web applications will include the following JAR files and property files:
Be sure to give the Read permission for these files.
NOTE for oop_util_x_y.jar:
If you have the older version oop_util_x_y.jar, please replace it with the new one. In other words, please be sure to find only the latest version of oop_util_x_y.jar under WEB-INF/lib directory.
If you specify:
PooledStatement is responsible for all the details, i.e. it establishes the JDBC Connection to your SQL database, creates the JDBC PreparedStatement and keeps it in the pool.
The required configuration is described in the README.html of PooledStatement, so please consult it.
The docBase directory of your web applications will include the following JAR files and property files:
Be sure to give the Read permission for these files.
NOTE for oop_util_x_y.jar:
If you have the older version oop_util_x_y.jar, please replace it with the new one. In other words, please be sure to find only the latest version of oop_util_x_y.jar under WEB-INF/lib directory.
To add the required JAR files to the new project ...
Dialog titled New Project will be shown. Please go ahead, then you will reach the section titled Java Setting Otherwise, please finish to set up the new project. You can add the JAR files later on the existing project.
For existing project ...
Dialog titled Properties for xyz (where xyz is the name of the project) will be shown. On the left navigation tree, select Java Build Path
To add the required JAR files to the new project ...
Dialog titled Project Wizard will be shown. Go ahead to the section titled Step 2 of 3
For existing project ...
Dialog titled Project properties will be shown. On the left navigation tree, select the item titled Paths
The distribution of this API is available at:
Whenever you have questions, please feel free to contact us at tech@oop-research.com. Please include your serial ID within your message.
ALL CONTENTS COPYRIGHT 2006, OOP-Research Corporation. All rights reserved.