Package com.mongodb

Examples of com.mongodb.MongoClientURI


            if (deleteData && !isExternal) {
                Map<String, String> tblParams = tbl.getParameters();
                if (tblParams.containsKey(MONGO_URI)) {
                    String mongoURIStr = tblParams.get(MONGO_URI);
                    DBCollection coll = MongoConfigUtil.getCollection(new MongoClientURI(mongoURIStr));
                    coll.drop();
                } else {
                    throw new MetaException(format("No '%s' property found. Collection not dropped.", MONGO_URI));
                }
            }
View Full Code Here


    private MongoClientURI uri;
    private MongoClient mongoClient;

    @Before
    public void setup() throws UnknownHostException {
        uri = new MongoClientURI("mongodb://localhost:27017/mongo_hadoop.pigtests");
        mongoClient = new MongoClient(uri);
    }
View Full Code Here

    public DBCollection getInputCollection() {
        return MongoConfigUtil.getInputCollection(configuration);
    }

    public void setMongoURI(final String key, final MongoURI value) {
        setMongoURI(key, new MongoClientURI(value.toString()));
    }
View Full Code Here

    //     public void setSort(DBObject sort){
    //         this.sort = sort;
    //     }

    protected void init() {
        MongoClientURI inputURI = MongoConfigUtil.getInputURI(getConfiguration());
        this.inputCollection = MongoConfigUtil.getCollection(inputURI);
        DB db = this.inputCollection.getDB();
        this.mongo = db.getMongo();
        MongoClientURI authURI = MongoConfigUtil.getAuthURI(getConfiguration());
        if (authURI != null) {
            if (authURI.getUsername() != null
                && authURI.getPassword() != null) {
                authDB = mongo.getDB(authURI.getDatabase());
            }
        }
    }
View Full Code Here

        int serverStart = idx > 0 ? idx + 1 : 0;

        StringBuilder sb = new StringBuilder(originalUriString);
        sb.replace(serverStart, serverEnd, newServerUri);
        String ans = MongoURI.MONGODB_PREFIX + sb.toString();
        return new MongoClientURI(ans);
    }
View Full Code Here

    @Override
    public List<InputSplit> calculateSplits() throws SplitFailedException {
        this.init();
        final ArrayList<InputSplit> returnVal = new ArrayList<InputSplit>();

        MongoClientURI inputURI = MongoConfigUtil.getInputURI(getConfiguration());

        Map<String, String> shardsMap;
        shardsMap = this.getShardsMap();

        for (Map.Entry<String, String> entry : shardsMap.entrySet()) {
View Full Code Here

    /**
     * @deprecated use {@link #setAuthURI(MongoClientURI)} instead
     */
    @Deprecated
    public void setAuthURI(final MongoURI authURI) {
        setAuthURI(authURI != null ? new MongoClientURI(authURI.toString()) : null);
    }
View Full Code Here

        byte[] data = new byte[dataLen + 4];
        System.arraycopy(l, 0, data, 0, 4);
        in.readFully(data, 4, dataLen - 4);
        _bsonDecoder.decode(data, cb);
        spec = (BSONObject) cb.get();
        setInputURI(new MongoClientURI((String) spec.get("inputURI")));

        if (spec.get("authURI") != null) {
            setAuthURI(new MongoClientURI((String) spec.get("authURI")));
        } else {
            setAuthURI((MongoClientURI) null);
        }

        setKeyField((String) spec.get("keyField"));
View Full Code Here

                uri.append(paramAdded ? "&" : "?");
                paramAdded = true;
                uri.append(format("%s=%s", entry.getKey(), entry.getValue()));
            }
        }
        return new MongoClientURI(uri.toString());
    }
View Full Code Here

     */
    @Deprecated
    public MultiCollectionSplitBuilder add(final MongoURI inputURI, final MongoURI authURI, final boolean noTimeout, final DBObject fields,
                                           final DBObject sort, final DBObject query, final boolean useRangeQuery,
                                           final Class<? extends MongoSplitter> splitClass) {
        return add(new MongoClientURI(inputURI.toString()), new MongoClientURI(authURI.toString()),
                   noTimeout, fields, sort, query, useRangeQuery, splitClass);
    }
View Full Code Here

TOP

Related Classes of com.mongodb.MongoClientURI

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.