Package mil.nga.giat.geowave.index

Examples of mil.nga.giat.geowave.index.ByteArrayId


      final DataInput input )
      throws IOException {
    final int adapterIdLength = input.readInt();
    final byte[] adapterIdBinary = new byte[adapterIdLength];
    input.readFully(adapterIdBinary);
    adapterId = new ByteArrayId(
        adapterIdBinary);
  }
View Full Code Here


    final PersistentDataset<CommonIndexValue> indexData = new PersistentDataset<CommonIndexValue>();
    final PersistentDataset<Object> extendedData = new PersistentDataset<Object>();
    // for now we are assuming all entries in a row are of the same type
    // and use the same adapter
    boolean adapterMatchVerified;
    ByteArrayId adapterId;
    if (adapter != null) {
      adapterId = adapter.getAdapterId();
      adapterMatchVerified = false;
    }
    else {
      adapterMatchVerified = true;
      adapterId = null;
    }
    final List<FieldInfo> fieldInfoList = new ArrayList<FieldInfo>(
        rowMapping.size());

    for (final Entry<Key, Value> entry : rowMapping.entrySet()) {
      // the column family is the data element's type ID
      if (adapterId == null) {
        adapterId = new ByteArrayId(
            entry.getKey().getColumnFamilyData().getBackingArray());
      }

      if (adapter == null) {
        adapter = (DataAdapter<T>) adapterStore.getAdapter(adapterId);
        if (adapter == null) {
          LOGGER.error("DataAdapter does not exist");
          return null;
        }
      }
      if (!adapterMatchVerified) {
        if (!adapterId.equals(adapter.getAdapterId())) {
          return null;
        }
        adapterMatchVerified = true;
      }
      final ByteArrayId fieldId = new ByteArrayId(
          entry.getKey().getColumnQualifierData().getBackingArray());
      // first check if this field is part of the index model
      final FieldReader<? extends CommonIndexValue> indexFieldReader = index.getIndexModel().getReader(
          fieldId);
      final byte byteValue[] = entry.getValue().get();
      if (indexFieldReader != null) {
        final CommonIndexValue indexValue = indexFieldReader.readField(byteValue);
        indexValue.setVisibility(entry.getKey().getColumnVisibilityData().getBackingArray());
        final PersistentValue<CommonIndexValue> val = new PersistentValue<CommonIndexValue>(
            fieldId,
            indexValue);
        indexData.addValue(val);
        fieldInfoList.add(getFieldInfo(
            val,
            byteValue,
            indexValue.getVisibility()));
      }
      else {
        // next check if this field is part of the adapter's
        // extended data model
        final FieldReader<?> extFieldReader = adapter.getReader(fieldId);
        if (extFieldReader == null) {
          // if it still isn't resolved, log an error, and
          // continue
          LOGGER.error("field reader not found for data entry, the value will be ignored");
          continue;
        }
        final Object value = extFieldReader.readField(byteValue);
        final PersistentValue<Object> val = new PersistentValue<Object>(
            fieldId,
            value);
        extendedData.addValue(val);
        fieldInfoList.add(getFieldInfo(
            val,
            byteValue,
            entry.getKey().getColumnVisibility().getBytes()));
      }
    }
    final IndexedAdapterPersistenceEncoding encodedRow = new IndexedAdapterPersistenceEncoding(
        adapterId,
        new ByteArrayId(
            rowId.getDataId()),
        new ByteArrayId(
            rowId.getIndexId()),
        rowId.getNumberOfDuplicates(),
        indexData,
        extendedData);
    if ((clientFilter == null) || clientFilter.accept(encodedRow)) {
      // cannot get here unless adapter is found (not null)
      return Pair.of(
          adapter.decode(
              encodedRow,
              index),
          new IngestEntryInfo(
              Arrays.asList(new ByteArrayId(
                  k.getRowData().getBackingArray())),
              fieldInfoList));
    }
    return null;
  }
View Full Code Here

        writableAdapter.getAdapterId().getBytes(),
        ingestInfo);

    final List<ByteArrayId> rowIds = new ArrayList<ByteArrayId>();
    for (final Mutation m : mutations) {
      rowIds.add(new ByteArrayId(
          m.getRow()));
    }
    writer.write(mutations);
    return ingestInfo;
  }
View Full Code Here

      // disambiguate index values that are the same, also adding
      // enough length values to be able to read the row ID again, we
      // lastly add a number of duplicates which can be useful as
      // metadata in our de-duplication
      // step
      rowIds.add(new ByteArrayId(
          new AccumuloRowId(
              indexId,
              dataId,
              adapterId,
              numberOfDuplicates).getRowId()));
View Full Code Here

      final Set<ByteArrayId> removeSet = new HashSet<ByteArrayId>();
      final List<Range> rowRanges = new ArrayList<Range>();
      for (final ByteArrayId rowId : rowIds) {
        rowRanges.add(Range.exact(new Text(
            rowId.getBytes())));
        removeSet.add(new ByteArrayId(
            rowId.getBytes()));
      }
      deleter.setRanges(rowRanges);

      final Iterator<Map.Entry<Key, Value>> iterator = deleter.iterator();
      while (iterator.hasNext()) {
        final Entry<Key, Value> entry = iterator.next();
        removeSet.remove(new ByteArrayId(
            entry.getKey().getRowData().getBackingArray()));
      }

      if (removeSet.isEmpty()) {
        deleter.delete();
View Full Code Here

    this.attrDesc = attrDesc;
  }

  @Override
  public ByteArrayId getFieldId() {
    return new ByteArrayId(
        StringUtils.stringToBinary(attrDesc.getLocalName()));
  }
View Full Code Here

      throws IOException {
    super.readFields(input);
    final int indexIdLength = input.readInt();
    final byte[] indexIdBytes = new byte[indexIdLength];
    input.readFully(indexIdBytes);
    indexId = new ByteArrayId(
        indexIdBytes);
  }
View Full Code Here

          nativeFields);
    }

    @Override
    public ByteArrayId getAdapterId() {
      return new ByteArrayId(
          "geoobj".getBytes());
    }
View Full Code Here

    }

    @Override
    public ByteArrayId getDataId(
        GeoObj entry ) {
      return new ByteArrayId(
          entry.id.getBytes());
    }
View Full Code Here

    assertTrue(Arrays.equals(
        "TS".getBytes(),
        simplePIDHandler.getVisibility(
            newFeature,
            new ByteArrayId(
                "pid".getBytes()),
            "pid")));
  }
View Full Code Here

TOP

Related Classes of mil.nga.giat.geowave.index.ByteArrayId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.