org.csstudio.utility.pv
Class PVFactory
java.lang.Object
org.csstudio.utility.pv.PVFactory
public class PVFactory
- extends java.lang.Object
PV Factory
Locates implementations of the IPVFactory
via an extension to the pvfactory extension point
and creates the PV through it, using the PV name prefix
to select an implementation.
// Create PV
final PV pv = PVFactory.createPV(pv_name);
// Register listener for updates
pv.addListener(new PVListener()
{
public void pvDisconnected(PV pv)
{
System.out.println(pv.getName() + " is disconnected");
}
public void pvValueUpdate(PV pv)
{
IValue value = pv.getValue();
System.out.println(pv.getName() + " = " + value);
if (value instanceof IDoubleValue)
{
IDoubleValue dbl = (IDoubleValue) value;
System.out.println(dbl.getValue());
}
// ... or use ValueUtil
}
});
// Start the PV
pv.start();
...
pv.stop();
- Author:
- Kay Kasemir
Field Summary |
static java.lang.String |
SEPARATOR
Separator between PV type indicator and rest of PV name. |
Method Summary |
static PV |
createPV(java.lang.String name)
Create a PV for the given channel name, using the PV factory
selected via the prefix of the channel name, or the default
PV factory if no prefix is included in the channel name. |
static java.lang.String[] |
getSupportedPrefixes()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SEPARATOR
public static final java.lang.String SEPARATOR
- Separator between PV type indicator and rest of PV name.
This one is URL-ish, and works OK with EPICS PVs because
those are unlikely to contain "://" themself, while
just ":" for example is likely to be inside the PV name
- See Also:
- Constant Field Values
PVFactory
public PVFactory()
getSupportedPrefixes
public static final java.lang.String[] getSupportedPrefixes()
throws java.lang.Exception
- Returns:
- Supported PV type prefixes
- Throws:
java.lang.Exception
createPV
public static final PV createPV(java.lang.String name)
throws java.lang.Exception
- Create a PV for the given channel name, using the PV factory
selected via the prefix of the channel name, or the default
PV factory if no prefix is included in the channel name.
- Parameters:
name
- Channel name, format "prefix://name" or just "name"
- Returns:
- PV
- Throws:
java.lang.Exception
- on error