Package net.sf.basedb.core
Class RawDataTypes
- java.lang.Object
-
- net.sf.basedb.core.RawDataTypes
-
public class RawDataTypes extends Object
This class is used for reading the XML configuration file with information about raw data types. All files returned byApplication.getRawDataTypeFiles()
are parsed.- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RawDataTypes.NameComparator
Comparator implementation that sorts raw data types according to their name.
-
Field Summary
Fields Modifier and Type Field Description private static Set<RawDataType>
all
private static URL
dtdFile
The DTD which is used to validate the XML file.private static boolean
isInitialised
private static org.slf4j.Logger
log
Log core events.private static Map<String,RawDataType>
platformTypes
private static Map<String,RawDataType>
rawDataTypes
A map from raw data type name -->RawDataType
.
-
Constructor Summary
Constructors Constructor Description RawDataTypes()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Collection<RawDataType>
getFileOnlyRawDataTypes()
Get the raw data types that are representations of file-onlyPlatform
:s.private static RawDataType
getPlatformRawDataType(org.hibernate.Session session, String id)
static RawDataType
getRawDataType(String id)
Get a information about a raw data type.static Collection<RawDataType>
getRawDataTypes()
Get a collection with all raw data types that has been defined.static RawDataType
getSafeRawDataType(String id)
Get a information about a raw data type or throw an exception if the raw data type is not found.static Collection<RawDataType>
getSortedRawDataTypes(Comparator<RawDataType> comparator)
Get all raw data types sorted according to the given comparator.private static RawDataType
getVariantRawDataType(org.hibernate.Session session, String id)
(package private) static void
init()
Initialize the class.(package private) static void
initPlatforms(org.hibernate.Session session)
Load file-only platforms and create raw data types for them.private static List<IntensityFormula>
loadIntensityFormulas(Element rawDataTypeElement, int channels, String xmlFile)
Load the intensity formulas for the specified raw data type node and return a list ofIntensityFormula
objects.private static List<RawDataProperty>
loadProperties(Element rawDataTypeElement, int channels, String xmlFile)
Load the properties for the specified raw data type node and return a list ofRawDataProperty
objects.private static void
loadRawDataTypes(Set<String> usedNames, Document dom, String xmlFile)
Load the raw data types and put the information in therawDataTypes
map.private static void
loadRawDataTypesFile()
Load and parse the file with raw data types.(package private) static void
registerFileOnlyRawDataType(RawDataType rdt)
(package private) static void
unload()
Unload all settings.(package private) static void
unregisterFileOnlyRawDataType(RawDataType rdt)
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
Log core events.
-
rawDataTypes
private static Map<String,RawDataType> rawDataTypes
A map from raw data type name -->RawDataType
.
-
platformTypes
private static Map<String,RawDataType> platformTypes
-
all
private static Set<RawDataType> all
-
dtdFile
private static final URL dtdFile
The DTD which is used to validate the XML file.
-
isInitialised
private static boolean isInitialised
-
-
Method Detail
-
init
static void init() throws BaseException
Initialize the class.- Throws:
BaseException
- This exception is thrown if there is an error
-
initPlatforms
static void initPlatforms(org.hibernate.Session session)
Load file-only platforms and create raw data types for them.- Since:
- 2.5
-
unload
static void unload()
Unload all settings.
-
loadRawDataTypesFile
private static void loadRawDataTypesFile() throws BaseException
Load and parse the file with raw data types. This method will populate therawDataTypes
variable.- Throws:
BaseException
-
getRawDataTypes
public static Collection<RawDataType> getRawDataTypes()
Get a collection with all raw data types that has been defined. This method returns both database and file-only raw data types. To get file-only raw data types usegetFileOnlyRawDataTypes()
- Returns:
- A
Collection
containingRawDataType
objects whereRawDataType.isStoredInDb()
returns true
-
getSortedRawDataTypes
public static Collection<RawDataType> getSortedRawDataTypes(Comparator<RawDataType> comparator)
Get all raw data types sorted according to the given comparator.- Parameters:
comparator
- A compartor- Returns:
- A sorted collection
- Since:
- 2.16.2
-
getFileOnlyRawDataTypes
public static Collection<RawDataType> getFileOnlyRawDataTypes()
Get the raw data types that are representations of file-onlyPlatform
:s.- Returns:
- A
Collection
containingRawDataType
objects whereRawDataType.isStoredInDb()
returns false - Since:
- 2.5
-
getRawDataType
public static RawDataType getRawDataType(String id)
Get a information about a raw data type.- Parameters:
id
- The id of the raw data type- Returns:
- A
RawDataType
object with information about the raw data type, or null if the specified id is not found
-
getSafeRawDataType
public static RawDataType getSafeRawDataType(String id)
Get a information about a raw data type or throw an exception if the raw data type is not found.- Parameters:
id
- The id of the raw data type- Returns:
- A
RawDataType
object with information about the raw data type - Throws:
ItemNotFoundException
- If the specified raw data type is not found- Since:
- 2.6
-
getPlatformRawDataType
private static RawDataType getPlatformRawDataType(org.hibernate.Session session, String id)
-
getVariantRawDataType
private static RawDataType getVariantRawDataType(org.hibernate.Session session, String id)
-
registerFileOnlyRawDataType
static void registerFileOnlyRawDataType(RawDataType rdt)
-
unregisterFileOnlyRawDataType
static void unregisterFileOnlyRawDataType(RawDataType rdt)
-
loadRawDataTypes
private static void loadRawDataTypes(Set<String> usedNames, Document dom, String xmlFile)
Load the raw data types and put the information in therawDataTypes
map.
-
loadProperties
private static List<RawDataProperty> loadProperties(Element rawDataTypeElement, int channels, String xmlFile)
Load the properties for the specified raw data type node and return a list ofRawDataProperty
objects.
-
loadIntensityFormulas
private static List<IntensityFormula> loadIntensityFormulas(Element rawDataTypeElement, int channels, String xmlFile)
Load the intensity formulas for the specified raw data type node and return a list ofIntensityFormula
objects.
-
-