Package org.apache.hadoop.hbase.security.visibility.expression

Examples of org.apache.hadoop.hbase.security.visibility.expression.NonLeafExpressionNode


    if (node.isSingleNode()) {
      writeLabelOrdinalsToStream(node, dos);
      tags.add(new Tag(VisibilityUtils.VISIBILITY_TAG_TYPE, baos.toByteArray()));
      baos.reset();
    } else {
      NonLeafExpressionNode nlNode = (NonLeafExpressionNode) node;
      if (nlNode.getOperator() == Operator.OR) {
        for (ExpressionNode child : nlNode.getChildExps()) {
          writeLabelOrdinalsToStream(child, dos);
          tags.add(new Tag(VisibilityUtils.VISIBILITY_TAG_TYPE, baos.toByteArray()));
          baos.reset();
        }
      } else {
View Full Code Here


    if (node.isSingleNode()) {
      writeLabelOrdinalsToStream(node, dos);
      tags.add(new Tag(VisibilityUtils.VISIBILITY_TAG_TYPE, baos.toByteArray()));
      baos.reset();
    } else {
      NonLeafExpressionNode nlNode = (NonLeafExpressionNode) node;
      if (nlNode.getOperator() == Operator.OR) {
        for (ExpressionNode child : nlNode.getChildExps()) {
          writeLabelOrdinalsToStream(child, dos);
          tags.add(new Tag(VisibilityUtils.VISIBILITY_TAG_TYPE, baos.toByteArray()));
          baos.reset();
        }
      } else {
View Full Code Here

      getLabelOrdinals(node, labelOrdinals, auths, userName);
      writeLabelOrdinalsToStream(labelOrdinals, dos);
      tags.add(new Tag(VisibilityUtils.VISIBILITY_TAG_TYPE, baos.toByteArray()));
      baos.reset();
    } else {
      NonLeafExpressionNode nlNode = (NonLeafExpressionNode) node;
      if (nlNode.getOperator() == Operator.OR) {
        for (ExpressionNode child : nlNode.getChildExps()) {
          getLabelOrdinals(child, labelOrdinals, auths, userName);
          writeLabelOrdinalsToStream(labelOrdinals, dos);
          tags.add(new Tag(VisibilityUtils.VISIBILITY_TAG_TYPE, baos.toByteArray()));
          baos.reset();
          labelOrdinals.clear();
View Full Code Here

      getLabelOrdinals(node, labelOrdinals, auths, checkAuths, ordinalProvider);
      writeLabelOrdinalsToStream(labelOrdinals, dos);
      tags.add(new Tag(VISIBILITY_TAG_TYPE, baos.toByteArray()));
      baos.reset();
    } else {
      NonLeafExpressionNode nlNode = (NonLeafExpressionNode) node;
      if (nlNode.getOperator() == Operator.OR) {
        for (ExpressionNode child : nlNode.getChildExps()) {
          getLabelOrdinals(child, labelOrdinals, auths, checkAuths, ordinalProvider);
          writeLabelOrdinalsToStream(labelOrdinals, dos);
          tags.add(new Tag(VISIBILITY_TAG_TYPE, baos.toByteArray()));
          baos.reset();
          labelOrdinals.clear();
View Full Code Here

      } else {
        labels.add(((LeafExpressionNode) node).getIdentifier());
      }
    } else {
      // A non leaf expression of labels with & operator.
      NonLeafExpressionNode nlNode = (NonLeafExpressionNode) node;
      assert nlNode.getOperator() == Operator.AND;
      List<ExpressionNode> childExps = nlNode.getChildExps();
      for (ExpressionNode child : childExps) {
        extractLabels(child, labels, notLabels);
      }
    }
  }
View Full Code Here

    ExpressionNode top = expStack.pop();
    if (top == LeafExpressionNode.OPEN_PARAN_NODE) {
      throw new ParseException("Error parsing expression " + expS);
    }
    if (top instanceof NonLeafExpressionNode) {
      NonLeafExpressionNode nlTop = (NonLeafExpressionNode) top;
      if (nlTop.getOperator() == Operator.NOT) {
        if (nlTop.getChildExps().size() != 1) {
          throw new ParseException("Error parsing expression " + expS);
        }
      } else if (nlTop.getChildExps().size() != 2) {
        throw new ParseException("Error parsing expression " + expS);
      }
    }
    return top;
  }
View Full Code Here

      // a&(b|) is not valid.
      // The top can be a ! node but with exactly child nodes. !).. is invalid
      // Other NonLeafExpressionNode , then there should be exactly 2 child.
      // (a&) is not valid.
      if (top instanceof NonLeafExpressionNode) {
        NonLeafExpressionNode nlTop = (NonLeafExpressionNode) top;
        if ((nlTop.getOperator() == Operator.NOT && nlTop.getChildExps().size() != 1)
            || (nlTop.getOperator() != Operator.NOT && nlTop.getChildExps().size() != 2)) {
          throw new ParseException("Error parsing expression " + expS + " at column : " + index);
        }
      }
      // When (a|b)&(c|d) comes while processing the second ) there will be
      // already (a|b)& node
      // avail in the stack. The top will be c|d node. We need to take it out
      // and combine as one
      // node.
      if (!expStack.isEmpty()) {
        ExpressionNode thirdTop = expStack.peek();
        if (thirdTop instanceof NonLeafExpressionNode) {
          NonLeafExpressionNode nlThirdTop = (NonLeafExpressionNode) expStack.pop();
          nlThirdTop.addChildExp(top);
          if (nlThirdTop.getOperator() == Operator.NOT) {
            // It is a NOT node. So there may be a NonLeafExpressionNode below
            // it to which the
            // completed NOT can be added now.
            if (!expStack.isEmpty()) {
              ExpressionNode fourthTop = expStack.peek();
              if (fourthTop instanceof NonLeafExpressionNode) {
                // Its Operator will be OR or AND
                NonLeafExpressionNode nlFourthTop = (NonLeafExpressionNode) fourthTop;
                assert nlFourthTop.getOperator() != Operator.NOT;
                // Also for sure its number of children will be 1
                assert nlFourthTop.getChildExps().size() == 1;
                nlFourthTop.addChildExp(nlThirdTop);
                return;// This case no need to add back the nlThirdTop.
              }
            }
          }
          top = nlThirdTop;
View Full Code Here

        // Top is non leaf.
        // It can be ! node but with out any child nodes. !a(.. is invalid
        // Other NonLeafExpressionNode , then there should be exactly 1 child.
        // a&b( is not valid.
        // a&( is valid though. Also !( is valid
        NonLeafExpressionNode nlTop = (NonLeafExpressionNode) top;
        if ((nlTop.getOperator() == Operator.NOT && nlTop.getChildExps().size() != 0)
            || (nlTop.getOperator() != Operator.NOT && nlTop.getChildExps().size() != 1)) {
          throw new ParseException("Error parsing expression " + expS + " at column : " + index);
        }
      }
    }
    expStack.push(LeafExpressionNode.OPEN_PARAN_NODE);
View Full Code Here

    } else {
      ExpressionNode top = expStack.peek();
      if (top == LeafExpressionNode.OPEN_PARAN_NODE) {
        expStack.push(node);
      } else if (top instanceof NonLeafExpressionNode) {
        NonLeafExpressionNode nlTop = (NonLeafExpressionNode) expStack.pop();
        nlTop.addChildExp(node);
        if (nlTop.getOperator() == Operator.NOT && !expStack.isEmpty()) {
          ExpressionNode secondTop = expStack.peek();
          if (secondTop == LeafExpressionNode.OPEN_PARAN_NODE) {
            expStack.push(nlTop);
          } else if (secondTop instanceof NonLeafExpressionNode) {
            ((NonLeafExpressionNode) secondTop).addChildExp(nlTop);
View Full Code Here

    ExpressionNode top = expStack.pop();
    if (top.isSingleNode()) {
      if (top == LeafExpressionNode.OPEN_PARAN_NODE) {
        throw new ParseException("Error parsing expression " + expS + " at column : " + index);
      }
      expStack.push(new NonLeafExpressionNode(op, top));
    } else {
      NonLeafExpressionNode nlTop = (NonLeafExpressionNode) top;
      if (nlTop.getChildExps().size() != 2) {
        throw new ParseException("Error parsing expression " + expS + " at column : " + index);
      }
      expStack.push(new NonLeafExpressionNode(op, nlTop));
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.security.visibility.expression.NonLeafExpressionNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.