Package com.mongodb

Examples of com.mongodb.ReadPreference$TaggedReadPreference


    if ( embeddingEntityDocument != null ) {
      return embeddingEntityDocument;
    }
    else {
      ReadPreference readPreference = getReadPreference( associationContext );

      DBCollection collection = getCollection( key.getEntityKey() );
      DBObject searchObject = prepareIdObject( key.getEntityKey() );
      DBObject projection = getProjection( key, true );
View Full Code Here


      return collection.findOne( searchObject, projection, readPreference );
    }
  }

  private DBObject getObject(EntityKey key, TupleContext tupleContext) {
    ReadPreference readPreference = getReadPreference( tupleContext );

    DBCollection collection = getCollection( key );
    DBObject searchObject = prepareIdObject( key );
    BasicDBObject projection = getProjection( tupleContext );
View Full Code Here

    return deleted != null;
  }

  //not for embedded
  private DBObject findAssociation(AssociationKey key, AssociationContext associationContext, AssociationStorageStrategy storageStrategy) {
    ReadPreference readPreference = getReadPreference( associationContext );
    final DBObject associationKeyObject = associationKeyToObject( key, storageStrategy );

    return getAssociationCollection( key, storageStrategy ).findOne( associationKeyObject, getProjection( key, false ), readPreference );
  }
View Full Code Here

    private MongoBlob getBlob(String id, long lastMod) {
        DBObject query = getBlobQuery(id, lastMod);
       
        // try the secondary first
        // TODO add a configuration option for whether to try reading from secondary
        ReadPreference pref = ReadPreference.secondaryPreferred();
        DBObject fields = new BasicDBObject();
        fields.put(MongoBlob.KEY_DATA, 1);
        MongoBlob blob = (MongoBlob) getBlobCollection().findOne(query, fields, pref);
        if (blob == null) {
            // not found in the secondary: try the primary
View Full Code Here

        lastReadWriteMode = readWriteMode;
        try {
            Map<String, String> map = Splitter.on(", ").withKeyValueSeparator(":").split(readWriteMode);
            String read = map.get("read");
            if (read != null) {
                ReadPreference readPref = ReadPreference.valueOf(read);
                if (!readPref.equals(nodes.getReadPreference())) {
                    nodes.setReadPreference(readPref);
                    LOG.info("Using ReadPreference " + readPref);
                }
            }
            String write = map.get("write");
View Full Code Here

        lastReadWriteMode = readWriteMode;       
        try {
            Map<String, String> map = Splitter.on(", ").withKeyValueSeparator(":").split(readWriteMode);
            String read = map.get("read");
            if (read != null) {
                ReadPreference readPref = ReadPreference.valueOf(read);
                if (!readPref.equals(this.readPreference)) {
                    this.readPreference = readPref;
                }
            }
            String write = map.get("write");
            if (write != null) {
View Full Code Here

  /**
   * Returns a {@link DBObject} representing the entity which embeds the specified association.
   */
  private DBObject getEmbeddingEntity(AssociationKey key, AssociationContext associationContext) {
    ReadPreference readPreference = getReadPreference( associationContext );

    DBCollection collection = getCollection( key.getEntityKey() );
    DBObject searchObject = prepareIdObject( key.getEntityKey() );
    DBObject projection = getProjection( key, true );

View Full Code Here

    return collection.findOne( searchObject, projection, readPreference );
  }

  private DBObject getObject(EntityKey key, TupleContext tupleContext) {
    ReadPreference readPreference = getReadPreference( tupleContext );

    DBCollection collection = getCollection( key );
    DBObject searchObject = prepareIdObject( key );
    BasicDBObject projection = getProjection( tupleContext );
View Full Code Here

    collection.remove( toDelete, writeConcern );
  }

  //not for embedded
  private DBObject findAssociation(AssociationKey key, AssociationContext associationContext, AssociationStorageStrategy storageStrategy) {
    ReadPreference readPreference = getReadPreference( associationContext );
    final DBObject associationKeyObject = associationKeyToObject( key, storageStrategy );

    return getAssociationCollection( key, storageStrategy ).findOne( associationKeyObject, getProjection( key, false ), readPreference );
  }
View Full Code Here

        lastReadWriteMode = readWriteMode;       
        try {
            Map<String, String> map = Splitter.on(", ").withKeyValueSeparator(":").split(readWriteMode);
            String read = map.get("read");
            if (read != null) {
                ReadPreference readPref = ReadPreference.valueOf(read);
                if (!readPref.equals(this.readPreference)) {
                    this.readPreference = readPref;
                }
            }
            String write = map.get("write");
            if (write != null) {
View Full Code Here

TOP

Related Classes of com.mongodb.ReadPreference$TaggedReadPreference

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.