Module openj9.dtfj

Class J9DDRStructureStore

java.lang.Object
com.ibm.j9ddr.tools.store.J9DDRStructureStore

public class J9DDRStructureStore extends Object
  • Field Details

  • Constructor Details

    • J9DDRStructureStore

      protected J9DDRStructureStore()
    • J9DDRStructureStore

      public J9DDRStructureStore(String databaseDirectory, String supersetFileName) throws IOException
      Create and open the database on the databaseDirectory. Store the current contents of the receiver in the database. Throw an IOException if the directory already exists and does not contain a valid database.
      Parameters:
      backingDirectory - - Full path to directory
      Throws:
      IOException - if backingDirectory does not exist or can not be accessed
  • Method Details

    • add

      public void add(StructureKey key, String structureFileName, boolean inService) throws IOException, StructureMismatchError
      Add newBlob to the database associated to key. If key exists and the associated blob is identical to newBlob no action is taken and no exception is thrown. If key exists but the associated blob is not identical to newBlob throw StructureMismatchError. This is to detect the situation where the structure has changed for a DDR enabled VM but the VM's DDR DDRStructKey has not been changed. If an identical blob with a different key already exists in the database the key is added with a reference to the existing blob. This will save space but will be transparent to the user. QUESTION: Do we want to store a time stamp with the key? On the order of 5000 keys will be added to the database annually. Ideally a partitioning scheme for DDRStructKey name space can be devised such that new keys need only be stored when structure data changes. Parameters may not be null
      Parameters:
      key - - Key identifying the VM the structure belongs to.
      structureFileName - - Full path to a structure file
      inService - - True if the structure is for an in-service (non-DDR enabled VM), false otherwise
      Throws:
      StructureMismatchError - - If key exists in the database but refers to a blob that is NOT identical to blob.
      IOException - - If there is a problem storing the blob
    • updateSuperset

      public void updateSuperset() throws IOException
      Throws:
      IOException
    • remove

      public boolean remove(StructureKey key) throws IOException
      Remove the element key from the database. Naturally the blob data itself is only removed once all keys that refer to it have been removed
      Parameters:
      key -
      Returns:
      true if the key was found and removed or did not exist, false otherwise
      Throws:
      IOException - - if there was a problem removing the blob
    • get

      public ImageInputStream get(StructureKey key) throws IOException
      Parameters:
      key -
      Returns:
      An InputStream open and positioned at the start of the J9DDR structure the blob associated with key. null if key is not contained in the database
      Throws:
      IOException - - if there is a problem retrieving the blob
    • getSuperset

      public InputStream getSuperset() throws FileNotFoundException
      Return a blob that is contains structures and fields that are a superset of all blobs stored in the database. Field offsets are ignored for this operation and the field offsets returned in the blob have no meaning. Only the structure and field names are useful. This API is used for the DDR Structure and Pointer Java code generator
      Returns:
      an ImageInputStream opened and positioned at the start of a J9DDR structure blob
      Throws:
      FileNotFoundException
    • getSuperSetFileName

      public String getSuperSetFileName()