Coverage Report - com.allanbank.mongodb.client.connection.ConnectionFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
ConnectionFactory
N/A
N/A
1
 
 1  
 /*
 2  
  * #%L
 3  
  * ConnectionFactory.java - mongodb-async-driver - Allanbank Consulting, Inc.
 4  
  * %%
 5  
  * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc.
 6  
  * %%
 7  
  * Licensed under the Apache License, Version 2.0 (the "License");
 8  
  * you may not use this file except in compliance with the License.
 9  
  * You may obtain a copy of the License at
 10  
  * 
 11  
  *      http://www.apache.org/licenses/LICENSE-2.0
 12  
  * 
 13  
  * Unless required by applicable law or agreed to in writing, software
 14  
  * distributed under the License is distributed on an "AS IS" BASIS,
 15  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 16  
  * See the License for the specific language governing permissions and
 17  
  * limitations under the License.
 18  
  * #L%
 19  
  */
 20  
 
 21  
 package com.allanbank.mongodb.client.connection;
 22  
 
 23  
 import java.io.Closeable;
 24  
 import java.io.IOException;
 25  
 
 26  
 import com.allanbank.mongodb.client.ClusterStats;
 27  
 import com.allanbank.mongodb.client.ClusterType;
 28  
 import com.allanbank.mongodb.client.connection.bootstrap.BootstrapConnectionFactory;
 29  
 import com.allanbank.mongodb.client.connection.socket.SocketConnection;
 30  
 
 31  
 /**
 32  
  * Provides an abstraction for constructing a connection. At the lowest level a
 33  
  * connection to a MongoDB process is done through a {@link SocketConnection}
 34  
  * but there are several connection facades to intelligently connect to Replica
 35  
  * Sets and Shard configurations.
 36  
  * <p>
 37  
  * The {@link BootstrapConnectionFactory} can be used to boot strap the
 38  
  * appropriate type of connection factory. It will use a single connection to a
 39  
  * MongoDB process to perform a series of commands to determine the server
 40  
  * configuration type (Sharded, Replica Set, Standalone) and the setup the
 41  
  * appropriate delegate connection factory.
 42  
  * </p>
 43  
  * 
 44  
  * @api.no This class is <b>NOT</b> part of the drivers API. This class may be
 45  
  *         mutated in incompatible ways between any two releases of the driver.
 46  
  * @copyright 2011-2013, Allanbank Consulting, Inc., All Rights Reserved
 47  
  */
 48  
 public interface ConnectionFactory extends Closeable {
 49  
 
 50  
     /**
 51  
      * Creates a connection to the address provided.
 52  
      * 
 53  
      * @return The Connection to MongoDB.
 54  
      * @throws IOException
 55  
      *             On a failure connecting to the server.
 56  
      */
 57  
     public Connection connect() throws IOException;
 58  
 
 59  
     /**
 60  
      * Returns the meta-data on the current cluster.
 61  
      * 
 62  
      * @return The meta-data on the current cluster.
 63  
      */
 64  
     public ClusterStats getClusterStats();
 65  
 
 66  
     /**
 67  
      * Returns the type of cluster the connection factory connects to.
 68  
      * 
 69  
      * @return The type of cluster the connection factory connects to.
 70  
      */
 71  
     public ClusterType getClusterType();
 72  
 
 73  
     /**
 74  
      * Returns the reconnection strategy for the type of connections.
 75  
      * 
 76  
      * @return The reconnection strategy for the type of connections.
 77  
      */
 78  
     public ReconnectStrategy getReconnectStrategy();
 79  
 }