Java Code Examples for com.mongodb.WriteConcern#REPLICA_ACKNOWLEDGED

The following examples show how to use com.mongodb.WriteConcern#REPLICA_ACKNOWLEDGED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PutMongo.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
protected WriteConcern getWriteConcern(final ProcessContext context) {
    final String writeConcernProperty = context.getProperty(WRITE_CONCERN).getValue();
    WriteConcern writeConcern = null;
    switch (writeConcernProperty) {
    case WRITE_CONCERN_ACKNOWLEDGED:
        writeConcern = WriteConcern.ACKNOWLEDGED;
        break;
    case WRITE_CONCERN_UNACKNOWLEDGED:
        writeConcern = WriteConcern.UNACKNOWLEDGED;
        break;
    case WRITE_CONCERN_FSYNCED:
        writeConcern = WriteConcern.FSYNCED;
        break;
    case WRITE_CONCERN_JOURNALED:
        writeConcern = WriteConcern.JOURNALED;
        break;
    case WRITE_CONCERN_REPLICA_ACKNOWLEDGED:
        writeConcern = WriteConcern.REPLICA_ACKNOWLEDGED;
        break;
    case WRITE_CONCERN_MAJORITY:
        writeConcern = WriteConcern.MAJORITY;
        break;
    default:
        writeConcern = WriteConcern.ACKNOWLEDGED;
    }
    return writeConcern;
}
 
Example 2
Source File: PutMongo.java    From nifi with Apache License 2.0 5 votes vote down vote up
protected WriteConcern getWriteConcern(final ProcessContext context) {
    final String writeConcernProperty = context.getProperty(WRITE_CONCERN).getValue();
    WriteConcern writeConcern = null;
    switch (writeConcernProperty) {
    case WRITE_CONCERN_ACKNOWLEDGED:
        writeConcern = WriteConcern.ACKNOWLEDGED;
        break;
    case WRITE_CONCERN_UNACKNOWLEDGED:
        writeConcern = WriteConcern.UNACKNOWLEDGED;
        break;
    case WRITE_CONCERN_FSYNCED:
        writeConcern = WriteConcern.FSYNCED;
        break;
    case WRITE_CONCERN_JOURNALED:
        writeConcern = WriteConcern.JOURNALED;
        break;
    case WRITE_CONCERN_REPLICA_ACKNOWLEDGED:
        writeConcern = WriteConcern.REPLICA_ACKNOWLEDGED;
        break;
    case WRITE_CONCERN_MAJORITY:
        writeConcern = WriteConcern.MAJORITY;
        break;
    default:
        writeConcern = WriteConcern.ACKNOWLEDGED;
    }
    return writeConcern;
}
 
Example 3
Source File: AbstractMongoProcessor.java    From nifi with Apache License 2.0 5 votes vote down vote up
protected WriteConcern getWriteConcern(final ProcessContext context) {
    final String writeConcernProperty = context.getProperty(WRITE_CONCERN).getValue();
    WriteConcern writeConcern = null;
    switch (writeConcernProperty) {
        case WRITE_CONCERN_ACKNOWLEDGED:
            writeConcern = WriteConcern.ACKNOWLEDGED;
            break;
        case WRITE_CONCERN_UNACKNOWLEDGED:
            writeConcern = WriteConcern.UNACKNOWLEDGED;
            break;
        case WRITE_CONCERN_FSYNCED:
            writeConcern = WriteConcern.FSYNCED;
            break;
        case WRITE_CONCERN_JOURNALED:
            writeConcern = WriteConcern.JOURNALED;
            break;
        case WRITE_CONCERN_REPLICA_ACKNOWLEDGED:
            writeConcern = WriteConcern.REPLICA_ACKNOWLEDGED;
            break;
        case WRITE_CONCERN_MAJORITY:
            writeConcern = WriteConcern.MAJORITY;
            break;
        default:
            writeConcern = WriteConcern.ACKNOWLEDGED;
    }
    return writeConcern;
}
 
Example 4
Source File: MongoDBControllerService.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public WriteConcern getWriteConcern(final ConfigurationContext context) {
    final String writeConcernProperty = context.getProperty(WRITE_CONCERN).getValue();
    WriteConcern writeConcern = null;
    switch (writeConcernProperty) {
        case WRITE_CONCERN_ACKNOWLEDGED:
            writeConcern = WriteConcern.ACKNOWLEDGED;
            break;
        case WRITE_CONCERN_UNACKNOWLEDGED:
            writeConcern = WriteConcern.UNACKNOWLEDGED;
            break;
        case WRITE_CONCERN_FSYNCED:
            writeConcern = WriteConcern.FSYNCED;
            break;
        case WRITE_CONCERN_JOURNALED:
            writeConcern = WriteConcern.JOURNALED;
            break;
        case WRITE_CONCERN_REPLICA_ACKNOWLEDGED:
            writeConcern = WriteConcern.REPLICA_ACKNOWLEDGED;
            break;
        case WRITE_CONCERN_MAJORITY:
            writeConcern = WriteConcern.MAJORITY;
            break;
        default:
            writeConcern = WriteConcern.ACKNOWLEDGED;
    }
    return writeConcern;
}
 
Example 5
Source File: DefaultDataSourceCreater.java    From tangyuan2 with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
private WriteConcern getWriteConcern(String writeConcern) {
	if ("ACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.ACKNOWLEDGED;
	}
	if ("W1".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W1;
	}
	if ("W2".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W2;
	}
	if ("W3".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.W3;
	}
	if ("UNACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.UNACKNOWLEDGED;
	}
	if ("FSYNCED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.FSYNCED;
	}
	if ("REPLICA_ACKNOWLEDGED".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.REPLICA_ACKNOWLEDGED;
	}
	if ("NORMAL".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.NORMAL;
	}
	if ("SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.SAFE;
	}
	if ("MAJORITY".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.MAJORITY;
	}
	if ("FSYNC_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.FSYNC_SAFE;
	}
	if ("JOURNAL_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.JOURNAL_SAFE;
	}
	if ("REPLICAS_SAFE".equalsIgnoreCase(writeConcern)) {
		return WriteConcern.REPLICAS_SAFE;
	}
	return WriteConcern.ACKNOWLEDGED;
}