1 /*
   2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.sound.sampled;
  27 
  28 import java.security.BasicPermission;
  29 
  30 /**
  31  * The {@code AudioPermission} class represents access rights to the audio
  32  * system resources. An {@code AudioPermission} contains a target name but no
  33  * actions list; you either have the named permission or you don't.
  34  * <p>
  35  * The target name is the name of the audio permission (see the table below).
  36  * The names follow the hierarchical property-naming convention. Also, an
  37  * asterisk can be used to represent all the audio permissions.
  38  * <p>
  39  * The following table lists the possible {@code AudioPermission} target names.
  40  * For each name, the table provides a description of exactly what that
  41  * permission allows, as well as a discussion of the risks of granting code the
  42  * permission.
  43  *
  44  * <table class="striped">
  45  * <caption>Permission target name, what the permission allows, and associated
  46  * risks</caption>
  47  * <thead>
  48  *   <tr>
  49  *     <th>Permission Target Name
  50  *     <th>What the Permission Allows
  51  *     <th>Risks of Allowing this Permission
  52  * </thead>
  53  * <tbody>
  54  *   <tr>
  55  *     <td>play
  56  *     <td>Audio playback through the audio device or devices on the system.
  57  *     Allows the application to obtain and manipulate lines and mixers for
  58  *     audio playback (rendering).
  59  *     <td>In some cases use of this permission may affect other
  60  *     applications because the audio from one line may be mixed with other
  61  *     audio being played on the system, or because manipulation of a mixer
  62  *     affects the audio for all lines using that mixer.
  63  *   <tr>
  64  *     <td>record
  65  *     <td>Audio recording through the audio device or devices on the system.
  66  *     Allows the application to obtain and manipulate lines and mixers for
  67  *     audio recording (capture).
  68  *     <td>In some cases use of this permission may affect other applications
  69  *     because manipulation of a mixer affects the audio for all lines using
  70  *     that mixer. This permission can enable an applet or application to
  71  *     eavesdrop on a user.
  72  * </tbody>
  73  * </table>
  74  *
  75  * @author Kara Kytle
  76  * @since 1.3
  77  */
  78 public class AudioPermission extends BasicPermission {
  79 
  80     /**
  81      * Use serialVersionUID from JDK 1.3 for interoperability.
  82      */
  83     private static final long serialVersionUID = -5518053473477801126L;
  84 
  85     /**
  86      * Creates a new {@code AudioPermission} object that has the specified
  87      * symbolic name, such as "play" or "record". An asterisk can be used to
  88      * indicate all audio permissions.
  89      *
  90      * @param  name the name of the new {@code AudioPermission}
  91      * @throws NullPointerException if {@code name} is {@code null}
  92      * @throws IllegalArgumentException if {@code name} is empty
  93      */
  94     public AudioPermission(final String name) {
  95         super(name);
  96     }
  97 
  98     /**
  99      * Creates a new {@code AudioPermission} object that has the specified
 100      * symbolic name, such as "play" or "record". The {@code actions} parameter
 101      * is currently unused and should be {@code null}.
 102      *
 103      * @param  name the name of the new {@code AudioPermission}
 104      * @param  actions (unused; should be {@code null})
 105      * @throws NullPointerException if {@code name} is {@code null}
 106      * @throws IllegalArgumentException if {@code name} is empty
 107      */
 108     public AudioPermission(final String name, final String actions) {
 109         super(name, actions);
 110     }
 111 }