-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from circlespainter/master
comsat-mongodb-allanbanks Thanks again!
- Loading branch information
Showing
14 changed files
with
3,317 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
dependencies { | ||
compile "com.allanbank:mongodb-async-driver:$mongodbJavaAsyncDriverVersion" | ||
testCompile "de.flapdoodle.embed:de.flapdoodle.embed.mongo:$embedMongoVersion" | ||
testCompile project(':comsat-test-utils') | ||
} | ||
|
||
tasks.withType(Test) { | ||
jvmArgs "-javaagent:${configurations.quasar.iterator().next()}" // =v, =d | ||
} |
36 changes: 36 additions & 0 deletions
36
...ngodb-allanbanks/src/main/java/co/paralleluniverse/fibers/mongodb/FiberMongoCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* COMSAT | ||
* Copyright (c) 2013-2014, Parallel Universe Software Co. All rights reserved. | ||
* | ||
* This program and the accompanying materials are dual-licensed under | ||
* either the terms of the Eclipse Public License v1.0 as published by | ||
* the Eclipse Foundation | ||
* | ||
* or (per the licensee's choosing) | ||
* | ||
* under the terms of the GNU Lesser General Public License version 3.0 | ||
* as published by the Free Software Foundation. | ||
*/ | ||
package co.paralleluniverse.fibers.mongodb; | ||
|
||
import co.paralleluniverse.fibers.FiberAsync; | ||
import com.allanbank.mongodb.Callback; | ||
import com.allanbank.mongodb.MongoDbException; | ||
|
||
/** | ||
* Base class for async-to-fiber-blocking Async Java Mongo Driver transformations | ||
* | ||
* @author circlespainter | ||
* @param <T> | ||
*/ | ||
public abstract class FiberMongoCallback<T> extends FiberAsync<T, MongoDbException> implements Callback<T> { | ||
@Override | ||
public void callback(T success) { | ||
asyncCompleted(success); | ||
} | ||
|
||
@Override | ||
public void exception(Throwable failure) { | ||
asyncFailed(failure); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...odb-allanbanks/src/main/java/co/paralleluniverse/fibers/mongodb/FiberMongoClientImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* COMSAT | ||
* Copyright (c) 2013-2014, Parallel Universe Software Co. All rights reserved. | ||
* | ||
* This program and the accompanying materials are dual-licensed under | ||
* either the terms of the Eclipse Public License v1.0 as published by | ||
* the Eclipse Foundation | ||
* | ||
* or (per the licensee's choosing) | ||
* | ||
* under the terms of the GNU Lesser General Public License version 3.0 | ||
* as published by the Free Software Foundation. | ||
*/ | ||
package co.paralleluniverse.fibers.mongodb; | ||
|
||
import com.allanbank.mongodb.MongoClient; | ||
import com.allanbank.mongodb.MongoClientConfiguration; | ||
import com.allanbank.mongodb.MongoDatabase; | ||
import com.allanbank.mongodb.client.Client; | ||
import com.allanbank.mongodb.client.ClientImpl; | ||
import com.allanbank.mongodb.client.MongoClientImpl; | ||
import com.allanbank.mongodb.client.SerialClientImpl; | ||
|
||
/** | ||
* @author circlespainter | ||
*/ | ||
public class FiberMongoClientImpl extends MongoClientImpl { | ||
|
||
public FiberMongoClientImpl(Client client) { | ||
super(client); | ||
} | ||
|
||
public FiberMongoClientImpl(MongoClientConfiguration mcc) { | ||
super(mcc); | ||
} | ||
|
||
@Override | ||
public MongoDatabase getDatabase(String name) { | ||
return new FiberMongoDatabaseImpl(this, getClient(), name); | ||
} | ||
|
||
@Override | ||
public MongoClient asSerializedClient() { | ||
// TODO Make more robust | ||
return new FiberMongoClientImpl(new SerialClientImpl((ClientImpl) getClient())); | ||
} | ||
} |
Oops, something went wrong.