1 /*
   2  * Copyright (c) 1999, 2014, 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 border=1 cellpadding=5 summary="permission target name, what the permission allows, and associated risks">
  45  * <tr>
  46  * <th>Permission Target Name</th>
  47  * <th>What the Permission Allows</th>
  48  * <th>Risks of Allowing this Permission</th>
  49  * </tr>
  50  *
  51  * <tr>
  52  * <td>play</td>
  53  * <td>Audio playback through the audio device or devices on the system.
  54  * Allows the application to obtain and manipulate lines and mixers for
  55  * audio playback (rendering).</td>
  56  * <td>In some cases use of this permission may affect other
  57  * applications because the audio from one line may be mixed with other audio
  58  * being played on the system, or because manipulation of a mixer affects the
  59  * audio for all lines using that mixer.</td>
  60  * </tr>
  61  *
  62  * <tr>
  63  * <td>record</td>
  64  * <td>Audio recording through the audio device or devices on the system.
  65  * Allows the application to obtain and manipulate lines and mixers for
  66  * audio recording (capture).</td>
  67  * <td>In some cases use of this permission may affect other
  68  * applications because manipulation of a mixer affects the audio for all lines
  69  * using that mixer.
  70  * This permission can enable an applet or application to eavesdrop on a user.</td>
  71  * </tr>
  72  * </table>
  73  *
  74  * @author Kara Kytle
  75  * @since 1.3
  76  */
  77 public class AudioPermission extends BasicPermission {
  78 
  79     private static final long serialVersionUID = -5518053473477801126L;
  80 
  81     /**
  82      * Creates a new {@code AudioPermission} object that has the specified
  83      * symbolic name, such as "play" or "record". An asterisk can be used to
  84      * indicate all audio permissions.
  85      *
  86      * @param  name the name of the new {@code AudioPermission}
  87      * @throws NullPointerException if {@code name} is {@code null}
  88      * @throws IllegalArgumentException if {@code name} is empty
  89      */
  90     public AudioPermission(final String name) {
  91         super(name);
  92     }
  93 
  94     /**
  95      * Creates a new {@code AudioPermission} object that has the specified
  96      * symbolic name, such as "play" or "record". The {@code actions} parameter
  97      * is currently unused and should be {@code null}.
  98      *
  99      * @param  name the name of the new {@code AudioPermission}
 100      * @param  actions (unused; should be {@code null})
 101      * @throws NullPointerException if {@code name} is {@code null}
 102      * @throws IllegalArgumentException if {@code name} is empty
 103      */
 104     public AudioPermission(final String name, final String actions) {
 105         super(name, actions);
 106     }
 107 }