Beispiel #1
0
  /** Sets the system metadata on the given disk (not extended MD) */
  private void setSysMetadata(
      SystemMetadata systemMD, Disk disk, ConnectionFactory.DiskConnection[] connections) {

    // only insert if layoutMapId still maps to this disk
    String sysCacheId = CacheClientInterface.SYSTEM_CACHE;
    if (usesDisk(systemMD.getLayoutMapId(), sysCacheId, disk)) {
      // set the system metadata
      setMetadata(sysCacheId, connections, systemMD.getOID(), systemMD);
    }
  }
Beispiel #2
0
  /**
   * Called to populate caches on given disk (not used during STORE). Inserts into BOTH the (1)
   * system cache, with the given systemMD, and the (2) non-system cache designated by the cacheId.
   *
   * @param systemMD extracted from the fragment file
   * @param cacheID cache in which to store the md
   * @param disk only insert into cache on this disk
   */
  public void setMetadata(SystemMetadata systemMD, String cacheId, Disk disk) {

    LOG.fine("setMetadata for oid " + systemMD.getOID() + " on disk [" + disk + "]");

    // get connection to the desired disk
    ConnectionFactory.DiskConnection[] connections = makeConn(disk);

    // set system metadata
    setSysMetadata(systemMD, disk, connections);

    // if cacheId represents system cache, we're done
    if (cacheId == null || cacheId.equals(CacheClientInterface.SYSTEM_CACHE)) {
      return;
    }

    setExtMetadata(systemMD.getOID(), cacheId, disk, connections);
  }
Beispiel #3
0
  /**
   * This <code>setMetadata</code> method is the OA callback to populate a local cache.
   *
   * @param <code>SystemMetadata</code> are the SystemMetadata extracted from the local fragment
   * @param <code>Disk</code> is the disk containing the fragment
   *     <p>note: this method DEPRECIATED, crawl uses above methods instead. Kept here for reference
   *     until replacement methods are validated.
   */
  public void setMetadata(SystemMetadata systemMD, byte[] MDField, Disk disk) {
    if (LOG.isLoggable(Level.FINE)) {
      LOG.fine(
          "setMetadata has been called for oid " + systemMD.getOID() + " on disk [" + disk + "]");
    }

    // Precompute the connection
    ConnectionFactory.DiskConnection[] connections = new ConnectionFactory.DiskConnection[1];
    connections[0] = ConnectionFactory.getConnection(disk);

    // Check if the system metadata should be set
    ArrayList disks =
        MDDiskAbstraction.getInstance((byte) 0)
            .getUsedDisksFromMapId(systemMD.getLayoutMapId(), CacheClientInterface.SYSTEM_CACHE);
    if (disks.contains(disk)) {
      setMetadata(CacheClientInterface.SYSTEM_CACHE, connections, systemMD.getOID(), systemMD);
    }

    try {
      // Find the cacheId
      MDHeader header = new MDHeader(MDField);

      String cacheId = header.getCacheId();

      if (cacheId != null) {
        disks =
            MDDiskAbstraction.getInstance((byte) 0)
                .getUsedDisksFromMapId(systemMD.getLayoutMapId(), cacheId);

        if (disks.contains(disk)) {
          CacheRecord metadataObject =
              CacheManager.getInstance()
                  .getClientInterface(cacheId)
                  .generateMetadataObject(systemMD.getOID());

          // Set the metadata
          setMetadata(cacheId, connections, systemMD.getOID(), metadataObject);
        }
      }

    } catch (IOException e) {
      LOG.log(Level.SEVERE, "Failed to update the metadata [" + e.getMessage() + "]", e);
    } catch (EMDException e) {
      LOG.log(Level.SEVERE, "Failed to update the metadata [" + e.getMessage() + "]", e);
    }
  }
Beispiel #4
0
  /**
   * Sets the system metadata on the given disk (not extended MD)
   *
   * @param systemMD extracted from the fragment file
   * @param disk only insert into cache on this disk
   */
  public void setSysMetadata(SystemMetadata systemMD, Disk disk) {

    LOG.fine("setSysMetadata for oid " + systemMD.getOID() + " on disk [" + disk + "]");

    setSysMetadata(systemMD, disk, makeConn(disk));
  }