Class MetaFile

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 Details

    • MetaFile

      public MetaFile(String label, String fn)
      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

      public String getFilename()
    • hasProperty

      public boolean hasProperty(String key)
      Test for the presence of a property
    • getProperty

      public String getProperty(String key)
      Get the property value or null.
    • getProperty

      public String getProperty(String key, String defaultString)
      Get the property value or return supplied default.
    • getPropertyAsInteger

      public int getPropertyAsInteger(String key)
      Get the property value and parse as an integer
    • getPropertyAsInteger

      public int getPropertyAsInteger(String key, int defaultValue)
      Get the property value and parse as an integer or return default value.
    • getPropertySplit

      public String[] getPropertySplit(String key)
      Get property as a string and split on ",".
    • getPropertySplit

      public String[] getPropertySplit(String key, String defaultString)
      Get property as a string and split on ",", using the default string if not present in the MetaFile.
    • setProperty

      public void setProperty(String key, String value)
      Set property
    • setProperty

      public void setProperty(String key, int value)
      Set property, turning integer into a string.
    • propertyEquals

      public boolean propertyEquals(String key, String value)
      Test whether a property has a value. Null tests equal to not present.
    • ensurePropertySet

      public void ensurePropertySet(String key, String expected)
      Set property if not already set.
    • getOrSetDefault

      public String getOrSetDefault(String key, String expected)
      Get property or the default value - also set the default value if not present
    • checkOrSetMetadata

      public void checkOrSetMetadata(String key, String expected)
      Check property is an expected value or set if missing
    • checkMetadata

      public void checkMetadata(String key, String expected)
      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

      public void dump(PrintStream output)
      Debugging
    • sync

      public void sync()
      Specified by:
      sync in interface org.apache.jena.atlas.lib.Sync
    • close

      public void close()
      Specified by:
      close in interface org.apache.jena.atlas.lib.Closeable