Creates a node, with initial values.

<p>
Note: nodes are created recursively (parent nodes are created if needed).
</p>

@param path
@param value
@return
@throws ZooKeeperException
423404
public boolean createNode(String path, String value) throws ZooKeeperException {
        return _create(path, value != null ? value.getBytes(UTF8) : null, CreateMode.PERSISTENT);
    }
1253867
public static UriComponentsBuilder fromPath(String path) {
		UriComponentsBuilder builder = new UriComponentsBuilder();
		builder.path(path);
		return builder;
	}
927951
private JavacEnvironment createEnvironment(String path, String source) throws IOException {
    List<JavaFileObject> inputFiles = new ArrayList<>();
    inputFiles.add(filterJavaFileObject(MemoryFileObject.createJavaFile(path, source)));
    return createEnvironment(Collections.emptyList(), inputFiles, false);
  }
1172505
public Tree putObject(String path, Object value) {
		return putObjectInternal(path, getNodeValue(value), false);
	}
213582
<T extends INode> T addNode(String path, T newNode) throws FileNotFoundException {
    return addNode(path, newNode, false);
  }
460471
public void init() throws IOException {
    try {
      if (zooKeeper.exists(zooKeeperParentPath, false) == null) {
        zooKeeper.create(zooKeeperParentPath, new byte[] { '0' },
            ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
        LOG.info("Created ZNode " + zooKeeperParentPath);
      }
      if (zooKeeper.exists(ledgerParentPath, false) == null) {
        zooKeeper.create(ledgerParentPath, new byte[] { '0' },
            ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
        LOG.info("Created ZNode" + ledgerParentPath);
      }
    } catch (InterruptedException e) {
      interruptedException("Interrupted ensuring that ZNodes " +
          zooKeeperParentPath + " and " + ledgerParentPath + " exist!", e);
    } catch (KeeperException e) {
      keeperException(
          "Unrecoverable ZooKeeper error ensuring that ZNodes "
              + zooKeeperParentPath + " and " + ledgerParentPath + " exist!",
          e);
    }
  }
391515
public String[] getChildren(String path) throws ZooKeeperException {
        try {
            List<String> result = curatorFramework.getChildren().forPath(path);
            return result != null ? result.toArray(ArrayUtils.EMPTY_STRING_ARRAY) : null;
        } catch (KeeperException.NoNodeException e) {
            return null;
        } catch (Exception e) {
            if (e instanceof ZooKeeperException) {
                throw (ZooKeeperException) e;
            } else {
                throw new ZooKeeperException(e);
            }
        }
    }
214765
private void _watchNode(String path) throws ZooKeeperException {
        try {
            cacheNodeWatcher.get(path);
        } catch (Exception e) {
            if (e instanceof ZooKeeperException) {
                throw (ZooKeeperException) e;
            } else {
                throw new ZooKeeperException(e);
            }
        }
    }
975671
public static Node nodeFromXPath(Document parsedXml, String path) {
		XPath xPath = XPathFactory.newInstance().newXPath();
		try {
			return (Node) xPath.evaluate(path, parsedXml.getDocumentElement(),
					XPathConstants.NODE);
		}
		catch (XPathExpressionException exception) {
			LOG.error("Incorrect xpath provided: " + path, exception);
			throw new IllegalArgumentException();
		}
	}
602054
public static MaxEntModel create(String path)
    {
        MaxEntModel m = new MaxEntModel();
        try
        {
            BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
            DataOutputStream out = new DataOutputStream(IOUtil.newOutputStream(path + Predefine.BIN_EXT));
            br.readLine();  // type
            m.correctionConstant = Integer.parseInt(br.readLine());  // correctionConstant
            out.writeInt(m.correctionConstant);
            m.correctionParam = Double.parseDouble(br.readLine());  // getCorrectionParameter
            out.writeDouble(m.correctionParam);
            // label
            int numOutcomes = Integer.parseInt(br.readLine());
            out.writeInt(numOutcomes);
            String[] outcomeLabels = new String[numOutcomes];
            m.outcomeNames = outcomeLabels;
            for (int i = 0; i < numOutcomes; i++)
            {
                outcomeLabels[i] = br.readLine();
                TextUtility.writeString(outcomeLabels[i], out);
            }
            // pattern
            int numOCTypes = Integer.parseInt(br.readLine());
            out.writeInt(numOCTypes);
            int[][] outcomePatterns = new int[numOCTypes][];
            for (int i = 0; i < numOCTypes; i++)
            {
                StringTokenizer tok = new StringTokenizer(br.readLine(), " ");
                int[] infoInts = new int[tok.countTokens()];
                out.writeInt(infoInts.length);
                for (int j = 0; tok.hasMoreTokens(); j++)
                {
                    infoInts[j] = Integer.parseInt(tok.nextToken());
                    out.writeInt(infoInts[j]);
                }
                outcomePatterns[i] = infoInts;
            }
            // feature
            int NUM_PREDS = Integer.parseInt(br.readLine());
            out.writeInt(NUM_PREDS);
            String[] predLabels = new String[NUM_PREDS];
            m.pmap = new DoubleArrayTrie<Integer>();
            TreeMap<String, Integer> tmpMap = new TreeMap<String, Integer>();
            for (int i = 0; i < NUM_PREDS; i++)
            {
                predLabels[i] = br.readLine();
                assert !tmpMap.containsKey(predLabels[i]) : "重复的键： " + predLabels[i] + " 请使用 -Dfile.encoding=UTF-8 训练";
                TextUtility.writeString(predLabels[i], out);
                tmpMap.put(predLabels[i], i);
            }
            m.pmap.build(tmpMap);
            for (Map.Entry<String, Integer> entry : tmpMap.entrySet())
            {
                out.writeInt(entry.getValue());
            }
            m.pmap.save(out);
            // params
            Context[] params = new Context[NUM_PREDS];
            int pid = 0;
            for (int i = 0; i < outcomePatterns.length; i++)
            {
                int[] outcomePattern = new int[outcomePatterns[i].length - 1];
                for (int k = 1; k < outcomePatterns[i].length; k++)
                {
                    outcomePattern[k - 1] = outcomePatterns[i][k];
                }
                for (int j = 0; j < outcomePatterns[i][0]; j++)
                {
                    double[] contextParameters = new double[outcomePatterns[i].length - 1];
                    for (int k = 1; k < outcomePatterns[i].length; k++)
                    {
                        contextParameters[k - 1] = Double.parseDouble(br.readLine());
                        out.writeDouble(contextParameters[k - 1]);
                    }
                    params[pid] = new Context(outcomePattern, contextParameters);
                    pid++;
                }
            }
            // prior
            m.prior = new UniformPrior();
            m.prior.setLabels(outcomeLabels);
            // eval
            m.evalParams = new EvalParameters(params, m.correctionParam, m.correctionConstant, outcomeLabels.length);
            out.close();
        }
        catch (Exception e)
        {
            logger.severe("从" + path + "加载最大熵模型失败！" + TextUtility.exceptionToString(e));
            return null;
        }
        return m;
    }
925767
private void createParents(String path, List<ACL> acl)
    throws InterruptedException, KeeperException

  {
    path = PathUtils.getParentPath(adjustPath(path));
    path = PathUtils.removeTrailingSlash(path);

    List<String> paths = new ArrayList<String>();

    while(!path.equals("") && getZk().exists(path, false) == null)
    {
      paths.add(path);

      path = PathUtils.getParentPath(path);
      path = PathUtils.removeTrailingSlash(path);
    }

    Collections.reverse(paths);

    for(String p : paths)
    {
      try
      {
        getZk().create(p,
                       null,
                       acl,
                       CreateMode.PERSISTENT);
      }
      catch(KeeperException.NodeExistsException e)
      {
        // ok we continue...
        if(log.isDebugEnabled())
          log.debug("parent already exists " + p);
      }
    }
  }
412605
public function set($path, $value) {
		if (!$this->zookeeper->exists($path)) {
			$this->makePath($path);
			$this->makeNode($path, $value);
		} else {
			$this->zookeeper->set($path, $value);
		}
	}
286979
public INode getNode(final INode node, String path) {
		final List<String> split = Strings.split(path, '/');
		INode result = node;
		for (String string : split) {
			String trimmed = string.trim();
			if (trimmed.length() > 0) {
				if ("..".equals(trimmed)) {
					if (result.getParent() == null)
						throw new IllegalStateException("node has no parent");
					result = result.getParent();
				} else {
					int index = Integer.parseInt(string);
					if (index >= 0) {
						INode child = ((ICompositeNode) result).getFirstChild();
						while(index > 0) {
							child = child.getNextSibling();
							index--;
						}
						result = child;
					}
				}
			}
		}
		return result;
	}
759937
private PathQueryNode createPathQueryNode(SimpleNode node) {
        root.setLocationNode(factory.createPathQueryNode(root));
        node.childrenAccept(this, root.getLocationNode());
        return root.getLocationNode();
    }
933487
public boolean setData(String path, String value) throws ZooKeeperException {
        return setData(path, value, false);
    }
230486
public static String createParticipantNode(ZooKeeper zk, String dir, String prefix, byte[] data)
        throws KeeperException, InterruptedException
    {
        createRootIfNotExist(zk, dir);

        String node = zk.create(ZKUtil.joinZKPath(dir, prefix + "_"), data,
                                Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);

        // Unlock the dir as initialized
        zk.setData(dir, new byte[] {INITIALIZED}, -1);

        return node;
    }
1232035
private void addChildNode(final Builder builder, final String name, final Object value) {
        assert !(value instanceof List);

        final Builder childBuilder = new Builder();
        // Set the name of the child node.
        childBuilder.name(name);
        // Set the value of the child node.
        final ImmutableNode childNode = toNode(childBuilder, value);
        // Add the node to the children of the node being built.
        builder.addChild(childNode);
    }