Commit 24af9b8a7ccda2f39f15f6d0042e3252f0bff239
1 parent
0a514a36
Exists in
master
Refatoração das classes de notificação da API de monitoração.
Showing
16 changed files
with
204 additions
and
327 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/AttributeChange.java
| @@ -1,62 +0,0 @@ | @@ -1,62 +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.internal.implementation; | ||
| 38 | - | ||
| 39 | -import java.lang.annotation.ElementType; | ||
| 40 | -import java.lang.annotation.Retention; | ||
| 41 | -import java.lang.annotation.RetentionPolicy; | ||
| 42 | -import java.lang.annotation.Target; | ||
| 43 | - | ||
| 44 | -import javax.inject.Qualifier; | ||
| 45 | - | ||
| 46 | -import br.gov.frameworkdemoiselle.management.AttributeChangeNotification; | ||
| 47 | -import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; | ||
| 48 | - | ||
| 49 | -/** | ||
| 50 | - * | ||
| 51 | - * Enables {@link ManagementNotificationEvent} observers to trigger only with notifications | ||
| 52 | - * of the specialized type {@link AttributeChangeNotification}. | ||
| 53 | - * | ||
| 54 | - * @author SERPRO | ||
| 55 | - * | ||
| 56 | - */ | ||
| 57 | -@Qualifier | ||
| 58 | -@Retention(RetentionPolicy.RUNTIME) | ||
| 59 | -@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE}) | ||
| 60 | -public @interface AttributeChange { | ||
| 61 | - | ||
| 62 | -} |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/Generic.java
| @@ -1,62 +0,0 @@ | @@ -1,62 +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.internal.implementation; | ||
| 38 | - | ||
| 39 | -import java.lang.annotation.ElementType; | ||
| 40 | -import java.lang.annotation.Retention; | ||
| 41 | -import java.lang.annotation.RetentionPolicy; | ||
| 42 | -import java.lang.annotation.Target; | ||
| 43 | - | ||
| 44 | -import javax.inject.Qualifier; | ||
| 45 | - | ||
| 46 | -import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; | ||
| 47 | -import br.gov.frameworkdemoiselle.management.GenericNotification; | ||
| 48 | - | ||
| 49 | -/** | ||
| 50 | - * | ||
| 51 | - * Enables {@link ManagementNotificationEvent} observers to trigger only with notifications | ||
| 52 | - * of the base type {@link GenericNotification}. | ||
| 53 | - * | ||
| 54 | - * @author SERPRO | ||
| 55 | - * | ||
| 56 | - */ | ||
| 57 | -@Qualifier | ||
| 58 | -@Retention(RetentionPolicy.RUNTIME) | ||
| 59 | -@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE}) | ||
| 60 | -public @interface Generic { | ||
| 61 | - | ||
| 62 | -} |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/Management.java
| @@ -59,12 +59,13 @@ import br.gov.frameworkdemoiselle.context.ConversationContext; | @@ -59,12 +59,13 @@ import br.gov.frameworkdemoiselle.context.ConversationContext; | ||
| 59 | import br.gov.frameworkdemoiselle.context.RequestContext; | 59 | import br.gov.frameworkdemoiselle.context.RequestContext; |
| 60 | import br.gov.frameworkdemoiselle.context.SessionContext; | 60 | import br.gov.frameworkdemoiselle.context.SessionContext; |
| 61 | import br.gov.frameworkdemoiselle.context.ViewContext; | 61 | import br.gov.frameworkdemoiselle.context.ViewContext; |
| 62 | -import br.gov.frameworkdemoiselle.internal.implementation.ManagedType; | ||
| 63 | import br.gov.frameworkdemoiselle.internal.implementation.ManagedType.MethodDetail; | 62 | import br.gov.frameworkdemoiselle.internal.implementation.ManagedType.MethodDetail; |
| 64 | -import br.gov.frameworkdemoiselle.management.AttributeChangeNotification; | 63 | +import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; |
| 64 | +import br.gov.frameworkdemoiselle.management.GenericNotification; | ||
| 65 | import br.gov.frameworkdemoiselle.management.ManagedAttributeNotFoundException; | 65 | import br.gov.frameworkdemoiselle.management.ManagedAttributeNotFoundException; |
| 66 | import br.gov.frameworkdemoiselle.management.ManagedInvokationException; | 66 | import br.gov.frameworkdemoiselle.management.ManagedInvokationException; |
| 67 | import br.gov.frameworkdemoiselle.management.ManagementExtension; | 67 | import br.gov.frameworkdemoiselle.management.ManagementExtension; |
| 68 | +import br.gov.frameworkdemoiselle.management.Notification; | ||
| 68 | import br.gov.frameworkdemoiselle.management.NotificationManager; | 69 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 69 | import br.gov.frameworkdemoiselle.stereotype.ManagementController; | 70 | import br.gov.frameworkdemoiselle.stereotype.ManagementController; |
| 70 | import br.gov.frameworkdemoiselle.util.Beans; | 71 | import br.gov.frameworkdemoiselle.util.Beans; |
| @@ -280,9 +281,12 @@ public class Management implements Serializable { | @@ -280,9 +281,12 @@ public class Management implements Serializable { | ||
| 280 | NotificationManager notificationManager = Beans.getReference(NotificationManager.class); | 281 | NotificationManager notificationManager = Beans.getReference(NotificationManager.class); |
| 281 | Class<? extends Object> attributeType = newValue != null ? newValue.getClass() : null; | 282 | Class<? extends Object> attributeType = newValue != null ? newValue.getClass() : null; |
| 282 | 283 | ||
| 283 | - AttributeChangeNotification notification = new AttributeChangeNotification(bundle.getString( | ||
| 284 | - "management-notification-attribute-changed", propertyName, managedType.getType() | ||
| 285 | - .getCanonicalName()), propertyName, attributeType, oldValue, newValue); | 284 | + Notification notification = new GenericNotification( new AttributeChangeMessage( |
| 285 | + bundle.getString("management-notification-attribute-changed", propertyName, managedType.getType().getCanonicalName()) | ||
| 286 | + , propertyName | ||
| 287 | + , attributeType | ||
| 288 | + , oldValue | ||
| 289 | + , newValue) ); | ||
| 286 | notificationManager.sendNotification(notification); | 290 | notificationManager.sendNotification(notification); |
| 287 | 291 | ||
| 288 | } catch (ConstraintViolationException ce) { | 292 | } catch (ConstraintViolationException ce) { |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ManagementNotificationEventImpl.java
| @@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
| 36 | */ | 36 | */ |
| 37 | package br.gov.frameworkdemoiselle.internal.implementation; | 37 | package br.gov.frameworkdemoiselle.internal.implementation; |
| 38 | 38 | ||
| 39 | -import br.gov.frameworkdemoiselle.management.GenericNotification; | 39 | +import br.gov.frameworkdemoiselle.management.Notification; |
| 40 | import br.gov.frameworkdemoiselle.management.NotificationManager; | 40 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 41 | 41 | ||
| 42 | /** | 42 | /** |
| @@ -49,17 +49,17 @@ import br.gov.frameworkdemoiselle.management.NotificationManager; | @@ -49,17 +49,17 @@ import br.gov.frameworkdemoiselle.management.NotificationManager; | ||
| 49 | */ | 49 | */ |
| 50 | public class ManagementNotificationEventImpl implements br.gov.frameworkdemoiselle.management.ManagementNotificationEvent { | 50 | public class ManagementNotificationEventImpl implements br.gov.frameworkdemoiselle.management.ManagementNotificationEvent { |
| 51 | 51 | ||
| 52 | - private GenericNotification notification; | 52 | + private Notification notification; |
| 53 | 53 | ||
| 54 | - public ManagementNotificationEventImpl(GenericNotification notification){ | 54 | + public ManagementNotificationEventImpl(Notification notification){ |
| 55 | this.notification = notification; | 55 | this.notification = notification; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | - public GenericNotification getNotification() { | 58 | + public Notification getNotification() { |
| 59 | return notification; | 59 | return notification; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | - public void setNotification(GenericNotification notification) { | 62 | + public void setNotification(Notification notification) { |
| 63 | this.notification = notification; | 63 | this.notification = notification; |
| 64 | } | 64 | } |
| 65 | } | 65 | } |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/NotificationManagerImpl.java
| @@ -39,12 +39,10 @@ package br.gov.frameworkdemoiselle.internal.implementation; | @@ -39,12 +39,10 @@ package br.gov.frameworkdemoiselle.internal.implementation; | ||
| 39 | import java.io.Serializable; | 39 | import java.io.Serializable; |
| 40 | 40 | ||
| 41 | import javax.enterprise.event.Event; | 41 | import javax.enterprise.event.Event; |
| 42 | -import javax.enterprise.util.AnnotationLiteral; | ||
| 43 | import javax.inject.Inject; | 42 | import javax.inject.Inject; |
| 44 | 43 | ||
| 45 | -import br.gov.frameworkdemoiselle.management.AttributeChangeNotification; | ||
| 46 | -import br.gov.frameworkdemoiselle.management.GenericNotification; | ||
| 47 | import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; | 44 | import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; |
| 45 | +import br.gov.frameworkdemoiselle.management.Notification; | ||
| 48 | import br.gov.frameworkdemoiselle.management.NotificationManager; | 46 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 49 | import br.gov.frameworkdemoiselle.util.Beans; | 47 | import br.gov.frameworkdemoiselle.util.Beans; |
| 50 | 48 | ||
| @@ -53,45 +51,24 @@ import br.gov.frameworkdemoiselle.util.Beans; | @@ -53,45 +51,24 @@ import br.gov.frameworkdemoiselle.util.Beans; | ||
| 53 | public class NotificationManagerImpl implements NotificationManager,Serializable { | 51 | public class NotificationManagerImpl implements NotificationManager,Serializable { |
| 54 | 52 | ||
| 55 | @Inject | 53 | @Inject |
| 56 | - @Generic | ||
| 57 | - private Event<ManagementNotificationEvent> genericNotificationEvent; | ||
| 58 | - | ||
| 59 | - @Inject | ||
| 60 | - @AttributeChange | ||
| 61 | - private Event<ManagementNotificationEvent> attributeChangeNotificationEvent; | 54 | + private Event<ManagementNotificationEvent> notificationEvent; |
| 62 | 55 | ||
| 63 | /** | 56 | /** |
| 64 | * Sends a generic notification to all management clients. | 57 | * Sends a generic notification to all management clients. |
| 65 | * | 58 | * |
| 66 | * @param notification The notification to send | 59 | * @param notification The notification to send |
| 67 | */ | 60 | */ |
| 68 | - public void sendNotification(GenericNotification notification) { | ||
| 69 | - if (! AttributeChangeNotification.class.isInstance(notification) ){ | ||
| 70 | - getGenericNotificationEvent().fire(new ManagementNotificationEventImpl(notification)); | ||
| 71 | - } | ||
| 72 | - else{ | ||
| 73 | - getAttributeChangeNotificationEvent().fire(new ManagementNotificationEventImpl(notification)); | ||
| 74 | - } | 61 | + public void sendNotification(Notification notification) { |
| 62 | + getGenericNotificationEvent().fire(new ManagementNotificationEventImpl(notification)); | ||
| 75 | } | 63 | } |
| 76 | 64 | ||
| 77 | @SuppressWarnings("unchecked") | 65 | @SuppressWarnings("unchecked") |
| 78 | private Event<ManagementNotificationEvent> getGenericNotificationEvent() { | 66 | private Event<ManagementNotificationEvent> getGenericNotificationEvent() { |
| 79 | - if (genericNotificationEvent==null){ | ||
| 80 | - genericNotificationEvent = Beans.getReference(Event.class , new AnnotationLiteral<Generic>() {}); | 67 | + if (notificationEvent==null){ |
| 68 | + notificationEvent = Beans.getReference(Event.class); | ||
| 81 | } | 69 | } |
| 82 | 70 | ||
| 83 | - return genericNotificationEvent; | 71 | + return notificationEvent; |
| 84 | } | 72 | } |
| 85 | 73 | ||
| 86 | - @SuppressWarnings("unchecked") | ||
| 87 | - private Event<ManagementNotificationEvent> getAttributeChangeNotificationEvent() { | ||
| 88 | - if (attributeChangeNotificationEvent==null){ | ||
| 89 | - attributeChangeNotificationEvent = Beans.getReference(Event.class , new AnnotationLiteral<AttributeChange>() {}); | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - return attributeChangeNotificationEvent; | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - | ||
| 96 | - | ||
| 97 | } | 74 | } |
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/AttributeChangeMessage.java
0 → 100644
| @@ -0,0 +1,82 @@ | @@ -0,0 +1,82 @@ | ||
| 1 | +package br.gov.frameworkdemoiselle.management; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Specialized message that can be used to create a {@link Notification} and be sent using {@link NotificationManager#sendNotification(Notification notification)}. | ||
| 5 | + * | ||
| 6 | + * This message contains information about an attribute change. | ||
| 7 | + * | ||
| 8 | + * @author serpro | ||
| 9 | + * | ||
| 10 | + */ | ||
| 11 | +public class AttributeChangeMessage { | ||
| 12 | + | ||
| 13 | + private String description; | ||
| 14 | + | ||
| 15 | + private String attributeName; | ||
| 16 | + | ||
| 17 | + private Class<? extends Object> attributeType; | ||
| 18 | + | ||
| 19 | + private Object oldValue; | ||
| 20 | + | ||
| 21 | + private Object newValue; | ||
| 22 | + | ||
| 23 | + public AttributeChangeMessage(){ | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public AttributeChangeMessage(String description, String attributeName, Class<? extends Object> attributeType, | ||
| 27 | + Object oldValue, Object newValue) { | ||
| 28 | + this.description = description; | ||
| 29 | + this.attributeName = attributeName; | ||
| 30 | + this.attributeType = attributeType; | ||
| 31 | + this.oldValue = oldValue; | ||
| 32 | + this.newValue = newValue; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public String getDescription() { | ||
| 36 | + return description; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public void setDescription(String description) { | ||
| 40 | + this.description = description; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public String getAttributeName() { | ||
| 44 | + return attributeName; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + public void setAttributeName(String attributeName) { | ||
| 49 | + this.attributeName = attributeName; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + | ||
| 53 | + public Class<? extends Object> getAttributeType() { | ||
| 54 | + return attributeType; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + public void setAttributeType(Class<? extends Object> attributeType) { | ||
| 59 | + this.attributeType = attributeType; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + | ||
| 63 | + public Object getOldValue() { | ||
| 64 | + return oldValue; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + public void setOldValue(Object oldValue) { | ||
| 69 | + this.oldValue = oldValue; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + public Object getNewValue() { | ||
| 74 | + return newValue; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + | ||
| 78 | + public void setNewValue(Object newValue) { | ||
| 79 | + this.newValue = newValue; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | +} |
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/AttributeChangeNotification.java
| @@ -1,116 +0,0 @@ | @@ -1,116 +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.management; | ||
| 38 | - | ||
| 39 | -/** | ||
| 40 | - * Special notification to denote an attribute has changed values. | ||
| 41 | - * | ||
| 42 | - * @see GenericNotification | ||
| 43 | - * @author SERPRO | ||
| 44 | - */ | ||
| 45 | -public class AttributeChangeNotification extends GenericNotification { | ||
| 46 | - | ||
| 47 | - private String attributeName; | ||
| 48 | - | ||
| 49 | - private Class<? extends Object> attributeType; | ||
| 50 | - | ||
| 51 | - private Object oldValue; | ||
| 52 | - | ||
| 53 | - private Object newValue; | ||
| 54 | - | ||
| 55 | - /** | ||
| 56 | - * Constructor without params. | ||
| 57 | - */ | ||
| 58 | - public AttributeChangeNotification() { | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - /** | ||
| 62 | - * Set all the class attibutes, according to the parameters received. | ||
| 63 | - * | ||
| 64 | - * @param message | ||
| 65 | - * message to be displayed. | ||
| 66 | - * @param attributeName | ||
| 67 | - * name of the monitored attribute. | ||
| 68 | - * @param attributeType | ||
| 69 | - * type of the monitored attribute. | ||
| 70 | - * @param oldValue | ||
| 71 | - * old value of the monitored attribute. | ||
| 72 | - * @param newValue | ||
| 73 | - * new value for the monitored attribute. | ||
| 74 | - */ | ||
| 75 | - public AttributeChangeNotification(Object message, String attributeName, Class<? extends Object> attributeType, | ||
| 76 | - Object oldValue, Object newValue) { | ||
| 77 | - super(message); | ||
| 78 | - this.attributeName = attributeName; | ||
| 79 | - this.attributeType = attributeType; | ||
| 80 | - this.oldValue = oldValue; | ||
| 81 | - this.newValue = newValue; | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - public String getAttributeName() { | ||
| 85 | - return attributeName; | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - public void setAttributeName(String attributeName) { | ||
| 89 | - this.attributeName = attributeName; | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - public Class<? extends Object> getAttributeType() { | ||
| 93 | - return attributeType; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - public void setAttributeType(Class<? extends Object> attributeType) { | ||
| 97 | - this.attributeType = attributeType; | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - public Object getOldValue() { | ||
| 101 | - return oldValue; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - public void setOldValue(Object oldValue) { | ||
| 105 | - this.oldValue = oldValue; | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - public Object getNewValue() { | ||
| 109 | - return newValue; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - public void setNewValue(Object newValue) { | ||
| 113 | - this.newValue = newValue; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | -} |
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/GenericNotification.java
| @@ -36,13 +36,17 @@ | @@ -36,13 +36,17 @@ | ||
| 36 | */ | 36 | */ |
| 37 | package br.gov.frameworkdemoiselle.management; | 37 | package br.gov.frameworkdemoiselle.management; |
| 38 | 38 | ||
| 39 | + | ||
| 39 | /** | 40 | /** |
| 40 | - * Notification that can be sent by the {@link NotificationManager}. | 41 | + * Notification that can be sent by the {@link NotificationManager}. This generic |
| 42 | + * notification only has a simple message. | ||
| 41 | * | 43 | * |
| 42 | * @author SERPRO | 44 | * @author SERPRO |
| 43 | */ | 45 | */ |
| 44 | -public class GenericNotification { | 46 | +public class GenericNotification implements Notification { |
| 45 | 47 | ||
| 48 | + private static final long serialVersionUID = 4861136187996412275L; | ||
| 49 | + | ||
| 46 | private Object message; | 50 | private Object message; |
| 47 | 51 | ||
| 48 | /** | 52 | /** |
| @@ -70,12 +74,12 @@ public class GenericNotification { | @@ -70,12 +74,12 @@ public class GenericNotification { | ||
| 70 | this.message = message; | 74 | this.message = message; |
| 71 | } | 75 | } |
| 72 | 76 | ||
| 73 | - public Class<? extends Object> getType() { | 77 | + /*public Class<? extends Object> getType() { |
| 74 | if (message != null) { | 78 | if (message != null) { |
| 75 | return message.getClass(); | 79 | return message.getClass(); |
| 76 | } | 80 | } |
| 77 | 81 | ||
| 78 | return null; | 82 | return null; |
| 79 | - } | 83 | + }*/ |
| 80 | 84 | ||
| 81 | } | 85 | } |
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/ManagementNotificationEvent.java
| @@ -46,6 +46,6 @@ package br.gov.frameworkdemoiselle.management; | @@ -46,6 +46,6 @@ package br.gov.frameworkdemoiselle.management; | ||
| 46 | */ | 46 | */ |
| 47 | public interface ManagementNotificationEvent { | 47 | public interface ManagementNotificationEvent { |
| 48 | 48 | ||
| 49 | - public GenericNotification getNotification(); | 49 | + public Notification getNotification(); |
| 50 | 50 | ||
| 51 | } | 51 | } |
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/Notification.java
0 → 100644
| @@ -0,0 +1,53 @@ | @@ -0,0 +1,53 @@ | ||
| 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.management; | ||
| 38 | + | ||
| 39 | +import java.io.Serializable; | ||
| 40 | + | ||
| 41 | +/** | ||
| 42 | + * | ||
| 43 | + * A notification is a message an application can send to remote clients, usually to inform | ||
| 44 | + * about events that needs special attention. | ||
| 45 | + * | ||
| 46 | + * @author serpro | ||
| 47 | + * | ||
| 48 | + */ | ||
| 49 | +public interface Notification extends Serializable { | ||
| 50 | + | ||
| 51 | + Object getMessage(); | ||
| 52 | + | ||
| 53 | +} |
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/NotificationManager.java
| @@ -40,8 +40,6 @@ import javax.enterprise.context.ApplicationScoped; | @@ -40,8 +40,6 @@ import javax.enterprise.context.ApplicationScoped; | ||
| 40 | import javax.enterprise.event.Observes; | 40 | import javax.enterprise.event.Observes; |
| 41 | import javax.inject.Inject; | 41 | import javax.inject.Inject; |
| 42 | 42 | ||
| 43 | -import br.gov.frameworkdemoiselle.internal.implementation.AttributeChange; | ||
| 44 | -import br.gov.frameworkdemoiselle.internal.implementation.Generic; | ||
| 45 | import br.gov.frameworkdemoiselle.util.Beans; | 43 | import br.gov.frameworkdemoiselle.util.Beans; |
| 46 | 44 | ||
| 47 | /** | 45 | /** |
| @@ -55,9 +53,7 @@ import br.gov.frameworkdemoiselle.util.Beans; | @@ -55,9 +53,7 @@ import br.gov.frameworkdemoiselle.util.Beans; | ||
| 55 | * is {@link ApplicationScoped}, so you can inject it as many times as needed and still have only one instance per application.</p> | 53 | * is {@link ApplicationScoped}, so you can inject it as many times as needed and still have only one instance per application.</p> |
| 56 | * | 54 | * |
| 57 | * <p>Implementators of management protocols must observe the {@link ManagementNotificationEvent} event (using the {@link Observes} annotation), this way | 55 | * <p>Implementators of management protocols must observe the {@link ManagementNotificationEvent} event (using the {@link Observes} annotation), this way |
| 58 | - * they will receive an event containing the original notification and can translate this notification to a specific protocol. Optionaly, | ||
| 59 | - * the implementator can use qualifiers like the {@link Generic} and {@link AttributeChange} qualifiers | ||
| 60 | - * to filter what king of notifications they will handle. One example of an implementator is the <b>demoiselle-jmx</b> extension.</p> | 56 | + * they will receive an event containing the original notification and can translate this notification to a specific protocol.</p> |
| 61 | * | 57 | * |
| 62 | * @author SERPRO | 58 | * @author SERPRO |
| 63 | * | 59 | * |
| @@ -70,6 +66,6 @@ public interface NotificationManager { | @@ -70,6 +66,6 @@ public interface NotificationManager { | ||
| 70 | * | 66 | * |
| 71 | * @param notification The notification to send | 67 | * @param notification The notification to send |
| 72 | */ | 68 | */ |
| 73 | - public void sendNotification(GenericNotification notification); | 69 | + public void sendNotification(Notification notification); |
| 74 | 70 | ||
| 75 | } | 71 | } |
impl/core/src/test/java/management/notification/NotificationTest.java
| @@ -52,8 +52,9 @@ import test.Tests; | @@ -52,8 +52,9 @@ import test.Tests; | ||
| 52 | import br.gov.frameworkdemoiselle.annotation.Name; | 52 | import br.gov.frameworkdemoiselle.annotation.Name; |
| 53 | import br.gov.frameworkdemoiselle.internal.implementation.ManagedType; | 53 | import br.gov.frameworkdemoiselle.internal.implementation.ManagedType; |
| 54 | import br.gov.frameworkdemoiselle.internal.implementation.Management; | 54 | import br.gov.frameworkdemoiselle.internal.implementation.Management; |
| 55 | -import br.gov.frameworkdemoiselle.management.AttributeChangeNotification; | 55 | +import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; |
| 56 | import br.gov.frameworkdemoiselle.management.GenericNotification; | 56 | import br.gov.frameworkdemoiselle.management.GenericNotification; |
| 57 | +import br.gov.frameworkdemoiselle.management.Notification; | ||
| 57 | import br.gov.frameworkdemoiselle.management.NotificationManager; | 58 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 58 | import br.gov.frameworkdemoiselle.util.Beans; | 59 | import br.gov.frameworkdemoiselle.util.Beans; |
| 59 | import br.gov.frameworkdemoiselle.util.ResourceBundle; | 60 | import br.gov.frameworkdemoiselle.util.ResourceBundle; |
| @@ -94,8 +95,9 @@ public class NotificationTest { | @@ -94,8 +95,9 @@ public class NotificationTest { | ||
| 94 | */ | 95 | */ |
| 95 | @Test | 96 | @Test |
| 96 | public void sendAttributeChangeNotification() { | 97 | public void sendAttributeChangeNotification() { |
| 97 | - manager.sendNotification(new AttributeChangeNotification("Test Message", "attribute", String.class, "old", | ||
| 98 | - "new")); | 98 | + Notification n = new GenericNotification( new AttributeChangeMessage("Test Message", "attribute", String.class, "old", "new") ); |
| 99 | + manager.sendNotification(n); | ||
| 100 | + | ||
| 99 | DummyNotificationListener listener = Beans.getReference(DummyNotificationListener.class); | 101 | DummyNotificationListener listener = Beans.getReference(DummyNotificationListener.class); |
| 100 | Assert.assertEquals("Test Message - attribute", listener.getMessage()); | 102 | Assert.assertEquals("Test Message - attribute", listener.getMessage()); |
| 101 | } | 103 | } |
impl/core/src/test/java/management/testclasses/DummyNotificationListener.java
| @@ -39,9 +39,7 @@ package management.testclasses; | @@ -39,9 +39,7 @@ package management.testclasses; | ||
| 39 | import javax.enterprise.context.ApplicationScoped; | 39 | import javax.enterprise.context.ApplicationScoped; |
| 40 | import javax.enterprise.event.Observes; | 40 | import javax.enterprise.event.Observes; |
| 41 | 41 | ||
| 42 | -import br.gov.frameworkdemoiselle.internal.implementation.AttributeChange; | ||
| 43 | -import br.gov.frameworkdemoiselle.internal.implementation.Generic; | ||
| 44 | -import br.gov.frameworkdemoiselle.management.AttributeChangeNotification; | 42 | +import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; |
| 45 | import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; | 43 | import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; |
| 46 | import br.gov.frameworkdemoiselle.management.NotificationManager; | 44 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 47 | 45 | ||
| @@ -56,13 +54,16 @@ public class DummyNotificationListener { | @@ -56,13 +54,16 @@ public class DummyNotificationListener { | ||
| 56 | 54 | ||
| 57 | private String message = null; | 55 | private String message = null; |
| 58 | 56 | ||
| 59 | - public void listenNotification(@Observes @Generic ManagementNotificationEvent event){ | ||
| 60 | - message = event.getNotification().getMessage().toString(); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - public void listenAttributeChangeNotification(@Observes @AttributeChange ManagementNotificationEvent event){ | ||
| 64 | - AttributeChangeNotification notification = (AttributeChangeNotification)event.getNotification(); | ||
| 65 | - message = notification.getMessage().toString() + " - " + notification.getAttributeName(); | 57 | + public void listenNotification(@Observes ManagementNotificationEvent event){ |
| 58 | + Object lMessage = event.getNotification().getMessage(); | ||
| 59 | + | ||
| 60 | + if (AttributeChangeMessage.class.isInstance(lMessage)){ | ||
| 61 | + AttributeChangeMessage lAttrMessage = (AttributeChangeMessage)lMessage; | ||
| 62 | + message = lAttrMessage.getDescription() + " - " + lAttrMessage.getAttributeName(); | ||
| 63 | + } | ||
| 64 | + else{ | ||
| 65 | + message = lMessage.toString(); | ||
| 66 | + } | ||
| 66 | } | 67 | } |
| 67 | 68 | ||
| 68 | public String getMessage() { | 69 | public String getMessage() { |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/NotificationBroadcaster.java
| @@ -37,12 +37,14 @@ | @@ -37,12 +37,14 @@ | ||
| 37 | package br.gov.frameworkdemoiselle.internal.implementation; | 37 | package br.gov.frameworkdemoiselle.internal.implementation; |
| 38 | 38 | ||
| 39 | import java.io.Serializable; | 39 | import java.io.Serializable; |
| 40 | +import java.util.concurrent.atomic.AtomicInteger; | ||
| 40 | 41 | ||
| 41 | import javax.management.AttributeChangeNotification; | 42 | import javax.management.AttributeChangeNotification; |
| 42 | import javax.management.Notification; | 43 | import javax.management.Notification; |
| 43 | import javax.management.NotificationBroadcasterSupport; | 44 | import javax.management.NotificationBroadcasterSupport; |
| 44 | 45 | ||
| 45 | import br.gov.frameworkdemoiselle.internal.configuration.JMXConfig; | 46 | import br.gov.frameworkdemoiselle.internal.configuration.JMXConfig; |
| 47 | +import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; | ||
| 46 | import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; | 48 | import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; |
| 47 | import br.gov.frameworkdemoiselle.management.NotificationManager; | 49 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 48 | 50 | ||
| @@ -58,25 +60,26 @@ public final class NotificationBroadcaster extends NotificationBroadcasterSuppor | @@ -58,25 +60,26 @@ public final class NotificationBroadcaster extends NotificationBroadcasterSuppor | ||
| 58 | 60 | ||
| 59 | private static final long serialVersionUID = 1L; | 61 | private static final long serialVersionUID = 1L; |
| 60 | 62 | ||
| 61 | - private int sequenceNumber = 1; | 63 | + private AtomicInteger sequence = new AtomicInteger(); |
| 62 | 64 | ||
| 63 | private static final String NOTIFICATION_TYPE_GENERIC = "jmx.message"; | 65 | private static final String NOTIFICATION_TYPE_GENERIC = "jmx.message"; |
| 64 | 66 | ||
| 65 | protected void sendNotification( ManagementNotificationEvent event , JMXConfig config ) { | 67 | protected void sendNotification( ManagementNotificationEvent event , JMXConfig config ) { |
| 66 | - br.gov.frameworkdemoiselle.management.GenericNotification demoiselleNotification = event.getNotification(); | ||
| 67 | - Notification n = new Notification(NOTIFICATION_TYPE_GENERIC, config.getNotificationMBeanName(), sequenceNumber++, System.currentTimeMillis(), demoiselleNotification.getMessage().toString()); | ||
| 68 | - sendNotification(n); | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - protected void sendAttributeChangedMessage( ManagementNotificationEvent event , JMXConfig config ) { | ||
| 72 | - br.gov.frameworkdemoiselle.management.AttributeChangeNotification demoiselleNotification = (br.gov.frameworkdemoiselle.management.AttributeChangeNotification)event.getNotification(); | ||
| 73 | - | ||
| 74 | - AttributeChangeNotification n = new AttributeChangeNotification(config.getNotificationMBeanName(), sequenceNumber++ | ||
| 75 | - , System.currentTimeMillis(), demoiselleNotification.getMessage().toString() | ||
| 76 | - , demoiselleNotification.getAttributeName(), demoiselleNotification.getAttributeType().getSimpleName() | ||
| 77 | - , demoiselleNotification.getOldValue(), demoiselleNotification.getNewValue()); | 68 | + br.gov.frameworkdemoiselle.management.Notification demoiselleNotification = event.getNotification(); |
| 69 | + Object message = demoiselleNotification.getMessage(); | ||
| 70 | + Notification n; | ||
| 78 | 71 | ||
| 72 | + if (AttributeChangeMessage.class.isInstance( message )){ | ||
| 73 | + AttributeChangeMessage attributeChangeMessage = (AttributeChangeMessage) message; | ||
| 74 | + | ||
| 75 | + n = new AttributeChangeNotification(config.getNotificationMBeanName(), sequence.incrementAndGet() | ||
| 76 | + , System.currentTimeMillis(), attributeChangeMessage.getDescription() | ||
| 77 | + , attributeChangeMessage.getAttributeName(), attributeChangeMessage.getAttributeType().getSimpleName() | ||
| 78 | + , attributeChangeMessage.getOldValue(), attributeChangeMessage.getNewValue()); | ||
| 79 | + } | ||
| 80 | + else{ | ||
| 81 | + n = new Notification(NOTIFICATION_TYPE_GENERIC, config.getNotificationMBeanName(), sequence.incrementAndGet(), System.currentTimeMillis(), demoiselleNotification.getMessage().toString()); | ||
| 82 | + } | ||
| 79 | sendNotification(n); | 83 | sendNotification(n); |
| 80 | } | 84 | } |
| 81 | - | ||
| 82 | } | 85 | } |
impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/NotificationEventListener.java
| @@ -59,14 +59,10 @@ public class NotificationEventListener implements Serializable { | @@ -59,14 +59,10 @@ public class NotificationEventListener implements Serializable { | ||
| 59 | 59 | ||
| 60 | private NotificationBroadcaster notificationBroadcaster; | 60 | private NotificationBroadcaster notificationBroadcaster; |
| 61 | 61 | ||
| 62 | - public void sendNotification( @Observes @Generic ManagementNotificationEvent event , JMXConfig config ) { | 62 | + public void sendNotification( @Observes ManagementNotificationEvent event , JMXConfig config ) { |
| 63 | createNotificationBroadcaster().sendNotification(event,config); | 63 | createNotificationBroadcaster().sendNotification(event,config); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | - public void sendAttributeChangedMessage( @Observes @AttributeChange ManagementNotificationEvent event , JMXConfig config ) { | ||
| 67 | - createNotificationBroadcaster().sendAttributeChangedMessage(event, config); | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | public NotificationBroadcaster createNotificationBroadcaster(){ | 66 | public NotificationBroadcaster createNotificationBroadcaster(){ |
| 71 | if (notificationBroadcaster==null){ | 67 | if (notificationBroadcaster==null){ |
| 72 | notificationBroadcaster = new NotificationBroadcaster(); | 68 | notificationBroadcaster = new NotificationBroadcaster(); |
| @@ -74,5 +70,4 @@ public class NotificationEventListener implements Serializable { | @@ -74,5 +70,4 @@ public class NotificationEventListener implements Serializable { | ||
| 74 | 70 | ||
| 75 | return notificationBroadcaster; | 71 | return notificationBroadcaster; |
| 76 | } | 72 | } |
| 77 | - | ||
| 78 | } | 73 | } |
impl/extension/jmx/src/test/java/management/tests/notification/NotificationBroadcasterTest.java
| @@ -61,8 +61,9 @@ import br.gov.frameworkdemoiselle.internal.configuration.JMXConfig; | @@ -61,8 +61,9 @@ import br.gov.frameworkdemoiselle.internal.configuration.JMXConfig; | ||
| 61 | import br.gov.frameworkdemoiselle.internal.implementation.MBeanManager; | 61 | import br.gov.frameworkdemoiselle.internal.implementation.MBeanManager; |
| 62 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; | 62 | import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; |
| 63 | import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; | 63 | import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; |
| 64 | -import br.gov.frameworkdemoiselle.management.AttributeChangeNotification; | 64 | +import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; |
| 65 | import br.gov.frameworkdemoiselle.management.GenericNotification; | 65 | import br.gov.frameworkdemoiselle.management.GenericNotification; |
| 66 | +import br.gov.frameworkdemoiselle.management.Notification; | ||
| 66 | import br.gov.frameworkdemoiselle.management.NotificationManager; | 67 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 67 | import br.gov.frameworkdemoiselle.util.Beans; | 68 | import br.gov.frameworkdemoiselle.util.Beans; |
| 68 | 69 | ||
| @@ -171,8 +172,7 @@ public class NotificationBroadcasterTest { | @@ -171,8 +172,7 @@ public class NotificationBroadcasterTest { | ||
| 171 | } | 172 | } |
| 172 | 173 | ||
| 173 | // Manda a notificação pelo Demoiselle | 174 | // Manda a notificação pelo Demoiselle |
| 174 | - AttributeChangeNotification notification = new AttributeChangeNotification("Attribute Changed", "name", | ||
| 175 | - String.class, "Demoiselle 1", "Demoiselle 2"); | 175 | + Notification notification = new GenericNotification( new AttributeChangeMessage("Attribute Changed", "name", String.class, "Demoiselle 1", "Demoiselle 2") ); |
| 176 | notificationManager.sendNotification(notification); | 176 | notificationManager.sendNotification(notification); |
| 177 | 177 | ||
| 178 | // Se o componente funcionou, o Demoiselle propagou a notificação para o servidor MBean e o listener preencheu | 178 | // Se o componente funcionou, o Demoiselle propagou a notificação para o servidor MBean e o listener preencheu |