UIMAFramework.getLogger(this.getClass()).logrb(Level.SEVERE, this.getClass().getName(),
"initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_vns_not_provided__SEVERE",
new Object[] { Thread.currentThread().getName() });
}
throw new ServiceConnectionException(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_vinci_vns_cfg_invalid__WARNING",
new Object[] { Thread.currentThread().getName() }));
}
System.setProperty("VNS_HOST", getVNSHost());
System.setProperty("VNS_PORT", getVNSPort());
try {
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(
Level.FINEST,
this.getClass().getName(),
"initialize",
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_locating_service__FINEST",
new Object[] { Thread.currentThread().getName(), aServiceName,
System.getProperty("VNS_HOST"), System.getProperty("VNS_PORT") });
}
// Override vinci default VNS settings
VinciContext vctx = new VinciContext(InetAddress.getLocalHost().getCanonicalHostName(), 0);
vctx.setVNSHost(getVNSHost());
vctx.setVNSPort(Integer.parseInt(getVNSPort()));
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).log(
Level.FINEST,
Thread.currentThread().getName() + " Connecting to::" + aServiceName
+ " VinciContext.getVNSHost():" + vctx.getVNSHost()
+ " VinciContext.getVNSPort():" + vctx.getVNSPort()); // getVNSHost());
}
// establish connection to service
conn = new VinciClient(aServiceName, vctx);
conn.setSocketTimeout(timeout);
conn.setRetry(false);
if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
UIMAFramework.getLogger(this.getClass()).logrb(
Level.FINEST,
this.getClass().getName(),
"initialize",
CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_set_service_timeout__FINEST",
new Object[] { Thread.currentThread().getName(),
aServiceName + ":" + String.valueOf(timeout) });
}
serviceHost = conn.getHost();
servicePort = String.valueOf(conn.getPort());
serviceName = aServiceName;
// Sucessfull connection. Return
return;
} catch (Exception e) {
if (UIMAFramework.getLogger().isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(this.getClass()).logrb(Level.WARNING, this.getClass().getName(),
"initialize", CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
"UIMA_CPM_connection_failed__WARNING",
new Object[] { Thread.currentThread().getName(), aServiceName, "" });
UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
Thread.currentThread().getName(), e);
}
}
// If we are here there was a problem connecting to Vinci service
throw new ServiceConnectionException(CpmLocalizedMessage.getLocalizedMessage(
CPMUtils.CPM_LOG_RESOURCE_BUNDLE, "UIMA_CPM_EXP_unable_to_connect_toservice__WARNING",
new Object[] { Thread.currentThread().getName(), aServiceName }));
}