Coverage Report - com.allanbank.mongodb.MongoDbConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
MongoDbConfiguration
92%
13/14
N/A
1
 
 1  
 /*
 2  
  * #%L
 3  
  * MongoDbConfiguration.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  
 package com.allanbank.mongodb;
 21  
 
 22  
 import java.net.InetSocketAddress;
 23  
 
 24  
 /**
 25  
  * Contains the configuration for the connection(s) to the MongoDB servers. This
 26  
  * class is the same as and extends the {@link MongoClientConfiguration} except
 27  
  * it defaults the {@link Durability} to {@link Durability#NONE} instead of
 28  
  * {@link Durability#ACK}.
 29  
  * 
 30  
  * @api.yes This class is part of the driver's API. Public and protected members
 31  
  *          will be deprecated for at least 1 non-bugfix release (version
 32  
  *          numbers are <major>.<minor>.<bugfix>) before being
 33  
  *          removed or modified.
 34  
  * @deprecated Please us the {@link MongoClientConfiguration} instead. This
 35  
  *             class will be removed on or after the 1.3.0 release.
 36  
  * @copyright 2011-2013, Allanbank Consulting, Inc., All Rights Reserved
 37  
  */
 38  0
 @Deprecated
 39  
 public class MongoDbConfiguration extends MongoClientConfiguration {
 40  
 
 41  
     /** Serialization version for the class. */
 42  
     private static final long serialVersionUID = -3986785427935492378L;
 43  
 
 44  
     /**
 45  
      * Creates a new MongoDbConfiguration.
 46  
      */
 47  
     public MongoDbConfiguration() {
 48  26
         super();
 49  
 
 50  26
         setDefaultDurability(Durability.NONE);
 51  26
     }
 52  
 
 53  
     /**
 54  
      * Creates a new MongoDbConfiguration.
 55  
      * 
 56  
      * @param servers
 57  
      *            The initial set of servers to connect to.
 58  
      */
 59  
     public MongoDbConfiguration(final InetSocketAddress... servers) {
 60  3
         super(servers);
 61  
 
 62  3
         setDefaultDurability(Durability.NONE);
 63  3
     }
 64  
 
 65  
     /**
 66  
      * Creates a new MongoDbConfiguration.
 67  
      * 
 68  
      * @param other
 69  
      *            The configuration to copy.
 70  
      */
 71  
     public MongoDbConfiguration(final MongoDbConfiguration other) {
 72  1
         super(other);
 73  1
     }
 74  
 
 75  
     /**
 76  
      * Creates a new {@link MongoDbConfiguration} instance using a MongoDB style
 77  
      * URL to initialize its state. Further configuration is possible once the
 78  
      * {@link MongoDbConfiguration} has been instantiated.
 79  
      * 
 80  
      * @param mongoDbUri
 81  
      *            The configuration for the connection to MongoDB expressed as a
 82  
      *            MongoDB URL.
 83  
      * @throws IllegalArgumentException
 84  
      *             If the <tt>mongoDbUri</tt> is not a properly formated MongoDB
 85  
      *             style URL.
 86  
      * 
 87  
      * @see <a href="http://www.mongodb.org/display/DOCS/Connections"> MongoDB
 88  
      *      Connections</a>
 89  
      */
 90  
     public MongoDbConfiguration(final MongoDbUri mongoDbUri)
 91  
             throws IllegalArgumentException {
 92  18
         super(mongoDbUri, Durability.NONE);
 93  17
     }
 94  
 
 95  
     /**
 96  
      * Creates a new {@link MongoDbConfiguration} instance using a MongoDB style
 97  
      * URL to initialize its state. Further configuration is possible once the
 98  
      * {@link MongoDbConfiguration} has been instantiated.
 99  
      * 
 100  
      * @param mongoDbUri
 101  
      *            The configuration for the connection to MongoDB expressed as a
 102  
      *            MongoDB URL.
 103  
      * @throws IllegalArgumentException
 104  
      *             If the <tt>mongoDbUri</tt> is not a properly formated MongoDB
 105  
      *             style URL.
 106  
      * 
 107  
      * @see <a href="http://www.mongodb.org/display/DOCS/Connections"> MongoDB
 108  
      *      Connections</a>
 109  
      */
 110  
     public MongoDbConfiguration(final String mongoDbUri)
 111  
             throws IllegalArgumentException {
 112  22
         this(new MongoDbUri(mongoDbUri));
 113  16
     }
 114  
 
 115  
     /**
 116  
      * Creates a copy of this MongoClientConfiguration.
 117  
      * <p>
 118  
      * Note: This is not a traditional clone to ensure a deep copy of all
 119  
      * information.
 120  
      * </p>
 121  
      */
 122  
     @Override
 123  
     public MongoDbConfiguration clone() {
 124  1
         return (MongoDbConfiguration) super.clone();
 125  
     }
 126  
 }