/** * Set bytes into the passed Writable by calling its * {@link Writable#readFields(java.io.DataInput)}. * @param bytes serialized bytes * @param w An empty Writable (usually made by calling the null-arg * constructor). * @return The passed Writable after its readFields has been called fed * by the passed <code>bytes</code> array or IllegalArgumentException * if passed null or an empty <code>bytes</code> array. * @throws IOException e * @throws IllegalArgumentException */ public static Writable getWritable(final byte [] bytes, final Writable w) throws IOException { return getWritable(bytes, 0, bytes.length, w); }
@Override public void nodeDataChanged(String path) { if (keysParentZNode.equals(ZKUtil.getParent(path))) { try { byte[] data = ZKUtil.getDataAndWatch(watcher, path); if (data == null || data.length == 0) { LOG.debug("Ignoring empty node "+path); return; } AuthenticationKey key = (AuthenticationKey)Writables.getWritable(data, new AuthenticationKey()); secretManager.addKey(key); } catch (KeeperException ke) { LOG.error(HBaseMarkers.FATAL, "Error reading data from zookeeper", ke); watcher.abort("Error reading updated key znode "+path, ke); } catch (IOException ioe) { LOG.error(HBaseMarkers.FATAL, "Error reading key writables", ioe); watcher.abort("Error reading key writables from znode "+path, ioe); } } }
private void refreshNodes(List<ZKUtil.NodeAndData> nodes) { for (ZKUtil.NodeAndData n : nodes) { String path = n.getNode(); String keyId = ZKUtil.getNodeName(path); try { byte[] data = n.getData(); if (data == null || data.length == 0) { LOG.debug("Ignoring empty node "+path); continue; } AuthenticationKey key = (AuthenticationKey)Writables.getWritable( data, new AuthenticationKey()); secretManager.addKey(key); } catch (IOException ioe) { LOG.error(HBaseMarkers.FATAL, "Failed reading new secret key for id '" + keyId + "' from zk", ioe); watcher.abort("Error deserializing key from znode "+path, ioe); } } }
/** * Set bytes into the passed Writable by calling its * {@link Writable#readFields(java.io.DataInput)}. * @param bytes serialized bytes * @param w An empty Writable (usually made by calling the null-arg * constructor). * @return The passed Writable after its readFields has been called fed * by the passed <code>bytes</code> array or IllegalArgumentException * if passed null or an empty <code>bytes</code> array. * @throws IOException e * @throws IllegalArgumentException */ public static Writable getWritable(final byte [] bytes, final Writable w) throws IOException { return getWritable(bytes, 0, bytes.length, w); }
@Test public void testTokenCreation() throws Exception { Token<AuthenticationTokenIdentifier> token = secretManager.generateToken("testuser"); AuthenticationTokenIdentifier ident = new AuthenticationTokenIdentifier(); Writables.getWritable(token.getIdentifier(), ident); assertEquals("Token username should match", "testuser", ident.getUsername()); byte[] passwd = secretManager.retrievePassword(ident); assertTrue("Token password and password from secret manager should match", Bytes.equals(token.getPassword(), passwd)); } // This won't work any more now RpcServer takes Shaded Service. It depends on RPCServer being able to provide a
public static MultiEncodedCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (MultiEncodedCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new MultiEncodedCQKeyValueComparisonFilter()); } catch (IOException e) { throw new DeserializationException(e); } }
public static MultiCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (MultiCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new MultiCQKeyValueComparisonFilter()); } catch (IOException e) { throw new DeserializationException(e); } } }
public static DistinctPrefixFilter parseFrom(final byte[] pbBytes) throws DeserializationException { try { return (DistinctPrefixFilter) Writables.getWritable(pbBytes, new DistinctPrefixFilter()); } catch (IOException e) { throw new DeserializationException(e); } } }
public static SingleCFCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (SingleCFCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new SingleCFCQKeyValueComparisonFilter()); } catch (IOException e) { throw new DeserializationException(e); } } }
public static ColumnProjectionFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (ColumnProjectionFilter)Writables.getWritable(pbBytes, new ColumnProjectionFilter()); } catch (IOException e) { throw new DeserializationException(e); } }
public static MultiCFCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (MultiCFCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new MultiCFCQKeyValueComparisonFilter()); } catch (IOException e) { throw new DeserializationException(e); } } }
public static SingleCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { SingleCQKeyValueComparisonFilter writable = (SingleCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new SingleCQKeyValueComparisonFilter()); return writable; } catch (IOException e) { throw new DeserializationException(e); } } }
public static EncodedQualifiersColumnProjectionFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (EncodedQualifiersColumnProjectionFilter)Writables.getWritable(pbBytes, new EncodedQualifiersColumnProjectionFilter()); } catch (IOException e) { throw new DeserializationException(e); } }
public static SkipScanFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (SkipScanFilter)Writables.getWritable(pbBytes, new SkipScanFilter()); } catch (IOException e) { throw new DeserializationException(e); } }
public static RowKeyComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (RowKeyComparisonFilter)Writables.getWritable(pbBytes, new RowKeyComparisonFilter()); } catch (IOException e) { throw new DeserializationException(e); } } }
Text t = new Text(); ByteBuff buf = block.getBufferWithoutHeader(); if (Writables.getWritable(buf.array(), buf.arrayOffset(), buf.limit(), t) == null) { throw new IOException("Failed to deserialize block " + this + " into a " + t.getClass().getSimpleName());
public static SingleCFCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (SingleCFCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new SingleCFCQKeyValueComparisonFilter()); } catch (IOException e) { throw new DeserializationException(e); } } }
public static MultiCQKeyValueComparisonFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (MultiCQKeyValueComparisonFilter)Writables.getWritable(pbBytes, new MultiCQKeyValueComparisonFilter()); } catch (IOException e) { throw new DeserializationException(e); } } }
public static DistinctPrefixFilter parseFrom(final byte[] pbBytes) throws DeserializationException { try { return (DistinctPrefixFilter) Writables.getWritable(pbBytes, new DistinctPrefixFilter()); } catch (IOException e) { throw new DeserializationException(e); } } }
public static EncodedQualifiersColumnProjectionFilter parseFrom(final byte [] pbBytes) throws DeserializationException { try { return (EncodedQualifiersColumnProjectionFilter)Writables.getWritable(pbBytes, new EncodedQualifiersColumnProjectionFilter()); } catch (IOException e) { throw new DeserializationException(e); } }