Merge branch 'master' of github.com:jamesagnew/hapi-fhir

This commit is contained in:
jamesagnew 2016-01-27 08:36:10 -05:00
commit 00f0ea4a0b
8 changed files with 163 additions and 257 deletions

View File

@ -47,6 +47,16 @@ public interface IRestfulClientFactory {
*/
public static final int DEFAULT_SOCKET_TIMEOUT = 10000;
/**
* Default value for {@link #getPoolMaxTotal() ()}
*/
public static final int DEFAULT_POOL_MAX = 20;
/**
* Default value for {@link #getPoolMaxPerRoute() }
*/
public static final int DEFAULT_POOL_MAX_PER_ROUTE = DEFAULT_POOL_MAX;
/**
* Gets the connection request timeout, in milliseconds. This is the amount of time that the HTTPClient connection
* pool may wait for an available connection before failing. This setting typically does not need to be adjusted.
@ -99,6 +109,22 @@ public interface IRestfulClientFactory {
*/
int getSocketTimeout();
/**
* Gets the maximum number of connections allowed in the pool.
* <p>
* The default value for this setting is defined by {@link #DEFAULT_POOL_MAX}
* </p>
*/
int getPoolMaxTotal();
/**
* Gets the maximum number of connections per route allowed in the pool.
* <p>
* The default value for this setting is defined by {@link #DEFAULT_POOL_MAX_PER_ROUTE}
* </p>
*/
int getPoolMaxPerRoute();
/**
* Instantiates a new client instance
*
@ -193,4 +219,19 @@ public interface IRestfulClientFactory {
*/
void setSocketTimeout(int theSocketTimeout);
/**
* Sets the maximum number of connections allowed in the pool.
* <p>
* The default value for this setting is defined by {@link #DEFAULT_POOL_MAX}
* </p>
*/
void setPoolMaxTotal(int thePoolMaxTotal);
/**
* Sets the maximum number of connections per route allowed in the pool.
* <p>
* The default value for this setting is defined by {@link #DEFAULT_POOL_MAX_PER_ROUTE}
* </p>
*/
void setPoolMaxPerRoute(int thePoolMaxPerRoute);
}

View File

@ -68,6 +68,8 @@ public class RestfulClientFactory implements IRestfulClientFactory {
private ServerValidationModeEnum myServerValidationMode = DEFAULT_SERVER_VALIDATION_MODE;
private int mySocketTimeout = DEFAULT_SOCKET_TIMEOUT;
private Set<String> myValidatedServerBaseUrls = Collections.synchronizedSet(new HashSet<String>());
private int myPoolMaxTotal = DEFAULT_POOL_MAX;
private int myPoolMaxPerRoute = DEFAULT_POOL_MAX_PER_ROUTE;
/**
* Constructor
@ -100,6 +102,8 @@ public class RestfulClientFactory implements IRestfulClientFactory {
if (myHttpClient == null) {
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
connectionManager.setMaxTotal(myPoolMaxTotal);
connectionManager.setDefaultMaxPerRoute(myPoolMaxPerRoute);
//@formatter:off
RequestConfig defaultRequestConfig = RequestConfig.custom()
@ -149,6 +153,16 @@ public class RestfulClientFactory implements IRestfulClientFactory {
return mySocketTimeout;
}
@Override
public int getPoolMaxTotal() {
return myPoolMaxTotal;
}
@Override
public int getPoolMaxPerRoute() {
return myPoolMaxPerRoute;
}
@SuppressWarnings("unchecked")
private <T extends IRestfulClient> T instantiateProxy(Class<T> theClientType, InvocationHandler theInvocationHandler) {
T proxy = (T) Proxy.newProxyInstance(theClientType.getClassLoader(), new Class[] { theClientType }, theInvocationHandler);
@ -276,6 +290,18 @@ public class RestfulClientFactory implements IRestfulClientFactory {
myHttpClient = null;
}
@Override
public synchronized void setPoolMaxTotal(int thePoolMaxTotal) {
myPoolMaxTotal = thePoolMaxTotal;
myHttpClient = null;
}
@Override
public synchronized void setPoolMaxPerRoute(int thePoolMaxPerRoute) {
myPoolMaxPerRoute = thePoolMaxPerRoute;
myHttpClient = null;
}
@SuppressWarnings("unchecked")
void validateServerBase(String theServerBase, HttpClient theHttpClient, BaseClient theClient) {

View File

@ -1,52 +0,0 @@
<project name="HAPI FHIR Core OSGi Bundle" default="all">
<property file="project.properties"/>
<property name="spring.dir" value="${resources.dir}/META-INF/spring" />
<property name="bundle.jar" value="${bundle.file.name}_${major.version}.${minor.version}.${micro.version}.jar" />
<property name="bundle.file" value="${target.dir}/${bundle.jar}" />
<property name="hapi.fhir.base.jar" value="${hapi.fhir.base.name}-${hapi.fhir.version}.jar" />
<property name="hapi.fhir.base.file" value="../${hapi.fhir.base.name}/target/${hapi.fhir.base.jar}" />
<property name="hapi.fhir.dstu.jar" value="${hapi.fhir.dstu.name}-${hapi.fhir.version}.jar" />
<property name="hapi.fhir.dstu.file" value="../${hapi.fhir.dstu.name}/target/${hapi.fhir.dstu.jar}" />
<property name="hapi.fhir.dstu2.jar" value="${hapi.fhir.dstu2.name}-${hapi.fhir.version}.jar" />
<property name="hapi.fhir.dstu2.file" value="../${hapi.fhir.dstu2.name}/target/${hapi.fhir.dstu2.jar}" />
<property name="hapi.fhir.hl7dstu2.jar" value="${hapi.fhir.hl7dstu2.name}-${hapi.fhir.version}.jar" />
<property name="hapi.fhir.hl7dstu2.file" value="../${hapi.fhir.hl7dstu2.name}/target/${hapi.fhir.hl7dstu2.jar}" />
<target name="all" depends="bundle" />
<target name="init">
<delete dir="${obr.target.dir}" failonerror="false"/>
<mkdir dir="${obr.target.dir}" />
</target>
<target name="collect.jars" depends="init">
<delete dir="${temp.target.dir}" failonerror="false"/>
<mkdir dir="${temp.target.dir}" />
<copy todir="${temp.target.dir}">
<fileset file="${hapi.fhir.base.file}"/>
<fileset file="${hapi.fhir.dstu.file}"/>
<fileset file="${hapi.fhir.dstu2.file}"/>
<fileset file="${hapi.fhir.hl7dstu2.file}"/>
</copy>
</target>
<target name="bundle" depends="collect.jars">
<echo>creating HAPI FHIR Core OSGi Bundle</echo>
<concat destfile="${temp.target.dir}/MANIFEST.MF">
<fileset dir="${resources.dir}/META-INF" includes="MANIFEST.MF" />
<footer>
Bundle-Classpath: .,
lib/${hapi.fhir.base.jar},
lib/${hapi.fhir.dstu.jar},
lib/${hapi.fhir.dstu2.jar},
lib/${hapi.fhir.hl7dstu2.jar}
</footer>
</concat>
<jar destfile="${bundle.file}" manifest="${temp.target.dir}/MANIFEST.MF">
<fileset dir="${classes.dir}" includes="**/*" />
<zipfileset dir="${temp.target.dir}" includes="*.jar" prefix="lib"/>
<zipfileset dir="${spring.dir}" prefix="META-INF/spring"/>
</jar>
</target>
</project>

View File

@ -36,11 +36,21 @@
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2.1</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2.1</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
@ -87,10 +97,11 @@
<fileset dir="../hapi-fhir-base/src/main/java" />
<fileset dir="../hapi-fhir-structures-dstu/src/main/java" />
<fileset dir="../hapi-fhir-structures-dstu/target/generated-sources/tinder" />
<fileset dir="../hapi-fhir-structures-dstu/src/main/java" />
<fileset dir="../hapi-fhir-structures-dstu2/src/main/java" />
<fileset dir="../hapi-fhir-structures-dstu2/target/generated-sources/tinder" />
<fileset dir="../hapi-fhir-structures-hl7org-dstu2/src/main/java" />
<fileset dir="../hapi-fhir-structures-dstu2.1/src/main/java" />
<!--<fileset dir="../hapi-fhir-structures-dstu2.1/target/generated-sources/tinder" /> -->
</copy>
</target>
</configuration>
@ -124,12 +135,28 @@
<!--<Export-Package>ca.uhn.fhir</Export-Package> <Export-Package>org.hl7.fhir</Export-Package> -->
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<!--<Embed-Dependency>*;scope=!provided|test</Embed-Dependency> <Embed-Directory>lib</Embed-Directory> <Embed-Transitive>true</Embed-Transitive> -->
<_nouses>true</_nouses>
<_removeheaders>Built-By, Include-Resource, Private-Package</_removeheaders>
<!-- <Private-Package>org.foo.myproject.*</Private-Package> <Bundle-Activator>org.foo.myproject.impl1.Activator</Bundle-Activator> -->
<!-- <Embed-Dependency>*;scope=compile|runtime;inline=false;artifactId=hapi-fhir-*</Embed-Dependency> -->
<Import-Package>
!ca.uhn.*,
!org.hl7.*,
com.ctc.wstx.api;version="4.4";resolution:=optional,
com.ctc.wstx.*;version="4.4";resolution:=optional,
com.google.*;resolution:=optional;-remove-attribute:=version,
com.phloc.commons;resolution:=optional;-remove-attribute:=version,
com.phloc.*;resolution:=optional;-remove-attribute:=version,
javax.*;-remove-attribute:=version,
net.sf.saxon;resolution:=optional,
org.apache.commons.*;-remove-attribute:=version,
org.apache.http.client.protocol;version="4.0",
org.apache.http.*;version="4.0",
org.codehaus.stax2;resolution:=optional;-remove-attribute:=version,
org.codehaus.stax2.*;resolution:=optional;-remove-attribute:=version,
org.oclc.purl.*;-remove-attribute:=version,
org.slf4j.*;-remove-attribute:=version,
org.xmlpull.v1;resolution:=optional,
*
</Import-Package>
</instructions>
@ -188,7 +215,25 @@
<filtering>false</filtering>
</resource>
<resource>
<directory>../hapi-fhir-structures-hl7org-dstu2/src/resources/java</directory>
<directory>../hapi-fhir-structures-hl7org-dstu2/src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>../hapi-fhir-structures-dstu2.1/src/main/resources</directory>
<filtering>false</filtering>
</resource>
<!--
<resource>
<directory>../hapi-fhir-structures-dstu2.1/target/generated-resources/tinder</directory>
<filtering>false</filtering>
</resource>
-->
<resource>
<directory>../hapi-fhir-validation-resources-dstu2/src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>../hapi-fhir-validation-resources-dstu2.1/src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>

View File

@ -1,18 +0,0 @@
#Fri, 31 Jul 2015 17:06:47 -0700
bundle.file.name=hapi-fhir-osgi-core
major.version=1
minor.version=2
micro.version=0.SNAPSHOT
src.dir=./src/main/java
resources.dir=./src/main/resources
classes.dir=./target/classes
target.dir=./target
obr.target.dir=./target/build-obr
temp.target.dir=./target/build-temp
hapi.fhir.version=1.2-SNAPSHOT
hapi.fhir.base.name=hapi-fhir-base
hapi.fhir.dstu.name=hapi-fhir-structures-dstu
hapi.fhir.dstu2.name=hapi-fhir-structures-dstu2
hapi.fhir.hl7dstu2.name=hapi-fhir-structures-hl7org-dstu2

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.osgi.impl;
package ca.uhn.fhir.osgi;
/*
* #%L
@ -23,8 +23,6 @@ package ca.uhn.fhir.osgi.impl;
import java.util.Collection;
import ca.uhn.fhir.osgi.FhirProviderBundle;
/**
*
* @author Akana, Inc. Professional Services

View File

@ -1,134 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: HAPI FHIR - Core Library and DSTU/DSTU2 Structures
Bundle-SymbolicName: hapi-fhir-osgi-core
Bundle-Version: 1.2.0.SNAPSHOT
Spring-Context: *;publish-context:=false
Export-Package: ca.uhn.fhir;version="1.2.0",
ca.uhn.fhir.context;version="1.2.0",
ca.uhn.fhir.i18n;version="1.2.0",
ca.uhn.fhir.model.api;version="1.2.0",
ca.uhn.fhir.model.api.annotation;version="1.2.0",
ca.uhn.fhir.model.base.composite;version="1.2.0",
ca.uhn.fhir.model.base.resource;version="1.2.0",
ca.uhn.fhir.model.dstu;version="1.2.0",
ca.uhn.fhir.model.dstu.api;version="1.2.0",
ca.uhn.fhir.model.dstu.composite;version="1.2.0",
ca.uhn.fhir.model.dstu.resource;version="1.2.0",
ca.uhn.fhir.model.dstu.valueset;version="1.2.0",
ca.uhn.fhir.model.dstu2;version="1.2.0",
ca.uhn.fhir.model.dstu2.composite;version="1.2.0",
ca.uhn.fhir.model.dstu2.resource;version="1.2.0",
ca.uhn.fhir.model.dstu2.valueset;version="1.2.0",
ca.uhn.fhir.model.primitive;version="1.2.0",
ca.uhn.fhir.model.valueset;version="1.2.0",
ca.uhn.fhir.model.view;version="1.2.0",
ca.uhn.fhir.narrative;version="1.2.0",
ca.uhn.fhir.narrative.datatype;version="1.2.0",
ca.uhn.fhir.narrative.title;version="1.2.0",
ca.uhn.fhir.osgi;version="1.2.0",
ca.uhn.fhir.osgi.impl;version="1.2.0",
ca.uhn.fhir.parser;version="1.2.0",
ca.uhn.fhir.rest.annotation;version="1.2.0",
ca.uhn.fhir.rest.api;version="1.2.0",
ca.uhn.fhir.rest.client;version="1.2.0",
ca.uhn.fhir.rest.client.api;version="1.2.0",
ca.uhn.fhir.rest.client.exceptions;version="1.2.0",
ca.uhn.fhir.rest.client.interceptor;version="1.2.0",
ca.uhn.fhir.rest.gclient;version="1.2.0",
ca.uhn.fhir.rest.method;version="1.2.0",
ca.uhn.fhir.rest.param;version="1.2.0",
ca.uhn.fhir.rest.server;version="1.2.0",
ca.uhn.fhir.rest.server.audit;version="1.2.0",
ca.uhn.fhir.rest.server.exceptions;version="1.2.0",
ca.uhn.fhir.rest.server.interceptor;version="1.2.0",
ca.uhn.fhir.rest.server.provider;version="1.2.0",
ca.uhn.fhir.rest.server.provider.dstu2;version="1.2.0",
ca.uhn.fhir.rest.server.provider.dstu2hl7org,
ca.uhn.fhir.store;version="1.2.0",
ca.uhn.fhir.util;version="1.2.0",
ca.uhn.fhir.validation;version="1.2.0",
org.hl7.fhir.instance;version="1.2.0",
org.hl7.fhir.instance.client;version="1.2.0",
org.hl7.fhir.instance.conf;version="1.2.0",
org.hl7.fhir.instance.formats;version="1.2.0",
org.hl7.fhir.instance.model;version="1.2.0",
org.hl7.fhir.instance.model.annotations;version="1.2.0",
org.hl7.fhir.instance.model.api;version="1.2.0",
org.hl7.fhir.instance.model.valuesets;version="1.2.0",
org.hl7.fhir.instance.terminologies;version="1.2.0",
org.hl7.fhir.instance.utils;version="1.2.0",
org.hl7.fhir.instance.validation;version="1.2.0",
org.hl7.fhir.utilities;version="1.2.0",
org.hl7.fhir.utilities.xhtml;version="1.2.0",
org.hl7.fhir.utilities.xml;version="1.2.0"
Import-Package: com.ctc.wstx.api;version="4.4.0",
com.ctc.wstx.stax;version="4.4.0",
com.google.gson;resolution:=optional,
com.phloc.commons;resolution:=optional,
com.phloc.commons.error;resolution:=optional,
com.phloc.schematron;resolution:=optional,
com.phloc.schematron.xslt;resolution:=optional,
javax.json,
javax.json.stream,
javax.servlet,
javax.servlet.http,
javax.xml.parsers,
javax.xml.stream,
javax.xml.stream,events,
net.sf.saxon;resolution:=optional,
net.sourceforge.cobertura;resolution:=optional,
org.apache.commons.codec.binary,
org.apache.commons.io,
org.apache.commons.io.input,
org.apache.commons.lang3,
org.apache.commons.lang3.builder,
org.apache.commons.lang3.exception,
org.apache.commons.lang3.text,
org.apache.commons.lang3.time,
org.apache.http;version="4.4.0",
org.apache.http.auth;version="4.4.0",
org.apache.http.client;version="4.4.0",
org.apache.http.client.config;version="4.4.0",
org.apache.http.client.entity;version="4.4.0",
org.apache.http.client.methods;version="4.4.0",
org.apache.http.client.protocol;version="4.4.0",
org.apache.http.client.utils;version="4.4.0",
org.apache.http.entity;version="4.4.0",
org.apache.http.impl.auth;version="4.4.0",
org.apache.http.impl.client;version="4.4.0",
org.apache.http.impl.conn;version="4.4.0",
org.apache.http.message;version="4.4.0",
org.apache.http.protocol;version="4.4.0",
org.apache.xerces.parsers,
org.apache.xerces.xni.parser,
org.codehaus.stax2,
org.codehaus.stax2.io,
org.oclc.purl.dsdl.svrl,
org.slf4j,
org.thymeleaf,
org.thymeleaf.context,
org.thymeleaf.dialect,
org.thymeleaf.dom,
org.thymeleaf.exceptions,
org.thymeleaf.messageresolver,
org.thymeleaf.processor,
org.thymeleaf.processor.attr,
org.thymeleaf.resourceresolver,
org.thymeleaf.standard,
org.thymeleaf.standard.expression,
org.thymeleaf.templatemode,
org.thymeleaf.templateparser.xmlsax,
org.thymeleaf.templateresolver,
org.thymeleaf.util,
org.unbescape.html,
org.unbescape.java,
org.unbescape.javascript,
org.unbescape.uri,
org.w3c.dom,
org.w3c.dom.ls,
org.xmlpull.v1;resolution:=optional,
org.xml.sax,
org.xml.sax.ext,
org.xml.sax.helpers
Bundle-Vendor: University Health Network