public void createOrUpdatePlan(Plan plan) throws WorkerDaoException {
    try {
      createZookeeperBase();
      Stat s = this.framework.getCuratorFramework().checkExists().forPath(PLANS_ZK + "/" + plan.getName());
      if (s != null) {
        framework.getCuratorFramework().setData().withVersion(s.getVersion())
                .forPath(PLANS_ZK + "/" + plan.getName(), serializePlan(plan));
      } else {
        framework.getCuratorFramework().create().withMode(CreateMode.PERSISTENT)
                .withACL(Ids.OPEN_ACL_UNSAFE)
                .forPath(PLANS_ZK + "/" + plan.getName(), serializePlan(plan));
      }
    } catch (Exception e) {
      LOGGER.warn(e);
      throw new WorkerDaoException(e);
    }
  }
public void createOrUpdatePlan ( Plan plan ) throws WorkerDaoException { try { createZookeeperBase ( ) ; Stat s = this . framework . getCuratorFramework ( ) . checkExists ( ) . forPath ( PLANS_ZK + "/" + plan . getName ( ) ) ; if ( s != null ) { framework . getCuratorFramework ( ) . setData ( ) . withVersion ( s . getVersion ( ) ) . forPath ( PLANS_ZK + "/" + plan . getName ( ) , serializePlan ( plan ) ) ; } else { framework . getCuratorFramework ( ) . create ( ) . withMode ( CreateMode . PERSISTENT ) . withACL ( Ids . OPEN_ACL_UNSAFE ) . forPath ( PLANS_ZK + "/" + plan . getName ( ) , serializePlan ( plan ) ) ; } } catch ( Exception e ) { LOGGER . warn ( e ) ; throw new WorkerDaoException ( e ) ; } }
Creates or updates a plan in zookeeper.
@param plan
@throws WorkerDaoException if malformed plan or communication error with zookeeper