Package com.elasticinbox.core.model

Examples of com.elasticinbox.core.model.Mailbox


      .getLogger(DummyValidator.class);

  @Override
  public AccountStatus getAccountStatus(String username)
  {
    Mailbox mailbox = new Mailbox(username);
    logger.debug("Validating " + mailbox.getId());
    return AccountStatus.ACTIVE;
  }
View Full Code Here


    for (MailAddress recipient : env.getRecipients())
    {
      DeliveryReturnCode reply = DeliveryReturnCode.TEMPORARY_FAILURE; // default LMTP reply
      DeliveryAction deliveryAction = DeliveryAction.DELIVER; // default delivery action

      Mailbox mailbox = new Mailbox(recipient.toString());
      String logMsg = new StringBuilder(" ").append(mailbox.getId())
                .append(" DID").append(deliveryId).toString();

      try {
        switch (deliveryAction) {
        case DELIVER:
View Full Code Here

    keyspace = HFactory.createKeyspace(KEYSPACE, cluster, clp);
   
    dao = new CassandraDAOFactory();
    CassandraDAOFactory.setKeyspace(keyspace);
    AccountDAO accountDAO = dao.getAccountDAO();
    accountDAO.add(new Mailbox(MAILBOX));
  }
View Full Code Here

  public void teardownCase() throws IOException {
    keyspace = null;
    cluster = null;

    AccountDAO accountDAO = dao.getAccountDAO();
    accountDAO.delete(new Mailbox(MAILBOX));
  }
View Full Code Here

  }

  @Test
  public void testStaleMessageIdRemoval() throws IOException, OverQuotaException
  {
    Mailbox mailbox = new Mailbox(MAILBOX);

    Message message = getDummyMessage();
    message.addLabel(ReservedLabels.NOTIFICATIONS.getId());

    MessageDAO messageDAO = dao.getMessageDAO();
    List<UUID> validMessageIds = new ArrayList<UUID>();
    List<UUID> invalidMessageIds = new ArrayList<UUID>();

    // save message under different message ids, and store message ids
    for (int i=0; i<5; i++) {
      UUID messageId = new MessageIdBuilder().build();
      validMessageIds.add(messageId);
      messageDAO.put(mailbox, messageId, message, null);
    }
   
    // generate stale message ids
    for (int i=0; i<5; i++) {
      UUID messageId = new MessageIdBuilder().build();
      invalidMessageIds.add(messageId);
    }

    // add stale message ids to indexes only (without message metadata)
    Mutator<String> m = createMutator(keyspace, strSe);
    LabelIndexPersistence.add(m, mailbox.getId(), invalidMessageIds, message.getLabels());
    m.execute();

    // get all messages from NOTIFICATION label
    List<UUID> allMessageIds = messageDAO.getMessageIds(mailbox,
        ReservedLabels.NOTIFICATIONS.getId(), new MessageIdBuilder().build(), 100, true);
View Full Code Here

      .getLogger(AllowAllAuthenticator.class);

  @Override
  public Mailbox authenticate(String username, String password)
  {
    Mailbox mailbox = new Mailbox(username);
    logger.debug("Authenticated " + mailbox.getId());
    return mailbox;
  }
View Full Code Here

      @PathParam("domain") final String domain,
      @QueryParam("label") Set<Integer> labels,
      @QueryParam("marker") Set<Marker> markers,
      File file)
  {
    Mailbox mailbox = new Mailbox(user, domain);
    // generate new UUID
    UUID messageId = new MessageIdBuilder().build();

    try {
      FileInputStream in = new FileInputStream(file);
View Full Code Here

      @QueryParam("removelabel") final Set<Integer> removeLabels,
      @QueryParam("addmarker") final Set<Marker> addMarkers,
      @QueryParam("removemarker") final Set<Marker> removeMarkers,
      final String requestJSONContent)
  {
    Mailbox mailbox = new Mailbox(user, domain);
    List<UUID> messageIds = null;

    try {
      messageIds = JSONUtils.toUUIDList(requestJSONContent);
    } catch (IllegalStateException jpe) {
View Full Code Here

  public Response deleteMessages(
      @PathParam("user") final String user,
      @PathParam("domain") final String domain,
      final String requestJSONContent)
  {
    Mailbox mailbox = new Mailbox(user, domain);
    List<UUID> messageIds = null;

    try {
      messageIds = JSONUtils.toUUIDList(requestJSONContent);
    } catch (IllegalStateException jpe) {
View Full Code Here

  @Produces(MediaType.APPLICATION_JSON)
  public Response add(
      @PathParam("user") final String user,
      @PathParam("domain") final String domain)
  {
    Mailbox mailbox = new Mailbox(user, domain);

    try {
      accountDAO.add(mailbox);
    } catch (IllegalArgumentException iae) {
      throw new BadRequestException(iae.getMessage());
    } catch (IOException e) {
      logger.error("Account initialization failed: {}", mailbox.getId());
      throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
    }

    URI messageUri = uriInfo.getAbsolutePathBuilder().path("mailbox").build();
View Full Code Here

TOP

Related Classes of com.elasticinbox.core.model.Mailbox

Copyright © 2018 www.massapicom. 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.