893N/A/*
2362N/A * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
893N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
893N/A *
893N/A * This code is free software; you can redistribute it and/or modify it
893N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
893N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
893N/A *
893N/A * This code is distributed in the hope that it will be useful, but WITHOUT
893N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
893N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
893N/A * version 2 for more details (a copy is included in the LICENSE file that
893N/A * accompanied this code).
893N/A *
893N/A * You should have received a copy of the GNU General Public License version
893N/A * 2 along with this work; if not, write to the Free Software Foundation,
893N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
893N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
893N/A */
893N/A
893N/Apackage java.nio.file.attribute;
893N/A
893N/Aimport java.io.IOException;
893N/A
893N/A/**
893N/A * An object to lookup user and group principals by name. A {@link UserPrincipal}
893N/A * represents an identity that may be used to determine access rights to objects
893N/A * in a file system. A {@link GroupPrincipal} represents a <em>group identity</em>.
893N/A * A {@code UserPrincipalLookupService} defines methods to lookup identities by
893N/A * name or group name (which are typically user or account names). Whether names
893N/A * and group names are case sensitive or not depends on the implementation.
893N/A * The exact definition of a group is implementation specific but typically a
893N/A * group represents an identity created for administrative purposes so as to
893N/A * determine the access rights for the members of the group. In particular it is
893N/A * implementation specific if the <em>namespace</em> for names and groups is the
893N/A * same or is distinct. To ensure consistent and correct behavior across
893N/A * platforms it is recommended that this API be used as if the namespaces are
893N/A * distinct. In other words, the {@link #lookupPrincipalByName
893N/A * lookupPrincipalByName} should be used to lookup users, and {@link
893N/A * #lookupPrincipalByGroupName lookupPrincipalByGroupName} should be used to
893N/A * lookup groups.
893N/A *
893N/A * @since 1.7
893N/A *
893N/A * @see java.nio.file.FileSystem#getUserPrincipalLookupService
893N/A */
893N/A
893N/Apublic abstract class UserPrincipalLookupService {
893N/A
893N/A /**
893N/A * Initializes a new instance of this class.
893N/A */
893N/A protected UserPrincipalLookupService() {
893N/A }
893N/A
893N/A /**
893N/A * Lookup a user principal by name.
893N/A *
893N/A * @param name
908N/A * the string representation of the user principal to lookup
893N/A *
908N/A * @return a user principal
893N/A *
893N/A * @throws UserPrincipalNotFoundException
908N/A * the principal does not exist
893N/A * @throws IOException
908N/A * if an I/O error occurs
893N/A * @throws SecurityException
893N/A * In the case of the default provider, and a security manager is
893N/A * installed, it checks {@link RuntimePermission}<tt>("lookupUserInformation")</tt>
893N/A */
893N/A public abstract UserPrincipal lookupPrincipalByName(String name)
893N/A throws IOException;
893N/A
893N/A /**
893N/A * Lookup a group principal by group name.
893N/A *
893N/A * <p> Where an implementation does not support any notion of group then
893N/A * this method always throws {@link UserPrincipalNotFoundException}. Where
893N/A * the namespace for user accounts and groups is the same, then this method
893N/A * is identical to invoking {@link #lookupPrincipalByName
893N/A * lookupPrincipalByName}.
893N/A *
893N/A * @param group
908N/A * the string representation of the group to lookup
893N/A *
1319N/A * @return a group principal
893N/A *
893N/A * @throws UserPrincipalNotFoundException
908N/A * the principal does not exist or is not a group
893N/A * @throws IOException
908N/A * if an I/O error occurs
893N/A * @throws SecurityException
893N/A * In the case of the default provider, and a security manager is
893N/A * installed, it checks {@link RuntimePermission}<tt>("lookupUserInformation")</tt>
893N/A */
893N/A public abstract GroupPrincipal lookupPrincipalByGroupName(String group)
893N/A throws IOException;
893N/A}