Examples of DeliveryService


Examples of com.ericdaugherty.mail.server.services.general.DeliveryService

        String username = "";
        String domain = "";
        String password = "";
        EmailAddress address = null;
        DeliveryService deliveryService = DeliveryService.getDeliveryService();

        //Get the username from the client.
        boolean userAccepted = false;

        while( !userAccepted ) {
            inputString = read();

            command = parseCommand( inputString );
            argument = parseArgument( inputString );

            //Check to see if they sent the user command.
            if( command.equals( COMMAND_USER ) ) {

                //Make sure they sent a username
                if( argument.equals( "" ) ) {
                    write( MESSAGE_TOO_FEW_ARGUMENTS );
                }
                else {
                    int atIndex = argument.indexOf( "@" );

                    //Verify that the username contains the domain.
                    if( atIndex == -1 ) {
                        write( MESSAGE_NEED_USER_DOMAIN );
                    }
                    else {
                        //Accept the user, and proceed to get the password.
                        username = argument.substring( 0, atIndex );
                        domain = argument.substring( atIndex + 1 );

                        address = new EmailAddress( username, domain );

                        //Check to see if the user's mailbox is locked
                        if( deliveryService.isMailboxLocked( address ) ) {
                            write( MESSAGE_USER_MAILBOX_LOCKED );
                        }
                        else {
                            write( MESSAGE_USER_ACCEPTED + argument );
                            userAccepted = true;
                        }
                    }
                }
            }
            else {
                write( MESSAGE_INVALID_COMMAND + command );
            }
        }

        //The user has been accepted, now get the password.
        boolean passwordAccepted = false;

        while( !passwordAccepted ) {
            inputString = read();

            command = parseCommand( inputString );
            argument = parseArgument( inputString );

            //Check to see if they sent the user command.
            if( command.equals( COMMAND_PASS ) ) {

                //Make sure they sent a password
                if( argument.equals( "" ) ) {
                    write( MESSAGE_TOO_FEW_ARGUMENTS );
                }
                else {
                    password = argument;
                    passwordAccepted = true;
                }
            }
            else {
                write( MESSAGE_INVALID_COMMAND + command );
            }
        }

        User user = configurationManager.getUser( address );
        if( user != null && user.isPasswordValid( password ) )
        {
            deliveryService.ipAuthenticated( clientIp );
            deliveryService.lockMailbox( address );
            write( MESSAGE_LOGIN_SUCCESSFUL );
            if( log.isInfoEnabled() ) log.info( "User: " + address.getAddress() + " logged in successfully.");
            return user;
        }
        else
View Full Code Here

Examples of com.ericdaugherty.mail.server.services.general.DeliveryService

        String toAddress = parseAddress( inputString.substring( 8 ) );

        try {
            EmailAddress address = new EmailAddress( toAddress );
            //Check the address to see if we can deliver it.
            DeliveryService deliveryService = DeliveryService.getDeliveryService();
            if( deliveryService.acceptAddress( address, clientIp, message.getFromAddress() ) ) {
                // Check to see if it is a local user.  If so, ask to
                // user object for the delivery addresses.
                User localUser = configurationManager.getUser( address );
                if( localUser!= null ) {
                    EmailAddress[] addresses = localUser.getDeliveryAddresses();
View Full Code Here

Examples of com.ericdaugherty.mail.server.services.general.DeliveryService

        for( int index = 0; index < numAddress; index++ ) {
            try {
                address = (EmailAddress) toAddresses.get( index );
                if( log.isDebugEnabled()) { log.debug( "Attempting to deliver message from: " + message.getFromAddress().getAddress() + " to: " + address ); }

                DeliveryService deliveryService = DeliveryService.getDeliveryService();

                try {
                    if( deliveryService.isLocalAddress( address ) ) {
                        deliverLocalMessage( address, message );
                    }
                    else {
                        deliverRemoteMessage( address, message );
                    }
View Full Code Here

Examples of etch.bindings.java.support.DeliveryService

    m = addFilters( m, u, resources );

    MailboxManager r = new PlainMailboxManager( m, u, resources );

    DeliveryService d = new DefaultDeliveryService( r, u, resources );

    ValueFactory vf = (ValueFactory) resources
      .get( Transport.VALUE_FACTORY );
    vf.lockDynamicTypes();
View Full Code Here

Examples of etch.bindings.java.support.DeliveryService

      r.put( "connection", connection );

      ValueFactory vf = session.newValueFactory();
      r.put( Transport.VALUE_FACTORY, vf );

      DeliveryService d = newTransport( uri, r );

      session.newServer( d, vf );

      d.transportControl( Transport.START, null );
    }
View Full Code Here

Examples of etch.bindings.java.support.DeliveryService

   
    m = addFilters( m, u, resources );
   
    MailboxManager r = new PlainMailboxManager( m, u, resources );
   
    DeliveryService d = new DefaultDeliveryService( r, u, resources );
   
    ValueFactory vf = (ValueFactory) resources.get( Transport.VALUE_FACTORY );
    vf.lockDynamicTypes();
   
    return d;
View Full Code Here

Examples of etch.bindings.java.support.DeliveryService

      r.put( SOCKET, socket );
     
      ValueFactory vf = session.newValueFactory();
      r.put( Transport.VALUE_FACTORY, vf );
     
      DeliveryService d = newTransport( uri, r );
     
      session.newServer( d, vf );
     
      d.transportControl( Transport.START, null );
    }
View Full Code Here

Examples of etch.bindings.java.support.DeliveryService

    m = addFilters( m, u, resources );

    MailboxManager r = new PlainMailboxManager( m, u, resources );

    DeliveryService d = new DefaultDeliveryService( r, u, resources );

    ValueFactory vf = (ValueFactory) resources
      .get( Transport.VALUE_FACTORY );
    vf.lockDynamicTypes();
View Full Code Here

Examples of etch.bindings.java.support.DeliveryService

      r.put( "connection", connection );

      ValueFactory vf = session.newValueFactory();
      r.put( Transport.VALUE_FACTORY, vf );

      DeliveryService d = newTransport( uri, r );

      session.newServer( d, vf );

      d.transportControl( Transport.START, null );
    }
View Full Code Here

Examples of etch.bindings.java.support.DeliveryService

   
    m = addFilters( m, u, resources );
   
    MailboxManager r = new PlainMailboxManager( m, u, resources );
   
    DeliveryService d = new DefaultDeliveryService( r, u, resources );
   
    ValueFactory vf = (ValueFactory) resources.get( Transport.VALUE_FACTORY );
    vf.lockDynamicTypes();
   
    return d;
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.