blob: 09f61a2addc93288085176a1e5d7f0e46adb9308 [file] [log] [blame]
Stephane Frenot1cee87d2006-07-17 12:14:31 +00001/*
2 * Copyright (C) MX4J.
3 * All rights reserved.
4 *
5 * This software is distributed under the terms of the MX4J License version 1.0.
6 * See the terms of the MX4J License in the documentation provided with this software.
7 */
8/*
9 * Copyright 2005 The Apache Software Foundation
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
14 *
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
22 *
23 */
24package org.apache.felix.mosgi.jmx.agent.mx4j.server.interceptor;
25
26
27import java.util.List;
28
29import javax.management.Attribute;
30import javax.management.AttributeList;
31import javax.management.AttributeNotFoundException;
32import javax.management.InvalidAttributeValueException;
33import javax.management.ListenerNotFoundException;
34import javax.management.MBeanException;
35import javax.management.MBeanInfo;
36import javax.management.MBeanRegistrationException;
37import javax.management.NotificationFilter;
38import javax.management.NotificationListener;
39import javax.management.ReflectionException;
40
41import org.apache.felix.mosgi.jmx.agent.mx4j.server.MBeanMetaData;
42
43/**
44 * MBeanServer --> MBean interceptor.
45 * These interceptors are used internally to implement MBeanServer functionality prior to call
46 * MBeans, and can be used to customize MBeanServer implementation by users.
47 *
48 * @author <a href="mailto:biorn_steedom@users.sourceforge.net">Simone Bordet</a>
49 * @version $Revision: 1.1.1.1 $
50 */
51public interface MBeanServerInterceptor
52{
53 /**
54 * Constant used to specify the status of the MBean registration in {@link #registration}
55 */
56 public static final int PRE_REGISTER = 1;
57 /**
58 * Constant used to specify the status of the MBean registration in {@link #registration}
59 */
60 public static final int POST_REGISTER_TRUE = 2;
61 /**
62 * Constant used to specify the status of the MBean registration in {@link #registration}
63 */
64 public static final int POST_REGISTER_FALSE = 3;
65 /**
66 * Constant used to specify the status of the MBean registration in {@link #registration}
67 */
68 public static final int PRE_DEREGISTER = 4;
69 /**
70 * Constant used to specify the status of the MBean registration in {@link #registration}
71 */
72 public static final int POST_DEREGISTER = 5;
73
74 /**
75 * A concise string that tells the type of this interceptor
76 */
77 public String getType();
78
79 /**
80 * Sets the chain of interceptors on this interceptor. This interceptor will use this list to
81 * find the interceptor in the chain after itself
82 * @param interceptors The list of interceptors
83 */
84 public void setChain(List interceptors);
85
86 /**
87 * Adds the given notification listener to the MBean, along with the given filter and handback
88 */
89 public void addNotificationListener(MBeanMetaData metadata, NotificationListener listener, NotificationFilter filter, Object handback);
90
91 /**
92 * Removes the given notification listener from the MBean.
93 */
94 public void removeNotificationListener(MBeanMetaData metadata, NotificationListener listener) throws ListenerNotFoundException;
95 /**
96 * Removes the given notification listener from the MBean, specified by the given filter and handback.
97 */
98 public void removeNotificationListener(MBeanMetaData metadata, NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException;
99
100 /**
101 * Instantiate the given className passing the given arguments to the constructor with the given signature
102 */
103 public void instantiate(MBeanMetaData metadata, String className, String[] params, Object[] args) throws ReflectionException, MBeanException;
104
105 /**
106 * Calls the specified {@link javax.management.MBeanRegistration} method on the MBean instance.
107 */
108 public void registration(MBeanMetaData metadata, int operation) throws MBeanRegistrationException;
109
110 /**
111 * Calls getMBeanInfo on the MBean instance (only on DynamicMBeans).
112 */
113 public MBeanInfo getMBeanInfo(MBeanMetaData metadata);
114
115 /**
116 * Invokes the specified MBean operation on the MBean instance
117 */
118 public Object invoke(MBeanMetaData metadata, String method, String[] params, Object[] args) throws MBeanException, ReflectionException;
119
120 /**
121 * Gets the specified attributes values from the MBean instance.
122 */
123 public AttributeList getAttributes(MBeanMetaData metadata, String[] attributes);
124
125 /**
126 * Sets the specified attributes values on the MBean instance.
127 */
128 public AttributeList setAttributes(MBeanMetaData metadata, AttributeList attributes);
129
130 /**
131 * Gets the specified attribute value from the MBean instance.
132 */
133 public Object getAttribute(MBeanMetaData metadata, String attribute) throws MBeanException, AttributeNotFoundException, ReflectionException;
134
135 /**
136 * Sets the specified attribute value on the MBean instance.
137 */
138 public void setAttribute(MBeanMetaData metadata, Attribute attribute) throws MBeanException, AttributeNotFoundException, InvalidAttributeValueException, ReflectionException;
139}