Class MetadataUtil
- java.lang.Object
-
- jetbrains.buildServer.serverSide.db.metadata.MetadataUtil
-
public class MetadataUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description MetadataUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String[]
loadMetadataFileAsStrings(InputStream inputStream)
static String[]
loadMetadataFileAsStrings(String fileName)
static SchemaDef
loadSchemaFromDatabase(DBFunctions dbf)
static SchemaDef
loadSchemaFromDatabase(DBFunctionsProvider db)
static InputStream
openMetadataFileAsBinaryStream(String fileName)
Opens a stream of the specified metadata file.static Map<String,List<String>>
parseMetadataFileToSections(String[] text)
Parses the metadata file into sections.static Set<String>
sectionStringsToSet(Collection<String> strings)
-
-
-
Method Detail
-
openMetadataFileAsBinaryStream
public static InputStream openMetadataFileAsBinaryStream(String fileName)
Opens a stream of the specified metadata file. This file is expected in the package the same as theMetadataConsts
class. The file is in the ISO-8859-1 character table (aka Latin-1). A client should close it after use.- Returns:
- a byte-stream of a text metadata file.
- See Also:
MetadataConsts.ourMetadataCharset
-
loadMetadataFileAsStrings
public static String[] loadMetadataFileAsStrings(InputStream inputStream) throws IOException
- Throws:
IOException
-
parseMetadataFileToSections
public static Map<String,List<String>> parseMetadataFileToSections(String[] text)
Parses the metadata file into sections. Each section is a word started without indentions, and all indented line are the content of the section.- Parameters:
text
- file text as strings.- Returns:
- map where key is a section caption and value is alist of inner lines (where head spaces are kept); the sections order is not supported but the order of lines inside a section is guaranteed to be the same as in the source file.
-
sectionStringsToSet
@NotNull public static Set<String> sectionStringsToSet(@Nullable Collection<String> strings)
-
loadSchemaFromDatabase
public static SchemaDef loadSchemaFromDatabase(@NotNull DBFunctions dbf)
-
loadSchemaFromDatabase
public static SchemaDef loadSchemaFromDatabase(@NotNull DBFunctionsProvider db)
-
-