Commit e742f58bcbd3060ff7e9d911ca2ee37e681c5336
1 parent
9f4d2bc5
Exists in
master
IN PROGRESS - issue FWK-123: Revisar e atualizar documentação do
Framework 2.4.0 https://demoiselle.atlassian.net/browse/FWK-123
Showing
6 changed files
with
95 additions
and
95 deletions
Show diff stats
documentation/reference/pt-BR/gerenciamento.xml
| @@ -198,7 +198,7 @@ public class DiskWritter{ | @@ -198,7 +198,7 @@ public class DiskWritter{ | ||
| 198 | // ... implementação da escrita de arquivo | 198 | // ... implementação da escrita de arquivo |
| 199 | 199 | ||
| 200 | if (fileToWrite.getUsableSpace() / (float)fileToWrite.getTotalSpace() <= 0.2f){ | 200 | if (fileToWrite.getUsableSpace() / (float)fileToWrite.getTotalSpace() <= 0.2f){ |
| 201 | - Notification notification = new GenericNotification("O espaço disponível no disco é inferior a 20% do total"); | 201 | + Notification notification = new DefaultNotification("O espaço disponível no disco é inferior a 20% do total"); |
| 202 | notificationManager.sendNotification( notification ); | 202 | notificationManager.sendNotification( notification ); |
| 203 | } | 203 | } |
| 204 | } | 204 | } |
| @@ -218,7 +218,7 @@ public class DiskWritter{ | @@ -218,7 +218,7 @@ public class DiskWritter{ | ||
| 218 | </para> | 218 | </para> |
| 219 | 219 | ||
| 220 | <para> | 220 | <para> |
| 221 | - O <emphasis>demoiselle-core</emphasis> disponibiliza por padrão o tipo concreto de notificação <emphasis>GenericNotification</emphasis> - uma | 221 | + O <emphasis>demoiselle-core</emphasis> disponibiliza por padrão o tipo concreto de notificação <emphasis>DefaultNotification</emphasis> - uma |
| 222 | implementação direta da interface <emphasis>Notification</emphasis> que permite definir a mensagem a ser retornada por <emphasis>getMessage()</emphasis>. | 222 | implementação direta da interface <emphasis>Notification</emphasis> que permite definir a mensagem a ser retornada por <emphasis>getMessage()</emphasis>. |
| 223 | Além disso o <emphasis>demoiselle-core</emphasis> disponibiliza o tipo especial de mensagem <emphasis>AttributeChangeMessage</emphasis>, que permite | 223 | Além disso o <emphasis>demoiselle-core</emphasis> disponibiliza o tipo especial de mensagem <emphasis>AttributeChangeMessage</emphasis>, que permite |
| 224 | 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. | 224 | 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. |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/Management.java
| @@ -61,7 +61,7 @@ import br.gov.frameworkdemoiselle.context.SessionContext; | @@ -61,7 +61,7 @@ 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.MethodDetail; | 62 | import br.gov.frameworkdemoiselle.internal.implementation.ManagedType.MethodDetail; |
| 63 | import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; | 63 | import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; |
| 64 | -import br.gov.frameworkdemoiselle.management.GenericNotification; | 64 | +import br.gov.frameworkdemoiselle.management.DefaultNotification; |
| 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; |
| @@ -281,7 +281,7 @@ public class Management implements Serializable { | @@ -281,7 +281,7 @@ public class Management implements Serializable { | ||
| 281 | NotificationManager notificationManager = Beans.getReference(NotificationManager.class); | 281 | NotificationManager notificationManager = Beans.getReference(NotificationManager.class); |
| 282 | Class<? extends Object> attributeType = newValue != null ? newValue.getClass() : null; | 282 | Class<? extends Object> attributeType = newValue != null ? newValue.getClass() : null; |
| 283 | 283 | ||
| 284 | - Notification notification = new GenericNotification( new AttributeChangeMessage( | 284 | + Notification notification = new DefaultNotification( new AttributeChangeMessage( |
| 285 | bundle.getString("management-notification-attribute-changed", propertyName, managedType.getType().getCanonicalName()) | 285 | bundle.getString("management-notification-attribute-changed", propertyName, managedType.getType().getCanonicalName()) |
| 286 | , propertyName | 286 | , propertyName |
| 287 | , attributeType | 287 | , attributeType |
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/DefaultNotification.java
0 → 100644
| @@ -0,0 +1,85 @@ | @@ -0,0 +1,85 @@ | ||
| 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 | +/** | ||
| 41 | + * Notification that can be sent by the {@link NotificationManager}. This generic | ||
| 42 | + * notification only has a simple message. | ||
| 43 | + * | ||
| 44 | + * @author SERPRO | ||
| 45 | + */ | ||
| 46 | +public class DefaultNotification implements Notification { | ||
| 47 | + | ||
| 48 | + private static final long serialVersionUID = 4861136187996412275L; | ||
| 49 | + | ||
| 50 | + private Object message; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * Constructor without params. | ||
| 54 | + */ | ||
| 55 | + public DefaultNotification() { | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * Constructor with message to notification. | ||
| 60 | + * | ||
| 61 | + * @param message | ||
| 62 | + * message to notification. | ||
| 63 | + */ | ||
| 64 | + public DefaultNotification(Object message) { | ||
| 65 | + super(); | ||
| 66 | + this.message = message; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public Object getMessage() { | ||
| 70 | + return message; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public void setMessage(Object message) { | ||
| 74 | + this.message = message; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /*public Class<? extends Object> getType() { | ||
| 78 | + if (message != null) { | ||
| 79 | + return message.getClass(); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + return null; | ||
| 83 | + }*/ | ||
| 84 | + | ||
| 85 | +} |
impl/core/src/main/java/br/gov/frameworkdemoiselle/management/GenericNotification.java
| @@ -1,85 +0,0 @@ | @@ -1,85 +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 | -/** | ||
| 41 | - * Notification that can be sent by the {@link NotificationManager}. This generic | ||
| 42 | - * notification only has a simple message. | ||
| 43 | - * | ||
| 44 | - * @author SERPRO | ||
| 45 | - */ | ||
| 46 | -public class GenericNotification implements Notification { | ||
| 47 | - | ||
| 48 | - private static final long serialVersionUID = 4861136187996412275L; | ||
| 49 | - | ||
| 50 | - private Object message; | ||
| 51 | - | ||
| 52 | - /** | ||
| 53 | - * Constructor without params. | ||
| 54 | - */ | ||
| 55 | - public GenericNotification() { | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - /** | ||
| 59 | - * Constructor with message to notification. | ||
| 60 | - * | ||
| 61 | - * @param message | ||
| 62 | - * message to notification. | ||
| 63 | - */ | ||
| 64 | - public GenericNotification(Object message) { | ||
| 65 | - super(); | ||
| 66 | - this.message = message; | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - public Object getMessage() { | ||
| 70 | - return message; | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - public void setMessage(Object message) { | ||
| 74 | - this.message = message; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - /*public Class<? extends Object> getType() { | ||
| 78 | - if (message != null) { | ||
| 79 | - return message.getClass(); | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - return null; | ||
| 83 | - }*/ | ||
| 84 | - | ||
| 85 | -} |
impl/core/src/test/java/management/notification/NotificationTest.java
| @@ -53,7 +53,7 @@ import br.gov.frameworkdemoiselle.annotation.Name; | @@ -53,7 +53,7 @@ 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.AttributeChangeMessage; | 55 | import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; |
| 56 | -import br.gov.frameworkdemoiselle.management.GenericNotification; | 56 | +import br.gov.frameworkdemoiselle.management.DefaultNotification; |
| 57 | import br.gov.frameworkdemoiselle.management.Notification; | 57 | import br.gov.frameworkdemoiselle.management.Notification; |
| 58 | import br.gov.frameworkdemoiselle.management.NotificationManager; | 58 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 59 | import br.gov.frameworkdemoiselle.util.Beans; | 59 | import br.gov.frameworkdemoiselle.util.Beans; |
| @@ -85,7 +85,7 @@ public class NotificationTest { | @@ -85,7 +85,7 @@ public class NotificationTest { | ||
| 85 | */ | 85 | */ |
| 86 | @Test | 86 | @Test |
| 87 | public void sendGenericNotification() { | 87 | public void sendGenericNotification() { |
| 88 | - manager.sendNotification(new GenericNotification("Test Message")); | 88 | + manager.sendNotification(new DefaultNotification("Test Message")); |
| 89 | DummyNotificationListener listener = Beans.getReference(DummyNotificationListener.class); | 89 | DummyNotificationListener listener = Beans.getReference(DummyNotificationListener.class); |
| 90 | Assert.assertEquals("Test Message", listener.getMessage()); | 90 | Assert.assertEquals("Test Message", listener.getMessage()); |
| 91 | } | 91 | } |
| @@ -95,7 +95,7 @@ public class NotificationTest { | @@ -95,7 +95,7 @@ public class NotificationTest { | ||
| 95 | */ | 95 | */ |
| 96 | @Test | 96 | @Test |
| 97 | public void sendAttributeChangeNotification() { | 97 | public void sendAttributeChangeNotification() { |
| 98 | - Notification n = new GenericNotification( new AttributeChangeMessage("Test Message", "attribute", String.class, "old", "new") ); | 98 | + Notification n = new DefaultNotification( new AttributeChangeMessage("Test Message", "attribute", String.class, "old", "new") ); |
| 99 | manager.sendNotification(n); | 99 | manager.sendNotification(n); |
| 100 | 100 | ||
| 101 | DummyNotificationListener listener = Beans.getReference(DummyNotificationListener.class); | 101 | DummyNotificationListener listener = Beans.getReference(DummyNotificationListener.class); |
impl/extension/jmx/src/test/java/management/tests/notification/NotificationBroadcasterTest.java
| @@ -62,7 +62,7 @@ import br.gov.frameworkdemoiselle.internal.implementation.MBeanManager; | @@ -62,7 +62,7 @@ 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.AttributeChangeMessage; | 64 | import br.gov.frameworkdemoiselle.management.AttributeChangeMessage; |
| 65 | -import br.gov.frameworkdemoiselle.management.GenericNotification; | 65 | +import br.gov.frameworkdemoiselle.management.DefaultNotification; |
| 66 | import br.gov.frameworkdemoiselle.management.Notification; | 66 | import br.gov.frameworkdemoiselle.management.Notification; |
| 67 | import br.gov.frameworkdemoiselle.management.NotificationManager; | 67 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 68 | import br.gov.frameworkdemoiselle.util.Beans; | 68 | import br.gov.frameworkdemoiselle.util.Beans; |
| @@ -128,7 +128,7 @@ public class NotificationBroadcasterTest { | @@ -128,7 +128,7 @@ public class NotificationBroadcasterTest { | ||
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | // Manda a notificação pelo Demoiselle | 130 | // Manda a notificação pelo Demoiselle |
| 131 | - GenericNotification n = new GenericNotification("Notification test successful"); | 131 | + DefaultNotification n = new DefaultNotification("Notification test successful"); |
| 132 | notificationManager.sendNotification(n); | 132 | notificationManager.sendNotification(n); |
| 133 | 133 | ||
| 134 | // Se o componente funcionou, o Demoiselle propagou a notificação para o servidor MBean e o listener preencheu | 134 | // 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 { | @@ -172,7 +172,7 @@ public class NotificationBroadcasterTest { | ||
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | // Manda a notificação pelo Demoiselle | 174 | // Manda a notificação pelo Demoiselle |
| 175 | - Notification notification = new GenericNotification( new AttributeChangeMessage("Attribute Changed", "name", String.class, "Demoiselle 1", "Demoiselle 2") ); | 175 | + Notification notification = new DefaultNotification( 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 |