keith-turner commented on code in PR #96:
URL: https://github.com/apache/accumulo-access/pull/96#discussion_r2674308178


##########
core/src/main/java/org/apache/accumulo/access/Access.java:
##########
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.access;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.function.Consumer;
+
+import org.apache.accumulo.access.impl.BuilderImpl;
+
+/**
+ * The entry point into Accumulo Access to create access expressions, 
expression evaluators, and
+ * authorization sets.
+ *
+ * @see #builder()
+ * @since 1.0
+ */
+public interface AccumuloAccess {
+
+  interface Builder {
+    /**
+     * Provide a validator to accumulo access to narrow the set of valid 
authorizations for your
+     * specific use case. If one is not provided then {@link 
AuthorizationValidator#DEFAULT} will be
+     * used.
+     *
+     * <p>
+     * The provided validator is called very frequently within accumulo access 
and implementations
+     * that are slow will slow down accumulo access.
+     */
+    Builder authorizationValidator(AuthorizationValidator validator);
+
+    AccumuloAccess build();
+  }
+
+  /**
+   * Used to create an instance of AccumuloAccess. For efficiency, the 
recommend way to use this is
+   * to create a single instance and somehow make it available to an entire 
project for use. In
+   * addition to being efficient this ensures the entire project is using the 
same configuration.
+   */
+  static Builder builder() {
+    return new BuilderImpl();
+  }
+
+  /**
+   * Validates an access expression and returns an immutable AccessExpression 
object. If passing
+   * access expressions as arguments in code, consider using this type instead 
of a String. The
+   * advantage of passing this type over a String is that its known to be a 
valid expression. Also,
+   * this type is much more informative than a String type. Conceptually this 
method calls
+   * {@link #validate(String)} and if that passes creates an immutable object 
that wraps the
+   * expression.
+   *
+   * @throws InvalidAccessExpressionException if the given expression is not 
valid
+   * @throws InvalidAuthorizationException when the expression contains an 
authorization that is not
+   *         valid
+   * @throws NullPointerException when the argument is null
+   */
+  AccessExpression newExpression(String expression)
+      throws InvalidAccessExpressionException, InvalidAuthorizationException;
+
+  /**
+   * Validates an access expression and returns an immutable object with a 
parse tree. Creating the
+   * parse tree is expensive relative to calling {@link 
#newExpression(String)} or
+   * {@link #validate(String)}, so only use this method when the parse tree is 
always needed. If the
+   * code may only use the parse tree sometimes, then it may be best to call
+   * {@link #newExpression(String)} to create the access expression and then 
call
+   * {@link AccessExpression#parse()} when needed.
+   *
+   * @throws NullPointerException when the argument is null
+   * @throws InvalidAuthorizationException when the expression contains an 
authorization that is not
+   *         valid
+   * @throws InvalidAccessExpressionException if the given expression is not 
valid
+   */
+  ParsedAccessExpression newParsedExpression(String expression)
+      throws InvalidAccessExpressionException, InvalidAuthorizationException;
+
+  /**
+   * @return a pre-allocated empty Authorizations object
+   */
+  Authorizations newAuthorizations();

Review Comment:
   Removed in 8331f6313fd6e8aa12cceb3d1b326743ac72316c



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to