
com.openfin.desktop.channel.AbstractServiceClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openfin-desktop-java-adapter Show documentation
Show all versions of openfin-desktop-java-adapter Show documentation
The Java API for OpenFin Runtime
package com.openfin.desktop.channel;
import com.openfin.desktop.Ack;
import com.openfin.desktop.AckListener;
import com.openfin.desktop.AsyncCallback;
import com.openfin.desktop.DesktopConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AbstractServiceClient {
protected Logger logger = LoggerFactory.getLogger(this.getClass().getName());
protected String channelName; // default channel name
protected ChannelClient channelClient;
protected DesktopConnection desktopConnection;
protected AbstractServiceClient(String channelName, DesktopConnection desktopConnection) {
this.channelName = channelName;
this.desktopConnection = desktopConnection;
}
protected void setChannelName(String name) {
this.channelName = name;
logger.debug(String.format("Setting FDC3 provider channel name %s", name));
}
public void connect(AckListener ackListener) {
desktopConnection.getChannel(this.channelName).connect(
new AsyncCallback() {
@Override
public void onSuccess(ChannelClient client) {
AbstractServiceClient.this.channelClient = client;
AbstractServiceClient.this.onChannelConnected();
Ack ack = new Ack(null, AbstractServiceClient.this);
logger.debug(String.format("Connected to service %s", AbstractServiceClient.this.channelName));
ackListener.onSuccess(ack);
}
});
}
protected void onChannelConnected() {
logger.debug(String.format("Connected to channel %s", this.channelName));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy