public class Li2b2Client extends Object
setProxy(URL),
setPM(URL), setAuthorisation(String, String, String, boolean) and
PM().requestUserConfiguration(). The returned UserConfiguration
must then be used for further configuration e.g. set the project via setProjectId(String)
and setServices(Cell[]) (with UserConfiguration.getCells()).
To find the values needed for the initial configuration, you can look at the contents
of /webclient/i2b2_config_data.js of your target i2b2 server.
For a code example, see src/test/java/de/sekmi/li2b2/client/TestClient.java. See also
the file README.md.
| Constructor and Description |
|---|
Li2b2Client()
Construct a new client instance.
|
| Modifier and Type | Method and Description |
|---|---|
QueryClient |
CRC() |
protected HiveRequest |
createRequest(DocumentBuilder builder) |
MessageLogger |
getMessageLog()
Get the message logger.
|
String |
getOutputEncoding() |
String |
getProjectId()
Get the project ID
|
URL |
getProxy() |
String |
getUserDomain() |
String |
getUserLogin() |
OntologyClient |
ONT() |
Document |
parseXML(InputStream in) |
PMClient |
PM()
Get the PM cell client services.
|
void |
setAuthorisation(Credentials credentials) |
void |
setAuthorisation(String user,
String password,
String domain)
Set login credentials for password based authentication.
|
void |
setAuthorisation(String user,
String password,
String domain,
boolean isToken)
Set login credentials for password based authentication.
|
void |
setCRC(String uri) |
void |
setMessageLog(MessageLogger log)
Set a message logger which will receive all sent and received messages.
|
void |
setONT(String uri)
Set the Ontology Service URI.
|
void |
setPM(URL pmService)
Set the PM service URL.
|
void |
setProjectId(String projectId)
Set the project id which will be used during hive communcations.
|
void |
setProxy(URL proxy)
Use a reverse proxy configuration (proprietary protocol by i2b2) if
the i2b2 webservices are not directly available via network.
|
void |
setServices(Cell[] cells)
Initialize services using URIs from the provided Cell[] structure.
|
public void setProjectId(String projectId)
projectId - project IDpublic String getProjectId()
public void setProxy(URL proxy)
If the webservices (e.g. /i2b2/services/PMService) are directly available,
you don't need to use this method or can set the argument to null.
If the application server (e.g. Wildfly) is listening only to localhost,
then you need to specify the reverse proxy script location. In i2b2 installations,
this is commonly the PHP script at /webclient/index.php.
If this method is used, you can then specify the local webservice address
via setPM(URL) (e.g. http://localhost:8080/i2b2/services/PMService/).
proxy - URL to the i2b2 reverse proxy php scriptpublic URL getProxy()
public String getOutputEncoding()
public String getUserLogin()
public String getUserDomain()
public MessageLogger getMessageLog()
null is returned.null if undefined.public void setMessageLog(MessageLogger log)
FormattedMessageLogger.consoleLogger().log - message loggerpublic void setAuthorisation(String user, String password, String domain, boolean isToken)
user - user namepassword - passworddomain - server domain name. The official i2b2 server exects this parameter to
match the domain name specified at the server.isToken - whether specified password argument is a server session token or a password.
Set this to false if you are using a real password.public void setAuthorisation(String user, String password, String domain)
setAuthorisation(String, String, String, boolean) with
the last argument set to false.user - user namepassword - passworddomain - server domain namepublic void setAuthorisation(Credentials credentials)
public void setPM(URL pmService)
This url can be behind the reverse proxy if, if the reverse proxy was specified
via setProxy(URL). E.g. http://localhost:9090/i2b2/services/PMService/
for some i2b2 demo VMs.
pmService - PM service URLpublic void setONT(String uri) throws MalformedURLException
/i2b2/services/QueryToolService).uri - URI to ontology service.MalformedURLException - for invalid URL stringspublic void setCRC(String uri) throws MalformedURLException
MalformedURLExceptionpublic PMClient PM()
public OntologyClient ONT()
public QueryClient CRC()
protected HiveRequest createRequest(DocumentBuilder builder)
public void setServices(Cell[] cells) throws MalformedURLException
cells - information about available cellsMalformedURLException - for invalid cell URL stringspublic Document parseXML(InputStream in) throws IOException
IOExceptionCopyright © 2013–2019 R.W.Majeed. All rights reserved.