Examples of MimeMessageWrapper


Examples of org.apache.james.core.MimeMessageWrapper

            mc.setRemoteHost(rsMessage.getString(5));
            mc.setRemoteAddr(rsMessage.getString(6));
            mc.setLastUpdated(rsMessage.getTimestamp(7));

            MimeMessageJDBCSource source = new MimeMessageJDBCSource(this, key, sr);
            MimeMessageWrapper message = new MimeMessageWrapper(source);
            mc.setMessage(message);
            return mc;
        } catch (SQLException sqle) {
            synchronized (System.err) {
                System.err.println("Error retrieving message");
View Full Code Here

Examples of org.apache.james.core.MimeMessageWrapper

            }
            catch ( Exception e ) {
                throw new ProtocolException( "UnexpectedException: " + e.getMessage() );
            }

            return new MimeMessageWrapper( source );
        }
View Full Code Here

Examples of org.apache.james.core.MimeMessageWrapper

    public synchronized MimeMessageWrapper retrieveUID(int uid, String user)
        throws AccessControlException, AuthorizationException {
        if (!hasReadRights(user)) { //throws AccessControlException
            throw new AuthorizationException("Not authorized to read.");
        }
        MimeMessageWrapper response = null;
        if (sequence.contains(new Integer(uid))) {
            //BufferedInputStream inMsg = null;
            try {
                path = getPath( absoluteName, owner, rootPath );
        MimeMessageFileSource source = new MimeMessageFileSource(path + File.separator + uid + MESSAGE_EXTENSION);
                response = new MimeMessageWrapper(source);
             //   inMsg.close();
            } catch(Exception e) {
                getLogger().error("Error reading message from disc: " + e);
                e.printStackTrace();
                throw new
View Full Code Here

Examples of org.apache.james.core.MimeMessageWrapper

            if (sequence.contains(uidObj)) {
                try  {
                    //SAM
                    try
                    {
                        MimeMessageWrapper message = retrieveUID(uid, user);
                        System.out.println("(before)decrementing mailboxSize ("+getName()+") = " + mailboxSize);
                        System.out.println("decre message.getMessageSize() = " + (int)message.getMessageSize());
                        mailboxSize -= (int)message.getMessageSize();
                        System.out.println("(after)decrementing mailboxSize ("+getName()+") = " + mailboxSize);
                    }
                    catch (MessagingException me)
                    {
                            //ignore
View Full Code Here

Examples of org.apache.james.core.MimeMessageWrapper

                    keys.add(key);
                }
                boolean saveStream = true;

                if (mc.getMessage() instanceof MimeMessageWrapper) {
                    MimeMessageWrapper wrapper = (MimeMessageWrapper) mc.getMessage();
                    if (DEEP_DEBUG) {
                        System.out.println("Retrieving from: " + wrapper.getSourceId());
                        StringBuffer debugBuffer =
                            new StringBuffer(64)
                                    .append("Saving to:       ")
                                    .append(destination)
                                    .append("/")
                                    .append(mc.getName());
                        System.out.println(debugBuffer.toString());
                        System.out.println("Modified: " + wrapper.isModified());
                    }
                    StringBuffer destinationBuffer =
                        new StringBuffer(128)
                            .append(destination)
                            .append("/")
                            .append(mc.getName());
                    if (wrapper.getSourceId().equals(destinationBuffer.toString()) && !wrapper.isModified()) {
                        //We're trying to save to the same place, and it's not modified... we shouldn't save.
                        //More importantly, if we try to save, we will create a 0-byte file since we're
                        //retrying to retrieve from a file we'll be overwriting.
                        saveStream = false;
                    }
View Full Code Here

Examples of org.apache.james.core.MimeMessageWrapper

                getLogger().error(exceptionBuffer.toString());
                remove(key);
                return null;
            }
            MimeMessageAvalonSource source = new MimeMessageAvalonSource(sr, destination, key);
            mc.setMessage(new MimeMessageWrapper(source));

            return mc;
        } catch (Exception me) {
            getLogger().error("Exception retrieving mail: " + me);
            throw new RuntimeException("Exception while retrieving mail: " + me.getMessage());
View Full Code Here

Examples of org.apache.james.core.MimeMessageWrapper

                                Date datetime, ImapMailbox mailbox )
    {
        MimeMessageSource source =
                new MimeMessageByteArraySource( "messageContent:" + System.currentTimeMillis(),
                                                messageContent.getBytes());
        MimeMessage message = new MimeMessageWrapper( source );
        SimpleImapMessage imapMessage = mailbox.createMessage( message, flags, datetime );
        return imapMessage.getUid();
    }
View Full Code Here

Examples of org.apache.james.core.MimeMessageWrapper

                                                     new ByteArrayInputStream(byteout.toByteArray()));
            } catch (MessagingException me) {
                me.printStackTrace();
                return false;
            }
            MimeMessageWrapper msg = new MimeMessageWrapper(source);

            try{
                msg.setHeader("Received", date);
                msg.saveChanges();
            }catch (MessagingException me){
                me.printStackTrace();
            }
            mailbox.store( (MimeMessage)msg, session.getCurrentUser() );
           
View Full Code Here

Examples of org.apache.james.core.MimeMessageWrapper

        if (message instanceof MimeMessageCopyOnWriteProxy) {
            MimeMessageCopyOnWriteProxy messageCow = (MimeMessageCopyOnWriteProxy) message;
            message = messageCow.getWrappedMessage();
        }
        if (message instanceof MimeMessageWrapper) {
            MimeMessageWrapper wrapper = (MimeMessageWrapper) message;
            if (DEEP_DEBUG) {
                System.out.println("Retrieving from: " + wrapper.getSourceId());
                StringBuffer debugBuffer =
                    new StringBuffer(64)
                            .append("Saving to:       ")
                            .append(destination)
                            .append("/")
                            .append(mc.getName());
                System.out.println(debugBuffer.toString());
                System.out.println("Modified: " + wrapper.isModified());
            }
            StringBuffer destinationBuffer =
                new StringBuffer(128)
                    .append(destination)
                    .append("/")
                    .append(mc.getName());
            if (destinationBuffer.toString().equals(wrapper.getSourceId()) && !wrapper.isModified()) {
                //We're trying to save to the same place, and it's not modified... we shouldn't save.
                //More importantly, if we try to save, we will create a 0-byte file since we're
                //retrying to retrieve from a file we'll be overwriting.
                saveStream = false;
            }
View Full Code Here

Examples of org.apache.james.core.MimeMessageWrapper

                                                     new ByteArrayInputStream(byteout.toByteArray()));
            } catch (MessagingException me) {
                me.printStackTrace();
                return false;
            }
            MimeMessageWrapper msg = new MimeMessageWrapper(source);

            try{
                msg.setHeader("Received", date);
                msg.saveChanges();
            }catch (MessagingException me){
                me.printStackTrace();
            }
            mailbox.store( (MimeMessage)msg, session.getCurrentUser() );
           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.