01: /*
02: * Copyright 2002-2005 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.jmx.export.metadata;
18:
19: import java.lang.reflect.Method;
20:
21: /**
22: * Interface used by the <code>MetadataMBeanInfoAssembler</code> to
23: * read source-level metadata from a managed resource's class.
24: *
25: * @author Rob Harrop
26: * @since 1.2
27: * @see org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler#setAttributeSource
28: * @see org.springframework.jmx.export.MBeanExporter#setAssembler
29: */
30: public interface JmxAttributeSource {
31:
32: /**
33: * Implementations should return an instance of <code>ManagedResource</code>
34: * if the supplied <code>Class</code> has the appropriate metadata.
35: * Otherwise should return <code>null</code>.
36: * @param clazz the class to read the attribute data from
37: * @return the attribute, or <code>null</code> if not found
38: * @throws InvalidMetadataException in case of invalid attributes
39: */
40: ManagedResource getManagedResource(Class clazz)
41: throws InvalidMetadataException;
42:
43: /**
44: * Implementations should return an instance of <code>ManagedAttribute</code>
45: * if the supplied <code>Method</code> has the corresponding metadata.
46: * Otherwise should return <code>null</code>.
47: * @param method the method to read the attribute data from
48: * @return the attribute, or <code>null</code> if not found
49: * @throws InvalidMetadataException in case of invalid attributes
50: */
51: ManagedAttribute getManagedAttribute(Method method)
52: throws InvalidMetadataException;
53:
54: /**
55: * Implementations should return an instance of <code>ManagedOperation</code>
56: * if the supplied <code>Method</code> has the corresponding metadata.
57: * Otherwise should return <code>null</code>.
58: * @param method the method to read the attribute data from
59: * @return the attribute, or <code>null</code> if not found
60: * @throws InvalidMetadataException in case of invalid attributes
61: */
62: ManagedOperation getManagedOperation(Method method)
63: throws InvalidMetadataException;
64:
65: /**
66: * Implementations should return an array of <code>ManagedOperationParameter</code>
67: * if the supplied <code>Method</code> has the corresponding metadata. Otherwise
68: * should return an empty array if no metadata is found.
69: * @param method the <code>Method</code> to read the metadata from
70: * @return the parameter information.
71: * @throws InvalidMetadataException in the case of invalid attributes.
72: */
73: ManagedOperationParameter[] getManagedOperationParameters(
74: Method method) throws InvalidMetadataException;
75:
76: /**
77: * Implementations should return an array of {@link ManagedNotification ManagedNotifications}
78: * if the supplied the <code>Class</code> has the corresponding metadata. Otherwise
79: * should return an empty array.
80: * @param clazz the <code>Class</code> to read the metadata from
81: * @return the notification information
82: * @throws InvalidMetadataException in the case of invalid metadata
83: */
84: ManagedNotification[] getManagedNotifications(Class clazz)
85: throws InvalidMetadataException;
86: }
|