Package com.mongodb

Examples of com.mongodb.WriteConcern$Majority


        if (o == null) {
            return null;
        } else if (o instanceof WriteConcern) {
            return ObjectHelper.cast(WriteConcern.class, o);
        } else if (o instanceof String) {
            WriteConcern answer = WriteConcern.valueOf(ObjectHelper.cast(String.class, o));
            if (answer == null) {
                throw new CamelMongoDbException("WriteConcern specified in the " + MongoDbConstants.WRITECONCERN + " header, with value " + o
                                                + " could not be resolved to a WriteConcern type");
            }
        }
View Full Code Here


                    LOG.info("Using ReadPreference " + readPref);
                }
            }
            String write = map.get("write");
            if (write != null) {
                WriteConcern writeConcern = WriteConcern.valueOf(write);
                if (!writeConcern.equals(nodes.getWriteConcern())) {
                    nodes.setWriteConcern(writeConcern);
                    LOG.info("Using WriteConcern " + writeConcern);
                }
            }
        } catch (Exception e) {
View Full Code Here

                    this.readPreference = readPref;
                }
            }
            String write = map.get("write");
            if (write != null) {
                WriteConcern writeConcern = WriteConcern.valueOf(write);
                if (!writeConcern.equals(this.writeConcern)) {
                    this.writeConcern = writeConcern;
                }
            }
        } catch (Exception e) {
            // unsupported or parse error - ignore
View Full Code Here

     * You can also use standard WriteConcerns by passing in their key. See the {@link #setWriteConcern(String) setWriteConcern} method.
     *
     * @param writeConcernRef the name of the bean in the registry that represents the WriteConcern to use
     */
    public void setWriteConcernRef(String writeConcernRef) {
        WriteConcern wc = this.getCamelContext().getRegistry().lookupByNameAndType(writeConcernRef, WriteConcern.class);
        if (wc == null) {
            String msg = "Camel MongoDB component could not find the WriteConcern in the Registry. Verify that the "
                    + "provided bean name (" + writeConcernRef + ")  is correct. Aborting initialization.";
            throw new IllegalArgumentException(msg);
        }
View Full Code Here

                        + "for the MongoDB provider.");
                return null;
            }
        }

        WriteConcern writeConcern;
        if (writeConcernConstant != null && writeConcernConstant.length() > 0) {
            if (writeConcernConstantClassName != null && writeConcernConstantClassName.length() > 0) {
                try {
                    final Class<?> writeConcernConstantClass = Class.forName(writeConcernConstantClassName);
                    final Field field = writeConcernConstantClass.getField(writeConcernConstant);
View Full Code Here

     * You can also use standard WriteConcerns by passing in their key. See the {@link #setWriteConcern(String) setWriteConcern} method.
     *
     * @param writeConcernRef the name of the bean in the registry that represents the WriteConcern to use
     */
    public void setWriteConcernRef(String writeConcernRef) {
        WriteConcern wc = this.getCamelContext().getRegistry().lookupByNameAndType(writeConcernRef, WriteConcern.class);
        if (wc == null) {
            String msg = "Camel MongoDB component could not find the WriteConcern in the Registry. Verify that the "
                    + "provided bean name (" + writeConcernRef + ")  is correct. Aborting initialization.";
            throw new IllegalArgumentException(msg);
        }
View Full Code Here

    }
  }

  private WriteConcern buildWriteConcern(Map<?, ?> cfg) {
    Object cfgWriteConcern = cfg.get( Environment.MONGODB_WRITE_CONCERN );
    WriteConcern writeConcern = Environment.MONGODB_DEFAULT_WRITE_CONCERN;
    String wcLogMessage = "ACKNOWLEDGED";
    if ( cfgWriteConcern != null ) {
      final String confWC = cfgWriteConcern.toString();
      writeConcern = WriteConcern.valueOf( confWC );
View Full Code Here

  @Override
  public void updateTuple(Tuple tuple, EntityKey key, TupleContext tupleContext) {
    BasicDBObject idObject = this.prepareIdObject( key );
    DBObject updater = objectForUpdate( tuple, key, idObject );
    WriteConcern writeConcern = getWriteConcern( tupleContext );

    getCollection( key ).update( idObject, updater, true, false, writeConcern );
  }
View Full Code Here

  @Override
  public void removeTuple(EntityKey key, TupleContext tupleContext) {
    DBCollection collection = getCollection( key );
    DBObject toDelete = prepareIdObject( key );
    WriteConcern writeConcern = getWriteConcern( tupleContext );

    collection.remove( toDelete, writeConcern );
  }
View Full Code Here

  }

  @Override
  public Association createAssociation(AssociationKey key, AssociationContext associationContext) {
    AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );
    WriteConcern writeConcern = getWriteConcern( associationContext );

    if ( storageStrategy == AssociationStorageStrategy.IN_ENTITY ) {
      DBObject entity = getEmbeddingEntity( key, associationContext );

      boolean insert = false;
View Full Code Here

TOP

Related Classes of com.mongodb.WriteConcern$Majority

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.