public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor )
throws IOException
{
if( !blobStore.blobExists( container, ref.identity() ) )
{
throw new EntityNotFoundException( ref );
}
return new StringWriter()
{
@Override
public void close()
throws IOException
{
super.close();
Blob blob = blobStore.blobBuilder( ref.identity() )
.payload( ByteSource.wrap( toString().getBytes( UTF_8 ) ) )
.build();
blobStore.putBlob( container, blob );
}
};
}
@Override
public void removeEntity( EntityReference ref, EntityDescriptor entityDescriptor )
throws EntityNotFoundException
{
if( !blobStore.blobExists( container, ref.identity() ) )
{
throw new EntityNotFoundException( ref );
}
blobStore.removeBlob( container, ref.identity() );
}
}
);