Class PVNames
- java.lang.Object
-
- org.epics.archiverappliance.config.PVNames
-
public class PVNames extends Object
Utility class for dealing with various aspects of EPICS PV names- Author:
- mshankar
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PVNames.EPICSVersion
-
Field Summary
Fields Modifier and Type Field Description static String
V3_PREFIX
When you intend to connect to the PV's using Channel Access, use this string as a prefix in the UI/archivePV BPL.static String
V4_PREFIX
When you intend to connect to the PV's using PVAccess, use this string as a prefix in the UI/archivePV BPL.
-
Constructor Summary
Constructors Constructor Description PVNames()
-
Method Summary
Modifier and Type Method Description static PVTypeInfo
determineAppropriatePVTypeInfo(String pvName, ConfigService configService)
A standard process for dealing with aliases, standard fields and the like and getting to the PVTypeInfo.static boolean
determineIfPVInWorkflow(String pvName, ConfigService configService)
A standard process for dealing with aliases, standard fields and the like and checking to see if the PV is in the archive workflow.static String
getFieldName(String pvName)
static boolean
isField(String pvName)
Is this a field?static boolean
isValidPVName(String pvName)
Check to see if the pvName has valid characters.static String
normalizePVName(String pvName)
Remove .VAL from pv names if present.static String
normalizePVNameWithField(String pvName, String fieldName)
Gives you something you can use with caget to get the field associated with a PV even if you have a field already.static PVNames.EPICSVersion
pvNameVersion(String pvName)
What type of name is the pv.static String
stripFieldNameFromPVName(String pvName)
Remove the .VAL, .HIHI etc portion of a pvName and return the plain pvNamestatic String[]
stripFieldNameFromPVNames(String[] pvNames)
Remove the .VAL, .HIHI etc portion of an array of pvNames and return an array of plain pvNamesstatic String
stripPrefixFromName(String pvName)
Remove the pva:// or ca:// prefix from the PV name if present.static String
transferField(String srcName, String destName)
Transfer any fields from the source name to the dest name Transferring ABC:123 onto DEF:456 should give DEF:456 Transferring ABC:123.DESC onto DEF:456 should give DEF:456.DESC
-
-
-
Field Detail
-
V4_PREFIX
public static final String V4_PREFIX
When you intend to connect to the PV's using PVAccess, use this string as a prefix in the UI/archivePV BPL. For example, pva://double01 This syntax should be consistent with CSS.- See Also:
- Constant Field Values
-
V3_PREFIX
public static final String V3_PREFIX
When you intend to connect to the PV's using Channel Access, use this string as a prefix in the UI/archivePV BPL. For example, ca://double01 This syntax should be consistent with CSS.- See Also:
- Constant Field Values
-
-
Method Detail
-
stripFieldNameFromPVName
public static String stripFieldNameFromPVName(String pvName)
Remove the .VAL, .HIHI etc portion of a pvName and return the plain pvName- Parameters:
pvName
- The name of PV.- Returns:
- String The plain pvName
-
stripFieldNameFromPVNames
public static String[] stripFieldNameFromPVNames(String[] pvNames)
Remove the .VAL, .HIHI etc portion of an array of pvNames and return an array of plain pvNames- Parameters:
pvNames
- The name of PVs.- Returns:
- String An array of plain pvNames
-
normalizePVName
public static String normalizePVName(String pvName)
Remove .VAL from pv names if present. Returned value is something that can be used to lookup for PVTypeInfo- Parameters:
pvName
- The name of PVs.- Returns:
- String normalizePVName
-
normalizePVNameWithField
public static String normalizePVNameWithField(String pvName, String fieldName)
Gives you something you can use with caget to get the field associated with a PV even if you have a field already. normalizePVNameWithField("ABC", "NAME") gives "ABC.NAME" normalizePVNameWithField("ABC.HIHI", "NAME") gives "ABC.NAME"- Parameters:
pvName
- The name of PV.fieldName
-- Returns:
- String normalizePVNameWithField
-
isField
public static boolean isField(String pvName)
Is this a field?- Parameters:
pvName
- The name of PV.- Returns:
- boolean True or False
-
transferField
public static String transferField(String srcName, String destName)
Transfer any fields from the source name to the dest name Transferring ABC:123 onto DEF:456 should give DEF:456 Transferring ABC:123.DESC onto DEF:456 should give DEF:456.DESC- Parameters:
srcName
- The source namedestName
- The destination name- Returns:
- String transferField
-
determineAppropriatePVTypeInfo
public static PVTypeInfo determineAppropriatePVTypeInfo(String pvName, ConfigService configService)
A standard process for dealing with aliases, standard fields and the like and getting to the PVTypeInfo.- Parameters:
pvName
- The name of PV.configService
- ConfigService- Returns:
- PVTypeInfo
Places where we look for the typeinfo.
- If the PV is not a field PV
- Typeinfo for full PV name
- Alias for full PV name + Typeinfo for full PV name
- If the PV is a field PV
- Typeinfo for fieldless PVName + archiveFields
- Typeinfo for full PV name
- Alias for fieldless PVName + Typeinfo for fieldless PVName + archiveFields
- Alias for full PV name + Typeinfo for full PV name
- If the PV is not a field PV
-
determineIfPVInWorkflow
public static boolean determineIfPVInWorkflow(String pvName, ConfigService configService)
A standard process for dealing with aliases, standard fields and the like and checking to see if the PV is in the archive workflow.- Parameters:
pvName
-configService
-- Returns:
- True if the PV or its avatars are in the archive workflow.
It is not possible to state this accurately for all fields.
For example, for fields that are archived as part of the stream, if the main PV is in the archive workflow, then the field is as well.
But it is impossible to state this before the PVTypeInfo has been computed.
So we resort to being pessimistic.
Places where we look for the typeinfo.
- If the PV is not a field PV
- ArchivePVRequests for full PV name
- Alias for full PV name + ArchivePVRequests for full PV name
- If the PV is a field PV
- ArchivePVRequests for full PVName
- Alias for full PV name + ArchivePVRequests for full PVName
- If the PV is not a field PV
-
isValidPVName
public static boolean isValidPVName(String pvName)
Check to see if the pvName has valid characters. For certain characters, EPICS will not throw exceptions but generate spurious traffic which is hard to detect. From the App dev Guide at http://www.aps.anl.gov/epics/base/R3-14/12-docs/AppDevGuide/node7.html#SECTION007140000000000000000 Valid characters are a-z A-Z 0-9 _ - + : [ ] < > ; We add the '.' character for suporting fieldnames as well. And we add the '/' character because some folks at FACET use this. And we add the ',' character because some folks at LBL use this. And we add the '#' character because some folks at FRIB use this. And we add the '{' and the '}' character because some folks at BNL use this. And we add the '^' character because some folks at LNL use this.- Parameters:
pvName
- The name of PV.- Returns:
- boolean True or False
-
pvNameVersion
public static PVNames.EPICSVersion pvNameVersion(String pvName)
What type of name is the pv. return EPICSVersion.V3 if starts with ca:// return EPICSVersion.V4 if starts with pva:// returns EPICSVersion.DEFAULT otherwise.- Parameters:
pvName
- The name of PV.- Returns:
- EPICSVersion
-
-