Skip to content

Commit

Permalink
Merge pull request #234 from geneontology/api_hack_1
Browse files Browse the repository at this point in the history
Adding search API at /search to minerva
  • Loading branch information
kltm committed Jul 11, 2019
2 parents 781ef94 + 737cb86 commit 41879e6
Show file tree
Hide file tree
Showing 8 changed files with 497 additions and 18 deletions.
Binary file added minerva-cli/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ private BigdataSailRepository initializeRepository(String pathToJournal) {
properties.setProperty(Options.FILE, pathToJournal);
BigdataSail sail = new BigdataSail(properties);
BigdataSailRepository repository = new BigdataSailRepository(sail);

repository.initialize();
return repository;
} catch (RepositoryException e) {
Expand Down
5 changes: 5 additions & 0 deletions minerva-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,10 @@
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-processing</artifactId>
<version>2.28</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package org.geneontology.minerva.server;

import org.apache.log4j.Logger;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.server.ServerConnector;
//import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.geneontology.minerva.ModelReaderHelper;
Expand Down Expand Up @@ -83,7 +86,7 @@ public static class MinervaStartUpConfig {

public String prefixesFile = null;

public int sparqlEndpointTimeout = 10;
public int sparqlEndpointTimeout = 100;
}

public static void main(String[] args) throws Exception {
Expand Down Expand Up @@ -379,15 +382,25 @@ public static Server startUp(UndoAwareMolecularModelManager models, MinervaStart
SimpleEcoMapper ecoMapper = EcoMapperFactory.createSimple();
JsonOrJsonpSeedHandler seedHandler = new JsonOrJsonpSeedHandler(models, conf.defaultModelState, conf.golrSeedUrl, ecoMapper );
SPARQLHandler sparqlHandler = new SPARQLHandler(models, conf.sparqlEndpointTimeout);
resourceConfig = resourceConfig.registerInstances(batchHandler, seedHandler, sparqlHandler);
ModelSearchHandler searchHandler = new ModelSearchHandler(models, conf.sparqlEndpointTimeout);
resourceConfig = resourceConfig.registerInstances(batchHandler, seedHandler, sparqlHandler, searchHandler);

// setup jetty server port, buffers and context path
Server server = new Server();
// create connector with port and custom buffer sizes
SelectChannelConnector connector = new SelectChannelConnector();
//old jetty
//SelectChannelConnector connector = new SelectChannelConnector();
//old jetty - they must be configured somewhere else in new jetty
//connector.setRequestHeaderSize(conf.requestHeaderSize);
//connector.setRequestBufferSize(conf.requestBufferSize);
//new jetty - does not have setRequestBufferSize at all
//seems to push defaults harder here.
//to change request header size need to create a new connector and manipulate httpconfiguration
HttpConfiguration http_config = new HttpConfiguration();
http_config.setRequestHeaderSize(conf.requestHeaderSize);
ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(http_config));
connector.setPort(conf.port);
connector.setRequestHeaderSize(conf.requestHeaderSize);
connector.setRequestBufferSize(conf.requestBufferSize);

server.addConnector(connector);

ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
Expand Down
Loading

0 comments on commit 41879e6

Please sign in to comment.