com.google.enterprise.adaptor
Class Acl.Builder

java.lang.Object
  extended by com.google.enterprise.adaptor.Acl.Builder
Enclosing class:
Acl

public static class Acl.Builder
extends Object

Mutable ACL for creating instances of Acl.


Constructor Summary
Acl.Builder()
          Create new empty builder.
Acl.Builder(Acl acl)
          Create and initialize builder with ACL information provided in acl.
 
Method Summary
 Acl build()
          Create immutable Acl instance of the current state.
 Acl.Builder setDenies(Collection<Principal> denies)
          Replace existing deny users and groups.
 Acl.Builder setDenyGroups(Collection<GroupPrincipal> denyGroups)
          Replace existing deny groups.
 Acl.Builder setDenyUsers(Collection<UserPrincipal> denyUsers)
          Replace existing deny users.
 Acl.Builder setEverythingCaseInsensitive()
           
 Acl.Builder setEverythingCaseSensitive()
           
 Acl.Builder setInheritanceType(Acl.InheritanceType inheritType)
          Set the type of inheritance of ACL information used to combine authz decisions of these ACLs with its child.
 Acl.Builder setInheritFrom(DocId inheritFrom)
          Set DocId to inherit ACLs from.
 Acl.Builder setInheritFrom(DocId inheritFrom, String fragment)
          Set the parent to inherit ACLs from.
 Acl.Builder setPermitGroups(Collection<GroupPrincipal> permitGroups)
          Replace existing permit groups.
 Acl.Builder setPermits(Collection<Principal> permits)
          Replace existing permit users and groups.
 Acl.Builder setPermitUsers(Collection<UserPrincipal> permitUsers)
          Replace existing permit users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Acl.Builder

public Acl.Builder()
Create new empty builder. All sets are empty, inheritFrom is null, and inheritType is Acl.InheritanceType.LEAF_NODE.


Acl.Builder

public Acl.Builder(Acl acl)
Create and initialize builder with ACL information provided in acl.

Method Detail

build

public Acl build()
Create immutable Acl instance of the current state.


setPermitGroups

public Acl.Builder setPermitGroups(Collection<GroupPrincipal> permitGroups)
Replace existing permit groups.

Returns:
the same instance of the builder, for chaining calls
Throws:
NullPointerException - if the collection is null or contains null
IllegalArgumentException - if the collection contains "" or a value that has leading or trailing whitespace

setDenyGroups

public Acl.Builder setDenyGroups(Collection<GroupPrincipal> denyGroups)
Replace existing deny groups.

Returns:
the same instance of the builder, for chaining calls
Throws:
NullPointerException - if the collection is null or contains null
IllegalArgumentException - if the collection contains "" or a value that has leading or trailing whitespace

setPermitUsers

public Acl.Builder setPermitUsers(Collection<UserPrincipal> permitUsers)
Replace existing permit users.

Returns:
the same instance of the builder, for chaining calls
Throws:
NullPointerException - if the collection is null or contains null
IllegalArgumentException - if the collection contains "" or a value that has leading or trailing whitespace

setDenyUsers

public Acl.Builder setDenyUsers(Collection<UserPrincipal> denyUsers)
Replace existing deny users.

Returns:
the same instance of the builder, for chaining calls
Throws:
NullPointerException - if the collection is null or contains null
IllegalArgumentException - if the collection contains "" or a value that has leading or trailing whitespace

setPermits

public Acl.Builder setPermits(Collection<Principal> permits)
Replace existing permit users and groups.

Returns:
the same instance of the builder, for chaining calls
Throws:
NullPointerException - if the collection is null or contains null
IllegalArgumentException - if the collection contains "" or a value that has leading or trailing whitespace

setDenies

public Acl.Builder setDenies(Collection<Principal> denies)
Replace existing deny users and groups.

Returns:
the same instance of the builder, for chaining calls
Throws:
NullPointerException - if the collection is null or contains null
IllegalArgumentException - if the collection contains "" or a value that has leading or trailing whitespace

setInheritFrom

public Acl.Builder setInheritFrom(DocId inheritFrom)
Set DocId to inherit ACLs from. This is also known as the "parent's" ACLs. Note that the parent's InheritanceType determines how to combine results with this ACL.

Returns:
the same instance of the builder, for chaining calls
See Also:
setInheritanceType(com.google.enterprise.adaptor.Acl.InheritanceType)

setInheritFrom

public Acl.Builder setInheritFrom(DocId inheritFrom,
                                  String fragment)
Set the parent to inherit ACLs from. Note that the parent's InheritanceType determines how to combine results with this ACL.

The fragment facilitates a single parent DocId having multiple ACLs to inherit from. For example a single parent DocId could have ACLs that are to be inherited by sub-folder DocId instances and different ACLs that are to be inherited by children files. The fragment allows specifying which of the parent's ACLs is to be inherited from.

Returns:
the same instance of the builder, for chaining calls
See Also:
setInheritanceType(com.google.enterprise.adaptor.Acl.InheritanceType)

setInheritanceType

public Acl.Builder setInheritanceType(Acl.InheritanceType inheritType)
Set the type of inheritance of ACL information used to combine authz decisions of these ACLs with its child. The inheritance type applies to the interaction between this ACL and any children it has.

Returns:
the same instance of the builder, for chaining calls
Throws:
NullPointerException - if inheritType is null
See Also:
setInheritFrom(com.google.enterprise.adaptor.DocId)

setEverythingCaseSensitive

public Acl.Builder setEverythingCaseSensitive()

setEverythingCaseInsensitive

public Acl.Builder setEverythingCaseInsensitive()