Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
* Make it buildable via Maven.
Browse files Browse the repository at this point in the history
* Delete non-essential parts.
  • Loading branch information
ceefour committed May 10, 2013
1 parent f2ed3cc commit 26132f7
Show file tree
Hide file tree
Showing 35 changed files with 146 additions and 1,444 deletions.
22 changes: 17 additions & 5 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/mongo-java-driver-2.7.3.jar"/>
<classpathentry kind="output" path="bin"/>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/target
.classpath
.project
.settings
.directory
9 changes: 2 additions & 7 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
17 changes: 0 additions & 17 deletions .settings/com.wdev91.eclipse.copyright.xml

This file was deleted.

4 changes: 1 addition & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
14 changes: 0 additions & 14 deletions META-INF/MANIFEST.MF

This file was deleted.

Binary file removed lib/mongo-java-driver-2.7.3.jar
Binary file not shown.
35 changes: 0 additions & 35 deletions plugin.xml

This file was deleted.

75 changes: 71 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,82 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<!--parent>
<groupId>com.jaspersoft.studio.community-edition</groupId>
<artifactId>plugins</artifactId>
<version>5.1.1-SNAPSHOT</version>
<relativePath>../aggregator/plugins/</relativePath>
</parent>
</parent-->

<groupId>com.jaspersoft.studio.community-edition</groupId>
<artifactId>com.jaspersoft.studio.data.mongodb</artifactId>
<packaging>eclipse-plugin</packaging>
<!--packaging>eclipse-plugin</packaging-->
<packaging>jar</packaging>
<version>5.1.1-SNAPSHOT</version>
</project>

<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.1.0</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
</dependencies>

<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<!-- http://maven.apache.org/plugins/maven-compiler-plugin/ -->
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
9 changes: 5 additions & 4 deletions src/com/jaspersoft/mongodb/MongoDbDataSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField;

import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jaspersoft.mongodb.query.MongoDbQueryWrapper;
import com.mongodb.DBObject;
Expand All @@ -34,13 +35,13 @@
*
*/
public class MongoDbDataSource implements JRDataSource {
private MongoDbQueryWrapper wrapper;
private final MongoDbQueryWrapper wrapper;

private DBObject currentDbObject;

public static final String QUERY_LANGUAGE = "MongoDbQuery";

private static final Logger logger = Logger.getLogger(MongoDbDataSource.class);
private static final Logger logger = LoggerFactory.getLogger(MongoDbDataSource.class);

private boolean hasIterator = false;

Expand Down Expand Up @@ -77,7 +78,7 @@ public Object getFieldValue(JRField field) throws JRException {
}
return null;
} catch (Exception e) {
logger.error(e);
logger.error("Cannot gt field value", e);
throw new JRException(e.getMessage());
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/com/jaspersoft/mongodb/MongoDbFieldsProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import net.sf.jasperreports.engine.JasperReportsContext;
import net.sf.jasperreports.engine.design.JRDesignField;

import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jaspersoft.mongodb.connection.MongoDbConnection;
import com.jaspersoft.mongodb.query.MongoDbParameter;
Expand All @@ -51,7 +52,7 @@ public class MongoDbFieldsProvider {

private static final Lock lock = new ReentrantLock();

private static final Logger logger = Logger.getLogger(MongoDbFieldsProvider.class);
private static final Logger logger = LoggerFactory.getLogger(MongoDbFieldsProvider.class);

public static final String FIELD_NAME_SEPARATOR = ".";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRParameter;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jaspersoft.mongodb.connection.MongoDbConnection;

Expand All @@ -32,11 +32,11 @@
* @author Eric Diaz
*/
public class MongoDbDataAdapterService extends AbstractDataAdapterService {
private static final Log log = LogFactory.getLog(MongoDbDataAdapterService.class);
private static final Logger log = LoggerFactory.getLogger(MongoDbDataAdapterService.class);

private MongoDbConnection connection;

private MongoDbDataAdapter dataAdapter;
private final MongoDbDataAdapter dataAdapter;

public MongoDbDataAdapterService(MongoDbDataAdapter dataAdapter) {
this.dataAdapter = dataAdapter;
Expand Down
22 changes: 14 additions & 8 deletions src/com/jaspersoft/mongodb/connection/MongoDbConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@

import net.sf.jasperreports.engine.JRException;

import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.mongodb.DB;
import com.mongodb.Mongo;
Expand All @@ -55,13 +56,13 @@ public class MongoDbConnection implements Connection {

private String mongoURI;

private String username;
private final String username;

private String password;
private final String password;

private DB mongoDatabase;

private final Logger logger = Logger.getLogger(MongoDbConnection.class);
private final Logger logger = LoggerFactory.getLogger(MongoDbConnection.class);

public MongoDbConnection(String mongoURI, String username, String password)
throws JRException {
Expand All @@ -76,7 +77,7 @@ private void create(String mongoURI) throws JRException {
try {
client = new Mongo(mongoURIObject = new MongoURI(mongoURI));
} catch (Exception e) {
logger.error(e);
logger.error("Cannot create connection", e);
throw new JRException(e.getMessage());
}
}
Expand All @@ -99,11 +100,11 @@ private void setDatabase() throws JRException {
if (message != null && message.startsWith("unauthorized db")) {
performaAuthentication = true;
} else {
logger.error(e);
logger.error("Cannot set database", e);
throw new JRException(message);
}
} else {
logger.error(e);
logger.error("Cannot set database", e);
throw new JRException(message);
}
}
Expand Down Expand Up @@ -175,7 +176,7 @@ public String test() throws JRException {
return "Connection test successful.\n" + "Mongo database name: "
+ mongoDatabase.getName();
} catch (Exception e) {
logger.error(e);
logger.error("Cannot test connection", e);
throw new JRException(e);
}
}
Expand Down Expand Up @@ -422,27 +423,32 @@ public Struct createStruct(String typeName, Object[] attributes)
return null;
}

@Override
public void setSchema(String schema) throws SQLException {
// TODO Auto-generated method stub

}

@Override
public String getSchema() throws SQLException {
// TODO Auto-generated method stub
return null;
}

@Override
public void abort(Executor executor) throws SQLException {
// TODO Auto-generated method stub

}

@Override
public void setNetworkTimeout(Executor executor, int milliseconds)
throws SQLException {
// TODO Auto-generated method stub

}

@Override
public int getNetworkTimeout() throws SQLException {
// TODO Auto-generated method stub
return 0;
Expand Down
Loading

0 comments on commit 26132f7

Please sign in to comment.