Here is a problem statement we will try to address today, one of our friend wanted to find a solution where he can reach customers with a Email platform. There are vendors like campaign monitor, zoho that do an excellent job for connecting with customers. But all providers come with a price tag, so here we are trying to get this problem solved. In order to address this simple problem, we conquered this problem by splitting it into some discrete steps:
- Find a free email service API support to send emails. Use GAE. Thank you google engineering for setting this up.
- Find a storage platform that can accept customer information as a comma separated file, safely encrypt the email address after sending out communication email. We will choose DropBox as our default engine for this requirement.
- Find a PaaS service that will keep cost almost to zero for maintenance. Finally to meet this part, we will leverage upon CloudBee infrastructure.
- Thanks to the generous folks of IntelliJ who were gracious to give a license to put together this solution.
Here is the link for working application copy: link
Default only user we will be using for the application is with user-id guest and password.
OK think we have the initial requirement, intent and infrastructure items working. Next we will go one step deeper now. What are the API's being used for application building.
- Spring Security
- Spring Core
We will handle GAE-Spring MVC integration first. GAE version used for the effort is GAE 1.5. Spring MVC is 3.0.1, ofcourse all jars including.
First GAE-Spring security integration: We want to make sure only users with proper credentials are allowed to use the application. Here is copy of the main file structure
Here is a quick overview of spring dependency diagram:
Here is a high level sequencing diagram for this workflow.
|From Sequence diagram|
Following is the web.xml file.
Closer look at the web.xml, DelegatingFilterProxy class tells application that all request are being handled by Spring MVC container. Immediately, application is notified about XML files that are going to be used. We are defining three layers of entry points for application. They are identified as login, admin and services. All these relative paths are self-explanatory. Relative path login handles login request, admin will be used for all admin related tasks and finally services is our work horse relative path.
Second think we can take a stab at the security sheet we are putting together for this application, we are defining two roles for the project. The first role is admin role, where users with this role will be able to add applications and email templates for those application. Application scope is limited to templates that are already in HTML format. Honestly I think this sticky thing has to be addressed somewhere. For now we will start with two templates and two applications. Here is a quick look at spring security xml file
Next comes our dispatcher-servlet, this file is dedicated for application navigation. Application will be using tiles configuration for JSP display. Some of main things in this xml are; all spring mvc controllers are annotation based, we have a validator that is annotation based. There are lot more items that is going on the dispatcher servlet xml file. We have declaration of tiles configuration, spring mvc url controller definitions. URL controller is an easier way to define static web-pages that we will be using in the application. Resolvers help the system on paths that will have JSP pages.
Spring beans that are going to do the magic. Here is a sequence diagram.
|From spring beans|
Application has everything in place now. Finally we can see this is the final look of spring-configuration file for this sequence diagram.
Now we have all the moving pieces in place. If you want to look at the entire code, it is all documented and checked into google code. Link to the repository is
svn checkout http://trisunkmailapps.googlecode.com/svn/ trisunkmailapps-read-only.
Just to keep you going, the first class that will be invoking is Email Controller class. Here is a link to its source code:
[googleapps domain="docs" dir="document/pub" query="id=1KSCVE7YZSIQn26I8lSaNdBpr_hQenBQ-c1xz41MgLyo&embedded=true" /]
Sure now time to get out of this post I guess. We will try to attend how drop box can be reused for this solution. We will also look @ oAuth for authentication. Send your questions comments and feedback always.