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 and Channel Names.
Author:
mshankar
  • Field Details

    • 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:
    • 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:
    • GROUP_PV_NAME

      public static final String GROUP_PV_NAME
      See Also:
    • GROUP_FIELD_NAME

      public static final String GROUP_FIELD_NAME
      See Also:
    • GROUP_FIELD_MODIFIER

      public static final String GROUP_FIELD_MODIFIER
      See Also:
    • channelNamePattern

      public static final Pattern channelNamePattern
  • Constructor Details

    • PVNames

      public PVNames()
  • Method Details

    • channelNamePVName

      public static String channelNamePVName(String channelName)
      Remove the .VAL, .HIHI etc portion of a channelName and return the plain pvName
      Parameters:
      channelName - The name of the PV channel.
      Returns:
      String The plain pvName
    • getFieldName

      public static String getFieldName(String channelName)
      Parameters:
      channelName - Input full name of the channel
      Returns:
      Only the group if exists, "" otherwise.
    • isFieldOrFieldModifier

      public static boolean isFieldOrFieldModifier(String channelName)
      Is this a field or field modifier?
      Parameters:
      channelName - The name of PV.
      Returns:
      boolean True or False
    • normalizeChannelName

      public static String normalizeChannelName(String channelName)
      Remove .VAL from pv names if present. Returned value is something that can be used to lookup for PVTypeInfo
      Parameters:
      channelName - 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
    • 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 name
      destName - 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
    • 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
        Note that this translates to the fact that regardless of whether the PV is a field or not, we look in the same places.
    • isValidChannelName

      public static boolean isValidChannelName(String channelName)
      Check to see if the channelName has valid characters. Uses the regex "(?<PVNAME>[a-zA-Z0-9_\-+:\[\]<>;/,#{}^]+)\.?(?<FIELDNAME>[a-zA-Z0-9_\-+:]+)?\.?(?<FIELDMODIFIER>\{.+})?" For certain characters, EPICS will not throw exceptions but generate spurious traffic which is hard to detect. From the App dev Guide Valid characters are a-z A-Z 0-9 _ - + : [ ] < > ; 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.

      For field names using the filter support: Filter support documentation: filters

      Parameters:
      channelName - 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
    • stripPrefixFromName

      public static String stripPrefixFromName(String pvName)
      Remove the pva:// or ca:// prefix from the PV name if present.
      Parameters:
      pvName - The name of PV.
      Returns:
      String