src/share/classes/javax/sound/sampled/AudioPermission.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 2013, 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 /**
  32  * The <code>AudioPermission</code> class represents access rights to the audio
  33  * system resources.  An <code>AudioPermission</code> contains a target name
  34  * but no actions list; you either have the named permission or you don't.
  35  * <p>
  36  * The target name is the name of the audio permission (see the table below).
  37  * The names follow the hierarchical property-naming convention. Also, an asterisk
  38  * can be used to represent all the audio permissions.
  39  * <p>
  40  * The following table lists the possible <code>AudioPermission</code> target names.
  41  * For each name, the table provides a description of exactly what that permission
  42  * allows, as well as a discussion of the risks of granting code the permission.
  43  *
  44  *
  45  * <table border=1 cellpadding=5 summary="permission target name, what the permission allows, and associated risks">
  46  * <tr>
  47  * <th>Permission Target Name</th>
  48  * <th>What the Permission Allows</th>
  49  * <th>Risks of Allowing this Permission</th>
  50  * </tr>


  59  * being played on the system, or because manipulation of a mixer affects the
  60  * audio for all lines using that mixer.</td>
  61  *</tr>
  62  *
  63  * <tr>
  64  * <td>record</td>
  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).</td>
  68  * <td>In some cases use of this permission may affect other
  69  * applications because manipulation of a mixer affects the audio for all lines
  70  * using that mixer.
  71  * This permission can enable an applet or application to eavesdrop on a user.</td>
  72  *</tr>
  73  *</table>
  74  *<p>
  75  *
  76  * @author Kara Kytle
  77  * @since 1.3
  78  */
  79 /*
  80  * (OLD PERMISSIONS TAKEN OUT FOR 1.2 BETA)
  81  *
  82  * <tr>
  83  * <td>playback device access</td>
  84  * <td>Direct access to the audio playback device(s), including configuration of the
  85  * playback format, volume, and balance, explicit opening and closing of the device,
  86  * etc.</td>
  87  * <td>Changes the properties of a shared system device and therefore
  88  * can affect other applications.</td>
  89  * </tr>
  90  *
  91  * <tr>
  92  * <td>playback device override</td>
  93  * <td>Manipulation of the audio playback device(s) in a way that directly conflicts
  94  * with use by other applications.  This includes closing the device while it is in
  95  * use by another application, changing the device format while another application
  96  * is using it, etc. </td>
  97  * <td>Changes the properties of a shared system device and therefore
  98  * can affect other applications.</td>
  99  * </tr>
 100  *
 101  * <tr>
 102  * <td>record device access</td>
 103  * <td>Direct access to the audio recording device(s), including configuration of the
 104  * the record format, volume, and balance, explicit opening and closing of the device,
 105  * etc.</td>
 106  * <td>Changes the properties of a shared system device and therefore
 107  * can affect other applications.</td>
 108  * </tr>
 109  *
 110  * <tr>
 111  * <td>record device override</td>
 112  * <td>Manipulation of the audio recording device(s) in a way that directly conflicts
 113  * with use by other applications.  This includes closing the device while it is in
 114  * use by another application, changing the device format while another application
 115  * is using it, etc. </td>
 116  * <td>Changes the properties of a shared system device and therefore
 117  * can affect other applications.</td>
 118  * </tr>
 119  *
 120  * </table>
 121  *<p>
 122  *
 123  * @author Kara Kytle
 124  * @since 1.3
 125  */
 126 
 127 /*
 128  * The <code>AudioPermission</code> class represents access rights to the audio
 129  * system resources.  An <code>AudioPermission</code> contains a target name
 130  * but no actions list; you either have the named permission or you don't.
 131  * <p>
 132  * The target name is the name of the audio permission (see the table below).
 133  * The names follow the hierarchical property-naming convention. Also, an asterisk
 134  * can be used to represent all the audio permissions.
 135  * <p>
 136  * The following table lists all the possible AudioPermission target names.
 137  * For each name, the table provides a description of exactly what that permission
 138  * allows, as well as a discussion of the risks of granting code the permission.
 139  * <p>
 140  *
 141  * <table border=1 cellpadding=5>
 142  * <tr>
 143  * <th>Permission Target Name</th>
 144  * <th>What the Permission Allows</th>
 145  * <th>Risks of Allowing this Permission</th>
 146  * </tr>
 147  *
 148  * <tr>
 149  * <td>play</td>
 150  * <td>Audio playback through the audio device or devices on the system.</td>
 151  * <td>Allows the application to use a system device.  Can affect other applications,
 152  * because the result will be mixed with other audio being played on the system.</td>
 153  *</tr>
 154  *
 155  * <tr>
 156  * <td>record</td>
 157  * <td>Recording audio from the audio device or devices on the system,
 158  * commonly through a microphone.</td>
 159  * <td>Can enable an applet or application to eavesdrop on a user.</td>
 160  * </tr>
 161  *
 162  * <tr>
 163  * <td>playback device access</td>
 164  * <td>Direct access to the audio playback device(s), including configuration of the
 165  * playback format, volume, and balance, explicit opening and closing of the device,
 166  * etc.</td>
 167  * <td>Changes the properties of a shared system device and therefore
 168  * can affect other applications.</td>
 169  * </tr>
 170  *
 171  * <tr>
 172  * <td>playback device override</td>
 173  * <td>Manipulation of the audio playback device(s) in a way that directly conflicts
 174  * with use by other applications.  This includes closing the device while it is in
 175  * use by another application, changing the device format while another application
 176  * is using it, etc. </td>
 177  * <td>Changes the properties of a shared system device and therefore
 178  * can affect other applications.</td>
 179  * </tr>
 180  *
 181  * <tr>
 182  * <td>record device access</td>
 183  * <td>Direct access to the audio recording device(s), including configuration of the
 184  * the record format, volume, and balance, explicit opening and closing of the device,
 185  * etc.</td>
 186  * <td>Changes the properties of a shared system device and therefore
 187  * can affect other applications.</td>
 188  * </tr>
 189  *
 190  * <tr>
 191  * <td>record device override</td>
 192  * <td>Manipulation of the audio recording device(s) in a way that directly conflicts
 193  * with use by other applications.  This includes closing the device while it is in
 194  * use by another application, changing the device format while another application
 195  * is using it, etc. </td>
 196  * <td>Changes the properties of a shared system device and therefore
 197  * can affect other applications.</td>
 198  * </tr>
 199  *
 200  * </table>
 201  *<p>
 202  *
 203  * @author Kara Kytle
 204  */
 205 
 206 public class AudioPermission extends BasicPermission {

 207 
 208     /**
 209      * Creates a new <code>AudioPermission</code> object that has the specified
 210      * symbolic name, such as "play" or "record". An asterisk can be used to indicate
 211      * all audio permissions.
 212      * @param name the name of the new <code>AudioPermission</code>
 213      *
 214      * @throws NullPointerException if <code>name</code> is <code>null</code>.
 215      * @throws IllegalArgumentException if <code>name</code> is empty.
 216      */
 217     public AudioPermission(String name) {
 218 
 219         super(name);
 220     }
 221 
 222     /**
 223      * Creates a new <code>AudioPermission</code> object that has the specified
 224      * symbolic name, such as "play" or "record".  The <code>actions</code>
 225      * parameter is currently unused and should be <code>null</code>.
 226      * @param name the name of the new <code>AudioPermission</code>
   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</code> class represents access rights to the audio
  32  * system resources.  An <code>AudioPermission</code> contains a target name
  33  * but no 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 asterisk
  37  * can be used to represent all the audio permissions.
  38  * <p>
  39  * The following table lists the possible <code>AudioPermission</code> target names.
  40  * For each name, the table provides a description of exactly what that permission
  41  * allows, as well as a discussion of the risks of granting code the permission.
  42  *
  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>


  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  *<p>
  74  *
  75  * @author Kara Kytle
  76  * @since 1.3
  77  */































































































































  78 public class AudioPermission extends BasicPermission {
  79     private static final long serialVersionUID = -5518053473477801126L;
  80 
  81     /**
  82      * Creates a new <code>AudioPermission</code> object that has the specified
  83      * symbolic name, such as "play" or "record". An asterisk can be used to indicate
  84      * all audio permissions.
  85      * @param name the name of the new <code>AudioPermission</code>
  86      *
  87      * @throws NullPointerException if <code>name</code> is <code>null</code>.
  88      * @throws IllegalArgumentException if <code>name</code> is empty.
  89      */
  90     public AudioPermission(String name) {
  91 
  92         super(name);
  93     }
  94 
  95     /**
  96      * Creates a new <code>AudioPermission</code> object that has the specified
  97      * symbolic name, such as "play" or "record".  The <code>actions</code>
  98      * parameter is currently unused and should be <code>null</code>.
  99      * @param name the name of the new <code>AudioPermission</code>