org.bdware.doip.cluster.entity.BDOEntity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of doip-audit-tool Show documentation
Show all versions of doip-audit-tool Show documentation
doip audit tool developed by bdware
The newest version!
package org.bdware.doip.cluster.entity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bdware.doip.audit.EndpointConfig;
import org.bdware.doip.cluster.callback.BDODelegateDoipMessageCallback;
import org.bdware.doip.cluster.client.DoaClusterClient;
import org.bdware.doip.cluster.util.DoipClientCacheUtil;
import org.bdware.doip.codec.doipMessage.DoipMessage;
import org.bdware.doip.endpoint.client.DoipMessageCallback;
public class BDOEntity implements DOEntity {
static Logger LOGGER = LogManager.getLogger(BDOEntity.class);
private final String address;
private final String version;
private final DoipClientCacheUtil connectionCache;
public BDOEntity(String address, String version, DoipClientCacheUtil connectionCache) {
this.address = address;
this.version = version;
this.connectionCache = connectionCache;
}
public String getAddress() {
return address;
}
public String getVersion() {
return version;
}
@Override
public BDWType getType() {
return BDWType.BDO;
}
@Override
public void sendMessage(DoaClusterClient client, DoipMessage doipMessage, DoipMessageCallback doipMessageCallback ) {
connectionCache.getClientByUrl(this, client.getAuditConfig(), doipClient -> {
client.signMessage(doipMessage);
BDODelegateDoipMessageCallback BDODelegateDoipMessageCallback = new BDODelegateDoipMessageCallback(doipClient, connectionCache,
doipMessageCallback, doipMessage);
doipClient.sendMessage(doipMessage, BDODelegateDoipMessageCallback);
});
}
}