Class ConvertPVNameToKey
- java.lang.Object
-
- org.epics.archiverappliance.config.ConvertPVNameToKey
-
- All Implemented Interfaces:
PVNameToKeyMapping
public class ConvertPVNameToKey extends Object implements PVNameToKeyMapping
Most labs use a standard character (typically the ":" or the "-" character) in their naming conventions to separate out the components of a name. We want to replace these characters with the File.separator so that the key/file structure reflects the naming convention reasonably closely This give us 2 things- All the files/keys for the entire archiver system do not land in the same folder. This improves performance significantly on ext2/3/4 like filesystems which can handle upto around 10000 files in a folder reasonably well but are very inefficient if this limit is crossed. Note, systems like ZFS/BTRFS do not have this limitation.
- We have a deterministic way to go from PV name to key/file name
One other issue we need to solve is that some PV's (
X:CTRD_V
) are substrings of other PV's (X:CTRD_V_BOOK
). So, files forX:CTRD_V
are matches forX:CTRD_V_BOOK
as well. We can either replace the underscores with /'s as well. Or the character that separates the final name component of the PV name from the rest of the file name (time partition info, extension etc) should also be something that would not show up in a PV name at the end. For now, we choose the latter and use another property to identify the separator string (for example ":") as the terminator. For example,X:CTRD_V_BOOK
is mapped toX/CTRD_V_BOOK:
.This class uses two properties obtained from the
archappl.properties
file to map PV names to keys.- org.epics.archiverappliance.config.ConvertPVNameToKey.siteNameSpaceSeparators - This is a list of characters that separate the components of the PV name. The syntax for this must satisfy Java's
replaceAll
regex requirements. So to specify a list containing the ":" and the "-" characters, we have to use[\\:\\-]
- org.epics.archiverappliance.config.ConvertPVNameToKey.siteNameSpaceTerminator - This is the character used as the terminator of the PV name portion of the key.
- Author:
- mshankar
-
-
Constructor Summary
Constructors Constructor Description ConvertPVNameToKey()
-
Method Summary
Modifier and Type Method Description String[]
breakIntoParts(String pvName)
Break a PV name into parts separated by the site specific separators For examples, ABC:123:DEF gets broken into [ABC, 123, DEF]boolean
containsSiteSeparators(String pvName)
Return true if the given pvName contains any site specific separators.String
convertPVNameToKey(String pvName)
protected String
generateChunkKey(String pvName)
One option is to simply override the final element of chunk key generation.void
initialize(ConfigService configService)
-
-
-
Method Detail
-
convertPVNameToKey
public String convertPVNameToKey(String pvName)
- Specified by:
convertPVNameToKey
in interfacePVNameToKeyMapping
-
initialize
public void initialize(ConfigService configService) throws ConfigException
- Specified by:
initialize
in interfacePVNameToKeyMapping
- Throws:
ConfigException
-
generateChunkKey
protected String generateChunkKey(String pvName)
One option is to simply override the final element of chunk key generation. To do that, subclass and override this method. (Of course, you still have to register the subclass in archappl.properties).- Parameters:
pvName
- The name of PV.- Returns:
- pvName
-
containsSiteSeparators
public boolean containsSiteSeparators(String pvName)
Description copied from interface:PVNameToKeyMapping
Return true if the given pvName contains any site specific separators.- Specified by:
containsSiteSeparators
in interfacePVNameToKeyMapping
- Parameters:
pvName
- The name of PV.- Returns:
- boolean True or False
-
breakIntoParts
public String[] breakIntoParts(String pvName)
Description copied from interface:PVNameToKeyMapping
Break a PV name into parts separated by the site specific separators For examples, ABC:123:DEF gets broken into [ABC, 123, DEF]- Specified by:
breakIntoParts
in interfacePVNameToKeyMapping
- Parameters:
pvName
- The name of PV.- Returns:
- String Parts separated by separators
-
-