Class CuratorOperations


  • public class CuratorOperations
    extends java.lang.Object
    Factory for transactional ZooKeeper operations. This mirrors the operations which are actually available in Curator, which unfortunately does not include variants that deletes children, creates parents etc. in a single operation.
    Author:
    Ulf Lilleengen, bratseth
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static CuratorOperation create​(java.lang.String path)
      Creates this path with no data.
      static CuratorOperation create​(java.lang.String path, byte[] bytes)
      Creates this path with data.
      static CuratorOperation delete​(java.lang.String path)
      Deletes this path.
      static java.util.List<CuratorOperation> deleteAll​(java.lang.String path, Curator curator)
      Returns operations deleting this path and everything below it, in an order where a parent is ordered after all its children, such that the operations will succeed when executed in the returned order.
      static CuratorOperation setData​(java.lang.String path, byte[] bytes)
      Sets data at this path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CuratorOperations

        public CuratorOperations()
    • Method Detail

      • setData

        public static CuratorOperation setData​(java.lang.String path,
                                               byte[] bytes)
        Sets data at this path.
        Throws:
        java.lang.IllegalStateException - in check() if the path does not exist
      • create

        public static CuratorOperation create​(java.lang.String path,
                                              byte[] bytes)
        Creates this path with data.
        Throws:
        java.lang.IllegalStateException - in check() if the parent does not exist
      • create

        public static CuratorOperation create​(java.lang.String path)
        Creates this path with no data.
        Throws:
        java.lang.IllegalStateException - in check() if the parent does not exist
      • delete

        public static CuratorOperation delete​(java.lang.String path)
        Deletes this path. This does not delete children.
        Throws:
        java.lang.IllegalStateException - in check() if the path does not exist.
      • deleteAll

        public static java.util.List<CuratorOperation> deleteAll​(java.lang.String path,
                                                                 Curator curator)
        Returns operations deleting this path and everything below it, in an order where a parent is ordered after all its children, such that the operations will succeed when executed in the returned order. This does not fail, but returns an empty list if the path does not exist.