When we have watches on SDN and there is an interesting post, we always have something in our mind. Its all about a thirst of having a new feature enabling SDN users to reply to watches which gets posted directly in SDN! This is my small contribution to SDN for implementing this new feature. I am sorry if this feature is already present and currently disabled. Even if it is so, the code may be useful to several others who may use it in Webdynpro/Java appliciation for other purposes! This blog is a small initiative towards SDN and Open Source by Craig Cmehil
The blog is about implementing a new feature in SDN, which enables users to post directly in SDN by replying from their outlook. In this part of the blog series, I will be explaining about the architectural design how its going to work.
Explanations for the numbers in the diagram
- Mail from SDN subscribed to watch a forum / post.
- Reply post from email to POP3 / IMAP server.
- Mail fetched by SDN_JPost, analyses and posting it into SDN.
- Posting it directly into SDN, identifying the specific forum / thread using the user id and password.
The whole implementation can be divided into two major modules (from Java perspective) namely
- Fetching emails from POP3/IMAP server and parsing it to find the parameters (email, thread id and forum id)
- Posting it into the SDN forum.
In development environment, I have a pop3 server running to which I will be sending my replies. SDN_JPost is a simple Java code or thread, constantly fetching mails from the pop3 server, parsing it and posting the reply to SDN.
The key factor in the whole implementation is about posting the reply from the email to SDN. For this, first we must understand the landscape of SDN from outside well. Posting into SDN requires a user id and password. Since email can be used for user id, the email from which the mail is sent can be used as user id. There must be some way SDN_JPost must know the password for the user id/email. Right now, here in development environment, I preferred to send the password as the first line in my message (though it is not preferred, this is until the java code has direct access to user id / passwords).
Once thread id, forum id, user id and password is known to SDN_JPost, the reply is directly posted into SDN Forums. But how is it done? First, using the user id and password, login is done by SDN_JPost which saves all session cookies in memory and posts the reply to the corresponding forum. Since session cookies are in memory, the post is done successfully. The session cookies are cleared for processing the next reply from the mail box. Since, the post is authorized initially by the users id and password; there cannot be any flaw in between.
In the next blog of this series, we shall see the complete implementation (with source code) of SDN_JPost (the key Java program) fetching email from the POP3 server. Finally in the last blog of the series, we will be seeing the most important functionality of SDN_JPost, posting the mail reply directly to SDN Forums.