Skip to content

Commit

Permalink
Added support for loading local Derby databases
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Feb 15, 2012
1 parent fe50b75 commit 0bd8895
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 4 deletions.
2 changes: 2 additions & 0 deletions plugins/net.bioclipse.bridgedb/.classpath
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="jar/derby.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="jar/org.bridgedb.bio.jar"/>
<classpathentry exported="true" kind="lib" path="jar/org.bridgedb.jar"/>
<classpathentry kind="lib" path="jar/org.bridgedb.webservice.bridgerest.jar"/>
<classpathentry kind="lib" path="jar/org.bridgedb.rdb.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
4 changes: 3 additions & 1 deletion plugins/net.bioclipse.bridgedb/META-INF/MANIFEST.MF
Expand Up @@ -17,5 +17,7 @@ Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
jar/org.bridgedb.bio.jar,
jar/org.bridgedb.jar,
jar/org.bridgedb.webservice.bridgerest.jar
jar/org.bridgedb.webservice.bridgerest.jar,
jar/org.bridgedb.rdb.jar,
jar/derby.jar
Bundle-RequiredExecutionEnvironment: J2SE-1.5
5 changes: 4 additions & 1 deletion plugins/net.bioclipse.bridgedb/build.properties
Expand Up @@ -5,4 +5,7 @@ bin.includes = plugin.xml,\
.,\
jar/org.bridgedb.bio.jar,\
jar/org.bridgedb.jar,\
jar/org.bridgedb.webservice.bridgerest.jar
jar/org.bridgedb.webservice.bridgerest.jar,\
jar/org.bridgedb.rdb.jar,\
jar/bridgeDB_license.txt,\
jar/derby.jar
Binary file added plugins/net.bioclipse.bridgedb/jar/derby.jar
Binary file not shown.
Binary file not shown.
Expand Up @@ -63,8 +63,14 @@ public Set<String> search(String restService, String query, int limit) throws Bi
throw new BioclipseException("Could not connect to the REST service at: " + restService);
}

return search(mapper, query, limit);
}

public Set<String> search(IDMapper database, String query, int limit) throws BioclipseException {
logger.debug("doing stuff...");

try {
return extractIdentifierStrings(mapper.freeSearch(query, limit));
return extractIdentifierStrings(database.freeSearch(query, limit));
} catch (IDMapperException exception) {
throw new BioclipseException("Could not search the REST service: " + exception);
}
Expand Down Expand Up @@ -136,4 +142,17 @@ private Set<String> extractIdentifierStrings(Set<Xref> dests) {
public Xref xref(String identifier, String source) throws BioclipseException {
return new Xref(identifier, getSource(source));
}

public IDMapper loadRelationalDatabase(String location) throws BioclipseException {
try {
Class.forName ("org.bridgedb.rdb.IDMapperRdb");
} catch (ClassNotFoundException exception) {
throw new BioclipseException("Could not load the IDMapperRdb driver.", exception);
}
try {
return BridgeDb.connect("idmapper-pgdb:" + location);
} catch (IDMapperException exception) {
throw new BioclipseException("Could not the database at this location: " + location, exception);
}
}
}
Expand Up @@ -19,6 +19,7 @@
import net.bioclipse.managers.business.IBioclipseManager;

import org.bridgedb.DataSource;
import org.bridgedb.IDMapper;
import org.bridgedb.Xref;

@PublishedClass(
Expand Down Expand Up @@ -50,6 +51,13 @@ public interface IBridgedbManager extends IBioclipseManager {
)
public Set<String> search(String restService, String query, int limit) throws BioclipseException;

@Recorded
@PublishedMethod(
methodSummary="Searches a local BridgeDB instance for the given query string.",
params="IDMapper database, String query, int limit"
)
public Set<String> search(IDMapper database, String query, int limit) throws BioclipseException;

@Recorded
@PublishedMethod(
methodSummary="Return a BioDataSource for the given string. It throws a BioclipseException when an" +
Expand Down Expand Up @@ -79,5 +87,11 @@ public interface IBridgedbManager extends IBioclipseManager {
params="String identifier, String source"
)
public Xref xref(String identifier, String source);


@Recorded
@PublishedMethod(
methodSummary="Loads a BridgeDB Rdb database from a file location.",
params="String location"
)
public IDMapper loadRelationalDatabase(String location) throws BioclipseException;
}

0 comments on commit 0bd8895

Please sign in to comment.