예제 #1
0
  public MetadataClient.QueryResult queryPlus(
      String cacheId,
      String query,
      ArrayList attributes,
      Cookie _cookie,
      int maxResults,
      int timeout,
      boolean forceResults,
      boolean abortOnFailure,
      Object[] boundParameters,
      MDOutputStream outputStream)
      throws EMDException {
    CacheClientInterface cache = CacheManager.getInstance().getClientInterface(cacheId);
    if (cache == null) {
      throw new IllegalArgumentException("invalid cache id: " + cacheId);
    }

    int[] maps = cache.layoutMapIdsToQuery(query, LayoutClient.NUM_MAP_IDS);

    return (queryPlus(
        maps,
        cacheId,
        query,
        attributes,
        _cookie,
        maxResults,
        timeout,
        forceResults,
        false,
        boundParameters,
        outputStream));
  }
예제 #2
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);
    }
  }
예제 #3
0
  /** Sets metadata for cacheId on given disk (not system MD) */
  private void setExtMetadata(
      NewObjectIdentifier oid,
      String cacheId,
      Disk disk,
      ConnectionFactory.DiskConnection[] connections) {

    // not all layout disks necessarily used, depends on reduncancy
    if (usesDisk(oid.getLayoutMapId(), cacheId, disk)) {
      try {
        CacheRecord metadataObject =
            CacheManager.getInstance().getClientInterface(cacheId).generateMetadataObject(oid);
        // Set the metadata
        setMetadata(cacheId, connections, oid, metadataObject);
      } catch (EMDException e) {
        LOG.log(Level.SEVERE, "Failed to update the metadata [" + e.getMessage() + "]", e);
      }
    }
  }