001/* 002 * The contents of this file are subject to the license and copyright 003 * detailed in the LICENSE and NOTICE files at the root of the source 004 * tree. 005 */ 006package org.fcrepo.auth.webac; 007 008import java.net.URI; 009import java.util.Collection; 010import java.util.HashSet; 011import java.util.Set; 012 013import org.fcrepo.kernel.api.auth.WebACAuthorization; 014 015/** 016 * @author whikloj 017 * @author acoburn 018 * @since 2015-08-25 019 */ 020public class WebACAuthorizationImpl implements WebACAuthorization { 021 022 private final Set<String> agents = new HashSet<>(); 023 024 private final Set<String> agentClasses = new HashSet<>(); 025 026 private final Set<URI> modes = new HashSet<>(); 027 028 private final Set<String> accessTo = new HashSet<>(); 029 030 private final Set<String> accessToClass = new HashSet<>(); 031 032 private final Set<String> agentGroups = new HashSet<>(); 033 034 private final Set<String> defaults = new HashSet<>(); 035 036 /** 037 * Constructor 038 * 039 * @param agents The acl:agent values 040 * @param agentClasses the acl:agentClass values 041 * @param modes the acl:mode values 042 * @param accessTo the acl:accessTo values 043 * @param accessToClass the acl:accessToClass values 044 * @param agentGroups the acl:agentGroup values 045 * @param defaults the acl:default values 046 */ 047 public WebACAuthorizationImpl(final Collection<String> agents, final Collection<String> agentClasses, 048 final Collection<URI> modes, final Collection<String> accessTo, 049 final Collection<String> accessToClass, final Collection<String> agentGroups, 050 final Collection<String> defaults) { 051 this.agents.addAll(agents); 052 this.agentClasses.addAll(agentClasses); 053 this.modes.addAll(modes); 054 this.accessTo.addAll(accessTo); 055 this.accessToClass.addAll(accessToClass); 056 this.agentGroups.addAll(agentGroups); 057 this.defaults.addAll(defaults); 058 } 059 060 /** 061 * Get the set of acl:agents, empty set if none. 062 * 063 * @return set of acl:agents 064 */ 065 public Set<String> getAgents() { 066 return agents; 067 } 068 069 /** 070 * Get the set of acl:agentClasses, empty set if none. 071 * 072 * @return set of acl:agentClasses 073 */ 074 public Set<String> getAgentClasses() { 075 return agentClasses; 076 } 077 078 /** 079 * Get the set of acl:modes, empty set if none. 080 * 081 * @return set of acl:modes 082 */ 083 public Set<URI> getModes() { 084 return modes; 085 } 086 087 /** 088 * Get the set of strings directly linked from this ACL, empty set if none. 089 * 090 * @return set of String 091 */ 092 public Set<String> getAccessToURIs() { 093 return accessTo; 094 } 095 096 /** 097 * Get the set of strings describing the rdf:types for this ACL, empty set if none. 098 * 099 * @return set of Strings 100 */ 101 public Set<String> getAccessToClassURIs() { 102 return accessToClass; 103 } 104 105 /** 106 * Get the set of strings describing the agent groups for this ACL, empty set if none. 107 * 108 * @return set of Strings 109 */ 110 public Set<String> getAgentGroups() { 111 return agentGroups; 112 } 113 114 /** 115 * Get the set of strings describing the defaults for this ACL, empty set if none. 116 * 117 * @return set of Strings 118 */ 119 public Set<String> getDefaults() { 120 return defaults; 121 } 122}