Skip to content

Commit

Permalink
Merge pull request #13 from circlespainter/master
Browse files Browse the repository at this point in the history
comsat-mongodb-allanbanks

Thanks again!
  • Loading branch information
pron committed Jul 21, 2014
2 parents f2dccb9 + 58dd679 commit 0b093ca
Show file tree
Hide file tree
Showing 14 changed files with 3,317 additions and 1 deletion.
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ subprojects {
ext.jooqVersion = '3.3.2'
ext.slf4jApiVer = '1.7.7'
ext.guavaVersion = '17.0'

ext.mongodbJavaAsyncDriverVersion = '2.0.0'
ext.embedMongoVersion = '1.46.0'

configurations.all {
resolutionStrategy {
Expand Down Expand Up @@ -68,6 +71,7 @@ subprojects {
maven { url "https://oss.sonatype.org/content/repositories/releases" }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://maven.java.net/content/repositories/snapshots' }
maven { url 'http://www.allanbank.com/repo/' }
}

configurations {
Expand Down Expand Up @@ -158,6 +162,11 @@ project (':comsat-httpclient') {
srcFiles "org.apache.httpcomponents:httpcore:$apacheClientVersion:sources"
}
}
/* project (':comsat-mongodb') {
dependencies {
srcFiles "com.allanbank:mongodb-async-driver:$mongodbJavaAsyncDriverVersion:sources"
}
} */

// links are needed for javadoc external links. (eg. instead of javax.sql.DataSource link to DataSource)
ext.javadocLinks = [
Expand All @@ -171,7 +180,8 @@ ext.javadocLinks = [
"http://docs.oracle.com/javase/7/docs/api/",
"http://puniverse.github.io/quasar/javadoc/",
"http://docs.guava-libraries.googlecode.com/git-history/v17.0/javadoc/",
"http://jersey.java.net/apidocs/latest/jersey/"
"http://jersey.java.net/apidocs/latest/jersey/",
"http://www.allanbank.com/mongodb-async-driver/apidocs/index.html"
]

ext.javadocExcludes = [
Expand Down
9 changes: 9 additions & 0 deletions comsat-mongodb-allanbanks/build.gradle
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
}
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);
}
}
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()));
}
}

0 comments on commit 0b093ca

Please sign in to comment.