diff --git a/documentation/reference/pt-BR/gerenciamento.xml b/documentation/reference/pt-BR/gerenciamento.xml index fbe0a9a..1902921 100644 --- a/documentation/reference/pt-BR/gerenciamento.xml +++ b/documentation/reference/pt-BR/gerenciamento.xml @@ -198,7 +198,7 @@ public class DiskWritter{ // ... implementação da escrita de arquivo if (fileToWrite.getUsableSpace() / (float)fileToWrite.getTotalSpace() <= 0.2f){ - Notification notification = new GenericNotification("O espaço disponível no disco é inferior a 20% do total"); + Notification notification = new DefaultNotification("O espaço disponível no disco é inferior a 20% do total"); notificationManager.sendNotification( notification ); } } @@ -218,7 +218,7 @@ public class DiskWritter{ - O demoiselle-core disponibiliza por padrão o tipo concreto de notificação GenericNotification - uma + O demoiselle-core disponibiliza por padrão o tipo concreto de notificação DefaultNotification - uma implementação direta da interface Notification que permite definir a mensagem a ser retornada por getMessage(). Além disso o demoiselle-core disponibiliza o tipo especial de mensagem AttributeChangeMessage, que permite especificar além do texto da mensagem enviada, dados sobre a mudança de valor de um atributo, como o nome do atributo alterado, o valor antigo e o novo. diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/Management.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/Management.java index 7af5fa9..5904403 100644 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/Management.java +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/Management.java @@ -61,7 +61,7 @@ import br.gov.frameworkdemoiselle.context.SessionContext; import br.gov.frameworkdemoiselle.context.ViewContext; import br.gov.frameworkdemoiselle.internal.implementation.ManagedType.MethodDetail; import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; -import br.gov.frameworkdemoiselle.management.GenericNotification; +import br.gov.frameworkdemoiselle.management.DefaultNotification; import br.gov.frameworkdemoiselle.management.ManagedAttributeNotFoundException; import br.gov.frameworkdemoiselle.management.ManagedInvokationException; import br.gov.frameworkdemoiselle.management.ManagementExtension; @@ -281,7 +281,7 @@ public class Management implements Serializable { NotificationManager notificationManager = Beans.getReference(NotificationManager.class); Class attributeType = newValue != null ? newValue.getClass() : null; - Notification notification = new GenericNotification( new AttributeChangeMessage( + Notification notification = new DefaultNotification( new AttributeChangeMessage( bundle.getString("management-notification-attribute-changed", propertyName, managedType.getType().getCanonicalName()) , propertyName , attributeType diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/DefaultNotification.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/DefaultNotification.java new file mode 100644 index 0000000..a4141b3 --- /dev/null +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/DefaultNotification.java @@ -0,0 +1,85 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package br.gov.frameworkdemoiselle.management; + + +/** + * Notification that can be sent by the {@link NotificationManager}. This generic + * notification only has a simple message. + * + * @author SERPRO + */ +public class DefaultNotification implements Notification { + + private static final long serialVersionUID = 4861136187996412275L; + + private Object message; + + /** + * Constructor without params. + */ + public DefaultNotification() { + } + + /** + * Constructor with message to notification. + * + * @param message + * message to notification. + */ + public DefaultNotification(Object message) { + super(); + this.message = message; + } + + public Object getMessage() { + return message; + } + + public void setMessage(Object message) { + this.message = message; + } + + /*public Class getType() { + if (message != null) { + return message.getClass(); + } + + return null; + }*/ + +} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/GenericNotification.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/GenericNotification.java deleted file mode 100644 index 7501d5d..0000000 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/management/GenericNotification.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.management; - - -/** - * Notification that can be sent by the {@link NotificationManager}. This generic - * notification only has a simple message. - * - * @author SERPRO - */ -public class GenericNotification implements Notification { - - private static final long serialVersionUID = 4861136187996412275L; - - private Object message; - - /** - * Constructor without params. - */ - public GenericNotification() { - } - - /** - * Constructor with message to notification. - * - * @param message - * message to notification. - */ - public GenericNotification(Object message) { - super(); - this.message = message; - } - - public Object getMessage() { - return message; - } - - public void setMessage(Object message) { - this.message = message; - } - - /*public Class getType() { - if (message != null) { - return message.getClass(); - } - - return null; - }*/ - -} diff --git a/impl/core/src/test/java/management/notification/NotificationTest.java b/impl/core/src/test/java/management/notification/NotificationTest.java index e7291ba..10e1884 100644 --- a/impl/core/src/test/java/management/notification/NotificationTest.java +++ b/impl/core/src/test/java/management/notification/NotificationTest.java @@ -53,7 +53,7 @@ import br.gov.frameworkdemoiselle.annotation.Name; import br.gov.frameworkdemoiselle.internal.implementation.ManagedType; import br.gov.frameworkdemoiselle.internal.implementation.Management; import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; -import br.gov.frameworkdemoiselle.management.GenericNotification; +import br.gov.frameworkdemoiselle.management.DefaultNotification; import br.gov.frameworkdemoiselle.management.Notification; import br.gov.frameworkdemoiselle.management.NotificationManager; import br.gov.frameworkdemoiselle.util.Beans; @@ -85,7 +85,7 @@ public class NotificationTest { */ @Test public void sendGenericNotification() { - manager.sendNotification(new GenericNotification("Test Message")); + manager.sendNotification(new DefaultNotification("Test Message")); DummyNotificationListener listener = Beans.getReference(DummyNotificationListener.class); Assert.assertEquals("Test Message", listener.getMessage()); } @@ -95,7 +95,7 @@ public class NotificationTest { */ @Test public void sendAttributeChangeNotification() { - Notification n = new GenericNotification( new AttributeChangeMessage("Test Message", "attribute", String.class, "old", "new") ); + Notification n = new DefaultNotification( new AttributeChangeMessage("Test Message", "attribute", String.class, "old", "new") ); manager.sendNotification(n); DummyNotificationListener listener = Beans.getReference(DummyNotificationListener.class); diff --git a/impl/extension/jmx/src/test/java/management/tests/notification/NotificationBroadcasterTest.java b/impl/extension/jmx/src/test/java/management/tests/notification/NotificationBroadcasterTest.java index 10398bc..89694af 100644 --- a/impl/extension/jmx/src/test/java/management/tests/notification/NotificationBroadcasterTest.java +++ b/impl/extension/jmx/src/test/java/management/tests/notification/NotificationBroadcasterTest.java @@ -62,7 +62,7 @@ import br.gov.frameworkdemoiselle.internal.implementation.MBeanManager; import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; -import br.gov.frameworkdemoiselle.management.GenericNotification; +import br.gov.frameworkdemoiselle.management.DefaultNotification; import br.gov.frameworkdemoiselle.management.Notification; import br.gov.frameworkdemoiselle.management.NotificationManager; import br.gov.frameworkdemoiselle.util.Beans; @@ -128,7 +128,7 @@ public class NotificationBroadcasterTest { } // Manda a notificação pelo Demoiselle - GenericNotification n = new GenericNotification("Notification test successful"); + DefaultNotification n = new DefaultNotification("Notification test successful"); notificationManager.sendNotification(n); // Se o componente funcionou, o Demoiselle propagou a notificação para o servidor MBean e o listener preencheu @@ -172,7 +172,7 @@ public class NotificationBroadcasterTest { } // Manda a notificação pelo Demoiselle - Notification notification = new GenericNotification( new AttributeChangeMessage("Attribute Changed", "name", String.class, "Demoiselle 1", "Demoiselle 2") ); + Notification notification = new DefaultNotification( new AttributeChangeMessage("Attribute Changed", "name", String.class, "Demoiselle 1", "Demoiselle 2") ); notificationManager.sendNotification(notification); // Se o componente funcionou, o Demoiselle propagou a notificação para o servidor MBean e o listener preencheu -- libgit2 0.21.2