public class InMemoryDriver extends Object implements MorphiumDriver
InMemory implementation of the MorphiumDriver interface. can be used for testing or caching. Does not cover all functionality yet.
VERSION_NAME| Constructor and Description |
|---|
InMemoryDriver() |
public void restore(InputStream in) throws IOException, org.json.simple.parser.ParseException
IOExceptionorg.json.simple.parser.ParseExceptionpublic void restoreFromFile(File f) throws IOException, org.json.simple.parser.ParseException
IOExceptionorg.json.simple.parser.ParseExceptionpublic void dumpToFile(Morphium m, String db, File f) throws IOException
IOExceptionpublic void dump(Morphium m, String db, OutputStream out) throws IOException
IOExceptionpublic List<String> listDatabases()
listDatabases in interface MorphiumDriverpublic List<String> listCollections(String db, String pattern)
MorphiumDriverlistCollections in interface MorphiumDriverpattern - regular expression for the collection, might be nullpublic void resetData()
public void setCredentials(String db, String login, char[] pwd)
setCredentials in interface MorphiumDriverpublic int getDefaultWriteTimeout()
getDefaultWriteTimeout in interface MorphiumDriverpublic void setDefaultWriteTimeout(int wt)
setDefaultWriteTimeout in interface MorphiumDriverpublic boolean isReplicaset()
isReplicaset in interface MorphiumDriverpublic String[] getCredentials(String db)
getCredentials in interface MorphiumDriverpublic boolean isDefaultFsync()
isDefaultFsync in interface MorphiumDriverpublic void setDefaultFsync(boolean j)
setDefaultFsync in interface MorphiumDriverpublic String[] getHostSeed()
getHostSeed in interface MorphiumDriverpublic void setHostSeed(String... host)
setHostSeed in interface MorphiumDriverpublic int getMaxConnections()
getMaxConnections in interface MorphiumDriverpublic void setMaxConnections(int maxConnections)
setMaxConnections in interface MorphiumDriverpublic int getMinConnections()
getMinConnections in interface MorphiumDriverpublic void setMinConnections(int minConnections)
setMinConnections in interface MorphiumDriverpublic int getMaxConnectionLifetime()
getMaxConnectionLifetime in interface MorphiumDriverpublic void setMaxConnectionLifetime(int timeout)
setMaxConnectionLifetime in interface MorphiumDriverpublic int getMaxConnectionIdleTime()
getMaxConnectionIdleTime in interface MorphiumDriverpublic void setMaxConnectionIdleTime(int time)
setMaxConnectionIdleTime in interface MorphiumDriverpublic void addCommandListener(com.mongodb.event.CommandListener cmd)
addCommandListener in interface MorphiumDriverpublic void removeCommandListener(com.mongodb.event.CommandListener cmd)
removeCommandListener in interface MorphiumDriverpublic void addClusterListener(com.mongodb.event.ClusterListener cl)
addClusterListener in interface MorphiumDriverpublic void removeClusterListener(com.mongodb.event.ClusterListener cl)
removeClusterListener in interface MorphiumDriverpublic void addConnectionPoolListener(com.mongodb.event.ConnectionPoolListener cpl)
addConnectionPoolListener in interface MorphiumDriverpublic void removeConnectionPoolListener(com.mongodb.event.ConnectionPoolListener cpl)
removeConnectionPoolListener in interface MorphiumDriverpublic int getConnectionTimeout()
getConnectionTimeout in interface MorphiumDriverpublic void setConnectionTimeout(int timeout)
setConnectionTimeout in interface MorphiumDriverpublic int getDefaultW()
getDefaultW in interface MorphiumDriverpublic void setDefaultW(int w)
setDefaultW in interface MorphiumDriverpublic int getHeartbeatFrequency()
getHeartbeatFrequency in interface MorphiumDriverpublic void setHeartbeatFrequency(int heartbeatFrequency)
setHeartbeatFrequency in interface MorphiumDriverpublic void setDefaultBatchSize(int defaultBatchSize)
setDefaultBatchSize in interface MorphiumDriverpublic void setCredentials(Map<String,String[]> credentials)
setCredentials in interface MorphiumDriverpublic boolean isRetryReads()
isRetryReads in interface MorphiumDriverpublic void setRetryReads(boolean retryReads)
setRetryReads in interface MorphiumDriverpublic boolean isRetryWrites()
isRetryWrites in interface MorphiumDriverpublic void setRetryWrites(boolean retryWrites)
setRetryWrites in interface MorphiumDriverpublic String getUuidRepresentation()
getUuidRepresentation in interface MorphiumDriverpublic void setUuidRepresentation(String uuidRepresentation)
setUuidRepresentation in interface MorphiumDriverpublic boolean isUseSSL()
isUseSSL in interface MorphiumDriverpublic void setUseSSL(boolean useSSL)
setUseSSL in interface MorphiumDriverpublic boolean isDefaultJ()
isDefaultJ in interface MorphiumDriverpublic void setDefaultJ(boolean j)
setDefaultJ in interface MorphiumDriverpublic int getReadTimeout()
getReadTimeout in interface MorphiumDriverpublic void setReadTimeout(int readTimeout)
setReadTimeout in interface MorphiumDriverpublic int getLocalThreshold()
getLocalThreshold in interface MorphiumDriverpublic void setLocalThreshold(int thr)
setLocalThreshold in interface MorphiumDriverpublic void heartBeatFrequency(int t)
heartBeatFrequency in interface MorphiumDriverpublic void useSsl(boolean ssl)
useSsl in interface MorphiumDriverpublic void connect()
connect in interface MorphiumDriverpublic void setDefaultReadPreference(ReadPreference rp)
setDefaultReadPreference in interface MorphiumDriverpublic void connect(String replicasetName)
connect in interface MorphiumDriverpublic Maximums getMaximums()
getMaximums in interface MorphiumDriverpublic boolean isConnected()
isConnected in interface MorphiumDriverpublic int getRetriesOnNetworkError()
getRetriesOnNetworkError in interface MorphiumDriverpublic void setRetriesOnNetworkError(int r)
setRetriesOnNetworkError in interface MorphiumDriverpublic int getSleepBetweenErrorRetries()
getSleepBetweenErrorRetries in interface MorphiumDriverpublic void setSleepBetweenErrorRetries(int s)
setSleepBetweenErrorRetries in interface MorphiumDriverpublic void close()
close in interface MorphiumDriverpublic Map<String,Object> getReplsetStatus()
getReplsetStatus in interface MorphiumDriverpublic Map<String,Object> getDBStats(String db)
getDBStats in interface MorphiumDriverpublic Map<String,Object> getOps(long threshold)
getOps in interface MorphiumDriverpublic Map<String,Object> runCommand(String db, Map<String,Object> cmd)
runCommand in interface MorphiumDriverpublic MorphiumCursor initAggregationIteration(String db, String collection, List<Map<String,Object>> aggregationPipeline, ReadPreference readPreference, Collation collation, int batchSize, Map<String,Object> findMetaData) throws MorphiumDriverException
initAggregationIteration in interface MorphiumDriverMorphiumDriverExceptionpublic MorphiumCursor initIteration(String db, String collection, Map<String,Object> query, Map<String,Integer> sort, Map<String,Object> projection, int skip, int limit, int batchSize, ReadPreference readPreference, Collation coll, Map<String,Object> findMetaData) throws MorphiumDriverException
initIteration in interface MorphiumDriverMorphiumDriverExceptionpublic void watch(String db, int timeout, boolean fullDocumentOnUpdate, List<Map<String,Object>> pipeline, DriverTailableIterationCallback cb) throws MorphiumDriverException
watch in interface MorphiumDriverMorphiumDriverExceptionpublic void watch(String db, String collection, int timeout, boolean fullDocumentOnUpdate, List<Map<String,Object>> pipeline, DriverTailableIterationCallback cb) throws MorphiumDriverException
watch in interface MorphiumDriverMorphiumDriverExceptionpublic MorphiumCursor nextIteration(MorphiumCursor crs) throws MorphiumDriverException
nextIteration in interface MorphiumDriverMorphiumDriverExceptionpublic List<Map<String,Object>> find(String db, String collection, Map<String,Object> query, Map<String,Integer> sort, Map<String,Object> projection, int skip, int limit, int batchSize, ReadPreference rp, Collation col, Map<String,Object> findMetaData) throws MorphiumDriverException
find in interface MorphiumDriverMorphiumDriverExceptionpublic long count(String db, String collection, Map<String,Object> query, Collation collation, ReadPreference rp)
count in interface MorphiumDriverpublic long estimatedDocumentCount(String db, String collection, ReadPreference rp)
estimatedDocumentCount in interface MorphiumDriverpublic List<Map<String,Object>> findByFieldValue(String db, String coll, String field, Object value)
public void insert(String db, String collection, List<Map<String,Object>> objs, WriteConcern wc) throws MorphiumDriverException
MorphiumDriverinsert in interface MorphiumDriverMorphiumDriverExceptionpublic Map<String,Integer> store(String db, String collection, List<Map<String,Object>> objs, WriteConcern wc)
MorphiumDriverstore in interface MorphiumDriverpublic void closeIteration(MorphiumCursor crs)
closeIteration in interface MorphiumDriverpublic Map<String,Object> update(String db, String collection, Map<String,Object> query, Map<String,Object> op, boolean multiple, boolean upsert, Collation collation, WriteConcern wc) throws MorphiumDriverException
update in interface MorphiumDriverMorphiumDriverExceptionpublic Map<String,Object> delete(String db, String collection, Map<String,Object> query, boolean multiple, Collation collation, WriteConcern wc) throws MorphiumDriverException
delete in interface MorphiumDriverMorphiumDriverExceptionpublic void drop(String db, String collection, WriteConcern wc)
drop in interface MorphiumDriverpublic void drop(String db, WriteConcern wc)
drop in interface MorphiumDriverpublic boolean exists(String db)
exists in interface MorphiumDriverpublic List<Object> distinct(String db, String collection, String field, Map<String,Object> filter, Collation collation, ReadPreference rp)
distinct in interface MorphiumDriverpublic boolean exists(String db, String collection)
exists in interface MorphiumDriverpublic List<Map<String,Object>> getIndexes(String db, String collection)
getIndexes in interface MorphiumDriverpublic List<String> getCollectionNames(String db)
getCollectionNames in interface MorphiumDriverpublic Map<String,Object> findAndOneAndDelete(String db, String col, Map<String,Object> query, Map<String,Integer> sort, Collation collation) throws MorphiumDriverException
findAndOneAndDelete in interface MorphiumDriverMorphiumDriverExceptionpublic Map<String,Object> findAndOneAndUpdate(String db, String col, Map<String,Object> query, Map<String,Object> update, Map<String,Integer> sort, Collation collation) throws MorphiumDriverException
findAndOneAndUpdate in interface MorphiumDriverMorphiumDriverExceptionpublic Map<String,Object> findAndOneAndReplace(String db, String col, Map<String,Object> query, Map<String,Object> replacement, Map<String,Integer> sort, Collation collation) throws MorphiumDriverException
findAndOneAndReplace in interface MorphiumDriverMorphiumDriverExceptionpublic List<Map<String,Object>> aggregate(String db, String collection, List<Map<String,Object>> pipeline, boolean explain, boolean allowDiskUse, Collation collation, ReadPreference readPreference) throws MorphiumDriverException
aggregate in interface MorphiumDriverMorphiumDriverExceptionpublic void tailableIteration(String db, String collection, Map<String,Object> query, Map<String,Integer> sort, Map<String,Object> projection, int skip, int limit, int batchSize, ReadPreference readPreference, int timeout, DriverTailableIterationCallback cb) throws MorphiumDriverException
tailableIteration in interface MorphiumDriverMorphiumDriverExceptionpublic int getMaxWaitTime()
getMaxWaitTime in interface MorphiumDriverpublic void setMaxWaitTime(int maxWaitTime)
setMaxWaitTime in interface MorphiumDriverpublic int getServerSelectionTimeout()
getServerSelectionTimeout in interface MorphiumDriverpublic void setServerSelectionTimeout(int serverSelectionTimeout)
setServerSelectionTimeout in interface MorphiumDriverpublic boolean isCapped(String db, String coll)
isCapped in interface MorphiumDriverpublic BulkRequestContext createBulkContext(Morphium m, String db, String collection, boolean ordered, WriteConcern wc)
createBulkContext in interface MorphiumDriverpublic void createIndex(String db, String collection, Map<String,Object> index, Map<String,Object> options)
createIndex in interface MorphiumDriverpublic List<Map<String,Object>> mapReduce(String db, String collection, String mapping, String reducing) throws MorphiumDriverException
mapReduce in interface MorphiumDriverMorphiumDriverExceptionpublic List<Map<String,Object>> mapReduce(String db, String collection, String mapping, String reducing, Map<String,Object> query) throws MorphiumDriverException
mapReduce in interface MorphiumDriverMorphiumDriverExceptionpublic List<Map<String,Object>> mapReduce(String db, String collection, String mapping, String reducing, Map<String,Object> query, Map<String,Object> sorting, Collation collation) throws MorphiumDriverException
mapReduce in interface MorphiumDriverMorphiumDriverExceptionpublic void startTransaction()
startTransaction in interface MorphiumDriverpublic void commitTransaction()
commitTransaction in interface MorphiumDriverpublic MorphiumTransactionContext getTransactionContext()
getTransactionContext in interface MorphiumDriverpublic void abortTransaction()
abortTransaction in interface MorphiumDriverpublic void setTransactionContext(MorphiumTransactionContext ctx)
setTransactionContext in interface MorphiumDriverpublic void writeDump(File f)
public SSLContext getSslContext()
getSslContext in interface MorphiumDriverpublic void setSslContext(SSLContext sslContext)
setSslContext in interface MorphiumDriverpublic boolean isSslInvalidHostNameAllowed()
isSslInvalidHostNameAllowed in interface MorphiumDriverpublic void setSslInvalidHostNameAllowed(boolean sslInvalidHostNameAllowed)
setSslInvalidHostNameAllowed in interface MorphiumDriverCopyright © 2021. All rights reserved.