public synchronized void connect() throws WorkflowEngineException {
if (this.engineURL == null) {
if (this.client != null) {
this.client = null;
sendSafeEvent(new Event(Event.Type.GPEL_ENGINE_DISCONNECTED));
}
return;
}
logger.finest("Connecting a GPEL Engine at " + this.engineURL);
try {
Transport transport;
if (isSecure()) {
if (this.gpelUserX509Credential == null) {
logger.finest("Using ssl without any credential.");
this.gpelUserX509Credential = new GpelUserX509Credential(
null, XBayaSecurity.getTrustedCertificates());
}
transport = new Transport(this.gpelUserX509Credential);
} else {
// This one is phasing out.
GpelUserCredentials credentials = new GpelUserCredentials(
"user", "password");
transport = new Transport(credentials);
}
this.client = new GpelClient(this.engineURL, transport);
this.client.setFilter(this.linksFilter);
sendSafeEvent(new Event(Event.Type.GPEL_ENGINE_CONNECTED));
} catch (RuntimeException e) {
this.client = null;
sendSafeEvent(new Event(Event.Type.GPEL_ENGINE_DISCONNECTED));
throw new WorkflowEngineException(ErrorMessages.GPEL_CONNECTION_ERROR, e);
}
}