Better approach for storing Messages ?

Hello all,
I am developing a Email module which does resembles yahoo or hotmail.
To my understanding POP3 dosn't support Folder creation and IMAP does. But, i have to go for POP3 only.
SO, i thought that i have to go for storing it in database(Message Object) as Byte array.
so, i have created sent fodler, save folder, draft and custom folders all in database for storing all this message as javax.mail.Message object.
Since i can't store Message object i have created a wraper class which implemets serialization.
Now my questions is
1. is my approach for folder with database is correct ?
2. if yes, then is it good to store Wraper class as a hole in database. or can i go for divinding the message into parts and store invidualy in database.
3. if my approach is wrong then how can i go about ?
awaiting for everybody's reply
dina

When through your thinking before :)
The correct way is to save Message object to disk, i.e cache so we
don't read from server. To save to database is your choice but it's
extra overhead. And if you intend client is going to install the
program on their desktop, database is out of the question.
The secret is making a simple database design as explain below, like
Microsoft outlook.pst or look at Netscape cache folders to see their
design too. Similar...
Message object is not savable, i.e not implemting serialization but
their is a way to save the mail messages to disk.
We use the writeTo method of MimeMessage class to save the whole
email, including attachments as one whole object stream.
I use one file for each mail folder, like Microsoft and Netscape does..
The reason is we might want to copy the whole inbox, which in effect
is copying the one file to another folder for backup etc...
Same reason for compressions
So you might ask, one file, that inefficient isn't it?
Not really it's how you design it.
Your mail file should have lookup keys of message id's of your message
objects. Hence, with message id in a file one can get the ObjectOutputStream in a file with a simple lookup. We use object output
stream as message class writeTo, writes to output stream, and using
ObjectOutputStream to store and retrieve makes a whole lot of sense.
The cahce mail storage should be using a RandomAccessFile and their
are package classes you can download from JavaWorld to have access
to writing and reading object streams from a file using the random
access file. So no need to worry about database as it does the
hard work for you. Search for RandomAccessFile in JavaWorld and
dowload that package.
RandomeAccessFile class is quite differently to other IO classes as
it does fast seeking, i.e the file points to different positions of
the file very quickly. Even if you inbox file is 70 megs big, it can
still handle it very quickly.
This should help you clear most of the design problems that I also
ponder for quite some time

Similar Messages

  • I am handling logistics department in a company, i am handling more than 100 calls in a day. But my iPhone 4 have only 100 number call history. How to increase my call log size or kindly suggest a better app for storing 1 month call history..

    I am handling logistics department in a company, i am handling more than 100 calls in a day. But my iPhone 4 have only 100 number call history. How to increase my call log size or kindly suggest a better app for storing 1 month call history..

    Here's one:
    https://itunes.apple.com/us/app/callog/id327883585?mt=8

  • Better approach for adding a new assignment block in a standard component

    Hi
    I need to add a new assignment block in the standard component bt116h_srvo. There are two approaches :
    1. create a new view in the component bt116h_srvo
    2. create a custom component and embed it into bt116h_srvo using component usage.
    Please tell which one is a better approach and why ??
    Thanks,
    Swati.

    Thanks for the quick reply lakshmi. However I am sure there is no possibility of reuse . My  main concern here is tat will patch upgradation in future would have any impact on the views added directly in standard component  or any other risk in adding view directly.
    Rgds,
    Swati

  • Which is better datatype for storing Images in 11gr2 Database ?

    Can anyone tell me which datatype should be maintained for storing images in database in terms of
    1. Space
    2. Speed.
    And, Is there another way for storing images instead of database ?
    Thanks/Regards in advacne.

    982164 wrote:
    Which one have better speed, database system or file system ?Database is better all around. It is not just a question of speed. It is a question of storage, security, flexibility, scalability, robustness and so on.
    If you use ASM and raw devices from a storage array or SAN, how do you get o/s files onto that? (requires a file system on the SAN/array LUNs)
    If it is inside the database, database security, concurrency and consistency apply to the image. Outside the database? How do you control who has access? Prevent someone with slippery fingers from accidentally deleting/renaming/moving images files? How do you backup up the image data with the image attribute data in the database?
    Having all this inside the database, part of the database, managed by the database, provides you with more flexibility, robustness, and security. After all a RDBMS is a data management system - it is designed for managing data. And that includes managing binary data.
    As for speed. Reading a 24MB image is reading 24MB worth of data. Whether that data is read by process A from disk1, or process B from disk2 - the amount of data is the same. So if you want faster I/O, then use faster disks. If disk1 is faster, process A will perform better reading the image than process B. If disk2 is faster, the roles are reversed.
    So I/O speed is not a direct function of process A or process B. It is a direct function of the I/O storage and fabric layer. Yes, a process's method of I/O can make a difference (e.g. using block reads not aligned with the physical blocks on disk). But this is more a configuration issue than process doing badly designed I/O calls.
    So the speed question is a bit loaded as it has more to do with the architecture and design of the I/O system - and less to do with the process doing that I/O. You can have a highly optimised I/O process doing poorly using an old and slow I/O layer, and poorly written I/O process doing pretty well on a SSD I/O layer.
    Databases like Oracle is designed for dealing with data - and thus effectively dealing with I/O. Lots of it. For lots of data. So I/O process design is not a consideration. The database processes will use the I/O layer as optimally as possible and as configured.

  • Better approach for checking column values between two different rows

    My requirement is to find best Approach to find difference between column values of two different rows.Below I've mentioned two different
    approaches I'm thinking of,but I'd like to know is there any other better approach.
    version details
    SQL> SELECT *
      2  FROM V$VERSION;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for Solaris: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionTable creation script
    CREATE TABLE R_DUMMY
       (CA_ID VARCHAR2(16) NOT NULL ENABLE,
         CA_VER_NUM NUMBER(4,2) NOT NULL ENABLE,
         BRWR_SHORT_NAME VARCHAR2(25 CHAR),
         sic_code     number,
         FAC_ID VARCHAR2(10) NOT NULL ENABLE
    / insert script
    insert into r_dummy (CA_ID, CA_VER_NUM, BRWR_SHORT_NAME, sic_code, FAC_ID)
    values ('CA2001/11/0002', 2.00, 'Nandu',1234, 'FA000008');
    insert into r_dummy (CA_ID, CA_VER_NUM, BRWR_SHORT_NAME, sic_code, FAC_ID)
    values ('CA2001/11/0002', 3.00, 'SHIJU',456, 'FA000008');Desired O/P :
    ca_id               fac_id          column_name          previous name          after_modification
    CA2001/11/0002          FA000008     BRWR_SHORT_NAME          Nandu               SHIJU
    CA2001/11/0002          FA000008     sic_code          1234               456My approach
    select      ca_id,fac_id,column_name,
         decode(column_name,'BRWR_SHORT_NAME',lg_brwr,lg_sic) previous_name ,
         decode(column_name,'BRWR_SHORT_NAME',ld_brwr,ld_sic) after_modification
    from
         select
                   case
                        when ld_brwr != lg_brwr then
                        'BRWR_SHORT_NAME'
                        when ld_brwr != lg_brwr then
                        'sic_code'
                   end
              ) column_name,ca_id,fac_id,lg_brwr,ld_brwr,ld_sic,lg_sic
         from     (
              select ca_id,fac_id,lag_brwr,ld_brwr,ld_sic,lag_sic
              from
                        Select      lead(brwr_short_name,1) over(partition by ca_id,fac_id) ld_brwr,
                             lag(brwr_short_name,1) over(partition by ca_id,fac_id) lg_brwr,
                             lead(sic_code,1) over(partition by ca_id,fac_id) ld_sic,
                             lag(sic_code,1) over(partition by ca_id,fac_id) lg_sic,
                             ca_id,fac_id
                        from r_dummy
              where (ld_brwr != lg_brwr or ld_sic != lg_sic)
    )2nd Approach :
    =============
    select      ca_id,fac_id,column_name,
         decode(column_name,'BRWR_SHORT_NAME',lg_brwr,lg_sic) previous_name ,
         decode(column_name,'BRWR_SHORT_NAME',ld_brwr,ld_sic) after_modification
    from
         select
                   case
                        when ld_brwr != lg_brwr then
                        'BRWR_SHORT_NAME'
                        when ld_brwr != lg_brwr then
                        'sic_code'
                   end
              ) column_name,ca_id,fac_id,lg_brwr,ld_brwr,ld_sic,lg_sic
         from     (
              select ca_id,fac_id,brwr_short_name,sic_code
              from
                        Select      ca_id,fac_id,brwr_short_name lg_brwr,sic_code lg_sic
                        from     r_dummy
                        where     ca_ver_num = '2.00'
                   )o,(
                        Select      ca_id,fac_id,brwr_short_name ld_brwr,sic_code ld_sic
                        from     r_dummy
                        where     ca_ver_num = '3.00'
                              )n
              where      0.ca_id = n.ca_id
                   and 0.fac_id = n.fac_id
                   and (ld_brwr != lg_brwr or ld_sic != lg_sic)
    )Hi Experts,
         I've provided sample data where I'm checking for just two columns viz brwr_short_name ,sic_code,but in real time
    I've to check for 8 more columns so please suggest me with a better approach.
    I appreciate your precious suggestions.

    Hi,
    Thanks for posting the CREATE TABLE and INSERT statements; that really helps!
    Here's one wa. Like your 2nd approach, this uses a self-join:
    WITH     got_r_num     AS
         SELECT  ca_id
         ,     ROW_NUMBER () OVER ( PARTITION BY  ca_id
                                   ,                    fac_id
                             ORDER BY        ca_ver_num
                                 )    AS r_num
         ,     brwr_short_name
         ,     TO_CHAR (sic_code)     AS sic_code
         ,     fac_id
    --     ,     ...     -- Other columns (using TO_CHAR if needed)
         FROM     r_dummy
    ,     unpivoted_data     AS
         SELECT     *
         FROM     got_r_num
         UNPIVOT     INCLUDE NULLS
              (    txt
              FOR  column_name IN ( brwr_short_name          AS 'BRWR_SHORT_NAME'
                            , sic_code               AS 'SIC_CODE'
    --                        , ...     -- Other columns
    SELECT       p.ca_id
    ,       p.fac_id
    ,       p.column_name
    ,       p.txt          AS previous_name
    ,       a.txt          AS after_modification
    FROM       unpivoted_data   p
    JOIN       unpivoted_data   a  ON  p.ca_id     = a.ca_id
                           AND p.fac_id     = a.fac_id
                         AND p.column_name     = a.column_name
                         AND p.r_num      = a.r_num - 1
                         AND p.txt || 'X' != a.txt || 'X'
    ORDER BY  a.r_num
    ;To include other columns, add them in the 2 places where I put the comment "Other columns".
    Ca_ver_num can have any values, not just 2.00 and 3.00.
    This will show cases where a value in one of the columns changed to NULL, or where NULL changed to a value.
    There ought to be a way to do this without a separate sub-query like got_r_num. According to the SQL Language manual, you can put expressions in the UPIVOT ... IN list, but when I tried
    ...     UNPIVOT     INCLUDE NULLS
              (    txt
              FOR  column_name IN ( brwr_short_name          AS 'BRWR_SHORT_NAME'
                                 , TO_CHAR (sic_code)     AS 'SIC_CODE'
              )I got the error "ORA_00917: missing comma" right after TO_CHAR. Perhaps someone else can show how to eliminate one of the sub-queries.

  • Better solution for Delivering messages

    Hello All,
    In our prod environment, We observe quite often, when ever there is an issue at target side ,messages are failing and status in NDLV state in Adapter Engine ,apart from this NDLV state ,we observe few messages in Delivering state.
    When the issue at target side get resolved.we are restarting NDLV (system error state ) messages from Adapter engine in RWB.
    In order to process the Delivering messages ,we are restarting the message system to make the delivering messages to NDLV state.then we reprocessing those messages.
    Because of this Messaging system restart  to resolve the issue ,few more messsages failing during that time.
    So for reprocessing the Delivering state message,Is there any possible way to handle this apart from restarting Messaging system.
    Please provide inputs on this
    Thanks and Regards,
    Vidya Sagar

    I dont think with out the restart of the java stack DLNG messages will get cleared off..
    options you can look for is possiblity of the target system maintenance schedule in advance and disable the particular channel
    which will not work for hard shutdowns of target systems..i.e immediate shutdown cases..
    Increase the no of threads for particular adapter queues..you can increase the thread count for the adapters based on the factors provided by the sap..which will not result in To be delivered messages..
    HTH
    Rajesh

  • Best approach for storing XML files long term

    We have a legal requirement to store the XML files that relate to SAP billing documents for 10 years. (This is a "digital seal" requirement in Mexico.) The files will be sent to SAP server by the third party software. We'll attach them as GOS objects to the billing documents, but we need another option for safekeeping the files for 10 years. Files need to be accessible somewhat easily if there is an audit down the road. We expect to have about 500 files per month, 5k each.
    The simplest solution that comes to mind is just to copy the files to a designated folder (or rather several folders by year or month) and backing it up regularly, but I'm wondering if there could be another solution.
    Has anyone had a similar requirement and what approach would you recommend? I'm also checking with our Basis support, but thought I'd ask here as well.
    Thank you.

    You may also check here: http://help.sap.com/saphelp_nw70/helpdata/en/26/72a1376f6cd903e10000009b38f8cf/content.htm

  • Better approach for deleting rows using trigger or procedure

    Hi,
    Please suggest which option is better for deleting rows from table trigger or procedure and why?
    In datawarehousing and OLTP DB's.
    Edited by: user6040008 on Nov 2, 2012 4:51 AM

    Hi,
    Please suggest which option is better for deleting rows from table trigger or procedure and why?
    In datawarehousing and OLTP DB's.
    Edited by: user6040008 on Nov 2, 2012 4:51 AM

  • Which is better for bulk message scenario in sap xi RFC or Proxy

    which is better for bulk message scenario in ( RFC or Proxy ) ?
    Edited by: prabhatxi on Aug 6, 2010 4:44 PM

    Proxy will alwaays be better option in this case, as it is adapter less framework, and communication happens directly with XI central integration engine. So it is always fast communication and gives good performance.
    But still you should consider other factors, you may consider using RFC as well, as sometime we go for RFC/IDOC as this are the standard interfaces already available rather than creating structure...
    May be you can share more info on what type/volume data are you planning to send via XI?
    Hope this cleart your doubt..
    Divyesh

  • JavaMail: data type for storing subjects and message content

    Hello,
    I am writing a JavaMail program which gets incoming emails.
    I need to retrieve the subjects of the emails which are codes (ABCDEF, for ex) and insert the corresponding message body in the database if one code matches one in de database (DB). The subject codes are not unique.
    For example:
    - Message 1 on 12/12/2007
    Subject: ABCDEF, Message Body: You need to come soon
    - Message 2 on 13/12/2007
    Subject: ABCDEF, Message body: Sorry I was late
    - Message 3 on 14/12/2007
    Subject: ABCGHI, Message body: We'll have Chrismas party at your place
    My questions are:
    1. Should I retrieve all messages at a time, get the subjects codes and then do the checking in the DB?
    2. If yes, what kind of data type should I use to store the subject codes and the message body in order to guarentee that the correct corresponding message will be inserted in the DB once one subject code matches in the DB.
    ( I thought of a HashMap<subject_code, msg_content> but the subject_code are not unique)
    All suggestions are really appreciated. Please help!
    Marianne

    If you get all the messages at once, store them in
    an array or list, and then iterate over them to
    query the database, that would work. The message
    data won't be fetched from the mail server until you
    access it for each message. If you want to reduce
    the time you're connected to the mail server (maybe
    not important), you'll need to copy the messages
    into memory.
    One of the big issues to consider is what you want
    to happen in the event of a failure. You can't include
    the mail server operations in your database
    transaction so you probably want to update the
    database before removing the messages from
    the mail server. But you'll need to handle possible
    duplicates if your application fails after the
    database transaction and before the message
    is removed from the mail server.

  • Java Application for submission message in multiple forum at a time

    Hello,
    I want to build a Java desktop application by which I can be able to submit any message to my desired forum without login into the forum website. My application will be able to send the same message to as many forum I specify.
    I have not yet started to work on it. So, I need ideas regarding the following topics-
    1. Is the message we submit in any forum same to any mail we generally use for email? if yes, hoe can I understand what protocol(SMTP, POP3, IMAP) is used in any website? If no, what is that kind of mailing for posting message in a forum and where is it stored?
    2. What should be my steps for building such application?
    3. Is there any Java API / technology that can help me?
    If you have done something like my project, please provide me some code for starting. And, please help me on this regard with your ideas.
    With Thanks-
    aynhq

    aynhq wrote:
    Hello,
    With a grateful heart I would say, I thank you for your mmessages. But, You have taken the problem I specified as an evil concept.
    Here I should mention that I have registration with more than one hundred forums. I have premium membership and secured password. In those forums I usually submit my writing for the other member in those forum.
    Sometimes I need to submit same writings to all the forum. And I manually enter into those websites using my username & password and then submit the writings. You must admit it is a time consuming process. So, I want to develop this programm that would help me to send messages using my username and password. In fact necessity is the mother of invention.
    One thing must be mentioned here that I don't have intension to use this program as a spam or something you are thinking of. Any way, if you don't understand my goal please ask me. But I need help on this concept. Better you suggest me some way how to solve my problem.
    With Thanks-
    aynhqYou sound like a parrot.
    Now go away.

  • How to configure Symantec Mail Security for SMTP & Messaging Server 6.3

    Hi!
    I want to install a Symantec Mail Security for SMTP 5.0.1(host1) with Messaging Server 6.3 (in production - host2), but when I try to access to POP protocol to send a message from Internet, the system display a message with a relay problem.
    - Could you help me with this issue?,
    - Do you know some documentation that speaks of this?. I can't find any documentation that explain how to configure and integrate SMS and Messaging Server. Thanks in advance.
    Regards, CR

    ctemp1 wrote:
    I want to install a Symantec Mail Security for SMTP 5.0.1(host1) with Messaging Server 6.3 (in production - host2), but when I try to access to POP protocol to send a message from Internet, the system display a message with a relay problem.I take it that you have configured the symantec software like this?
    internet -> symantec mail security system -> sun messaging server -> recipientA better approach is the following
    internet -> sun messaging server -> recipient
                              |
                             V
                  symantec mail security system(refer here: http://blogs.sun.com/factotum/entry/messaging_server_correctly_deploying_the)
    - Do you know some documentation that speaks of this?. I can't find any documentation that explain how to configure and integrate SMS and Messaging Server. Thanks in advance.There is no documentation specifically for symantec software but we do document how to send emails via the symantec mail security server using the aliasdetourhost channel keyword:
    http://docs.sun.com/app/docs/doc/819-4428/6n6j42615?a=view#bgaqy
    Regards,
    Shane.

  • How to Approach for full implementation

    We have a situation here that we r planning to implement
    SAP BW. But here R/3 is not fully implemented. In this situation how to approach to prepare a Blueprint. 
    We are planning to implement SD,MM,PP,QM and FICO modules. We dont have any functional specs But we can communicate functional people. In this way how can I approach for each module.
    Specially for INVENTORY and FI.
    Thanks in Advance.

    Hi,
    As per my knowledge it is better if you have data at least for 5 five years but This is not mandatory. You can have BW even for 1 year data also.
    Coming to your question Please contact the users and collect their requirements.
    Ask them what reports exactly they are using?
    What issues they have with the existing reports?
    What additional fileds or colums they are expecting in BW?
    Howmany users will be there?
    How many roles do they have?
    do they have any third party involved in the current reporting?
    Do we have to ectract the data only from R/3 or from Thrid party tool (Ex Indian Statutory)also.
    How many source systems do they have?
    Hope this will give you idea. please post message iy you are not clear.
    Vijay

  • Proxy or File which is better approach

    Hi
    I am using PI 7.1. I need to pass some informations (approx. 40K records per day) from SAP CRM database to a third party application. The target communication will be file. What is the best approach for source communication? Is proxy the better option or should I write an extraction programme in SAP CRM, generate one file, and then do the transformations required in PI?
    Regards,
    Nirupam

    HI,
    First of all as this is adapter less communication, I think it is better to use in as many senario as possible. Why only for big messages. There is no limit on number of Proxy senario count ;).
    Secondly, You need ABAPer for custom ABAP program to extarct and create file. So in either case you need both ABAP and PI skill.
    Monitoring will be using same tools no extra tool is needed for proxy.
    And If you use Proxy, in future even if you message size increses you dont have to bother.
    If any change is there in the interface then also you need both ABAPer and PI Skill to make the changes.
    Hence I feel, whenever possible, it is better to use Proxy.
    Shweta.

  • Best Approach for Reporting on SAP HANA Views

    Hi,
    Kindly provide information w.r.t the best approach for the reporting on HANA views for the architecture displayed below:
    We are on a lookout for information mainly around the following points:
    There are two reporting options which are known to us and listed below namely:
    Reporting on HANA views through SAP BW  (View > VirtualProvider > BEx > BI 4.1)
    Reporting on HANA views in ECC using BI 4.1 tools
            Which is the best option for reporting (please provide supportive reasons : as in advantages and limitations)?
             In case a better approach exists, please let us know of the same.
    Best approach for reporting option on a mixed scenario wherein data of BW and HANA views is to be utilized together.

    Hi Alston,
    To be honest I did not understand the architecture that you have figured out in your message.
    Do you have HANA instance as far as I understood and one ERP and BW is running on HANA. Or there might be 2 HANA instance and ERP and BW are running independently.
    Anyway If you have HANA you have many options to present data by using analytic views. Also you have BW on HANA as EDW. So for both you can use BO and Lumira as well for presenting data.
    Check this document as well: http://scn.sap.com/docs/DOC-34403

Maybe you are looking for

  • Configuring JCo3 Connection Pool with single sign on on non SAP Java server

    Hi Everyone, i have configured a connection pool on JBoss as per JCo3 Documentation and is working great. Now I need help to configure this connection pool with single sign on so that RFc on SAP ECC systems are executed using end users credential rat

  • How Do I Access An XML File For A SWF I Put Into Captivate 6.0

    Hi, I inserted a swf animation into my Captivate project that calls an external xml file. When I run the Captivate project, the swf works except it doesn't display any of the information from the xml file. How do I get Captivate let the inserted swf

  • Where can I learn Flash CS5.5 basic + Game development?

    Hey where can I learn Flash CS5.5 basics along with game development with the Adobe Gaming SDK?

  • Newbie: Out of the box wtgdebug exception

    Hello Forum... I'm new to Oracle and Oracle lite. I've just installed version 10.0.0.0 of the mobile development kit and launched wtgdebug.exe. It opens with the following exception: C:\oracle\ora92\Mobile\Sdk>wtgdebug log1: Mount point jdbc:polite:W

  • Release order restrction against contract

    Is there a way to control authorization for creating release order with reference to contract? Buyer which is maintaing contract can specify the user who can create release order agains that contract, may be using purchasing group. Thanks, Shahzad Sh