java.lang.Object
org.apache.jena.tdb1.base.file.MetaFile
- All Implemented Interfaces:
org.apache.jena.atlas.lib.Closeable,org.apache.jena.atlas.lib.Sync
public class MetaFile
extends Object
implements org.apache.jena.atlas.lib.Sync, org.apache.jena.atlas.lib.Closeable
Abstraction and many convenience operations on metadata.
Metadata is recorded in Java properties style - not RDF - because it's relative to the file or context used.
Keys and values are always strings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckMetadata(String key, String expected) Check property has the value given - throw exception if not.voidcheckOrSetMetadata(String key, String expected) Check property is an expected value or set if missingvoidclear()Clear all properties.voidclose()voiddump(PrintStream output) DebuggingvoidensurePropertySet(String key, String expected) Set property if not already set.booleanDoes this metafile exist on disk? (In-memory MetaFiles always exist)voidflush()Write to backing file if changedgetOrSetDefault(String key, String expected) Get property or the default value - also set the default value if not presentgetProperty(String key) Get the property value or null.getProperty(String key, String defaultString) Get the property value or return supplied default.intGet the property value and parse as an integerintgetPropertyAsInteger(String key, int defaultValue) Get the property value and parse as an integer or return default value.String[]getPropertySplit(String key) Get property as a string and split on ",".String[]getPropertySplit(String key, String defaultString) Get property as a string and split on ",", using the default string if not present in the MetaFile.booleanhasProperty(String key) Test for the presence of a propertybooleanpropertyEquals(String key, String value) Test whether a property has a value.voidsetProperty(String key, int value) Set property, turning integer into a string.voidsetProperty(String key, String value) Set propertyvoidsync()
-
Constructor Details
-
MetaFile
Create a MetaFile- Parameters:
label- Convenience label.fn- On disk filename @link{Names.mem} for in-memory
-
-
Method Details
-
existsMetaData
public boolean existsMetaData()Does this metafile exist on disk? (In-memory MetaFiles always exist) -
getFilename
-
hasProperty
Test for the presence of a property -
getProperty
Get the property value or null. -
getProperty
Get the property value or return supplied default. -
getPropertyAsInteger
Get the property value and parse as an integer -
getPropertyAsInteger
Get the property value and parse as an integer or return default value. -
getPropertySplit
Get property as a string and split on ",". -
getPropertySplit
Get property as a string and split on ",", using the default string if not present in the MetaFile. -
setProperty
Set property -
setProperty
Set property, turning integer into a string. -
propertyEquals
Test whether a property has a value. Null tests equal to not present. -
ensurePropertySet
Set property if not already set. -
getOrSetDefault
Get property or the default value - also set the default value if not present -
checkOrSetMetadata
Check property is an expected value or set if missing -
checkMetadata
Check property has the value given - throw exception if not. -
clear
public void clear()Clear all properties. -
flush
public void flush()Write to backing file if changed -
dump
Debugging -
sync
public void sync()- Specified by:
syncin interfaceorg.apache.jena.atlas.lib.Sync
-
close
public void close()- Specified by:
closein interfaceorg.apache.jena.atlas.lib.Closeable
-