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