summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/javax/management/remote/rmi/RMIConnection.java
blob: edf8c895c8682070ae9dc087188c39cb6108d5df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
/* RMIConnection.java -- RMI object representing a MBean server connection.
   Copyright (C) 2007, 2008 Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.

Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module.  An independent module is a module which is not derived from
or based on this library.  If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so.  If you do not wish to do so, delete this
exception statement from your version. */

package javax.management.remote.rmi;

import java.io.Closeable;
import java.io.IOException;

import java.rmi.MarshalledObject;
import java.rmi.Remote;

import java.util.Set;

import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.IntrospectionException;
import javax.management.InvalidAttributeValueException;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanInfo;
import javax.management.MBeanException;
import javax.management.MBeanRegistrationException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.management.ReflectionException;

import javax.management.remote.NotificationResult;

import javax.security.auth.Subject;

/**
 * <p>
 * RMI interface for forwarding requests to a remote
 * {@link javax.management.MBeanServer}.  This interface
 * parallels the {@link javax.management.MBeanServerConnection}
 * interface, providing a way of invoking those methods using
 * the RMI protocol.  When a client wishes to call a method
 * of an MBean server using RMI, the method is called on the stub
 * on the client side, which serializes the object parameters
 * and sends them to the server where they are deserialized and
 * an implementation of this interface forwards them to the
 * appropriate MBean server.  Return values follow the same
 * process, only in reverse.  Each client obtains its own
 * implementation of this interface from an {@link RMIServer}
 * instance.
 * </p>
 * <p>
 * Implementations of this interface do more than simply
 * forward requests directly to the server.  The arguments
 * of the server methods are wrapped in {@link MarshalledObject}
 * instances, so that the correct classloader can be used to
 * deserialize the arguments.  When a method is called, the
 * implementation must first retrieve the appropriate classloader
 * and then use it to deserialize the marshalled object.  Unless
 * explicitly specified in the documentation for the method,
 * a parameter of the type {@link MarshalledObject} or an array
 * of that type should not be {@code null}.
 * </p>
 * <p>
 * Security is also handled by this interface, as the methods
 * use an additional {@link javax.security.auth.Subject} parameter
 * for role delegation.
 * </p>
 *
 * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
 * @since 1.5
 */
public interface RMIConnection
  extends Closeable, Remote
{

  /**
   * Handles {@link
   * MBeanServerConnection#addNotificationListener(ObjectName,
   * ObjectName, NotificationFilter, Object)} by
   * registering the supplied listener with the specified management
   * bean.  Notifications emitted by the management bean are forwarded
   * to the listener via the server, which will convert any MBean
   * references in the source to portable {@link ObjectName}
   * instances.  The notification is otherwise unchanged.  The filter
   * and handback object are wrapped in a {@link MarshalledObject}
   * so that they are deserialised using the bean's classloader.
   *
   * @param name the name of the management bean with which the listener
   *             should be registered.
   * @param listener the listener which will handle notifications from
   *                 the bean.
   * @param filter a wrapper containing a filter to apply to incoming
   *               notifications, or <code>null</code> if no filtering
   *               should be applied.
   * @param passback a wrapper containing an object to be passed to the
   *                 listener when a notification is emitted.
   * @param delegationSubject a {@link javax.security.auth.Subject} instance
   *                          containing the delegation principles or
   *                          {@code null} if authentication is used.
   * @throws InstanceNotFoundException if the name of the management bean
   *                                   could not be resolved.
   * @throws RuntimeOperationsException if the bean associated with the given
   *                                    object name is not a
   *                                    {@link NotificationListener}.  This
   *                                    exception wraps an
   *                                    {@link IllegalArgumentException}.
   * @throws SecurityException if the client or delegated subject (if any)
   *                           does not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see #removeNotificationListener(ObjectName, ObjectName,
   *                                  javax.security.auth.Subject)
   * @see #removeNotificationListener(ObjectName, ObjectName,
   *                                  java.rmi.MarshalledObject,
   *                                  java.rmi.MarshalledObject,
   *                                  javax.security.auth.Subject)
   * @see #removeNotificationListeners(ObjectName, Integer[],
   *                                  javax.security.auth.Subject)
   * @see NotificationBroadcaster#addNotificationListener(NotificationListener,
   *                                                      NotificationFilter,
   *                                                      Object)
   */
  @SuppressWarnings("rawtypes")
  void addNotificationListener(ObjectName name, ObjectName listener,
                               MarshalledObject filter, MarshalledObject passback,
                               Subject delegationSubject)
    throws InstanceNotFoundException, IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#addNotificationListener(ObjectName,
   * NotificationListener, NotificationFilter, Object)} by
   * registering for notifications from the specified management
   * beans.  The array of filters is assumed to be aligned with
   * the array of bean names, so that the notifications from each
   * bean are matched against the appropriate filter (or left as
   * is if the filter is {@code null}.  Notifications emitted by
   * the management beans are forwarded to a local listener created
   * by this method, via the server, which converts any MBean
   * references in the source to portable {@link ObjectName}
   * instances.  The notification is otherwise unchanged.
   * </p>
   * <p>
   * This local listener buffers the notifications for retrieval by
   * {@link #fetchNotifications(long,int,long).  This method returns
   * an array of listener identifiers which aligns with the supplied
   * array of beans so that the appropriate listener can be identified
   * by the client, which retains its own listener and handback object.
   * The filters are wrapped in {@link MarshalledObject}s so that they are
   * deserialised using the bean's classloader.
   * </p>
   *
   * @param names the names of the management bean whose notifications
   *              should be recorded.
   * @param filters an array of wrappers containing filters to apply to
   *                incoming notifications.  An element may be <code>null</code>
   *                if no filtering should be applied to a bean's notifications.
   * @param delegationSubjects an array of {@link javax.security.auth.Subject}
   *                          instances containing the delegation principles for
   *                          each listener.  An element may be {@code null} if
   *                          authentication is used instead, or the entire
   *                          argument itself may be {@code null}.  In the latter
   *                          case, this is treated as an array of {@code null}
   *                          values.
   * @return an array of integers which act as listener identifiers, so that
   *         notifications retrieved from {@link #fetchNotifications(long,int,long)
   *         can be matched to the beans they were emitted from.  The array is
   *         aligned against the array of beans supplied to this methods, so that
   *         the identifier in position 0 represents the bean in position 0 of the
   *         input array.
   * @throws IllegalArgumentException if the {@code names} or {@code filters} array
   *                                  is {@code null}, the {@code names} array contains
   *                                  a {@code null} value or the three arrays are not
   *                                  of the same size.
   * @throws ClassCastException if an element of the {@code filters} array unmarshalls
   *                            as a non-null object that is not a {@link NotificationFilter}.
   * @throws InstanceNotFoundException if the name of one of the management beans
   *                                   could not be resolved.
   * @throws SecurityException if, for one of the beans, the client or delegated subject
   *                           (if any) does not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see #removeNotificationListener(ObjectName, ObjectName,
   *                                  javax.security.auth.Subject)
   * @see #removeNotificationListener(ObjectName, ObjectName,
   *                                  java.rmi.MarshalledObject,
   *                                  java.rmi.MarshalledObject,
   *                                  javax.security.auth.Subject)
   * @see #removeNotificationListeners(ObjectName, Integer[],
   *                                  javax.security.auth.Subject)
   * @see NotificationBroadcaster#addNotificationListener(NotificationListener,
   *                                                      NotificationFilter,
   *                                                      Object)
   */
  @SuppressWarnings("rawtypes")
  Integer[] addNotificationListeners(ObjectName[] names, MarshalledObject[] filters,
                                     Subject[] delegationSubjects)
    throws InstanceNotFoundException, IOException;

  /**
   * Closes the connection and unexports the RMI object implementing this
   * interface.  Following this call, future method calls to this instance
   * will fail.
   *
   * @throws IOException if there is an I/O error in transmitting the close
   *                     request via RMI, closing the connection, or unexporting
   *                     the RMI object.
   */
  void close()
    throws IOException;

  /**
   * <p>
   * Handles {@link
   * MBeanServerConnection#createMBean(String, ObjectName,
   * Object[], String[])}.  The array of parameters is wrapped in
   * a {@link MarshalledObject} so that it is deserialised using the
   * bean's classloader.
   * </p>
   * <p>
   * Instantiates a new instance of the specified management bean
   * using the given constructor and registers it with the server
   * under the supplied name.  The class is loaded using the
   * {@link javax.management.loading.ClassLoaderRepository default
   * loader repository} of the server.
   * </p>
   * <p>
   * If the name supplied is <code>null</code>, then the bean is
   * expected to implement the {@link MBeanRegistration} interface.
   * The {@link MBeanRegistration#preRegister preRegister} method
   * of this interface will be used to obtain the name in this case.
   * </p>
   *
   * @param className the class of the management bean, of which
   *                  an instance should be created.
   * @param name the name to register the new bean with.  This may
   *             be <code>null</code>.
   * @param params the parameters for the bean's constructor, encapsulated
   *               in a {@link MarshalledObject}.  If this parameter is
   *               <code>null</code>, it will be judged equivalent to an
   *               empty array.
   * @param sig the signature of the constructor to use.  If this parameter
   *            is <code>null</code>, it will be judged equivalent to an
   *            empty array.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return an {@link ObjectInstance} containing the {@link ObjectName}
   *         and Java class name of the created instance.
   * @throws ReflectionException if an exception occurs in creating
   *                             an instance of the bean.
   * @throws InstanceAlreadyExistsException if a matching instance
   *                                        already exists.
   * @throws MBeanRegistrationException if an exception occurs in
   *                                    calling the preRegister
   *                                    method.
   * @throws MBeanException if the bean's constructor throws an exception.
   * @throws NotCompliantMBeanException if the created bean is not
   *                                    compliant with the JMX specification.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> class name or object
   *                                    name or if the object name is a pattern.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   */
  @SuppressWarnings("rawtypes")
  ObjectInstance createMBean(String className, ObjectName name,
                             MarshalledObject params, String[] sig,
                             Subject delegationSubject)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException, IOException;

  /**
   * <p>
   * Handles {@link
   * MBeanServerConnection#createMBean(String, ObjectName,
   * ObjectName, Object[], String[])}.  The array of parameters is
   * wrapped in a {@link MarshalledObject} so that it is deserialised
   * using the bean's classloader.
   * </p>
   * <p>
   * Instantiates a new instance of the specified management bean
   * using the given constructor and registers it with the server
   * under the supplied name.  The class is loaded using the
   * given class loader.  If this argument is <code>null</code>,
   * then the same class loader as was used to load the server
   * is used.
   * </p>
   * <p>
   * If the name supplied is <code>null</code>, then the bean is
   * expected to implement the {@link MBeanRegistration} interface.
   * The {@link MBeanRegistration#preRegister preRegister} method
   * of this interface will be used to obtain the name in this case.
   * </p>
   *
   * @param className the class of the management bean, of which
   *                  an instance should be created.
   * @param name the name to register the new bean with.  This may
   *             be <code>null</code>.
   * @param loaderName the name of the class loader.
   * @param params the parameters for the bean's constructor, encapsulated
   *               in a {@link MarshalledObject}.  If this parameter is
   *               <code>null</code>, it will be judged equivalent to an
   *               empty array.
   * @param sig the signature of the constructor to use.  If this parameter
   *            is <code>null</code>, it will be judged equivalent to an
   *            empty array.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return an {@link ObjectInstance} containing the {@link ObjectName}
   *         and Java class name of the created instance.
   * @throws ReflectionException if an exception occurs in creating
   *                             an instance of the bean.
   * @throws InstanceAlreadyExistsException if a matching instance
   *                                        already exists.
   * @throws MBeanRegistrationException if an exception occurs in
   *                                    calling the preRegister
   *                                    method.
   * @throws MBeanException if the bean's constructor throws an exception.
   * @throws NotCompliantMBeanException if the created bean is not
   *                                    compliant with the JMX specification.
   * @throws InstanceNotFoundException if the specified class loader is not
   *                                   registered with the server.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> class name or object
   *                                    name or if the object name is a pattern.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   */
  @SuppressWarnings("rawtypes")
  ObjectInstance createMBean(String className, ObjectName name,
                             ObjectName loaderName, MarshalledObject params,
                             String[] sig, Subject delegationSubject)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException, InstanceNotFoundException,
           IOException;

  /**
   * <p>
   * Handles {@link
   * MBeanServerConnection#createMBean(String, ObjectName,
   * ObjectName)} by instantiating a new instance of the specified
   * management bean using the default constructor and registering
   * it with the server under the supplied name.  The class is loaded
   * using the given class loader.  If this argument is <code>null</code>,
   * then the same class loader as was used to load the server
   * is used.
   * </p>
   * <p>
   * If the name supplied is <code>null</code>, then the bean is
   * expected to implement the {@link MBeanRegistration} interface.
   * The {@link MBeanRegistration#preRegister preRegister} method
   * of this interface will be used to obtain the name in this case.
   * </p>
   * <p>
   * This method is equivalent to calling {@link
   * #createMBean(String, ObjectName, ObjectName, Object[], String)
   * <code>createMBean(className, name, loaderName, (Object[]) null,
   * (String) null)</code>} with <code>null</code> parameters
   * and signature.
   * </p>
   *
   * @param className the class of the management bean, of which
   *                  an instance should be created.
   * @param name the name to register the new bean with.  This may
   *             be <code>null</code>.
   * @param loaderName the name of the class loader.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return an {@link ObjectInstance} containing the {@link ObjectName}
   *         and Java class name of the created instance.
   * @throws ReflectionException if an exception occurs in creating
   *                             an instance of the bean.
   * @throws InstanceAlreadyExistsException if a matching instance
   *                                        already exists.
   * @throws MBeanRegistrationException if an exception occurs in
   *                                    calling the preRegister
   *                                    method.
   * @throws MBeanException if the bean's constructor throws an exception.
   * @throws NotCompliantMBeanException if the created bean is not
   *                                    compliant with the JMX specification.
   * @throws InstanceNotFoundException if the specified class loader is not
   *                                   registered with the server.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> class name or object
   *                                    name or if the object name is a pattern.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see #createMBean(String, ObjectName, ObjectName, MarshalledObject,
   *                   String[], Subject)
   */
  ObjectInstance createMBean(String className, ObjectName name,
                             ObjectName loaderName, Subject delegationSubject)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException, InstanceNotFoundException,
           IOException;

  /**
   * <p>
   * Handles {@link
   * MBeanServerConnection#createMBean(String, ObjectName)} by
   * instantiating a new instance of the specified management bean
   * using the default constructor and registering it with the server
   * under the supplied name.  The class is loaded using the
   * {@link javax.management.loading.ClassLoaderRepository default
   * loader repository} of the server.
   * </p>
   * <p>
   * If the name supplied is <code>null</code>, then the bean is
   * expected to implement the {@link MBeanRegistration} interface.
   * The {@link MBeanRegistration#preRegister preRegister} method
   * of this interface will be used to obtain the name in this case.
   * </p>
   * <p>
   * This method is equivalent to calling {@link
   * #createMBean(String, ObjectName, Object[], String[])
   * <code>createMBean(className, name, (Object[]) null,
   * (String[]) null)</code>} with <code>null</code> parameters
   * and signature.
   * </p>
   *
   * @param className the class of the management bean, of which
   *                  an instance should be created.
   * @param name the name to register the new bean with.  This may
   *             be <code>null</code>.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return an {@link ObjectInstance} containing the {@link ObjectName}
   *         and Java class name of the created instance.
   * @throws ReflectionException if an exception occurs in creating
   *                             an instance of the bean.
   * @throws InstanceAlreadyExistsException if a matching instance
   *                                        already exists.
   * @throws MBeanRegistrationException if an exception occurs in
   *                                    calling the preRegister
   *                                    method.
   * @throws MBeanException if the bean's constructor throws an exception.
   * @throws NotCompliantMBeanException if the created bean is not
   *                                    compliant with the JMX specification.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> class name or object
   *                                    name or if the object name is a pattern.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see #createMBean(String, ObjectName, MarshalledObject, String[], Subject)
   */
  ObjectInstance createMBean(String className, ObjectName name,
                             Subject delegationSubject)
    throws ReflectionException, InstanceAlreadyExistsException,
           MBeanRegistrationException, MBeanException,
           NotCompliantMBeanException, IOException;

  /**
   * <p>
   * Retrieves any waiting notifications from the server.  When notifications
   * are requested using the {@link #addNotificationListeners(ObjectName[],
   * MarshalledObject[], Subject[])} method, the server sets up an internal
   * listener to receive notifications from the bean and buffer them.  When
   * this method is called, these buffered notifications can be retrieved.
   * </p>
   * <p>
   * The blocking behaviour of this method depends on the timeout value specified.
   * If there are no waiting notifications in the buffer, a value of 0 will cause
   * the method to return immediately.  Conversely, if the value is
   * {@link Long#MAX_VALUE}, then it will wait indefinitely until a notification
   * arrives. For any other value, it waits until a notification arrives or the
   * number of milliseconds specified by the timeout value is exceeded.  The
   * behaviour for a negative timeout value is undefined.
   * </p>
   * <p>
   * For a notification to be returned, the following criteria must be fulfilled:
   * </p>
   * <ul>
   * <li>the client must have previously requested notifications from at least
   * one bean</li>
   * <li>a bean from which notifications have been requested must have emitted
   * a notification since the last call to this method</li>
   * <li>the emitted notification must pass through any filters established
   * when notifications were requested</li>
   * <li>the sequence number of the notification must be greater than or equal
   * to the specified sequence number (if non-negative)</li>
   * </ul>
   *
   * @param sequenceNumber the sequence number of each notification returned
   *                       must be greater than or equal to this value.  If
   *                       the number is negative, this is interpreted as
   *                       meaning the sequence number of the next notification
   *                       and so all notifications are allowed through.
   * @param maxNotifications the maximum number of notifications to return.
   *                         This does not include any duplicates so the
   *                         number of actual notifications returned may
   *                         be larger.
   * @param timeout the number of milliseconds to wait for a notification
   *                if the buffer is empty.  <code>0</code> causes the
   *                method to return immediately even if there are no
   *                notifications available (non-blocking behaviour) while
   *                a value of {@link Long#MAX_VALUE} causes it to wait
   *                indefinitely (blocking behaviour).  The response to
   *                a negative value is undefined.
   * @return a {@link NotificationResult} object containing the buffered
   *         notifications.
   * @throws IOException if an I/O error occurs.
   */
  NotificationResult fetchNotifications(long sequenceNumber,
                                        int maxNotifications,
                                        long timeout)
    throws IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#getAttribute(ObjectName, String)},
   * returning the value of the supplied attribute from the specified
   * management bean.
   *
   * @param bean the bean to retrieve the value from.
   * @param name the name of the attribute to retrieve.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return the value of the attribute.
   * @throws AttributeNotFoundException if the attribute could not be
   *                                    accessed from the bean.
   * @throws MBeanException if the management bean's accessor throws
   *                        an exception.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws ReflectionException if an exception was thrown in trying
   *                             to invoke the bean's accessor.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> bean or attribute
   *                                    name.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see DynamicMBean#getAttribute(String)
   */
  Object getAttribute(ObjectName bean, String name, Subject delegationSubject)
    throws MBeanException, AttributeNotFoundException,
           InstanceNotFoundException, ReflectionException,
           IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#getAttribute(ObjectName, String)},
   * returning the values of the named attributes from the specified
   * management bean.
   *
   * @param bean the bean to retrieve the value from.
   * @param names the names of the attributes to retrieve.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return the values of the attributes.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws ReflectionException if an exception was thrown in trying
   *                             to invoke the bean's accessor.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> bean or attribute
   *                                    name.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see DynamicMBean#getAttributes(String[])
   */
  AttributeList getAttributes(ObjectName bean, String[] names,
                              Subject delegationSubject)
    throws InstanceNotFoundException, ReflectionException,
           IOException;

  /**
   * Returns the unique identifier for this connection to the RMI
   * server.
   *
   * @return the connection ID.
   * @throws IOException if an I/O error occurred.
   */
  String getConnectionId()
    throws IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#getDefaultDomain()} by returning the default
   * domain this server applies to beans that have no specified domain.
   *
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return the default domain.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   */
  String getDefaultDomain(Subject delegationSubject)
    throws IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#getDomains()} by returning an array
   * containing all the domains used by beans registered with
   * this server.  The ordering of the array is undefined.
   *
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return the list of domains.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see ObjectName#getDomain()
   */
  String[] getDomains(Subject delegationSubject)
    throws IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#getMBeanCount()} by returning the number of
   * management beans registered with this server.
   *
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return the number of registered beans.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   */
  Integer getMBeanCount(Subject delegationSubject)
    throws IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#getMBeanInfo(ObjectName)} by returning
   * information on the given management bean.
   *
   * @param name the name of the management bean.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return an instance of {@link MBeanInfo} for the bean.
   * @throws IntrospectionException if an exception occurs in examining
   *                                the bean.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws ReflectionException if an exception occurs when trying
   *                             to invoke {@link DynamicMBean#getMBeanInfo()}
   *                             on the bean.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see DynamicMBean#getMBeanInfo()
   */
  MBeanInfo getMBeanInfo(ObjectName name, Subject delegationSubject)
    throws InstanceNotFoundException, IntrospectionException,
           ReflectionException, IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#getObjectInstance(ObjectName)} by returning
   * the {@link ObjectInstance} created for the specified management
   * bean on registration.
   *
   * @param name the name of the bean.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return the corresponding {@link ObjectInstance} instance.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see #createMBean(String, ObjectName, Subject)
   */
  ObjectInstance getObjectInstance(ObjectName name, Subject delegationSubject)
    throws InstanceNotFoundException, IOException;

  /**
   * <p>
   * Handles {@link
   * MBeanServerConnection#invoke(ObjectName, String, Object[],
   * String[])}.  The array of parameters is wrapped in a
   * {@link MarshalledObject} so that it is deserialised
   * using the bean's classloader.
   * </p>
   * <p>
   * Invokes the supplied operation on the specified management
   * bean.  The class objects specified in the signature are loaded
   * using the same class loader as was used for the management bean.
   *
   * @param bean the management bean whose operation should be invoked.
   * @param name the name of the operation to invoke.
   * @param params the parameters for the bean's constructor, encapsulated
   *               in a {@link MarshalledObject}.  If this parameter is
   *               <code>null</code>, it will be judged equivalent to an
   *               empty array.
   * @param sig the signature of the constructor to use.  If this parameter
   *            is <code>null</code>, it will be judged equivalent to an
   *            empty array.  The class objects will be loaded using the
   *            bean's classloader.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return the return value of the method.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws MBeanException if the method invoked throws an exception.
   * @throws ReflectionException if an exception is thrown in invoking the
   *                             method.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see DynamicMBean#invoke(String, Object[], String[])
   */
  @SuppressWarnings("rawtypes")
  Object invoke(ObjectName bean, String name, MarshalledObject params,
                String[] sig, Subject delegationSubject)
    throws InstanceNotFoundException, MBeanException,
           ReflectionException, IOException;

  /**
   * <p>
   * Handles {@link
   * MBeanServerConnection#isInstanceOf(ObjectName, String) by
   * returning true if the specified management bean is an instance
   * of the supplied class.
   * </p>
   * <p>
   * A bean, B, is an instance of a class, C, if either of the following
   * conditions holds:
   * </p>
   * <ul>
   * <li>The class name in B's {@link MBeanInfo} is equal to the supplied
   * name.</li>
   * <li>Both the class of B and C were loaded by the same class loader,
   * and B is assignable to C.</li>
   * </ul>
   *
   * @param name the name of the management bean.
   * @param className the name of the class to test if <code>name</code> is
   *                  an instance of.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return true if either B is directly an instance of the named class,
   *         or B is assignable to the class, given that both it and B's
   *         current class were loaded using the same class loader.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   */
  boolean isInstanceOf(ObjectName name, String className,
                       Subject delegationSubject)
    throws InstanceNotFoundException, IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#isRegistered(ObjectName) by returning
   * true if the specified management bean is registered with
   * the server.
   *
   * @param name the name of the management bean.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return true if the bean is registered.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> bean name.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   */
  boolean isRegistered(ObjectName name, Subject delegationSubject)
    throws IOException;

  /**
   * <p>
   * Handles {@link
   * MBeanServerConnection#queryMBeans(ObjectName, QueryExp)}.
   * The query expression is wrapped in a {@link MarshalledObject}
   * so that it is deserialised using the bean's classloader.
   * </p>
   * <p>
   * Returns a set of {@link ObjectInstance}s matching the specified
   * criteria.  The full set of beans registered with the server
   * are passed through two filters:
   * </p>
   * <ol>
   * <li>Pattern matching is performed using the supplied
   * {@link ObjectName}.</li>
   * <li>The supplied query expression is applied.</li>
   * </ol>
   * <p>
   * If both the object name and the query expression are <code>null</code>,
   * or the object name has no domain and no key properties,
   * no filtering will be performed and all beans are returned.
   * </p>
   *
   * @param name an {@link ObjectName} to use as a filter.
   * @param query a query expression to apply to each of the beans that match
   *              the given object name, encapsulated in a
   *              {@link MarshalledObject}.  If a <code>null</code> value is
   *              encapsulated, then the beans will only be filtered using
   *              pattern matching on the supplied {@link ObjectName}.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return a set of {@link ObjectInstance}s matching the filtered beans.
   *         This is empty if no beans survived the filters.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   */
  @SuppressWarnings("rawtypes")
  Set<ObjectInstance> queryMBeans(ObjectName name, MarshalledObject query,
                                  Subject delegationSubject)
    throws IOException;

  /**
   * <p>
   * Handles {@link
   * MBeanServerConnection#queryNames(ObjectName, QueryExp)}.
   * The query expression is wrapped in a {@link MarshalledObject}
   * so that it is deserialised using the bean's classloader.
   * </p>
   * <p>
   * Returns a set of {@link ObjectName}s matching the specified
   * criteria.  The full set of beans registered with the server
   * are passed through two filters:
   * </p>
   * <ol>
   * <li>Pattern matching is performed using the supplied
   * {@link ObjectName}.</li>
   * <li>The supplied query expression is applied.</li>
   * </ol>
   * <p>
   * If both the object name and the query expression are <code>null</code>,
   * or the object name has no domain and no key properties,
   * no filtering will be performed and all beans are returned.
   * </p>
   *
   * @param name an {@link ObjectName} to use as a filter.
   * @param query a query expression to apply to each of the beans that match
   *              the given object name, encapsulated in a
   *              {@link MarshalledObject}.  If a <code>null</code> value is
   *              encapsulated, then the beans will only be filtered using
   *              pattern matching on the supplied {@link ObjectName}.
   * @param delegationSubject an instance of {@link javax.security.auth.Subject}
   *                          containing the delegation principles.  This may be
   *                          {@code null} is authentication is used instead.
   * @return a set of {@link ObjectName}s matching the filtered beans.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   */
  @SuppressWarnings("rawtypes")
  Set<ObjectName> queryNames(ObjectName name, MarshalledObject query,
                             Subject delegationSubject)
    throws IOException;

  /**
   * <p>
   * Handles {@link
   * MBeanServerConnection#removeNotificationListener(ObjectName,
   * ObjectName, NotificationFilter, Object)}. Both the filter and
   * the handback object are wrapped in a {@link MarshalledObject}
   * so that they are deserialised using the bean's classloader.
   * </p>
   * <p>
   * Removes the specified listener from the list of recipients
   * of notifications from the supplied bean.  Only the first instance with
   * the supplied filter and passback object is removed.
   * <code>null</code> is used as a valid value for these parameters,
   * rather than as a way to remove all registration instances for
   * the specified listener; for this behaviour instead, see
   * {@link #removeNotificationListener(ObjectName, NotificationListener)}.
   * </p>
   *
   * @param name the name of the management bean from which the
   *             listener should be removed.
   * @param listener the listener to remove.
   * @param filter a wrapper containing the filter of the listener
   *               to remove.
   * @param passback a wrapper containing the handback object of the
   *                 listener to remove.
   * @param delegationSubject a {@link javax.security.auth.Subject} instance
   *                          containing the delegation principles or
   *                          {@code null} if authentication is used.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws ListenerNotFoundException if the specified listener
   *                                   is not registered with the bean.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see #addNotificationListener(ObjectName, NotificationListener,
   *                               MarshalledObject, MarshalledObject, Subject)
   * @see NotificationEmitter#removeNotificationListener(NotificationListener,
   *                                                     NotificationFilter,
   *                                                     Object)
   */
  @SuppressWarnings("rawtypes")
  void removeNotificationListener(ObjectName name,
                                  ObjectName listener,
                                  MarshalledObject filter,
                                  MarshalledObject passback,
                                  Subject delegationSubject)
    throws InstanceNotFoundException, ListenerNotFoundException,
           IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#removeNotificationListener(ObjectName,
   * ObjectName)} by removing the specified listener from the list
   * of recipients of notifications from the supplied bean.  This
   * includes all combinations of filters and passback objects
   * registered for this listener.  For more specific removal of
   * listeners, see {@link #removeNotificationListener(ObjectName,
   * ObjectName,MarshalledObject,MarshalledObject,Subject)}
   *
   * @param name the name of the management bean from which the
   *             listener should be removed.
   * @param listener the name of the listener to remove.
   * @param delegationSubject a {@link javax.security.auth.Subject} instance
   *                          containing the delegation principles or
   *                          {@code null} if authentication is used.
   * @throws InstanceNotFoundException if a name doesn't match a registered
   *                                   bean.
   * @throws ListenerNotFoundException if the specified listener
   *                                   is not registered with the bean.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see #addNotificationListener(ObjectName, NotificationListener,
   *                               MarshalledObject, MarshalledObject, Subject)
   * @see NotificationBroadcaster#removeNotificationListener(NotificationListener)
   */
  void removeNotificationListener(ObjectName name, ObjectName listener,
                                  Subject delegationSubject)
    throws InstanceNotFoundException, ListenerNotFoundException,
           IOException;

  /**
   * Removes one or more {@link NotificationListener}s from the specified
   * management bean.  This method corresponds to
   * {@link #addNotificationListeners(ObjectName[], MarshalledObject[],
   * Subject)} and provides a different way of handling
   * MBeanServerConnection#removeNotificationListener(ObjectName,
   * ObjectName)} and
   * {@link MBeanServerConnection#removeNotificationListener(ObjectName,
   * ObjectName, NotificationFilter, Object)} by using the integer
   * identifiers provided by the
   * {@link #addNotificationListeners(ObjectName[], MarshalledObject[],
   * Subject)} method to select the listeners to remove.
   *
   * @param name the name of the management bean from which the
   *             listeners should be removed.
   * @param listenerIds the identifiers of the listeners to remove.
   * @param delegationSubject a {@link javax.security.auth.Subject} instance
   *                          containing the delegation principles or
   *                          {@code null} if authentication is used.
   * @throws InstanceNotFoundException if a name doesn't match a registered
   *                                   bean.
   * @throws ListenerNotFoundException if the specified listener
   *                                   is not registered with the bean.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @throws IllegalArgumentException if either <code>name</code>,
   *                                  <code>listenerIds</code> or an element
   *                                  of <code>listenerIds</code>
   *                                  is <code>null</code>.
   * @see #addNotificationListeners(ObjectName[], MarshalledObject[], Subject)
   */
  void removeNotificationListeners(ObjectName name, Integer[] listenerIds,
                                   Subject delegationSubject)
    throws InstanceNotFoundException, ListenerNotFoundException,
           IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#setAttribute(ObjectName, Attribute)}
   * by setting the value of the specified attribute of the supplied
   * management bean.  The attribute is wrapped in a
   * {@link MarshalledObject} so that it is deserialised using the
   * bean's classloader.
   *
   * @param name the name of the management bean.
   * @param attribute the attribute to set, encapsulated in a
   *                  {@link MarshalledObject}.
   * @param delegationSubject a {@link javax.security.auth.Subject} instance
   *                          containing the delegation principles or
   *                          {@code null} if authentication is used.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws AttributeNotFoundException if the attribute does not
   *                                    correspond to an attribute
   *                                    of the bean.
   * @throws InvalidAttributeValueException if the value is invalid
   *                                        for this particular
   *                                        attribute of the bean.
   * @throws MBeanException if setting the attribute causes
   *                        the bean to throw an exception (which
   *                        becomes the cause of this exception).
   * @throws ReflectionException if an exception occurred in trying
   *                             to use the reflection interface
   *                             to lookup the attribute.  The
   *                             thrown exception is the cause of
   *                             this exception.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> bean or attribute
   *                                    name.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see #getAttribute(ObjectName, String, Subject)
   * @see javax.management.DynamicMBean#setAttribute(Attribute)
   */
  @SuppressWarnings("rawtypes")
  void setAttribute(ObjectName name, MarshalledObject attribute,
                    Subject delegationSubject)
    throws InstanceNotFoundException, AttributeNotFoundException,
           InvalidAttributeValueException, MBeanException,
           ReflectionException, IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#setAttributes(ObjectName, AttributeList)}
   * by setting the value of each of the specified attributes
   * of the supplied management bean to that specified by
   * the {@link Attribute} object.  The returned list contains
   * the attributes that were set and their new values.
   * The attribute list is wrapped in a {@link MarshalledObject} so
   * that it is deserialised using the bean's classloader.
   *
   * @param name the name of the management bean.
   * @param attributes the attributes to set, encapsulated in a
   *                   {@link MarshalledObject}.
   * @param delegationSubject a {@link javax.security.auth.Subject} instance
   *                          containing the delegation principles or
   *                          {@code null} if authentication is used.
   * @return a list of the changed attributes.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws ReflectionException if an exception occurred in trying
   *                             to use the reflection interface
   *                             to lookup the attribute.  The
   *                             thrown exception is the cause of
   *                             this exception.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> bean or attribute
   *                                    list.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   * @see #getAttributes(ObjectName, String[])
   * @see DynamicMBean#setAttributes(AttributeList)
   */
  @SuppressWarnings("rawtypes")
  AttributeList setAttributes(ObjectName name, MarshalledObject attributes,
                              Subject delegationSubject)
    throws InstanceNotFoundException, ReflectionException,
           IOException;

  /**
   * Handles {@link
   * MBeanServerConnection#unregisterMBean(ObjectName)} by unregistering
   * the specified management bean.  Following this operation,
   * the bean instance is no longer accessible from the server via this
   * name.  Prior to unregistering the bean, the
   * {@link MBeanRegistration#preDeregister()} method will be called if
   * the bean implements the {@link MBeanRegistration} interface.
   *
   * @param name the name of the management bean.
   * @param delegationSubject a {@link javax.security.auth.Subject} instance
   *                          containing the delegation principles or
   *                          {@code null} if authentication is used.
   * @throws InstanceNotFoundException if the bean can not be found.
   * @throws MBeanRegistrationException if an exception occurs in
   *                                    calling the preDeregister
   *                                    method.
   * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
   *                                    is thrown by the server due to a
   *                                    <code>null</code> bean name or a
   *                                    request being made to unregister the
   *                                    {@link MBeanServerDelegate} bean.
   * @throws SecurityException if the client or delegated subject (if any) does
   *                           not have permission to invoke this operation.
   * @throws IOException if an I/O error occurred in communicating with
   *                     the bean server.
   */
  void unregisterMBean(ObjectName name, Subject delegationSubject)
    throws InstanceNotFoundException, MBeanRegistrationException,
           IOException;

}
OpenPOWER on IntegriCloud