Class ModeledFrameworkImpl<T>

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> ModeledFrameworkImpl<T> build​(AsyncCuratorFramework client, ModelSpec<T> model, WatchMode watchMode, java.util.function.UnaryOperator<org.apache.zookeeper.WatchedEvent> watcherFilter, org.apache.curator.framework.api.UnhandledErrorListener unhandledErrorListener, java.util.function.UnaryOperator<org.apache.curator.framework.api.CuratorEvent> resultFilter, java.util.Set<ModeledOptions> modeledOptions)  
      CachedModeledFramework<T> cached()
      Use an internally created cache as a front for this modeled instance.
      CachedModeledFramework<T> cached​(java.util.concurrent.ExecutorService executor)
      Same as ModeledFramework.cached() but allows for providing an executor service
      AsyncStage<org.apache.zookeeper.data.Stat> checkExists()
      Check to see if the ZNode at this instance's path exists
      org.apache.curator.framework.api.transaction.CuratorOp checkExistsOp()
      Check exists operation instance that can be passed among other operations to ModeledFramework.inTransaction(java.util.List) to be executed as a single transaction.
      org.apache.curator.framework.api.transaction.CuratorOp checkExistsOp​(int version)
      Check exists operation instance that can be passed among other operations to ModeledFramework.inTransaction(java.util.List) to be executed as a single transaction.
      ModeledFramework<T> child​(java.lang.Object child)
      Return a new Modeled Curator instance with all the same options but applying to the given child node of this Modeled Curator's path.
      AsyncStage<java.util.List<ZPath>> children()
      Return the child paths of this instance's path (in no particular order)
      AsyncStage<java.util.List<ZNode<T>>> childrenAsZNodes()
      Return the child paths of this instance's path (in no particular order) and deserialize into a models.
      org.apache.curator.framework.api.transaction.CuratorOp createOp​(T model)
      Create operation instance that can be passed among other operations to ModeledFramework.inTransaction(java.util.List) to be executed as a single transaction.
      AsyncStage<java.lang.Void> delete()
      Delete the ZNode at this instance's path passing -1 for the delete version
      AsyncStage<java.lang.Void> delete​(int version)
      Delete the ZNode at this instance's path passing the given delete version
      org.apache.curator.framework.api.transaction.CuratorOp deleteOp()
      Delete operation instance that can be passed among other operations to ModeledFramework.inTransaction(java.util.List) to be executed as a single transaction.
      org.apache.curator.framework.api.transaction.CuratorOp deleteOp​(int version)
      Delete operation instance that can be passed among other operations to ModeledFramework.inTransaction(java.util.List) to be executed as a single transaction.
      AsyncStage<java.util.List<org.apache.curator.framework.api.transaction.CuratorTransactionResult>> inTransaction​(java.util.List<org.apache.curator.framework.api.transaction.CuratorOp> operations)
      Invoke ZooKeeper to commit the given operations as a single transaction.
      static boolean isCompressed​(java.util.Set<CreateOption> createOptions)  
      ModelSpec<T> modelSpec()
      Return the model being used
      ModeledFramework<T> parent()
      Return a new Modeled Curator instance with all the same options but applying to the parent node of this Modeled Curator's path.
      AsyncStage<T> read()
      Read the ZNode at this instance's path and deserialize into a model
      AsyncStage<T> read​(org.apache.zookeeper.data.Stat storingStatIn)
      Read the ZNode at this instance's path and deserialize into a model
      AsyncStage<ZNode<T>> readAsZNode()
      Read the ZNode at this instance's path and deserialize into a model
      AsyncStage<java.lang.String> set​(T item)
      Create (or update depending on build options) a ZNode at this instance's path with a serialized version of the given model
      AsyncStage<java.lang.String> set​(T item, int version)
      Create (or update depending on build options) a ZNode at this instance's path with a serialized version of the given model
      AsyncStage<java.lang.String> set​(T item, org.apache.zookeeper.data.Stat storingStatIn)
      Create (or update depending on build options) a ZNode at this instance's path with a serialized form of the given model
      AsyncStage<java.lang.String> set​(T item, org.apache.zookeeper.data.Stat storingStatIn, int version)
      Create (or update depending on build options) a ZNode at this instance's path with a serialized form of the given model
      AsyncCuratorFramework unwrap()
      Returns the client that was originally passed to ModeledFramework.wrap(org.apache.curator.x.async.AsyncCuratorFramework, ModelSpec) or the builder.
      AsyncStage<org.apache.zookeeper.data.Stat> update​(T item)
      Update the ZNode at this instance's path with a serialized form of the given model passing "-1" for the update version
      AsyncStage<org.apache.zookeeper.data.Stat> update​(T item, int version)
      Update the ZNode at this instance's path with a serialized form of the given model passing the given update version
      org.apache.curator.framework.api.transaction.CuratorOp updateOp​(T model)
      Update operation instance that can be passed among other operations to ModeledFramework.inTransaction(java.util.List) to be executed as a single transaction.
      org.apache.curator.framework.api.transaction.CuratorOp updateOp​(T model, int version)
      Create operation instance that can be passed among other operations to ModeledFramework.inTransaction(java.util.List) to be executed as a single transaction.
      VersionedModeledFramework<T> versioned()
      Return mutator APIs that work with Versioned containers
      ModeledFramework<T> withPath​(ZPath path)
      Return a Modeled Curator instance with all the same options but using the given path.
      • Methods inherited from class java.lang.Object

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

      • build

        public static <T> ModeledFrameworkImpl<T> build​(AsyncCuratorFramework client,
                                                        ModelSpec<T> model,
                                                        WatchMode watchMode,
                                                        java.util.function.UnaryOperator<org.apache.zookeeper.WatchedEvent> watcherFilter,
                                                        org.apache.curator.framework.api.UnhandledErrorListener unhandledErrorListener,
                                                        java.util.function.UnaryOperator<org.apache.curator.framework.api.CuratorEvent> resultFilter,
                                                        java.util.Set<ModeledOptions> modeledOptions)
      • set

        public AsyncStage<java.lang.String> set​(T item)
        Description copied from interface: ModeledFramework
        Create (or update depending on build options) a ZNode at this instance's path with a serialized version of the given model
        Specified by:
        set in interface ModeledFramework<T>
        Parameters:
        item - model to write
        Returns:
        AsyncStage
        See Also:
        AsyncStage
      • set

        public AsyncStage<java.lang.String> set​(T item,
                                                org.apache.zookeeper.data.Stat storingStatIn)
        Description copied from interface: ModeledFramework
        Create (or update depending on build options) a ZNode at this instance's path with a serialized form of the given model
        Specified by:
        set in interface ModeledFramework<T>
        Parameters:
        item - model to write
        storingStatIn - the stat for the new ZNode is stored here
        Returns:
        AsyncStage
        See Also:
        AsyncStage
      • set

        public AsyncStage<java.lang.String> set​(T item,
                                                int version)
        Description copied from interface: ModeledFramework
        Create (or update depending on build options) a ZNode at this instance's path with a serialized version of the given model
        Specified by:
        set in interface ModeledFramework<T>
        Parameters:
        item - model to write
        version - if data is being set instead of creating the node, the data version to use
        Returns:
        AsyncStage
        See Also:
        AsyncStage
      • set

        public AsyncStage<java.lang.String> set​(T item,
                                                org.apache.zookeeper.data.Stat storingStatIn,
                                                int version)
        Description copied from interface: ModeledFramework
        Create (or update depending on build options) a ZNode at this instance's path with a serialized form of the given model
        Specified by:
        set in interface ModeledFramework<T>
        Parameters:
        item - model to write
        storingStatIn - the stat for the new ZNode is stored here
        version - if data is being set instead of creating the node, the data version to use
        Returns:
        AsyncStage
        See Also:
        AsyncStage
      • read

        public AsyncStage<T> read​(org.apache.zookeeper.data.Stat storingStatIn)
        Description copied from interface: ModeledFramework
        Read the ZNode at this instance's path and deserialize into a model
        Specified by:
        read in interface ModeledFramework<T>
        Parameters:
        storingStatIn - the stat for the new ZNode is stored here
        Returns:
        AsyncStage
        See Also:
        AsyncStage
      • update

        public AsyncStage<org.apache.zookeeper.data.Stat> update​(T item)
        Description copied from interface: ModeledFramework
        Update the ZNode at this instance's path with a serialized form of the given model passing "-1" for the update version
        Specified by:
        update in interface ModeledFramework<T>
        Parameters:
        item - model to write
        Returns:
        AsyncStage
        See Also:
        AsyncStage
      • update

        public AsyncStage<org.apache.zookeeper.data.Stat> update​(T item,
                                                                 int version)
        Description copied from interface: ModeledFramework
        Update the ZNode at this instance's path with a serialized form of the given model passing the given update version
        Specified by:
        update in interface ModeledFramework<T>
        Parameters:
        item - model to write
        version - update version to use
        Returns:
        AsyncStage
        See Also:
        AsyncStage
      • delete

        public AsyncStage<java.lang.Void> delete​(int version)
        Description copied from interface: ModeledFramework
        Delete the ZNode at this instance's path passing the given delete version
        Specified by:
        delete in interface ModeledFramework<T>
        Parameters:
        version - update version to use
        Returns:
        AsyncStage
        See Also:
        AsyncStage
      • childrenAsZNodes

        public AsyncStage<java.util.List<ZNode<T>>> childrenAsZNodes()
        Description copied from interface: ModeledFramework
        Return the child paths of this instance's path (in no particular order) and deserialize into a models. IMPORTANT: this results in a ZooKeeper query for each child node returned. i.e. if the initial children() call returns 10 nodes an additional 10 ZooKeeper queries are made to get the data. Note: cannot be used if any of the ModeledFrameworkBuilder.watched() modes are used.
        Specified by:
        childrenAsZNodes in interface ModeledFramework<T>
        Returns:
        AsyncStage
        See Also:
        AsyncStage
      • parent

        public ModeledFramework<T> parent()
        Description copied from interface: ModeledFramework

        Return a new Modeled Curator instance with all the same options but applying to the parent node of this Modeled Curator's path. E.g. if this Modeled Curator instance applies to "/a/b/c", calling modeled.parent() returns an instance that applies to "/a/b".

        The replacement is the toString() value of child or, if it implements NodeName, the value of nodeName().

        Specified by:
        parent in interface ModeledFramework<T>
        Returns:
        new Modeled Curator instance
      • child

        public ModeledFramework<T> child​(java.lang.Object child)
        Description copied from interface: ModeledFramework

        Return a new Modeled Curator instance with all the same options but applying to the given child node of this Modeled Curator's path. E.g. if this Modeled Curator instance applies to "/a/b", calling modeled.at("c") returns an instance that applies to "/a/b/c".

        The replacement is the toString() value of child or, if it implements NodeName, the value of nodeName().

        Specified by:
        child in interface ModeledFramework<T>
        Parameters:
        child - child node.
        Returns:
        new Modeled Curator instance
      • withPath

        public ModeledFramework<T> withPath​(ZPath path)
        Description copied from interface: ModeledFramework
        Return a Modeled Curator instance with all the same options but using the given path.
        Specified by:
        withPath in interface ModeledFramework<T>
        Parameters:
        path - new path
        Returns:
        new Modeled Curator instance
      • isCompressed

        public static boolean isCompressed​(java.util.Set<CreateOption> createOptions)
      • createOp

        public org.apache.curator.framework.api.transaction.CuratorOp createOp​(T model)
        Description copied from interface: ModeledFramework
        Create operation instance that can be passed among other operations to ModeledFramework.inTransaction(java.util.List) to be executed as a single transaction. Note: due to ZooKeeper transaction limits, this is a _not_ a "set or update" operation but only a create operation and will generate an error if the node already exists.
        Specified by:
        createOp in interface ModeledFramework<T>
        Parameters:
        model - the model
        Returns:
        operation
      • updateOp

        public org.apache.curator.framework.api.transaction.CuratorOp updateOp​(T model,
                                                                               int version)
        Description copied from interface: ModeledFramework
        Create operation instance that can be passed among other operations to ModeledFramework.inTransaction(java.util.List) to be executed as a single transaction.
        Specified by:
        updateOp in interface ModeledFramework<T>
        Parameters:
        model - the model
        version - update version to use
        Returns:
        operation
      • inTransaction

        public AsyncStage<java.util.List<org.apache.curator.framework.api.transaction.CuratorTransactionResult>> inTransaction​(java.util.List<org.apache.curator.framework.api.transaction.CuratorOp> operations)
        Description copied from interface: ModeledFramework
        Invoke ZooKeeper to commit the given operations as a single transaction.
        Specified by:
        inTransaction in interface ModeledFramework<T>
        Parameters:
        operations - operations that make up the transaction.
        Returns:
        AsyncStage instance for managing the completion