1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package java.security.acl; 19 20 import java.security.Principal; 21 22 /** 23 * The interface to manage owners of objects that require ownership. 24 * 25 * @see Acl 26 * @see Principal 27 */ 28 public interface Owner { 29 30 /** 31 * Adds a principal to the list of owners. 32 * 33 * @param caller 34 * the invoking principal. 35 * @param owner 36 * the owner to added. 37 * @return {@code true} if the owner was added, {@code false} if it was already an owner. 38 * @throws NotOwnerException 39 * if the invoking principal is not an owner. 40 */ 41 boolean addOwner(Principal caller, Principal owner) 42 throws NotOwnerException; 43 44 /** 45 * Removes a principal from the list of owners. 46 * 47 * @param caller 48 * the invoking principal. 49 * @param owner 50 * the owner to be removed. 51 * @return {@code true} if the owner was removed, {@code false} if it was not an owner. 52 * @throws NotOwnerException 53 * if the invoking principal is not an owner. 54 * @throws LastOwnerException 55 * if the owner to be removed is the last owner and hence removing it 56 * would make this object owner-less. 57 */ 58 boolean deleteOwner(Principal caller, Principal owner) 59 throws NotOwnerException, LastOwnerException; 60 61 /** 62 * Checks whether the specified principal is an owner of this object. 63 * 64 * @param owner 65 * the principal to check. 66 * @return {@code true} if the specified principal is an owner, otherwise {@code false}. 67 */ 68 boolean isOwner(Principal owner); 69 } 70