Commit d0857853f01931f96f04ebf4cfaca857ce64e2db
1 parent
c5c7b636
Exists in
master
Refatorado pacote do projeto para conformar com padrões do framework
demoiselle.
Showing
18 changed files
with
914 additions
and
895 deletions
Show diff stats
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/configuration/JMXConfig.java
0 → 100644
... | ... | @@ -0,0 +1,142 @@ |
1 | +/* | |
2 | + * Demoiselle Framework | |
3 | + * Copyright (C) 2010 SERPRO | |
4 | + * ---------------------------------------------------------------------------- | |
5 | + * This file is part of Demoiselle Framework. | |
6 | + * | |
7 | + * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | + * as published by the Free Software Foundation. | |
10 | + * | |
11 | + * This program is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | + * ---------------------------------------------------------------------------- | |
21 | + * Este arquivo é parte do Framework Demoiselle. | |
22 | + * | |
23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | + * do Software Livre (FSF). | |
26 | + * | |
27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | + * para maiores detalhes. | |
31 | + * | |
32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | + */ | |
37 | +package br.gov.frameworkdemoiselle.configuration; | |
38 | + | |
39 | +import javax.management.NotificationBroadcaster; | |
40 | + | |
41 | +import br.gov.frameworkdemoiselle.annotation.Name; | |
42 | +import br.gov.frameworkdemoiselle.configuration.Configuration; | |
43 | +import br.gov.frameworkdemoiselle.stereotype.ManagementController; | |
44 | + | |
45 | +/** | |
46 | + * | |
47 | + * Contains configuration parameters to control how {@link Managed} classes are exposed to the MBean server. | |
48 | + * | |
49 | + * To use this class, inject it into your code using the {@link Inject} annotation. | |
50 | + * | |
51 | + * ex:<pre><code> | |
52 | + * | |
53 | + * public class BusinessClass(){ | |
54 | + * | |
55 | + * //... | |
56 | + * | |
57 | + * &at;Inject | |
58 | + * private JMXConfig jmxConfiguration; | |
59 | + * | |
60 | + * //... | |
61 | + * | |
62 | + * } | |
63 | + * </code></pre> | |
64 | + * | |
65 | + * @author serpro | |
66 | + * | |
67 | + */ | |
68 | +@Configuration(prefix = "frameworkdemoiselle.management.jmx.") | |
69 | +public class JMXConfig { | |
70 | + | |
71 | + @Name("mbean.domain") | |
72 | + private String mbeanDomain; | |
73 | + | |
74 | + @Name("notification.domain") | |
75 | + private String notificationDomain = "br.gov.frameworkdemoiselle.jmx"; | |
76 | + | |
77 | + @Name("notification.name") | |
78 | + private String notificationMBeanName = "NotificationBroadcaster"; | |
79 | + | |
80 | + /** | |
81 | + * </p>The domain to register all {@link ManagementController} classes found during boot.</p> | |
82 | + * | |
83 | + * <p>The full name of a MBean has the format of <code>domain:name=MBeanName</code> (ex: <code>br.gov.frameworkdemoiselle.jmx:name=NotificationBroadcaster</code>), this | |
84 | + * parameter is the "domain" portion of the full name.</p> | |
85 | + * | |
86 | + * <p>The default is <code>null</code> and when is set to <code>null</code>, all {@link Managed} classes will use it's own package as the domain.</p> | |
87 | + * | |
88 | + */ | |
89 | + public String getMbeanDomain() { | |
90 | + return mbeanDomain; | |
91 | + } | |
92 | + | |
93 | + /** | |
94 | + * @see #getMbeanDomain() | |
95 | + */ | |
96 | + public void setMbeanDomain(String mbeanDomain) { | |
97 | + this.mbeanDomain = mbeanDomain; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * <p>The name the {@link NotificationBroadcaster} MBean will be registered to. The full name | |
102 | + * of a MBean has the format of <code>domain:name=MBeanName</code> (ex: <code>br.gov.frameworkdemoiselle.jmx:name=NotificationBroadcaster</code>), this | |
103 | + * parameter is the ":name=MBeanName" portion without the ":name=".</p> | |
104 | + * | |
105 | + * <p>The default is the value returned by {@link Class#getSimpleName()} when called from the {@link NotificationBroadcaster} class.</p> | |
106 | + * | |
107 | + * @see #getMbeanDomain() | |
108 | + */ | |
109 | + public String getNotificationMBeanName() { | |
110 | + return notificationMBeanName; | |
111 | + } | |
112 | + | |
113 | + /** | |
114 | + * @see #getNotificationMBeanName() | |
115 | + */ | |
116 | + public void setNotificationMBeanName(String notificationMBeanName) { | |
117 | + this.notificationMBeanName = notificationMBeanName; | |
118 | + } | |
119 | + | |
120 | + /** | |
121 | + * </p>The domain to register the {@link NotificationBroadcaster} MBean.</p> | |
122 | + * | |
123 | + * <p>The full name of a MBean has the format of <code>domain:name=MBeanName</code> (ex: <code>br.gov.frameworkdemoiselle.jmx:name=NotificationBroadcaster</code>), this | |
124 | + * parameter is the "domain" portion of the full name.</p> | |
125 | + * | |
126 | + * <p>The default is <code>br.gov.frameworkdemoiselle.jmx</code>.</p> | |
127 | + * | |
128 | + */ | |
129 | + public String getNotificationDomain() { | |
130 | + return notificationDomain; | |
131 | + } | |
132 | + | |
133 | + /** | |
134 | + * @see #getNotificationDomain() | |
135 | + */ | |
136 | + public void setNotificationDomain(String notificationDomain) { | |
137 | + this.notificationDomain = notificationDomain; | |
138 | + } | |
139 | + | |
140 | + | |
141 | + | |
142 | +} | ... | ... |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/internal/DynamicMBeanProxy.java
0 → 100644
... | ... | @@ -0,0 +1,264 @@ |
1 | +/* | |
2 | + * Demoiselle Framework | |
3 | + * Copyright (C) 2010 SERPRO | |
4 | + * ---------------------------------------------------------------------------- | |
5 | + * This file is part of Demoiselle Framework. | |
6 | + * | |
7 | + * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | + * as published by the Free Software Foundation. | |
10 | + * | |
11 | + * This program is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | + * ---------------------------------------------------------------------------- | |
21 | + * Este arquivo é parte do Framework Demoiselle. | |
22 | + * | |
23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | + * do Software Livre (FSF). | |
26 | + * | |
27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | + * para maiores detalhes. | |
31 | + * | |
32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | + */ | |
37 | +package br.gov.frameworkdemoiselle.internal; | |
38 | + | |
39 | +import java.util.ArrayList; | |
40 | +import java.util.Locale; | |
41 | +import java.util.Map.Entry; | |
42 | + | |
43 | +import javax.management.Attribute; | |
44 | +import javax.management.AttributeList; | |
45 | +import javax.management.AttributeNotFoundException; | |
46 | +import javax.management.DynamicMBean; | |
47 | +import javax.management.InvalidAttributeValueException; | |
48 | +import javax.management.MBeanAttributeInfo; | |
49 | +import javax.management.MBeanException; | |
50 | +import javax.management.MBeanInfo; | |
51 | +import javax.management.MBeanOperationInfo; | |
52 | +import javax.management.MBeanParameterInfo; | |
53 | +import javax.management.ReflectionException; | |
54 | + | |
55 | +import br.gov.frameworkdemoiselle.DemoiselleException; | |
56 | +import br.gov.frameworkdemoiselle.internal.management.ManagedType; | |
57 | +import br.gov.frameworkdemoiselle.internal.management.ManagedType.FieldDetail; | |
58 | +import br.gov.frameworkdemoiselle.internal.management.ManagedType.MethodDetail; | |
59 | +import br.gov.frameworkdemoiselle.internal.management.ManagedType.ParameterDetail; | |
60 | +import br.gov.frameworkdemoiselle.internal.management.Management; | |
61 | +import br.gov.frameworkdemoiselle.stereotype.ManagementController; | |
62 | +import br.gov.frameworkdemoiselle.util.Beans; | |
63 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
64 | + | |
65 | +/** | |
66 | + * <p> | |
67 | + * This class is a MBean that gets registered everytime you mark a class with {@link ManagementController}. It dynamicaly reads the | |
68 | + * fields and operations contained in a {@link ManagementController} class and exposes them to the MBean server. Everytime a client | |
69 | + * tries to call an operation or read/write a property inside a ManagementController class, this class will call the appropriate | |
70 | + * method and pass the result to the MBean client. | |
71 | + * </p> | |
72 | + * | |
73 | + * @author SERPRO | |
74 | + */ | |
75 | +public class DynamicMBeanProxy implements DynamicMBean { | |
76 | + | |
77 | + private MBeanInfo delegateInfo; | |
78 | + | |
79 | + private ManagedType managedType; | |
80 | + | |
81 | + private ResourceBundle bundle; | |
82 | + | |
83 | + public DynamicMBeanProxy(ManagedType type) { | |
84 | + if (type == null) { | |
85 | + throw new NullPointerException(getBundle().getString("mbean-null-type-defined")); | |
86 | + } | |
87 | + managedType = type; | |
88 | + } | |
89 | + | |
90 | + @Override | |
91 | + public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { | |
92 | + // Se o bean ainda não foi lido para determinar seus atributos, o faz agora. | |
93 | + if (delegateInfo == null) { | |
94 | + initializeMBeanInfo(); | |
95 | + } | |
96 | + | |
97 | + Management manager = Beans.getReference(Management.class); | |
98 | + return manager.getProperty(managedType, attribute); | |
99 | + } | |
100 | + | |
101 | + @Override | |
102 | + public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, | |
103 | + MBeanException, ReflectionException { | |
104 | + | |
105 | + // Se o bean ainda não foi lido para determinar seus atributos, o faz agora. | |
106 | + if (delegateInfo == null) { | |
107 | + initializeMBeanInfo(); | |
108 | + } | |
109 | + | |
110 | + Management manager = Beans.getReference(Management.class); | |
111 | + manager.setProperty(managedType, attribute.getName(), attribute.getValue()); | |
112 | + } | |
113 | + | |
114 | + @Override | |
115 | + public AttributeList getAttributes(String[] attributes) { | |
116 | + if (attributes != null) { | |
117 | + AttributeList list = new AttributeList(); | |
118 | + for (String attribute : attributes) { | |
119 | + try { | |
120 | + Object value = getAttribute(attribute); | |
121 | + list.add(new Attribute(attribute, value)); | |
122 | + } catch (Throwable t) { | |
123 | + } | |
124 | + } | |
125 | + | |
126 | + return list; | |
127 | + } | |
128 | + | |
129 | + return null; | |
130 | + } | |
131 | + | |
132 | + @Override | |
133 | + public AttributeList setAttributes(AttributeList attributes) { | |
134 | + AttributeList settedAttributes = new AttributeList(); | |
135 | + if (attributes != null) { | |
136 | + for (Attribute attribute : attributes.asList()) { | |
137 | + try { | |
138 | + setAttribute(attribute); | |
139 | + | |
140 | + // A razão para separarmos a criação do atributo de sua adição na lista é que | |
141 | + // caso a obtenção do novo valor do atributo dispare uma exceção então o atributo não será | |
142 | + // adicionado na lista de atributos que foram afetados. | |
143 | + Attribute attributeWithNewValue = new Attribute(attribute.getName(), | |
144 | + getAttribute(attribute.getName())); | |
145 | + settedAttributes.add(attributeWithNewValue); | |
146 | + } catch (Throwable t) { | |
147 | + } | |
148 | + } | |
149 | + } | |
150 | + | |
151 | + return settedAttributes; | |
152 | + } | |
153 | + | |
154 | + @Override | |
155 | + public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, | |
156 | + ReflectionException { | |
157 | + | |
158 | + // Se o bean ainda não foi lido para determinar seus atributos, o faz agora. | |
159 | + if (this.delegateInfo == null) { | |
160 | + initializeMBeanInfo(); | |
161 | + } | |
162 | + | |
163 | + Management manager = Beans.getReference(Management.class); | |
164 | + return manager.invoke(managedType, actionName, params); | |
165 | + } | |
166 | + | |
167 | + /** | |
168 | + * Initialize the Managed information for this instance of Managed | |
169 | + */ | |
170 | + private void initializeMBeanInfo() { | |
171 | + // Aqui vamos armazenar nossos atributos | |
172 | + ArrayList<MBeanAttributeInfo> attributes = new ArrayList<MBeanAttributeInfo>(); | |
173 | + | |
174 | + // Aqui vamos armazenar nossas operações | |
175 | + ArrayList<MBeanOperationInfo> operations = new ArrayList<MBeanOperationInfo>(); | |
176 | + | |
177 | + // Para cada propriedade descoberta no ManagementController, cria um attributeInfo correspondente | |
178 | + for (Entry<String, FieldDetail> fieldEntry : managedType.getFields().entrySet()) { | |
179 | + | |
180 | + try { | |
181 | + | |
182 | + MBeanAttributeInfo attributeInfo = new MBeanAttributeInfo(fieldEntry.getKey(), fieldEntry.getValue() | |
183 | + .getDescription(), fieldEntry.getValue().getGetterMethod(), fieldEntry.getValue() | |
184 | + .getSetterMethod()); | |
185 | + attributes.add(attributeInfo); | |
186 | + | |
187 | + } catch (javax.management.IntrospectionException e) { | |
188 | + throw new DemoiselleException(getBundle().getString("mbean-introspection-error", managedType.getType() | |
189 | + .getSimpleName())); | |
190 | + } | |
191 | + } | |
192 | + | |
193 | + // Para cada operação descoberta no ManagementController, cria um operationInfo correspondente | |
194 | + for (Entry<String, MethodDetail> methodEntry : managedType.getOperationMethods().entrySet()) { | |
195 | + | |
196 | + MethodDetail methodDetail = methodEntry.getValue(); | |
197 | + | |
198 | + ParameterDetail[] parameterTypes = methodDetail.getParameterTypers(); | |
199 | + | |
200 | + MBeanParameterInfo[] parameters = parameterTypes.length > 0 ? new MBeanParameterInfo[parameterTypes.length] | |
201 | + : null; | |
202 | + | |
203 | + if (parameters != null) { | |
204 | + | |
205 | + for (int i = 0; i < parameterTypes.length; i++) { | |
206 | + | |
207 | + parameters[i] = new MBeanParameterInfo(parameterTypes[i].getParameterName(), parameterTypes[i] | |
208 | + .getParameterType().getCanonicalName(), parameterTypes[i].getParameterDescription()); | |
209 | + } | |
210 | + } | |
211 | + | |
212 | + // Com todas as informações, criamos nossa instância de MBeanOperationInfo e | |
213 | + // acrescentamos na lista de todas as operações. | |
214 | + int operationType = 0; | |
215 | + switch(methodDetail.getType()){ | |
216 | + case ACTION: | |
217 | + operationType = MBeanOperationInfo.ACTION; | |
218 | + break; | |
219 | + | |
220 | + case INFO: | |
221 | + operationType = MBeanOperationInfo.INFO; | |
222 | + break; | |
223 | + | |
224 | + case ACTION_INFO: | |
225 | + operationType = MBeanOperationInfo.ACTION_INFO; | |
226 | + break; | |
227 | + | |
228 | + default: | |
229 | + operationType = MBeanOperationInfo.UNKNOWN; | |
230 | + } | |
231 | + | |
232 | + MBeanOperationInfo operation = new MBeanOperationInfo(methodDetail.getMethod().getName(), | |
233 | + methodDetail.getDescription(), parameters, methodDetail.getMethod().getReturnType().getName(), | |
234 | + operationType); | |
235 | + | |
236 | + operations.add(operation); | |
237 | + | |
238 | + } | |
239 | + | |
240 | + // Por fim criamos nosso bean info. | |
241 | + delegateInfo = new MBeanInfo(managedType.getType().getCanonicalName(), managedType.getDescription(), | |
242 | + attributes.toArray(new MBeanAttributeInfo[0]), null, operations.toArray(new MBeanOperationInfo[0]), | |
243 | + null); | |
244 | + | |
245 | + } | |
246 | + | |
247 | + @Override | |
248 | + public MBeanInfo getMBeanInfo() { | |
249 | + if (delegateInfo == null) { | |
250 | + initializeMBeanInfo(); | |
251 | + } | |
252 | + | |
253 | + return delegateInfo; | |
254 | + } | |
255 | + | |
256 | + public ResourceBundle getBundle(){ | |
257 | + if (bundle==null){ | |
258 | + bundle = new ResourceBundle("demoiselle-jmx-bundle", Locale.getDefault()); | |
259 | + } | |
260 | + | |
261 | + return bundle; | |
262 | + } | |
263 | + | |
264 | +} | ... | ... |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/internal/JMXManagementExtension.java
0 → 100644
... | ... | @@ -0,0 +1,104 @@ |
1 | +/* | |
2 | + * Demoiselle Framework | |
3 | + * Copyright (C) 2010 SERPRO | |
4 | + * ---------------------------------------------------------------------------- | |
5 | + * This file is part of Demoiselle Framework. | |
6 | + * | |
7 | + * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | + * as published by the Free Software Foundation. | |
10 | + * | |
11 | + * This program is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | + * ---------------------------------------------------------------------------- | |
21 | + * Este arquivo é parte do Framework Demoiselle. | |
22 | + * | |
23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | + * do Software Livre (FSF). | |
26 | + * | |
27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | + * para maiores detalhes. | |
31 | + * | |
32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | + */ | |
37 | +package br.gov.frameworkdemoiselle.internal; | |
38 | + | |
39 | +import java.util.List; | |
40 | + | |
41 | +import javax.management.ObjectInstance; | |
42 | + | |
43 | +import br.gov.frameworkdemoiselle.annotation.Name; | |
44 | +import br.gov.frameworkdemoiselle.configuration.JMXConfig; | |
45 | +import br.gov.frameworkdemoiselle.internal.management.ManagedType; | |
46 | +import br.gov.frameworkdemoiselle.lifecycle.ManagementExtension; | |
47 | +import br.gov.frameworkdemoiselle.util.Beans; | |
48 | + | |
49 | +public class JMXManagementExtension implements ManagementExtension { | |
50 | + | |
51 | + public void registerNotificationMBean(){ | |
52 | + MBeanManager mbeanManager = Beans.getReference(MBeanManager.class); | |
53 | + JMXConfig configuration = Beans.getReference(JMXConfig.class); | |
54 | + | |
55 | + StringBuffer notificationMBeanName = new StringBuffer() | |
56 | + .append( configuration.getNotificationDomain()!=null ? configuration.getNotificationDomain() : "br.gov.frameworkdemoiselle.jmx" ) | |
57 | + .append(":name=") | |
58 | + .append(configuration.getNotificationMBeanName()); | |
59 | + | |
60 | + if (mbeanManager.findMBeanInstance(notificationMBeanName.toString()) == null){ | |
61 | + NotificationEventListener listener = Beans.getReference(NotificationEventListener.class); | |
62 | + | |
63 | + ObjectInstance instance = MBeanHelper.register(listener.createNotificationBroadcaster(), notificationMBeanName.toString()); | |
64 | + mbeanManager.storeRegisteredMBean(instance); | |
65 | + } | |
66 | + } | |
67 | + | |
68 | + @Override | |
69 | + public void initialize(List<ManagedType> managedTypes) { | |
70 | + MBeanManager manager = Beans.getReference(MBeanManager.class); | |
71 | + JMXConfig configuration = Beans.getReference(JMXConfig.class); | |
72 | + | |
73 | + for (ManagedType type : managedTypes) { | |
74 | + DynamicMBeanProxy beanProxy = new DynamicMBeanProxy(type); | |
75 | + | |
76 | + Name nameAnnotation = type.getType().getAnnotation(Name.class); | |
77 | + String mbeanName = nameAnnotation != null ? nameAnnotation.value() : type.getType().getSimpleName(); | |
78 | + | |
79 | + StringBuffer name = new StringBuffer() | |
80 | + .append( configuration.getMbeanDomain()!=null ? configuration.getMbeanDomain() : type.getType().getPackage().getName() ) | |
81 | + .append(":name=") | |
82 | + .append( mbeanName ); | |
83 | + | |
84 | + | |
85 | + if (manager.findMBeanInstance(name.toString()) == null){ | |
86 | + ObjectInstance instance = MBeanHelper.register(beanProxy, name.toString()); | |
87 | + manager.storeRegisteredMBean(instance); | |
88 | + } | |
89 | + } | |
90 | + | |
91 | + registerNotificationMBean(); | |
92 | + } | |
93 | + | |
94 | + @Override | |
95 | + public void shutdown(List<ManagedType> managedTypes) { | |
96 | + MBeanManager manager = Beans.getReference(MBeanManager.class); | |
97 | + for (ObjectInstance instance : manager.listRegisteredMBeans()){ | |
98 | + MBeanHelper.unregister(instance.getObjectName()); | |
99 | + } | |
100 | + | |
101 | + manager.cleanRegisteredMBeans(); | |
102 | + } | |
103 | + | |
104 | +} | ... | ... |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/internal/MBeanHelper.java
0 → 100644
... | ... | @@ -0,0 +1,120 @@ |
1 | +/* | |
2 | + * Demoiselle Framework | |
3 | + * Copyright (C) 2010 SERPRO | |
4 | + * ---------------------------------------------------------------------------- | |
5 | + * This file is part of Demoiselle Framework. | |
6 | + * | |
7 | + * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | + * as published by the Free Software Foundation. | |
10 | + * | |
11 | + * This program is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | + * ---------------------------------------------------------------------------- | |
21 | + * Este arquivo é parte do Framework Demoiselle. | |
22 | + * | |
23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | + * do Software Livre (FSF). | |
26 | + * | |
27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | + * para maiores detalhes. | |
31 | + * | |
32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | + */ | |
37 | +package br.gov.frameworkdemoiselle.internal; | |
38 | + | |
39 | +import java.lang.management.ManagementFactory; | |
40 | +import java.util.Locale; | |
41 | + | |
42 | +import javax.management.MBeanServer; | |
43 | +import javax.management.ObjectInstance; | |
44 | +import javax.management.ObjectName; | |
45 | + | |
46 | +import org.slf4j.Logger; | |
47 | + | |
48 | +import br.gov.frameworkdemoiselle.DemoiselleException; | |
49 | +import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; | |
50 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
51 | + | |
52 | +/** | |
53 | + * Class with common tools for registering MBeans into an Managed server | |
54 | + * | |
55 | + * @author SERPRO | |
56 | + */ | |
57 | +public class MBeanHelper { | |
58 | + | |
59 | + private static final Logger logger = LoggerProducer.create(MBeanHelper.class); | |
60 | + | |
61 | + private static ResourceBundle bundle = new ResourceBundle("demoiselle-jmx-bundle", Locale.getDefault()); | |
62 | + | |
63 | + private static final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); | |
64 | + | |
65 | + // @Inject | |
66 | + // @Name("demoiselle-monitoring-bundle") | |
67 | + // private ResourceBundle bundle; | |
68 | + | |
69 | + /** | |
70 | + * Return the MBean Server instance. | |
71 | + * | |
72 | + * @return MBeanServer | |
73 | + */ | |
74 | + public static final MBeanServer getMBeanServer() { | |
75 | + return server; | |
76 | + } | |
77 | + | |
78 | + /** | |
79 | + * Register a given managed bean (MBean) with the specified name. | |
80 | + * | |
81 | + * @param mbean | |
82 | + * the managed bean to register | |
83 | + * @param name | |
84 | + * the name under which to register the bean | |
85 | + * @return the object name of the mbean, for later deregistration | |
86 | + */ | |
87 | + public static ObjectInstance register(final Object mbean, final String name) { | |
88 | + | |
89 | + logger.info(bundle.getString("mbean-registration",name)); | |
90 | + | |
91 | + ObjectInstance instance = null; | |
92 | + try { | |
93 | + ObjectName objectName = new ObjectName(name); | |
94 | + instance = server.registerMBean(mbean, objectName); | |
95 | + } catch (Exception e) { | |
96 | + logger.error(bundle.getString("mbean-registration-error",name),e); | |
97 | + throw new DemoiselleException(bundle.getString("mbean-registration-error",name), e); | |
98 | + } | |
99 | + | |
100 | + return instance; | |
101 | + } | |
102 | + | |
103 | + /** | |
104 | + * Remove the registration of a mbean. | |
105 | + * | |
106 | + * @param objectName | |
107 | + * the name of the bean to unregister | |
108 | + */ | |
109 | + public static void unregister(final ObjectName objectName) { | |
110 | + | |
111 | + logger.info(bundle.getString("mbean-deregistration",objectName.getCanonicalName())); | |
112 | + | |
113 | + try { | |
114 | + server.unregisterMBean(objectName); | |
115 | + } catch (Exception e) { | |
116 | + logger.error(bundle.getString("mbean-deregistration",objectName.getCanonicalName()),e); | |
117 | + throw new DemoiselleException(bundle.getString("mbean-deregistration",objectName.getCanonicalName()), e); | |
118 | + } | |
119 | + } | |
120 | +} | ... | ... |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/internal/MBeanManager.java
0 → 100644
... | ... | @@ -0,0 +1,67 @@ |
1 | +/* | |
2 | + * Demoiselle Framework | |
3 | + * Copyright (C) 2010 SERPRO | |
4 | + * ---------------------------------------------------------------------------- | |
5 | + * This file is part of Demoiselle Framework. | |
6 | + * | |
7 | + * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | + * as published by the Free Software Foundation. | |
10 | + * | |
11 | + * This program is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | + * ---------------------------------------------------------------------------- | |
21 | + * Este arquivo é parte do Framework Demoiselle. | |
22 | + * | |
23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | + * do Software Livre (FSF). | |
26 | + * | |
27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | + * para maiores detalhes. | |
31 | + * | |
32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | + */ | |
37 | +package br.gov.frameworkdemoiselle.internal; | |
38 | + | |
39 | +import java.util.Collection; | |
40 | +import java.util.HashMap; | |
41 | + | |
42 | +import javax.enterprise.context.ApplicationScoped; | |
43 | +import javax.management.ObjectInstance; | |
44 | + | |
45 | +@ApplicationScoped | |
46 | +public class MBeanManager { | |
47 | + | |
48 | + private HashMap<String,ObjectInstance> registeredMBeans = new HashMap<String,ObjectInstance>(); | |
49 | + | |
50 | + public void storeRegisteredMBean(ObjectInstance instance){ | |
51 | + registeredMBeans.put(instance.getObjectName().getCanonicalName(),instance); | |
52 | + } | |
53 | + | |
54 | + public Collection<ObjectInstance> listRegisteredMBeans(){ | |
55 | + return registeredMBeans.values(); | |
56 | + } | |
57 | + | |
58 | + public ObjectInstance findMBeanInstance(String name){ | |
59 | + ObjectInstance instance = registeredMBeans.get(name); | |
60 | + return instance; | |
61 | + } | |
62 | + | |
63 | + public void cleanRegisteredMBeans(){ | |
64 | + registeredMBeans.clear(); | |
65 | + } | |
66 | + | |
67 | +} | ... | ... |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/internal/NotificationBroadcaster.java
0 → 100644
... | ... | @@ -0,0 +1,86 @@ |
1 | +/* | |
2 | + * Demoiselle Framework | |
3 | + * Copyright (C) 2010 SERPRO | |
4 | + * ---------------------------------------------------------------------------- | |
5 | + * This file is part of Demoiselle Framework. | |
6 | + * | |
7 | + * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | + * as published by the Free Software Foundation. | |
10 | + * | |
11 | + * This program is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | + * ---------------------------------------------------------------------------- | |
21 | + * Este arquivo é parte do Framework Demoiselle. | |
22 | + * | |
23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | + * do Software Livre (FSF). | |
26 | + * | |
27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | + * para maiores detalhes. | |
31 | + * | |
32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | + */ | |
37 | +package br.gov.frameworkdemoiselle.internal; | |
38 | + | |
39 | +import java.io.Serializable; | |
40 | + | |
41 | +import javax.management.AttributeChangeNotification; | |
42 | +import javax.management.Notification; | |
43 | +import javax.management.NotificationBroadcasterSupport; | |
44 | + | |
45 | +import br.gov.frameworkdemoiselle.configuration.JMXConfig; | |
46 | +import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; | |
47 | +import br.gov.frameworkdemoiselle.management.NotificationManager; | |
48 | + | |
49 | +/** | |
50 | + * Implementation of the {@link NotificationBroadcaster} MBean. | |
51 | + * When the {@link NotificationManager} sends an event, a {@link NotificationEventListener} captures the notification and uses | |
52 | + * this MBean to send it as a JMX notification. | |
53 | + * | |
54 | + * @author serpro | |
55 | + * | |
56 | + */ | |
57 | +public final class NotificationBroadcaster extends NotificationBroadcasterSupport implements NotificationBroadcasterMBean,Serializable { | |
58 | + | |
59 | + private static final long serialVersionUID = 1L; | |
60 | + | |
61 | + private int sequenceNumber = 1; | |
62 | + | |
63 | + /*public static final String NOTIFICATION_DEFAULT_MBEAN_NAME = NotificationBroadcaster.class.getPackage().getName() | |
64 | + +":name=" | |
65 | + +NotificationBroadcaster.class.getSimpleName();*/ | |
66 | + | |
67 | + private static final String NOTIFICATION_TYPE_GENERIC = "jmx.message"; | |
68 | + | |
69 | + protected void sendNotification( ManagementNotificationEvent event , JMXConfig config ) { | |
70 | + br.gov.frameworkdemoiselle.management.GenericNotification demoiselleNotification = event.getNotification(); | |
71 | + Notification n = new Notification(NOTIFICATION_TYPE_GENERIC, config.getNotificationMBeanName(), sequenceNumber++, System.currentTimeMillis(), demoiselleNotification.getMessage().toString()); | |
72 | + sendNotification(n); | |
73 | + } | |
74 | + | |
75 | + protected void sendAttributeChangedMessage( ManagementNotificationEvent event , JMXConfig config ) { | |
76 | + br.gov.frameworkdemoiselle.management.AttributeChangeNotification demoiselleNotification = (br.gov.frameworkdemoiselle.management.AttributeChangeNotification)event.getNotification(); | |
77 | + | |
78 | + AttributeChangeNotification n = new AttributeChangeNotification(config.getNotificationMBeanName(), sequenceNumber++ | |
79 | + , System.currentTimeMillis(), demoiselleNotification.getMessage().toString() | |
80 | + , demoiselleNotification.getAttributeName(), demoiselleNotification.getAttributeType().getSimpleName() | |
81 | + , demoiselleNotification.getOldValue(), demoiselleNotification.getNewValue()); | |
82 | + | |
83 | + sendNotification(n); | |
84 | + } | |
85 | + | |
86 | +} | ... | ... |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/internal/NotificationBroadcasterMBean.java
0 → 100644
... | ... | @@ -0,0 +1,48 @@ |
1 | +/* | |
2 | + * Demoiselle Framework | |
3 | + * Copyright (C) 2010 SERPRO | |
4 | + * ---------------------------------------------------------------------------- | |
5 | + * This file is part of Demoiselle Framework. | |
6 | + * | |
7 | + * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | + * as published by the Free Software Foundation. | |
10 | + * | |
11 | + * This program is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | + * ---------------------------------------------------------------------------- | |
21 | + * Este arquivo é parte do Framework Demoiselle. | |
22 | + * | |
23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | + * do Software Livre (FSF). | |
26 | + * | |
27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | + * para maiores detalhes. | |
31 | + * | |
32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | + */ | |
37 | +package br.gov.frameworkdemoiselle.internal; | |
38 | + | |
39 | + | |
40 | + | |
41 | +/** | |
42 | + * MBean interface responsible for sending MBean notifications to remote clients. | |
43 | + * | |
44 | + * @author serpro | |
45 | + * | |
46 | + */ | |
47 | +public interface NotificationBroadcasterMBean { | |
48 | +} | ... | ... |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/internal/NotificationEventListener.java
0 → 100644
... | ... | @@ -0,0 +1,80 @@ |
1 | +/* | |
2 | + * Demoiselle Framework | |
3 | + * Copyright (C) 2010 SERPRO | |
4 | + * ---------------------------------------------------------------------------- | |
5 | + * This file is part of Demoiselle Framework. | |
6 | + * | |
7 | + * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | + * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | + * as published by the Free Software Foundation. | |
10 | + * | |
11 | + * This program is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | + * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | + * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | + * ---------------------------------------------------------------------------- | |
21 | + * Este arquivo é parte do Framework Demoiselle. | |
22 | + * | |
23 | + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | + * do Software Livre (FSF). | |
26 | + * | |
27 | + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | + * para maiores detalhes. | |
31 | + * | |
32 | + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | + * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | + */ | |
37 | +package br.gov.frameworkdemoiselle.internal; | |
38 | + | |
39 | +import java.io.Serializable; | |
40 | + | |
41 | +import javax.enterprise.context.ApplicationScoped; | |
42 | +import javax.enterprise.event.Observes; | |
43 | + | |
44 | +import br.gov.frameworkdemoiselle.configuration.JMXConfig; | |
45 | +import br.gov.frameworkdemoiselle.internal.management.qualifier.AttributeChange; | |
46 | +import br.gov.frameworkdemoiselle.internal.management.qualifier.Generic; | |
47 | +import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; | |
48 | +import br.gov.frameworkdemoiselle.management.NotificationManager; | |
49 | + | |
50 | +/** | |
51 | + * Listens to {@link NotificationManager} notification events and proxies them | |
52 | + * to a {@link NotificationBroadcaster} MBean. This MBean will send the notification to | |
53 | + * any JMX clients connected and listening. | |
54 | + * | |
55 | + * @author serpro | |
56 | + * | |
57 | + */ | |
58 | +@ApplicationScoped | |
59 | +@SuppressWarnings("serial") | |
60 | +public class NotificationEventListener implements Serializable { | |
61 | + | |
62 | + private NotificationBroadcaster notificationBroadcaster; | |
63 | + | |
64 | + public void sendNotification( @Observes @Generic ManagementNotificationEvent event , JMXConfig config ) { | |
65 | + createNotificationBroadcaster().sendNotification(event,config); | |
66 | + } | |
67 | + | |
68 | + public void sendAttributeChangedMessage( @Observes @AttributeChange ManagementNotificationEvent event , JMXConfig config ) { | |
69 | + createNotificationBroadcaster().sendAttributeChangedMessage(event, config); | |
70 | + } | |
71 | + | |
72 | + public NotificationBroadcaster createNotificationBroadcaster(){ | |
73 | + if (notificationBroadcaster==null){ | |
74 | + notificationBroadcaster = new NotificationBroadcaster(); | |
75 | + } | |
76 | + | |
77 | + return notificationBroadcaster; | |
78 | + } | |
79 | + | |
80 | +} | ... | ... |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/bootstrap/JMXManagementExtension.java
... | ... | @@ -1,108 +0,0 @@ |
1 | -/* | |
2 | - * Demoiselle Framework | |
3 | - * Copyright (C) 2010 SERPRO | |
4 | - * ---------------------------------------------------------------------------- | |
5 | - * This file is part of Demoiselle Framework. | |
6 | - * | |
7 | - * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | - * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | - * as published by the Free Software Foundation. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | - * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | - * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | - * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | - * ---------------------------------------------------------------------------- | |
21 | - * Este arquivo é parte do Framework Demoiselle. | |
22 | - * | |
23 | - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | - * do Software Livre (FSF). | |
26 | - * | |
27 | - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | - * para maiores detalhes. | |
31 | - * | |
32 | - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | - * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | - */ | |
37 | -package br.gov.frameworkdemoiselle.jmx.bootstrap; | |
38 | - | |
39 | -import java.util.List; | |
40 | - | |
41 | -import javax.management.ObjectInstance; | |
42 | - | |
43 | -import br.gov.frameworkdemoiselle.annotation.Name; | |
44 | -import br.gov.frameworkdemoiselle.internal.management.ManagedType; | |
45 | -import br.gov.frameworkdemoiselle.jmx.configuration.JMXConfig; | |
46 | -import br.gov.frameworkdemoiselle.jmx.internal.DynamicMBeanProxy; | |
47 | -import br.gov.frameworkdemoiselle.jmx.internal.MBeanHelper; | |
48 | -import br.gov.frameworkdemoiselle.jmx.internal.MBeanManager; | |
49 | -import br.gov.frameworkdemoiselle.jmx.internal.NotificationEventListener; | |
50 | -import br.gov.frameworkdemoiselle.lifecycle.ManagementExtension; | |
51 | -import br.gov.frameworkdemoiselle.util.Beans; | |
52 | - | |
53 | -public class JMXManagementExtension implements ManagementExtension { | |
54 | - | |
55 | - public void registerNotificationMBean(){ | |
56 | - MBeanManager mbeanManager = Beans.getReference(MBeanManager.class); | |
57 | - JMXConfig configuration = Beans.getReference(JMXConfig.class); | |
58 | - | |
59 | - StringBuffer notificationMBeanName = new StringBuffer() | |
60 | - .append( configuration.getNotificationDomain()!=null ? configuration.getNotificationDomain() : "br.gov.frameworkdemoiselle.jmx" ) | |
61 | - .append(":name=") | |
62 | - .append(configuration.getNotificationMBeanName()); | |
63 | - | |
64 | - if (mbeanManager.findMBeanInstance(notificationMBeanName.toString()) == null){ | |
65 | - NotificationEventListener listener = Beans.getReference(NotificationEventListener.class); | |
66 | - | |
67 | - ObjectInstance instance = MBeanHelper.register(listener.createNotificationBroadcaster(), notificationMBeanName.toString()); | |
68 | - mbeanManager.storeRegisteredMBean(instance); | |
69 | - } | |
70 | - } | |
71 | - | |
72 | - @Override | |
73 | - public void initialize(List<ManagedType> managedTypes) { | |
74 | - MBeanManager manager = Beans.getReference(MBeanManager.class); | |
75 | - JMXConfig configuration = Beans.getReference(JMXConfig.class); | |
76 | - | |
77 | - for (ManagedType type : managedTypes) { | |
78 | - DynamicMBeanProxy beanProxy = new DynamicMBeanProxy(type); | |
79 | - | |
80 | - Name nameAnnotation = type.getType().getAnnotation(Name.class); | |
81 | - String mbeanName = nameAnnotation != null ? nameAnnotation.value() : type.getType().getSimpleName(); | |
82 | - | |
83 | - StringBuffer name = new StringBuffer() | |
84 | - .append( configuration.getMbeanDomain()!=null ? configuration.getMbeanDomain() : type.getType().getPackage().getName() ) | |
85 | - .append(":name=") | |
86 | - .append( mbeanName ); | |
87 | - | |
88 | - | |
89 | - if (manager.findMBeanInstance(name.toString()) == null){ | |
90 | - ObjectInstance instance = MBeanHelper.register(beanProxy, name.toString()); | |
91 | - manager.storeRegisteredMBean(instance); | |
92 | - } | |
93 | - } | |
94 | - | |
95 | - registerNotificationMBean(); | |
96 | - } | |
97 | - | |
98 | - @Override | |
99 | - public void shutdown(List<ManagedType> managedTypes) { | |
100 | - MBeanManager manager = Beans.getReference(MBeanManager.class); | |
101 | - for (ObjectInstance instance : manager.listRegisteredMBeans()){ | |
102 | - MBeanHelper.unregister(instance.getObjectName()); | |
103 | - } | |
104 | - | |
105 | - manager.cleanRegisteredMBeans(); | |
106 | - } | |
107 | - | |
108 | -} |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/configuration/JMXConfig.java
... | ... | @@ -1,119 +0,0 @@ |
1 | -/* | |
2 | - * Demoiselle Framework | |
3 | - * Copyright (C) 2010 SERPRO | |
4 | - * ---------------------------------------------------------------------------- | |
5 | - * This file is part of Demoiselle Framework. | |
6 | - * | |
7 | - * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | - * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | - * as published by the Free Software Foundation. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | - * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | - * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | - * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | - * ---------------------------------------------------------------------------- | |
21 | - * Este arquivo é parte do Framework Demoiselle. | |
22 | - * | |
23 | - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | - * do Software Livre (FSF). | |
26 | - * | |
27 | - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | - * para maiores detalhes. | |
31 | - * | |
32 | - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | - * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | - */ | |
37 | -package br.gov.frameworkdemoiselle.jmx.configuration; | |
38 | - | |
39 | -import javax.management.NotificationBroadcaster; | |
40 | - | |
41 | -import br.gov.frameworkdemoiselle.annotation.Name; | |
42 | -import br.gov.frameworkdemoiselle.configuration.Configuration; | |
43 | -import br.gov.frameworkdemoiselle.stereotype.ManagementController; | |
44 | - | |
45 | -@Configuration(prefix = "frameworkdemoiselle.management.jmx.") | |
46 | -public class JMXConfig { | |
47 | - | |
48 | - @Name("mbean.domain") | |
49 | - private String mbeanDomain; | |
50 | - | |
51 | - @Name("notification.domain") | |
52 | - private String notificationDomain = "br.gov.frameworkdemoiselle.jmx"; | |
53 | - | |
54 | - @Name("notification.name") | |
55 | - private String notificationMBeanName = "NotificationBroadcaster"; | |
56 | - | |
57 | - /** | |
58 | - * </p>The domain to register all {@link ManagementController} classes found during boot.</p> | |
59 | - * | |
60 | - * <p>The full name of a MBean has the format of <code>domain:name=MBeanName</code> (ex: <code>br.gov.frameworkdemoiselle.jmx:name=NotificationBroadcaster</code>), this | |
61 | - * parameter is the "domain" portion of the full name.</p> | |
62 | - * | |
63 | - * <p>The default is <code>null</code> and when is set to <code>null</code>, all {@link Managed} classes will use it's own package as the domain.</p> | |
64 | - * | |
65 | - */ | |
66 | - public String getMbeanDomain() { | |
67 | - return mbeanDomain; | |
68 | - } | |
69 | - | |
70 | - /** | |
71 | - * @see #getMbeanDomain() | |
72 | - */ | |
73 | - public void setMbeanDomain(String mbeanDomain) { | |
74 | - this.mbeanDomain = mbeanDomain; | |
75 | - } | |
76 | - | |
77 | - /** | |
78 | - * <p>The name the {@link NotificationBroadcaster} MBean will be registered to. The full name | |
79 | - * of a MBean has the format of <code>domain:name=MBeanName</code> (ex: <code>br.gov.frameworkdemoiselle.jmx:name=NotificationBroadcaster</code>), this | |
80 | - * parameter is the ":name=MBeanName" portion without the ":name=".</p> | |
81 | - * | |
82 | - * <p>The default is the value returned by {@link Class#getSimpleName()} when called from the {@link NotificationBroadcaster} class.</p> | |
83 | - * | |
84 | - * @see #getMbeanDomain() | |
85 | - */ | |
86 | - public String getNotificationMBeanName() { | |
87 | - return notificationMBeanName; | |
88 | - } | |
89 | - | |
90 | - /** | |
91 | - * @see #getNotificationMBeanName() | |
92 | - */ | |
93 | - public void setNotificationMBeanName(String notificationMBeanName) { | |
94 | - this.notificationMBeanName = notificationMBeanName; | |
95 | - } | |
96 | - | |
97 | - /** | |
98 | - * </p>The domain to register the {@link NotificationBroadcaster} MBean.</p> | |
99 | - * | |
100 | - * <p>The full name of a MBean has the format of <code>domain:name=MBeanName</code> (ex: <code>br.gov.frameworkdemoiselle.jmx:name=NotificationBroadcaster</code>), this | |
101 | - * parameter is the "domain" portion of the full name.</p> | |
102 | - * | |
103 | - * <p>The default is <code>br.gov.frameworkdemoiselle.jmx</code>.</p> | |
104 | - * | |
105 | - */ | |
106 | - public String getNotificationDomain() { | |
107 | - return notificationDomain; | |
108 | - } | |
109 | - | |
110 | - /** | |
111 | - * @see #getNotificationDomain() | |
112 | - */ | |
113 | - public void setNotificationDomain(String notificationDomain) { | |
114 | - this.notificationDomain = notificationDomain; | |
115 | - } | |
116 | - | |
117 | - | |
118 | - | |
119 | -} |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/DynamicMBeanProxy.java
... | ... | @@ -1,264 +0,0 @@ |
1 | -/* | |
2 | - * Demoiselle Framework | |
3 | - * Copyright (C) 2010 SERPRO | |
4 | - * ---------------------------------------------------------------------------- | |
5 | - * This file is part of Demoiselle Framework. | |
6 | - * | |
7 | - * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | - * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | - * as published by the Free Software Foundation. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | - * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | - * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | - * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | - * ---------------------------------------------------------------------------- | |
21 | - * Este arquivo é parte do Framework Demoiselle. | |
22 | - * | |
23 | - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | - * do Software Livre (FSF). | |
26 | - * | |
27 | - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | - * para maiores detalhes. | |
31 | - * | |
32 | - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | - * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | - */ | |
37 | -package br.gov.frameworkdemoiselle.jmx.internal; | |
38 | - | |
39 | -import java.util.ArrayList; | |
40 | -import java.util.Locale; | |
41 | -import java.util.Map.Entry; | |
42 | - | |
43 | -import javax.management.Attribute; | |
44 | -import javax.management.AttributeList; | |
45 | -import javax.management.AttributeNotFoundException; | |
46 | -import javax.management.DynamicMBean; | |
47 | -import javax.management.InvalidAttributeValueException; | |
48 | -import javax.management.MBeanAttributeInfo; | |
49 | -import javax.management.MBeanException; | |
50 | -import javax.management.MBeanInfo; | |
51 | -import javax.management.MBeanOperationInfo; | |
52 | -import javax.management.MBeanParameterInfo; | |
53 | -import javax.management.ReflectionException; | |
54 | - | |
55 | -import br.gov.frameworkdemoiselle.DemoiselleException; | |
56 | -import br.gov.frameworkdemoiselle.internal.management.ManagedType; | |
57 | -import br.gov.frameworkdemoiselle.internal.management.ManagedType.FieldDetail; | |
58 | -import br.gov.frameworkdemoiselle.internal.management.ManagedType.MethodDetail; | |
59 | -import br.gov.frameworkdemoiselle.internal.management.ManagedType.ParameterDetail; | |
60 | -import br.gov.frameworkdemoiselle.internal.management.Management; | |
61 | -import br.gov.frameworkdemoiselle.stereotype.ManagementController; | |
62 | -import br.gov.frameworkdemoiselle.util.Beans; | |
63 | -import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
64 | - | |
65 | -/** | |
66 | - * <p> | |
67 | - * This class is a MBean that gets registered everytime you mark a class with {@link ManagementController}. It dynamicaly reads the | |
68 | - * fields and operations contained in a {@link ManagementController} class and exposes them to the MBean server. Everytime a client | |
69 | - * tries to call an operation or read/write a property inside a ManagementController class, this class will call the appropriate | |
70 | - * method and pass the result to the MBean client. | |
71 | - * </p> | |
72 | - * | |
73 | - * @author SERPRO | |
74 | - */ | |
75 | -public class DynamicMBeanProxy implements DynamicMBean { | |
76 | - | |
77 | - private MBeanInfo delegateInfo; | |
78 | - | |
79 | - private ManagedType managedType; | |
80 | - | |
81 | - private ResourceBundle bundle; | |
82 | - | |
83 | - public DynamicMBeanProxy(ManagedType type) { | |
84 | - if (type == null) { | |
85 | - throw new NullPointerException(getBundle().getString("mbean-null-type-defined")); | |
86 | - } | |
87 | - managedType = type; | |
88 | - } | |
89 | - | |
90 | - @Override | |
91 | - public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { | |
92 | - // Se o bean ainda não foi lido para determinar seus atributos, o faz agora. | |
93 | - if (delegateInfo == null) { | |
94 | - initializeMBeanInfo(); | |
95 | - } | |
96 | - | |
97 | - Management manager = Beans.getReference(Management.class); | |
98 | - return manager.getProperty(managedType, attribute); | |
99 | - } | |
100 | - | |
101 | - @Override | |
102 | - public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, | |
103 | - MBeanException, ReflectionException { | |
104 | - | |
105 | - // Se o bean ainda não foi lido para determinar seus atributos, o faz agora. | |
106 | - if (delegateInfo == null) { | |
107 | - initializeMBeanInfo(); | |
108 | - } | |
109 | - | |
110 | - Management manager = Beans.getReference(Management.class); | |
111 | - manager.setProperty(managedType, attribute.getName(), attribute.getValue()); | |
112 | - } | |
113 | - | |
114 | - @Override | |
115 | - public AttributeList getAttributes(String[] attributes) { | |
116 | - if (attributes != null) { | |
117 | - AttributeList list = new AttributeList(); | |
118 | - for (String attribute : attributes) { | |
119 | - try { | |
120 | - Object value = getAttribute(attribute); | |
121 | - list.add(new Attribute(attribute, value)); | |
122 | - } catch (Throwable t) { | |
123 | - } | |
124 | - } | |
125 | - | |
126 | - return list; | |
127 | - } | |
128 | - | |
129 | - return null; | |
130 | - } | |
131 | - | |
132 | - @Override | |
133 | - public AttributeList setAttributes(AttributeList attributes) { | |
134 | - AttributeList settedAttributes = new AttributeList(); | |
135 | - if (attributes != null) { | |
136 | - for (Attribute attribute : attributes.asList()) { | |
137 | - try { | |
138 | - setAttribute(attribute); | |
139 | - | |
140 | - // A razão para separarmos a criação do atributo de sua adição na lista é que | |
141 | - // caso a obtenção do novo valor do atributo dispare uma exceção então o atributo não será | |
142 | - // adicionado na lista de atributos que foram afetados. | |
143 | - Attribute attributeWithNewValue = new Attribute(attribute.getName(), | |
144 | - getAttribute(attribute.getName())); | |
145 | - settedAttributes.add(attributeWithNewValue); | |
146 | - } catch (Throwable t) { | |
147 | - } | |
148 | - } | |
149 | - } | |
150 | - | |
151 | - return settedAttributes; | |
152 | - } | |
153 | - | |
154 | - @Override | |
155 | - public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, | |
156 | - ReflectionException { | |
157 | - | |
158 | - // Se o bean ainda não foi lido para determinar seus atributos, o faz agora. | |
159 | - if (this.delegateInfo == null) { | |
160 | - initializeMBeanInfo(); | |
161 | - } | |
162 | - | |
163 | - Management manager = Beans.getReference(Management.class); | |
164 | - return manager.invoke(managedType, actionName, params); | |
165 | - } | |
166 | - | |
167 | - /** | |
168 | - * Initialize the Managed information for this instance of Managed | |
169 | - */ | |
170 | - private void initializeMBeanInfo() { | |
171 | - // Aqui vamos armazenar nossos atributos | |
172 | - ArrayList<MBeanAttributeInfo> attributes = new ArrayList<MBeanAttributeInfo>(); | |
173 | - | |
174 | - // Aqui vamos armazenar nossas operações | |
175 | - ArrayList<MBeanOperationInfo> operations = new ArrayList<MBeanOperationInfo>(); | |
176 | - | |
177 | - // Para cada propriedade descoberta no ManagementController, cria um attributeInfo correspondente | |
178 | - for (Entry<String, FieldDetail> fieldEntry : managedType.getFields().entrySet()) { | |
179 | - | |
180 | - try { | |
181 | - | |
182 | - MBeanAttributeInfo attributeInfo = new MBeanAttributeInfo(fieldEntry.getKey(), fieldEntry.getValue() | |
183 | - .getDescription(), fieldEntry.getValue().getGetterMethod(), fieldEntry.getValue() | |
184 | - .getSetterMethod()); | |
185 | - attributes.add(attributeInfo); | |
186 | - | |
187 | - } catch (javax.management.IntrospectionException e) { | |
188 | - throw new DemoiselleException(getBundle().getString("mbean-introspection-error", managedType.getType() | |
189 | - .getSimpleName())); | |
190 | - } | |
191 | - } | |
192 | - | |
193 | - // Para cada operação descoberta no ManagementController, cria um operationInfo correspondente | |
194 | - for (Entry<String, MethodDetail> methodEntry : managedType.getOperationMethods().entrySet()) { | |
195 | - | |
196 | - MethodDetail methodDetail = methodEntry.getValue(); | |
197 | - | |
198 | - ParameterDetail[] parameterTypes = methodDetail.getParameterTypers(); | |
199 | - | |
200 | - MBeanParameterInfo[] parameters = parameterTypes.length > 0 ? new MBeanParameterInfo[parameterTypes.length] | |
201 | - : null; | |
202 | - | |
203 | - if (parameters != null) { | |
204 | - | |
205 | - for (int i = 0; i < parameterTypes.length; i++) { | |
206 | - | |
207 | - parameters[i] = new MBeanParameterInfo(parameterTypes[i].getParameterName(), parameterTypes[i] | |
208 | - .getParameterType().getCanonicalName(), parameterTypes[i].getParameterDescription()); | |
209 | - } | |
210 | - } | |
211 | - | |
212 | - // Com todas as informações, criamos nossa instância de MBeanOperationInfo e | |
213 | - // acrescentamos na lista de todas as operações. | |
214 | - int operationType = 0; | |
215 | - switch(methodDetail.getType()){ | |
216 | - case ACTION: | |
217 | - operationType = MBeanOperationInfo.ACTION; | |
218 | - break; | |
219 | - | |
220 | - case INFO: | |
221 | - operationType = MBeanOperationInfo.INFO; | |
222 | - break; | |
223 | - | |
224 | - case ACTION_INFO: | |
225 | - operationType = MBeanOperationInfo.ACTION_INFO; | |
226 | - break; | |
227 | - | |
228 | - default: | |
229 | - operationType = MBeanOperationInfo.UNKNOWN; | |
230 | - } | |
231 | - | |
232 | - MBeanOperationInfo operation = new MBeanOperationInfo(methodDetail.getMethod().getName(), | |
233 | - methodDetail.getDescription(), parameters, methodDetail.getMethod().getReturnType().getName(), | |
234 | - operationType); | |
235 | - | |
236 | - operations.add(operation); | |
237 | - | |
238 | - } | |
239 | - | |
240 | - // Por fim criamos nosso bean info. | |
241 | - delegateInfo = new MBeanInfo(managedType.getType().getCanonicalName(), managedType.getDescription(), | |
242 | - attributes.toArray(new MBeanAttributeInfo[0]), null, operations.toArray(new MBeanOperationInfo[0]), | |
243 | - null); | |
244 | - | |
245 | - } | |
246 | - | |
247 | - @Override | |
248 | - public MBeanInfo getMBeanInfo() { | |
249 | - if (delegateInfo == null) { | |
250 | - initializeMBeanInfo(); | |
251 | - } | |
252 | - | |
253 | - return delegateInfo; | |
254 | - } | |
255 | - | |
256 | - public ResourceBundle getBundle(){ | |
257 | - if (bundle==null){ | |
258 | - bundle = new ResourceBundle("demoiselle-jmx-bundle", Locale.getDefault()); | |
259 | - } | |
260 | - | |
261 | - return bundle; | |
262 | - } | |
263 | - | |
264 | -} |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanHelper.java
... | ... | @@ -1,120 +0,0 @@ |
1 | -/* | |
2 | - * Demoiselle Framework | |
3 | - * Copyright (C) 2010 SERPRO | |
4 | - * ---------------------------------------------------------------------------- | |
5 | - * This file is part of Demoiselle Framework. | |
6 | - * | |
7 | - * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | - * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | - * as published by the Free Software Foundation. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | - * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | - * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | - * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | - * ---------------------------------------------------------------------------- | |
21 | - * Este arquivo é parte do Framework Demoiselle. | |
22 | - * | |
23 | - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | - * do Software Livre (FSF). | |
26 | - * | |
27 | - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | - * para maiores detalhes. | |
31 | - * | |
32 | - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | - * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | - */ | |
37 | -package br.gov.frameworkdemoiselle.jmx.internal; | |
38 | - | |
39 | -import java.lang.management.ManagementFactory; | |
40 | -import java.util.Locale; | |
41 | - | |
42 | -import javax.management.MBeanServer; | |
43 | -import javax.management.ObjectInstance; | |
44 | -import javax.management.ObjectName; | |
45 | - | |
46 | -import org.slf4j.Logger; | |
47 | - | |
48 | -import br.gov.frameworkdemoiselle.DemoiselleException; | |
49 | -import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; | |
50 | -import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
51 | - | |
52 | -/** | |
53 | - * Class with common tools for registering MBeans into an Managed server | |
54 | - * | |
55 | - * @author SERPRO | |
56 | - */ | |
57 | -public class MBeanHelper { | |
58 | - | |
59 | - private static final Logger logger = LoggerProducer.create(MBeanHelper.class); | |
60 | - | |
61 | - private static ResourceBundle bundle = new ResourceBundle("demoiselle-jmx-bundle", Locale.getDefault()); | |
62 | - | |
63 | - private static final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); | |
64 | - | |
65 | - // @Inject | |
66 | - // @Name("demoiselle-monitoring-bundle") | |
67 | - // private ResourceBundle bundle; | |
68 | - | |
69 | - /** | |
70 | - * Return the MBean Server instance. | |
71 | - * | |
72 | - * @return MBeanServer | |
73 | - */ | |
74 | - public static final MBeanServer getMBeanServer() { | |
75 | - return server; | |
76 | - } | |
77 | - | |
78 | - /** | |
79 | - * Register a given managed bean (MBean) with the specified name. | |
80 | - * | |
81 | - * @param mbean | |
82 | - * the managed bean to register | |
83 | - * @param name | |
84 | - * the name under which to register the bean | |
85 | - * @return the object name of the mbean, for later deregistration | |
86 | - */ | |
87 | - public static ObjectInstance register(final Object mbean, final String name) { | |
88 | - | |
89 | - logger.info(bundle.getString("mbean-registration",name)); | |
90 | - | |
91 | - ObjectInstance instance = null; | |
92 | - try { | |
93 | - ObjectName objectName = new ObjectName(name); | |
94 | - instance = server.registerMBean(mbean, objectName); | |
95 | - } catch (Exception e) { | |
96 | - logger.error(bundle.getString("mbean-registration-error",name),e); | |
97 | - throw new DemoiselleException(bundle.getString("mbean-registration-error",name), e); | |
98 | - } | |
99 | - | |
100 | - return instance; | |
101 | - } | |
102 | - | |
103 | - /** | |
104 | - * Remove the registration of a mbean. | |
105 | - * | |
106 | - * @param objectName | |
107 | - * the name of the bean to unregister | |
108 | - */ | |
109 | - public static void unregister(final ObjectName objectName) { | |
110 | - | |
111 | - logger.info(bundle.getString("mbean-deregistration",objectName.getCanonicalName())); | |
112 | - | |
113 | - try { | |
114 | - server.unregisterMBean(objectName); | |
115 | - } catch (Exception e) { | |
116 | - logger.error(bundle.getString("mbean-deregistration",objectName.getCanonicalName()),e); | |
117 | - throw new DemoiselleException(bundle.getString("mbean-deregistration",objectName.getCanonicalName()), e); | |
118 | - } | |
119 | - } | |
120 | -} |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanManager.java
... | ... | @@ -1,67 +0,0 @@ |
1 | -/* | |
2 | - * Demoiselle Framework | |
3 | - * Copyright (C) 2010 SERPRO | |
4 | - * ---------------------------------------------------------------------------- | |
5 | - * This file is part of Demoiselle Framework. | |
6 | - * | |
7 | - * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | - * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | - * as published by the Free Software Foundation. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | - * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | - * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | - * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | - * ---------------------------------------------------------------------------- | |
21 | - * Este arquivo é parte do Framework Demoiselle. | |
22 | - * | |
23 | - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | - * do Software Livre (FSF). | |
26 | - * | |
27 | - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | - * para maiores detalhes. | |
31 | - * | |
32 | - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | - * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | - */ | |
37 | -package br.gov.frameworkdemoiselle.jmx.internal; | |
38 | - | |
39 | -import java.util.Collection; | |
40 | -import java.util.HashMap; | |
41 | - | |
42 | -import javax.enterprise.context.ApplicationScoped; | |
43 | -import javax.management.ObjectInstance; | |
44 | - | |
45 | -@ApplicationScoped | |
46 | -public class MBeanManager { | |
47 | - | |
48 | - private HashMap<String,ObjectInstance> registeredMBeans = new HashMap<String,ObjectInstance>(); | |
49 | - | |
50 | - public void storeRegisteredMBean(ObjectInstance instance){ | |
51 | - registeredMBeans.put(instance.getObjectName().getCanonicalName(),instance); | |
52 | - } | |
53 | - | |
54 | - public Collection<ObjectInstance> listRegisteredMBeans(){ | |
55 | - return registeredMBeans.values(); | |
56 | - } | |
57 | - | |
58 | - public ObjectInstance findMBeanInstance(String name){ | |
59 | - ObjectInstance instance = registeredMBeans.get(name); | |
60 | - return instance; | |
61 | - } | |
62 | - | |
63 | - public void cleanRegisteredMBeans(){ | |
64 | - registeredMBeans.clear(); | |
65 | - } | |
66 | - | |
67 | -} |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcaster.java
... | ... | @@ -1,86 +0,0 @@ |
1 | -/* | |
2 | - * Demoiselle Framework | |
3 | - * Copyright (C) 2010 SERPRO | |
4 | - * ---------------------------------------------------------------------------- | |
5 | - * This file is part of Demoiselle Framework. | |
6 | - * | |
7 | - * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | - * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | - * as published by the Free Software Foundation. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | - * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | - * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | - * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | - * ---------------------------------------------------------------------------- | |
21 | - * Este arquivo é parte do Framework Demoiselle. | |
22 | - * | |
23 | - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | - * do Software Livre (FSF). | |
26 | - * | |
27 | - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | - * para maiores detalhes. | |
31 | - * | |
32 | - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | - * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | - */ | |
37 | -package br.gov.frameworkdemoiselle.jmx.internal; | |
38 | - | |
39 | -import java.io.Serializable; | |
40 | - | |
41 | -import javax.management.AttributeChangeNotification; | |
42 | -import javax.management.Notification; | |
43 | -import javax.management.NotificationBroadcasterSupport; | |
44 | - | |
45 | -import br.gov.frameworkdemoiselle.jmx.configuration.JMXConfig; | |
46 | -import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; | |
47 | -import br.gov.frameworkdemoiselle.management.NotificationManager; | |
48 | - | |
49 | -/** | |
50 | - * Implementation of the {@link NotificationBroadcaster} MBean. | |
51 | - * When the {@link NotificationManager} sends an event, a {@link NotificationEventListener} captures the notification and uses | |
52 | - * this MBean to send it as a JMX notification. | |
53 | - * | |
54 | - * @author serpro | |
55 | - * | |
56 | - */ | |
57 | -final class NotificationBroadcaster extends NotificationBroadcasterSupport implements NotificationBroadcasterMBean,Serializable { | |
58 | - | |
59 | - private static final long serialVersionUID = 1L; | |
60 | - | |
61 | - private int sequenceNumber = 1; | |
62 | - | |
63 | - /*public static final String NOTIFICATION_DEFAULT_MBEAN_NAME = NotificationBroadcaster.class.getPackage().getName() | |
64 | - +":name=" | |
65 | - +NotificationBroadcaster.class.getSimpleName();*/ | |
66 | - | |
67 | - private static final String NOTIFICATION_TYPE_GENERIC = "jmx.message"; | |
68 | - | |
69 | - protected void sendNotification( ManagementNotificationEvent event , JMXConfig config ) { | |
70 | - br.gov.frameworkdemoiselle.management.GenericNotification demoiselleNotification = event.getNotification(); | |
71 | - Notification n = new Notification(NOTIFICATION_TYPE_GENERIC, config.getNotificationMBeanName(), sequenceNumber++, System.currentTimeMillis(), demoiselleNotification.getMessage().toString()); | |
72 | - sendNotification(n); | |
73 | - } | |
74 | - | |
75 | - protected void sendAttributeChangedMessage( ManagementNotificationEvent event , JMXConfig config ) { | |
76 | - br.gov.frameworkdemoiselle.management.AttributeChangeNotification demoiselleNotification = (br.gov.frameworkdemoiselle.management.AttributeChangeNotification)event.getNotification(); | |
77 | - | |
78 | - AttributeChangeNotification n = new AttributeChangeNotification(config.getNotificationMBeanName(), sequenceNumber++ | |
79 | - , System.currentTimeMillis(), demoiselleNotification.getMessage().toString() | |
80 | - , demoiselleNotification.getAttributeName(), demoiselleNotification.getAttributeType().getSimpleName() | |
81 | - , demoiselleNotification.getOldValue(), demoiselleNotification.getNewValue()); | |
82 | - | |
83 | - sendNotification(n); | |
84 | - } | |
85 | - | |
86 | -} |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcasterMBean.java
... | ... | @@ -1,48 +0,0 @@ |
1 | -/* | |
2 | - * Demoiselle Framework | |
3 | - * Copyright (C) 2010 SERPRO | |
4 | - * ---------------------------------------------------------------------------- | |
5 | - * This file is part of Demoiselle Framework. | |
6 | - * | |
7 | - * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | - * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | - * as published by the Free Software Foundation. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | - * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | - * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | - * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | - * ---------------------------------------------------------------------------- | |
21 | - * Este arquivo é parte do Framework Demoiselle. | |
22 | - * | |
23 | - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | - * do Software Livre (FSF). | |
26 | - * | |
27 | - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | - * para maiores detalhes. | |
31 | - * | |
32 | - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | - * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | - */ | |
37 | -package br.gov.frameworkdemoiselle.jmx.internal; | |
38 | - | |
39 | - | |
40 | - | |
41 | -/** | |
42 | - * MBean interface responsible for sending MBean notifications to remote clients. | |
43 | - * | |
44 | - * @author serpro | |
45 | - * | |
46 | - */ | |
47 | -interface NotificationBroadcasterMBean { | |
48 | -} |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationEventListener.java
... | ... | @@ -1,80 +0,0 @@ |
1 | -/* | |
2 | - * Demoiselle Framework | |
3 | - * Copyright (C) 2010 SERPRO | |
4 | - * ---------------------------------------------------------------------------- | |
5 | - * This file is part of Demoiselle Framework. | |
6 | - * | |
7 | - * Demoiselle Framework is free software; you can redistribute it and/or | |
8 | - * modify it under the terms of the GNU Lesser General Public License version 3 | |
9 | - * as published by the Free Software Foundation. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU Lesser General Public License version 3 | |
17 | - * along with this program; if not, see <http://www.gnu.org/licenses/> | |
18 | - * or write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | - * Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | - * ---------------------------------------------------------------------------- | |
21 | - * Este arquivo é parte do Framework Demoiselle. | |
22 | - * | |
23 | - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | |
24 | - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | |
25 | - * do Software Livre (FSF). | |
26 | - * | |
27 | - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | |
28 | - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | |
29 | - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | |
30 | - * para maiores detalhes. | |
31 | - * | |
32 | - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | |
33 | - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | |
34 | - * ou escreva para a Fundação do Software Livre (FSF) Inc., | |
35 | - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | |
36 | - */ | |
37 | -package br.gov.frameworkdemoiselle.jmx.internal; | |
38 | - | |
39 | -import java.io.Serializable; | |
40 | - | |
41 | -import javax.enterprise.context.ApplicationScoped; | |
42 | -import javax.enterprise.event.Observes; | |
43 | - | |
44 | -import br.gov.frameworkdemoiselle.internal.management.qualifier.AttributeChange; | |
45 | -import br.gov.frameworkdemoiselle.internal.management.qualifier.Generic; | |
46 | -import br.gov.frameworkdemoiselle.jmx.configuration.JMXConfig; | |
47 | -import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; | |
48 | -import br.gov.frameworkdemoiselle.management.NotificationManager; | |
49 | - | |
50 | -/** | |
51 | - * Listens to {@link NotificationManager} notification events and proxies them | |
52 | - * to a {@link NotificationBroadcaster} MBean. This MBean will send the notification to | |
53 | - * any JMX clients connected and listening. | |
54 | - * | |
55 | - * @author serpro | |
56 | - * | |
57 | - */ | |
58 | -@ApplicationScoped | |
59 | -@SuppressWarnings("serial") | |
60 | -public class NotificationEventListener implements Serializable { | |
61 | - | |
62 | - private NotificationBroadcaster notificationBroadcaster; | |
63 | - | |
64 | - public void sendNotification( @Observes @Generic ManagementNotificationEvent event , JMXConfig config ) { | |
65 | - createNotificationBroadcaster().sendNotification(event,config); | |
66 | - } | |
67 | - | |
68 | - public void sendAttributeChangedMessage( @Observes @AttributeChange ManagementNotificationEvent event , JMXConfig config ) { | |
69 | - createNotificationBroadcaster().sendAttributeChangedMessage(event, config); | |
70 | - } | |
71 | - | |
72 | - public NotificationBroadcaster createNotificationBroadcaster(){ | |
73 | - if (notificationBroadcaster==null){ | |
74 | - notificationBroadcaster = new NotificationBroadcaster(); | |
75 | - } | |
76 | - | |
77 | - return notificationBroadcaster; | |
78 | - } | |
79 | - | |
80 | -} |
impl/extension/jmx/src/test/java/management/tests/basic/DynamicMBeanProxyTest.java
... | ... | @@ -55,7 +55,7 @@ import org.junit.BeforeClass; |
55 | 55 | import org.junit.Test; |
56 | 56 | import org.junit.runner.RunWith; |
57 | 57 | |
58 | -import br.gov.frameworkdemoiselle.jmx.internal.MBeanManager; | |
58 | +import br.gov.frameworkdemoiselle.internal.MBeanManager; | |
59 | 59 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; |
60 | 60 | import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; |
61 | 61 | import br.gov.frameworkdemoiselle.util.Beans; | ... | ... |
impl/extension/jmx/src/test/java/management/tests/notification/NotificationBroadcasterTest.java
... | ... | @@ -57,8 +57,8 @@ import org.junit.BeforeClass; |
57 | 57 | import org.junit.Test; |
58 | 58 | import org.junit.runner.RunWith; |
59 | 59 | |
60 | -import br.gov.frameworkdemoiselle.jmx.configuration.JMXConfig; | |
61 | -import br.gov.frameworkdemoiselle.jmx.internal.MBeanManager; | |
60 | +import br.gov.frameworkdemoiselle.configuration.JMXConfig; | |
61 | +import br.gov.frameworkdemoiselle.internal.MBeanManager; | |
62 | 62 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; |
63 | 63 | import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; |
64 | 64 | import br.gov.frameworkdemoiselle.management.AttributeChangeNotification; | ... | ... |