Exemple #1
0
 /** Only called by unit-tests */
 public static synchronized void reset() {
   cqsQueuePersistence = new CQSQueueCassandraPersistence();
   cnsSubscriptionPersistence = new CNSSubscriptionCassandraPersistence();
   cnsTopicPersistence = new CNSTopicCassandraPersistence();
   userPersistence = new UserCassandraPersistence();
   cnsAttributePersistence = new CNSAttributesCassandraPersistence();
   cqsMessagePersistence = RedisSortedSetPersistence.getInstance();
 }
Exemple #2
0
/**
 * The factory to create appt implementations of the various persistence interfaces
 *
 * @author bwolf, aseem, jorge, baosen
 */
public class PersistenceFactory {
  /**
   * Note: The attributes are made public and non-final only for unit-test purposes. Non-unit-test
   * code should only call accessors.
   */
  public static ICQSQueuePersistence cqsQueuePersistence = new CQSQueueCassandraPersistence();

  public static ICNSSubscriptionPersistence cnsSubscriptionPersistence =
      new CNSSubscriptionCassandraPersistence();
  public static ICNSTopicPersistence cnsTopicPersistence = new CNSTopicCassandraPersistence();
  public static IUserPersistence userPersistence = new UserCassandraPersistence();
  public static ICNSAttributesPersistence cnsAttributePersistence =
      new CNSAttributesCassandraPersistence();
  public static ICQSMessagePersistence cqsMessagePersistence =
      RedisSortedSetPersistence.getInstance();

  public static IUserPersistence getUserPersistence() {
    return userPersistence;
  }

  public static ICNSTopicPersistence getTopicPersistence() {
    return cnsTopicPersistence;
  }

  public static ICNSSubscriptionPersistence getSubscriptionPersistence() {
    return cnsSubscriptionPersistence;
  }

  public static ICQSQueuePersistence getQueuePersistence() {
    return cqsQueuePersistence;
  }

  public static ICNSAttributesPersistence getCNSAttributePersistence() {
    return cnsAttributePersistence;
  }

  public static ICQSMessagePersistence getCQSMessagePersistence() {
    return cqsMessagePersistence;
  }

  /** Only called by unit-tests */
  public static synchronized void reset() {
    cqsQueuePersistence = new CQSQueueCassandraPersistence();
    cnsSubscriptionPersistence = new CNSSubscriptionCassandraPersistence();
    cnsTopicPersistence = new CNSTopicCassandraPersistence();
    userPersistence = new UserCassandraPersistence();
    cnsAttributePersistence = new CNSAttributesCassandraPersistence();
    cqsMessagePersistence = RedisSortedSetPersistence.getInstance();
  }
}