Creates <code>LocationStepQueryNode</code>s from a <code>path</code>.

@param path      the path pattern
@param operation the type of the parent node
513660
private void createPathQuery(String path, int operation)
   {
      MergingPathQueryNode pathNode =
         new MergingPathQueryNode(operation, factory.createPathQueryNode(null).getValidJcrSystemNodeTypeNames());
      pathNode.setAbsolute(true);

      if (path.equals("/"))
      {
         pathNode.addPathStep(factory.createLocationStepQueryNode(pathNode));
         pathConstraints.add(pathNode);
         return;
      }

      String[] names = path.split("/");

      for (int i = 0; i < names.length; i++)
      {
         if (names[i].length() == 0)
         {
            if (i == 0)
            {
               // root
               pathNode.addPathStep(factory.createLocationStepQueryNode(pathNode));
            }
            else
            {
               // descendant '//' -> invalid path
               // todo throw or ignore?
               // we currently do not throw and add location step for an
               // empty name (which is basically the root node)
               pathNode.addPathStep(factory.createLocationStepQueryNode(pathNode));
            }
         }
         else
         {
            int idx = names[i].indexOf('[');
            String name;
            int index = LocationStepQueryNode.NONE;
            if (idx > -1)
            {
               // contains index
               name = names[i].substring(0, idx);
               String suffix = names[i].substring(idx);
               String indexStr = suffix.substring(1, suffix.length() - 1);
               if (indexStr.equals("%"))
               {
                  // select all same name siblings
                  index = LocationStepQueryNode.NONE;
               }
               else
               {
                  try
                  {
                     index = Integer.parseInt(indexStr);
                  }
                  catch (NumberFormatException e)
                  {
                     log.warn("Unable to parse index for path element: " + names[i]);
                  }
               }
               if (name.equals("%"))
               {
                  name = null;
               }
            }
            else
            {
               // no index specified
               // - index defaults to 1 if there is an explicit name test
               // - index defaults to NONE if name test is %
               name = names[i];
               if (name.equals("%"))
               {
                  name = null;
               }
               else
               {
                  index = 1;
               }
            }
            InternalQName qName = null;
            if (name != null)
            {
               try
               {
                  qName = resolver.parseJCRName(name).getInternalName();
               }
               catch (NamespaceException e)
               {
                  throw new IllegalArgumentException("Illegal name: " + name, e);
               }
               catch (RepositoryException e)
               {
                  throw new IllegalArgumentException("Illegal name: " + name, e);
               }

            }
            // if name test is % this means also search descendants
            boolean descendant = name == null;
            LocationStepQueryNode step = factory.createLocationStepQueryNode(pathNode);
            step.setNameTest(qName);
            step.setIncludeDescendants(descendant);
            if (index > 0)
            {
               step.setIndex(index);
            }
            pathNode.addPathStep(step);
         }
      }
      pathConstraints.add(pathNode);
   }
365930
@Nullable
    private Node<V> findNode(Node<V> node, String path, int begin, boolean exact) {
        final int next;
        switch (node.type()) {
            case EXACT:
                final int len = node.path().length();
                if (!path.regionMatches(begin, node.path(), 0, len)) {
                    // A given path does not start with the path of this node.
                    return null;
                }
                if (len == path.length() - begin) {
                    // Matched. No more input characters.
                    // If this node is not added by a user, then we should return a catch-all child
                    // if it exists. But if 'exact' is true, we just return this node to make caller
                    // have the exact matched node.
                    return exact || node.hasValues() || !node.hasCatchAllChild() ? node
                                                                                 : node.catchAllChild();
                }
                next = begin + len;
                break;
            case PARAMETER:
                // Consume characters until the delimiter '/' as a path variable.
                final int delim = path.indexOf('/', begin);
                if (delim < 0) {
                    // No more delimiter.
                    return node;
                }
                if (path.length() == delim + 1) {
                    final Node<V> trailingSlashNode = node.child('/');
                    return trailingSlashNode != null ? trailingSlashNode : node;
                }
                next = delim;
                break;
            default:
                throw new Error("Should not reach here");
        }

        // The path is not matched to this node, but it is possible to be matched on my children
        // because the path starts with the path of this node. So we need to visit children as the
        // following sequences:
        //  - The child which is able to consume the next character of the path.
        //  - The child which has a path variable.
        //  - The child which is able to consume every remaining path. (catch-all)

        Node<V> child = node.child(path.charAt(next));
        if (child != null) {
            final Node<V> found = findNode(child, path, next, exact);
            if (found != null) {
                return found;
            }
        }
        child = node.parameterChild();
        if (child != null) {
            final Node<V> found = findNode(child, path, next, exact);
            if (found != null) {
                return found;
            }
        }
        child = node.catchAllChild();
        if (child != null) {
            return child;
        }

        return null;
    }
829240
public Object visit(QueryRootNode node, Object data) throws RepositoryException {
        StringBuilder sb = (StringBuilder) data;
        try {
            sb.append("SELECT");

            InternalQName[] selectProps = node.getSelectProperties();
            if (selectProps.length == 0) {
                sb.append(" *");
            } else {
                String comma = "";
                for (int i = 0; i < selectProps.length; i++) {
                    sb.append(comma).append(" ");
                    appendName(selectProps[i], resolver, sb);
                    comma = ",";
                }
            }

            sb.append(" FROM");

            // node type restrictions are within predicates of location nodes
            // therefore we write the where clause first to a temp string to
            // collect the node types.
            StringBuilder tmp = new StringBuilder();
            LocationStepQueryNode[] steps = node.getLocationNode().getPathSteps();
            QueryNode[] predicates = steps[steps.length - 1].getPredicates();
            // are there any relevant predicates?
            for (int i = 0; i < predicates.length; i++) {
                if (predicates[i].getType() != QueryNode.TYPE_NODETYPE) {
                    tmp.append(" WHERE ");
                }
            }
            String and = "";
            for (int i = 0; i < predicates.length; i++) {
                if (predicates[i].getType() != QueryNode.TYPE_NODETYPE) {
                    tmp.append(and);
                    and = " AND ";
                }
                predicates[i].accept(this, tmp);
            }

            // node types have been collected by now
            String comma = "";
            int ntCount = 0;
            for (Iterator<InternalQName> it = nodeTypes.iterator(); it.hasNext(); ntCount++) {
               InternalQName nt = it.next();
                sb.append(comma).append(" ");
                appendName(nt, resolver, sb);
                comma = ",";
            }

            if (ntCount == 0) {
                sb.append(" ");
                sb.append(resolver.createJCRName(Constants.NT_BASE).getAsString());
            }

            // append WHERE clause
            sb.append(tmp.toString());

            if (steps.length == 2
                    && steps[1].getIncludeDescendants()
                    && steps[1].getNameTest() == null) {
                // then this query selects all paths
            } else if (steps.length == 1
                    && steps[0].getIncludeDescendants()
                    && steps[0].getNameTest() == null) {
                // then this query selects all paths
            } else {
                if (predicates.length > 0) {
                    sb.append(" AND ");
                } else {
                    sb.append(" WHERE ");
                }
                node.getLocationNode().accept(this, sb);
            }
        } catch (NamespaceException e) {
            exceptions.add(e);
        }

        if (node.getOrderNode() != null) {
            node.getOrderNode().accept(this, sb);
        }

        return sb;
    }
334203
private void parseLocationStep(String selector,
                                 int start,
                                 int stepEnd)
    throws InvalidXPathSyntaxException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(cclass,
               "parseLocationStep",
               "selector: " + selector + ", start: " + start + ", end: " + stepEnd);

    int stepStart = start;
    int posOpenBracket = selector.indexOf("[", start);
    if(posOpenBracket > stepEnd || posOpenBracket == -1)
    {
      // Set posOpenBracket to avoid further processing
      posOpenBracket = -1;
      // No brackets so process whole of the location step
      String step = selector.substring(start,stepEnd);
      // Set the full name into the identifier. The full name is used in position assignment when
      // determining uniqueness of names. Only a full name will do.
      String full = selector.substring(0,stepEnd);
      // Add an IdentifierImpl for the location step to the array list
      selOperands.add(createIdentifierForSubExpression(step, full, true, false));      
    }
    
    int posCloseBracket = selector.indexOf("]", start); 
 
    boolean wrapWholeStep = false;
    boolean foundPredicates = false;
    ArrayList tempSelOperands = new ArrayList();
    while (posOpenBracket >= 0)
    {
      foundPredicates = true;
      if(posCloseBracket < posOpenBracket)
      {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
          tc.exit(this,cclass, "parseLocationStep", "bracket error"); 
        
        InvalidXPathSyntaxException iex = new InvalidXPathSyntaxException(selector);
        FFDC.processException(cclass,
            "com.ibm.ws.sib.matchspace.selector.impl.XPath10ParserImpl",
            iex,
            "1:372:1.16"); 
        
        throw iex;
      }
      else
      {
        // The full selector path up to this point
        String full = selector.substring(0,posOpenBracket);
        
        // Factor out the location step first but be careful we may have a predicate
        if(start != posOpenBracket)
        {
          // Go ahead and deal with the location step
          String step = selector.substring(start,posOpenBracket);
          // Add an IdentifierImpl for the location step to the array list
          tempSelOperands.add(createIdentifierForSubExpression(step, full, true, false));    
        }
        
        // Now parse the predicate
        String predicate = selector.substring(posOpenBracket + 1,posCloseBracket);
        Selector parsedPredicate = parsePredicate(predicate, full);
        
        // Check whether we were able to parse
        if(parsedPredicate == null)
        {
          // Unable to parse the expression, so we need to wrap the entire step
//          tempSelOperands.add(createIdentifierForSubExpression(predicate, false));
          wrapWholeStep = true;
          break;
        }
        else
        {
          // we were able to parse the expression with the MatchParser
          // Check that the predicate has Simple tests only
          if(!Matching.isSimple(parsedPredicate))
          {
            wrapWholeStep = true;
            break;
          }
          parsedPredicate.setExtended();
          tempSelOperands.add(parsedPredicate);
        }       
      }
        
      // Move to beyond the close bracket
      start = posCloseBracket+1;
      //Are there any more brackets?
      posOpenBracket = selector.indexOf("[", start);
      posCloseBracket = selector.indexOf("]", start); 
      
      // Have we found the last bracket in this location step?
      if(posOpenBracket > stepEnd || posOpenBracket == -1)
      {
        // Set posOpenBracket to avoid further processing
        posOpenBracket = -1; 
      }
    } // eof while
    
    if(foundPredicates)
    {
      // If we determined that we cannot parse this location step, then wrap it
      if(wrapWholeStep)
        wrapLocationStep(selector, stepStart,stepEnd);
      else
      {
        // PostProcessing here
        selOperands.addAll(tempSelOperands);
      }
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(this,cclass, "parseLocationStep");      
  }
1129748
private void addOp(String op, String path, String value) {
        if (this.operations == null) {
            this.operations = new JsonArray();
        }

        this.operations.add(new JsonObject()
                .add("op", op)
                .add("path", path)
                .add("value", value));
    }
831974
@Override
    public ExternalStorageLocation getLocation(Operation operation, PayloadType payloadType, String path) {
        String uri;
        switch (payloadType) {
            case WORKFLOW_INPUT:
            case WORKFLOW_OUTPUT:
                uri = "workflow";
                break;
            case TASK_INPUT:
            case TASK_OUTPUT:
                uri = "tasks";
                break;
            default:
                throw new ConductorClientException(String.format("Invalid payload type: %s for operation: %s", payloadType.toString(), operation.toString()));
        }
        return clientBase.getForEntity(String.format("%s/externalstoragelocation", uri), new Object[]{"path", path, "operation", operation.toString(), "payloadType", payloadType.toString()}, ExternalStorageLocation.class);
    }
914923
public static ModelNode createBatchRequest(ModelNode... steps) {
        final ModelNode composite = new ModelNode();
        composite.get(OPERATION).set(BATCH);
        composite.get(ADDRESS).setEmptyList();
        final ModelNode stepsNode = composite.get(BATCH_STEPS);
        for (ModelNode step : steps) {
            if (step != null) {
                stepsNode.add(step);
            }
        }
        return composite;
    }
1229733
protected ILocationInResource createLocationInResourceFor(ILocationData location, AbstractTraceRegion traceRegion) {
		SourceRelativeURI path = location.getSrcRelativePath();
		if (path == null)
			path = traceRegion.getAssociatedSrcRelativePath();
		if (path == null)
			return null;
		return createLocationInResource(location, path);
	}
661563
public OqlBuilder<T> join(final String joinMode, final String path, final String alias) {
    from = concat(from, " ", joinMode, " join ", path, " ", alias);
    return this;
  }
626589
@SuppressWarnings("unchecked")
    protected <A, E extends SimpleExpression<? super A>> ListPath<A, E> createList(String property, Class<? super A> type, Class<? super E> queryType, PathInits inits) {
        return add(new ListPath<A, E>(type, (Class) queryType, forProperty(property), inits));
    }
673281
public static <A> CollQuery<A> from(Path<A> path, Iterable<A> col) {
        return new CollQuery<Void>().from(path, col).select(path);
    }
305188
public static RegionOperationId of(String project, String region, String operation) {
    return new RegionOperationId(project, region, operation);
  }
1343235
void createZKDirectory(String path) {
        try {
            try {
                m_zk.create(path, new byte[0],
                            Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            } catch (KeeperException e) {
                if (e.code() != Code.NODEEXISTS) {
                    throw e;
                }
            }
        } catch (Exception e) {
            VoltDB.crashGlobalVoltDB("Failed to create Zookeeper node: " + e.getMessage(),
                                     false, e);
        }
    }
438062
public static PathMappingResult of(String path, @Nullable String query, Map<String, String> rawPathParams) {
        return of(path, query, rawPathParams, LOWEST_SCORE);
    }
931907
public String buildWhere(String field, Object value, String operation) {
		return CoreSQLUtils.quoteWrap(field) + " "
				+ (value != null ? operation + " ?" : "IS NULL");
	}
799682
public void createPath(String pathName, String pathValue, String requestType) {
        try {
            int type = getRequestTypeFromString(requestType);
            String url = BASE_PATH;
            BasicNameValuePair[] params = {
                new BasicNameValuePair("pathName", pathName),
                new BasicNameValuePair("path", pathValue),
                new BasicNameValuePair("requestType", String.valueOf(type)),
                new BasicNameValuePair("profileIdentifier", this._profileName)
            };

            JSONObject response = new JSONObject(doPost(BASE_PATH, params));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
1077023
protected void addRequiredPath(OperationRequestAddress requiredPath) {
        if(requiredPath == null) {
            throw new IllegalArgumentException("Required path can't be null.");
        }
        // there perhaps could be more but for now only one is allowed
        if(requiredAddress != null) {
            throw new IllegalStateException("Only one required address is allowed, atm.");
        }
        requiredAddress = requiredPath;

        final Iterator<Node> iterator = requiredAddress.iterator();
        if(iterator.hasNext()) {
            final String firstType = iterator.next().getType();
            dependsOnProfile = Util.SUBSYSTEM.equals(firstType) || Util.PROFILE.equals(firstType);
        }
        if(requiredAddress.endsOnType()) {
            requiredType = requiredAddress.toParentNode().getType();
        }
    }