You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looked at the CA server support that's included in CAJ. It's very easy to create the start of a "caSnooper" that logs all searches, but didn't find an obvious way to act as a name server, see comments in example:
import java.net.InetSocketAddress;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import gov.aps.jca.CAException;
import gov.aps.jca.CAStatus;
import gov.aps.jca.CAStatusException;
import gov.aps.jca.JCALibrary;
import gov.aps.jca.cas.ProcessVariable;
import gov.aps.jca.cas.ProcessVariableAttachCallback;
import gov.aps.jca.cas.ProcessVariableEventCallback;
import gov.aps.jca.cas.ProcessVariableExistanceCallback;
import gov.aps.jca.cas.ProcessVariableExistanceCompletion;
import gov.aps.jca.cas.Server;
import gov.aps.jca.cas.ServerContext;
public class CANameServer
{
public static void main(String[] args) throws Exception
{ // Log as much as possible
Logger logger = Logger.getLogger("");
logger.setLevel(Level.ALL);
for (Handler handler : logger.getHandlers())
handler.setLevel(Level.ALL);
JCALibrary jca = JCALibrary.getInstance();
Server server = new Server()
{
@Override
public ProcessVariableExistanceCompletion processVariableExistanceTest(String name,
InetSocketAddress client,
ProcessVariableExistanceCallback callback)
throws CAException, IllegalArgumentException, IllegalStateException
{
System.out.println("Client " + client + " searches for '" + name + "'");
// Options:
// 1) Return DOES_NOT_EXIST_HERE, and that's the end
// 2) Return EXISTS_HERE, in which case the library will reply with this server's IP and port,
// and then processVariableAttach() will be called to provide the PV
//
// There is no API for returning "EXISTS, but use the following IP and port",
// as necessary for a name server.
// The SearchResponse
// https://github.com/epics-base/jca/blob/master/src/core/com/cosylab/epics/caj/cas/handlers/SearchResponse.java
// always sends a reply with IP and port info from "context.getBroadcastTransport()".
//
// Need a CAS update which changes the ProcessVariableExistanceCompletion
// to allow something like
//
// return ProcessVariableExistanceCompletion.EXISTS(other_IP, other_port);
return ProcessVariableExistanceCompletion.EXISTS_HERE;
}
@Override
public ProcessVariable processVariableAttach(String name,
ProcessVariableEventCallback event,
ProcessVariableAttachCallback attach)
throws CAStatusException, IllegalArgumentException, IllegalStateException
{
throw new CAStatusException(CAStatus.NOSUPPORT, "not supported");
}
};
ServerContext context = jca.createServerContext(JCALibrary.CHANNEL_ACCESS_SERVER_JAVA, server);
context.run(0);
}
}
The text was updated successfully, but these errors were encountered:
Checked https://gitlab.aquenos.com/oss/epics/epics-jackie/ as an alternate Java implementation of CA. It only offers a client, no server. Updating CAJ to a more flexible ProcessVariableExistanceCompletion doesn't seem too hard if we're indeed interested in a CA name server.
Notes from July 3, 2024 online meeting:
This GitHub repo can contain sources for both a PVA and CA name server, but they should be available as separate tools and run as separate processes.
So there'll be one CA name server and one PVA name server tool, and you can run one, the other, or both.
Looked at the CA server support that's included in CAJ. It's very easy to create the start of a "caSnooper" that logs all searches, but didn't find an obvious way to act as a name server, see comments in example:
The text was updated successfully, but these errors were encountered: