private List<Object> prepareValue(@Unretained Object value) { if (value == null) { return null; } final GemFireContainer container = getContainer(); assert container.isByteArrayStore(); final int size = container.getNumColumns(); final Class<?> valClass = value.getClass(); if (valClass == byte[].class) { return new BytesJavaObjectsList(size, (byte[]) value, container); } else if (valClass == byte[][].class) { return new BytesJavaObjectsList(size, (byte[][]) value, container); } else if (valClass == OffHeapRow.class) { return new BytesJavaObjectsList(size, ((OffHeapRow) value).getRowBytes(), container); } else if (valClass == OffHeapRowWithLobs.class) { return new BytesJavaObjectsList( size, ((OffHeapRowWithLobs) value).getRowByteArrays(), container); } else { return new DVDArrayJavaObjectsList((DataValueDescriptor[]) value); } }
/** {@inheritDoc} */ @Override public ResultSet getNewRowsAsResultSet() { if (this.newRow == null) { // first check for UPDATE ops to get the delta if (this.type == Type.BEFORE_UPDATE || this.type == Type.AFTER_UPDATE) { final SerializableDelta delta = getSerializableDelta(); final GemFireContainer container = getContainer(); assert container.isByteArrayStore(); // We ensure that all WAN queues are drained completely before changing // schema in ALTER TABLE (see GemFireContainer.incrementSchemaVersion) // so using getCurrentRowFormatter below is safe. return (this.newRow = new DVDStoreResultSet( delta.getChangedRow(), -1, container.getCurrentRowFormatter(), delta.getChangedColumns(), null)); } Object newVal = getNewValue(); if (newVal != null) { assert getContainer().isByteArrayStore(); assert !(newVal instanceof OffHeapByteSource); if (newVal.getClass() == byte[].class) { // table shape may have changed by the time event is replayed in // AsyncEventListener so use RowFormatter using the row bytes final byte[] row = (byte[]) newVal; return (this.newRow = new RawStoreResultSet(row, getRowFormatter(row))); } else { // table shape may have changed by the time event is replayed in // AsyncEventListener so use RowFormatter using the row bytes final byte[][] row = (byte[][]) newVal; return (this.newRow = new RawStoreResultSet(row, getRowFormatter(row))); } } else { return null; } } return this.newRow; }
@Override public final Object setContainerInfo(final LocalRegion owner, final Object val) { final GemFireContainer container; ExtraTableInfo tabInfo; if (owner == null) { final RowFormatter rf; if ((tabInfo = this.tableInfo) != null && (rf = tabInfo.getRowFormatter()) != null) { container = rf.container; } else { return null; } } else { container = (GemFireContainer) owner.getUserAttribute(); } if (container != null && container.isByteArrayStore()) { tabInfo = container.getExtraTableInfo(val); this.tableInfo = tabInfo; // cleanup the key if required if (tabInfo != null && tabInfo.regionKeyPartOfValue()) { return tabInfo; } } return null; }
@Override public ExecRow getRowWithoutFaultIn(GemFireContainer baseContainer) { return RegionEntryUtils.getRowWithoutFaultIn( baseContainer, baseContainer.getRegion(), this, this.tableInfo); }
@Override public Object getValueWithoutFaultIn(GemFireContainer baseContainer) { return RegionEntryUtils.getValueWithoutFaultIn(baseContainer.getRegion(), this); }