@Override public boolean exists(final NamespacedEntityId entityId) throws IOException { validate(entityId); return Transactionals.execute(transactional, context -> { byte[] principalBytes = getTable(context).get(createRowKey(entityId), COL); return principalBytes != null; }, IOException.class); }
DefaultOwnerStore.setupDatasets(datasetFramework);
@Override public void delete(final NamespacedEntityId entityId) throws IOException { validate(entityId); Transactionals.execute(transactional, context -> { getTable(context).delete(createRowKey(entityId)); }, IOException.class); }
@Override public void delete(final NamespacedEntityId entityId) throws IOException { validate(entityId); Transactionals.execute(transactional, context -> { getTable(context).delete(createRowKey(entityId)); }, IOException.class); }
@Override public boolean exists(final NamespacedEntityId entityId) throws IOException { validate(entityId); return Transactionals.execute(transactional, context -> { byte[] principalBytes = getTable(context).get(createRowKey(entityId), COL); return principalBytes != null; }, IOException.class); }
@Override @Nullable public KerberosPrincipalId getOwner(final NamespacedEntityId entityId) throws IOException { validate(entityId); return Transactionals.execute(transactional, context -> { byte[] principalBytes = getTable(context).get(createRowKey(entityId), COL); return principalBytes == null ? null : new KerberosPrincipalId(Bytes.toString(principalBytes)); }, IOException.class); }
@Override @Nullable public KerberosPrincipalId getOwner(final NamespacedEntityId entityId) throws IOException { validate(entityId); return Transactionals.execute(transactional, context -> { byte[] principalBytes = getTable(context).get(createRowKey(entityId), COL); return principalBytes == null ? null : new KerberosPrincipalId(Bytes.toString(principalBytes)); }, IOException.class); }
@Override public void add(final NamespacedEntityId entityId, final KerberosPrincipalId kerberosPrincipalId) throws IOException, AlreadyExistsException { validate(entityId, kerberosPrincipalId); Transactionals.execute(transactional, context -> { Table metaTable = getTable(context); // make sure that an owner does not already exists byte[] principalBytes = metaTable.get(createRowKey(entityId), COL); if (principalBytes != null) { throw new AlreadyExistsException(entityId, String.format("Owner information already exists for entity '%s'.", entityId)); } metaTable.put(createRowKey(entityId), COL, Bytes.toBytes(kerberosPrincipalId.getPrincipal())); }, IOException.class, AlreadyExistsException.class); }
@Override public void add(final NamespacedEntityId entityId, final KerberosPrincipalId kerberosPrincipalId) throws IOException, AlreadyExistsException { validate(entityId, kerberosPrincipalId); Transactionals.execute(transactional, context -> { Table metaTable = getTable(context); // make sure that an owner does not already exists byte[] principalBytes = metaTable.get(createRowKey(entityId), COL); if (principalBytes != null) { throw new AlreadyExistsException(entityId, String.format("Owner information already exists for entity '%s'.", entityId)); } metaTable.put(createRowKey(entityId), COL, Bytes.toBytes(kerberosPrincipalId.getPrincipal())); }, IOException.class, AlreadyExistsException.class); }