From fa219700eb30d6e64095709e585b4a8162eb0c65 Mon Sep 17 00:00:00 2001 From: Dancovich Date: Tue, 21 May 2013 14:34:13 -0300 Subject: [PATCH] Release inicial após período de incubação --- impl/extension/jmx/.gitignore | 9 +++++++++ impl/extension/jmx/pom.xml | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/bootstrap/JMXManagementExtension.java | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/configuration/JMXConfig.java | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/DynamicMBeanProxy.java | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanHelper.java | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanManager.java | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcaster.java | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcasterMBean.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationEventListener.java | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/main/resources/META-INF/beans.xml | 4 ++++ impl/extension/jmx/src/main/resources/META-INF/persistence.xml | 5 +++++ impl/extension/jmx/src/main/resources/demoiselle-jmx-bundle.properties | 8 ++++++++ impl/extension/jmx/src/test/java/management/LocaleProducer.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/test/java/management/domain/ManagedTestClass.java | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/test/java/management/tests/internal/DynamicMBeanProxyTestCase.java | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/test/java/management/tests/internal/NotificationBroadcasterTestCase.java | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/test/java/management/tests/internal/RemoteManagementTestCase.java | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/test/resources/META-INF/beans.xml | 7 +++++++ impl/extension/jmx/src/test/resources/META-INF/persistence.xml | 22 ++++++++++++++++++++++ impl/extension/jmx/src/test/resources/arquillian.xml | 27 +++++++++++++++++++++++++++ impl/extension/jmx/src/test/resources/configuration/demoiselle.properties | 1 + impl/extension/jmx/src/test/resources/log4j.properties | 42 ++++++++++++++++++++++++++++++++++++++++++ impl/extension/jmx/src/test/resources/test/beans.xml | 11 +++++++++++ 24 files changed, 1730 insertions(+), 0 deletions(-) create mode 100644 impl/extension/jmx/.gitignore create mode 100644 impl/extension/jmx/pom.xml create mode 100644 impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/bootstrap/JMXManagementExtension.java create mode 100644 impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/configuration/JMXConfig.java create mode 100644 impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/DynamicMBeanProxy.java create mode 100644 impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanHelper.java create mode 100644 impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanManager.java create mode 100644 impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcaster.java create mode 100644 impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcasterMBean.java create mode 100644 impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationEventListener.java create mode 100644 impl/extension/jmx/src/main/resources/META-INF/beans.xml create mode 100644 impl/extension/jmx/src/main/resources/META-INF/persistence.xml create mode 100644 impl/extension/jmx/src/main/resources/demoiselle-jmx-bundle.properties create mode 100644 impl/extension/jmx/src/test/java/management/LocaleProducer.java create mode 100644 impl/extension/jmx/src/test/java/management/domain/ManagedTestClass.java create mode 100644 impl/extension/jmx/src/test/java/management/tests/internal/DynamicMBeanProxyTestCase.java create mode 100644 impl/extension/jmx/src/test/java/management/tests/internal/NotificationBroadcasterTestCase.java create mode 100644 impl/extension/jmx/src/test/java/management/tests/internal/RemoteManagementTestCase.java create mode 100644 impl/extension/jmx/src/test/resources/META-INF/beans.xml create mode 100644 impl/extension/jmx/src/test/resources/META-INF/persistence.xml create mode 100644 impl/extension/jmx/src/test/resources/arquillian.xml create mode 100644 impl/extension/jmx/src/test/resources/configuration/demoiselle.properties create mode 100755 impl/extension/jmx/src/test/resources/log4j.properties create mode 100644 impl/extension/jmx/src/test/resources/test/beans.xml diff --git a/impl/extension/jmx/.gitignore b/impl/extension/jmx/.gitignore new file mode 100644 index 0000000..c112012 --- /dev/null +++ b/impl/extension/jmx/.gitignore @@ -0,0 +1,9 @@ +/.settings +/hsql:..tmp +/target +/.classpath +/.project +/hsql:..lck +/hsql:..log +/hsql:..properties +/hsql:..script diff --git a/impl/extension/jmx/pom.xml b/impl/extension/jmx/pom.xml new file mode 100644 index 0000000..ce030fc --- /dev/null +++ b/impl/extension/jmx/pom.xml @@ -0,0 +1,131 @@ + + + 4.0.0 + + demoiselle-jmx + Demoiselle Framework JMX Extension + Demoiselle Framework JMX Extension + + + demoiselle-extension-parent + br.gov.frameworkdemoiselle + 2.4.0-BETA2-SNAPSHOT + ../../../parent/extension + + + + + + br.gov.frameworkdemoiselle + demoiselle-core + + + + + junit + junit + test + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + 2.0.0-beta-3 + test + + + org.jboss.weld.se + weld-se-core + test + + + org.jboss.arquillian.container + arquillian-weld-se-embedded-1.1 + test + + + org.hibernate + hibernate-validator + test + + + + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + false + + + + sonatype-nexus-releases + Sonatype Nexus Releases + https://oss.sonatype.org/content/repositories/releases + + false + + + true + + + + + http://www.frameworkdemoiselle.gov.br + + + SERPRO - Serviço Federal de Processamento de Dados + http://www.serpro.gov.br + + + + + GNU Lesser General Public License, Version 3 + http://www.gnu.org/licenses/lgpl-3.0.txt + + + \ No newline at end of file diff --git a/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/bootstrap/JMXManagementExtension.java b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/bootstrap/JMXManagementExtension.java new file mode 100644 index 0000000..47a19b7 --- /dev/null +++ b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/bootstrap/JMXManagementExtension.java @@ -0,0 +1,108 @@ +/* + * 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.jmx.bootstrap; + +import java.util.List; + +import javax.management.ObjectInstance; + +import br.gov.frameworkdemoiselle.annotation.Name; +import br.gov.frameworkdemoiselle.internal.management.ManagedType; +import br.gov.frameworkdemoiselle.jmx.configuration.JMXConfig; +import br.gov.frameworkdemoiselle.jmx.internal.DynamicMBeanProxy; +import br.gov.frameworkdemoiselle.jmx.internal.MBeanHelper; +import br.gov.frameworkdemoiselle.jmx.internal.MBeanManager; +import br.gov.frameworkdemoiselle.jmx.internal.NotificationEventListener; +import br.gov.frameworkdemoiselle.lifecycle.ManagementExtension; +import br.gov.frameworkdemoiselle.util.Beans; + +public class JMXManagementExtension implements ManagementExtension { + + public void registerNotificationMBean(){ + MBeanManager mbeanManager = Beans.getReference(MBeanManager.class); + JMXConfig configuration = Beans.getReference(JMXConfig.class); + + StringBuffer notificationMBeanName = new StringBuffer() + .append( configuration.getNotificationDomain()!=null ? configuration.getNotificationDomain() : "br.gov.frameworkdemoiselle.jmx" ) + .append(":name=") + .append(configuration.getNotificationMBeanName()); + + if (mbeanManager.findMBeanInstance(notificationMBeanName.toString()) == null){ + NotificationEventListener listener = Beans.getReference(NotificationEventListener.class); + + ObjectInstance instance = MBeanHelper.register(listener.createNotificationBroadcaster(), notificationMBeanName.toString()); + mbeanManager.storeRegisteredMBean(instance); + } + } + + @Override + public void initialize(List managedTypes) { + MBeanManager manager = Beans.getReference(MBeanManager.class); + JMXConfig configuration = Beans.getReference(JMXConfig.class); + + for (ManagedType type : managedTypes) { + DynamicMBeanProxy beanProxy = new DynamicMBeanProxy(type); + + Name nameAnnotation = type.getType().getAnnotation(Name.class); + String mbeanName = nameAnnotation != null ? nameAnnotation.value() : type.getType().getSimpleName(); + + StringBuffer name = new StringBuffer() + .append( configuration.getMbeanDomain()!=null ? configuration.getMbeanDomain() : type.getType().getPackage().getName() ) + .append(":name=") + .append( mbeanName ); + + + if (manager.findMBeanInstance(name.toString()) == null){ + ObjectInstance instance = MBeanHelper.register(beanProxy, name.toString()); + manager.storeRegisteredMBean(instance); + } + } + + registerNotificationMBean(); + } + + @Override + public void shutdown(List managedTypes) { + MBeanManager manager = Beans.getReference(MBeanManager.class); + for (ObjectInstance instance : manager.listRegisteredMBeans()){ + MBeanHelper.unregister(instance.getObjectName()); + } + + manager.cleanRegisteredMBeans(); + } + +} diff --git a/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/configuration/JMXConfig.java b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/configuration/JMXConfig.java new file mode 100644 index 0000000..b31efdd --- /dev/null +++ b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/configuration/JMXConfig.java @@ -0,0 +1,118 @@ +/* + * 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.jmx.configuration; + +import javax.management.NotificationBroadcaster; + +import br.gov.frameworkdemoiselle.annotation.Name; +import br.gov.frameworkdemoiselle.configuration.Configuration; + +@Configuration(prefix = "frameworkdemoiselle.management.jmx.") +public class JMXConfig { + + @Name("mbean.domain") + private String mbeanDomain; + + @Name("notification.domain") + private String notificationDomain; + + @Name("notification.name") + private String notificationMBeanName = "NotificationBroadcaster"; + + /** + *

The domain to register all {@link Managed} classes found during boot.

+ * + *

The full name of a MBean has the format of domain:name=MBeanName (ex: br.gov.frameworkdemoiselle.jmx:name=NotificationBroadcaster), this + * parameter is the "domain" portion of the full name.

+ * + *

The default is null and when is set to null, all {@link Managed} classes will use it's own package as the domain.

+ * + */ + public String getMbeanDomain() { + return mbeanDomain; + } + + /** + * @see #getMbeanDomain() + */ + public void setMbeanDomain(String mbeanDomain) { + this.mbeanDomain = mbeanDomain; + } + + /** + *

The name the {@link NotificationBroadcaster} MBean will be registered to. The full name + * of a MBean has the format of domain:name=MBeanName (ex: br.gov.frameworkdemoiselle.jmx:name=NotificationBroadcaster), this + * parameter is the ":name=MBeanName" portion without the ":name=".

+ * + *

The default is the value returned by {@link Class#getSimpleName()} when called from the {@link NotificationBroadcaster} class.

+ * + * @see #getMbeanDomain() + */ + public String getNotificationMBeanName() { + return notificationMBeanName; + } + + /** + * @see #getNotificationMBeanName() + */ + public void setNotificationMBeanName(String notificationMBeanName) { + this.notificationMBeanName = notificationMBeanName; + } + + /** + *

The domain to register the {@link NotificationBroadcaster} MBean.

+ * + *

The full name of a MBean has the format of domain:name=MBeanName (ex: br.gov.frameworkdemoiselle.jmx:name=NotificationBroadcaster), this + * parameter is the "domain" portion of the full name.

+ * + *

The default is br.gov.frameworkdemoiselle.jmx.

+ * + */ + public String getNotificationDomain() { + return notificationDomain; + } + + /** + * @see #getNotificationDomain() + */ + public void setNotificationDomain(String notificationDomain) { + this.notificationDomain = notificationDomain; + } + + + +} diff --git a/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/DynamicMBeanProxy.java b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/DynamicMBeanProxy.java new file mode 100644 index 0000000..b4db8cd --- /dev/null +++ b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/DynamicMBeanProxy.java @@ -0,0 +1,239 @@ +/* + * 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.jmx.internal; + +import java.util.ArrayList; +import java.util.Locale; +import java.util.Map.Entry; + +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.AttributeNotFoundException; +import javax.management.DynamicMBean; +import javax.management.InvalidAttributeValueException; +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanException; +import javax.management.MBeanInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanParameterInfo; +import javax.management.ReflectionException; + +import br.gov.frameworkdemoiselle.DemoiselleException; +import br.gov.frameworkdemoiselle.internal.management.ManagedType; +import br.gov.frameworkdemoiselle.internal.management.ManagedType.FieldDetail; +import br.gov.frameworkdemoiselle.internal.management.ManagedType.MethodDetail; +import br.gov.frameworkdemoiselle.internal.management.ManagedType.ParameterDetail; +import br.gov.frameworkdemoiselle.internal.management.Management; +import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer; +import br.gov.frameworkdemoiselle.stereotype.ManagementController; +import br.gov.frameworkdemoiselle.util.Beans; +import br.gov.frameworkdemoiselle.util.ResourceBundle; + +/** + *

+ * This class is a MBean that gets registered everytime you mark a class with {@link ManagementController}. It dynamicaly reads the + * fields and operations contained in a {@link ManagementController} class and exposes them to the MBean server. Everytime a client + * tries to call an operation or read/write a property inside a ManagementController class, this class will call the appropriate + * method and pass the result to the MBean client. + *

+ * + * @author SERPRO + */ +public class DynamicMBeanProxy implements DynamicMBean { + + private MBeanInfo delegateInfo; + + private ManagedType managedType; + + private ResourceBundle bundle = ResourceBundleProducer.create("demoiselle-jmx-bundle", Locale.getDefault()); + + public DynamicMBeanProxy(ManagedType type) { + if (type == null) { + throw new NullPointerException(bundle.getString("mbean-null-type-defined")); + } + managedType = type; + } + + @Override + public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { + // Se o bean ainda não foi lido para determinar seus atributos, o faz agora. + if (delegateInfo == null) { + initializeMBeanInfo(); + } + + Management manager = Beans.getReference(Management.class); + return manager.getProperty(managedType, attribute); + } + + @Override + public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, + MBeanException, ReflectionException { + + // Se o bean ainda não foi lido para determinar seus atributos, o faz agora. + if (delegateInfo == null) { + initializeMBeanInfo(); + } + + Management manager = Beans.getReference(Management.class); + manager.setProperty(managedType, attribute.getName(), attribute.getValue()); + } + + @Override + public AttributeList getAttributes(String[] attributes) { + if (attributes != null) { + AttributeList list = new AttributeList(); + for (String attribute : attributes) { + try { + Object value = getAttribute(attribute); + list.add(new Attribute(attribute, value)); + } catch (Throwable t) { + } + } + + return list; + } + + return null; + } + + @Override + public AttributeList setAttributes(AttributeList attributes) { + AttributeList settedAttributes = new AttributeList(); + if (attributes != null) { + for (Attribute attribute : attributes.asList()) { + try { + setAttribute(attribute); + + // A razão para separarmos a criação do atributo de sua adição na lista é que + // caso a obtenção do novo valor do atributo dispare uma exceção então o atributo não será + // adicionado na lista de atributos que foram afetados. + Attribute attributeWithNewValue = new Attribute(attribute.getName(), + getAttribute(attribute.getName())); + settedAttributes.add(attributeWithNewValue); + } catch (Throwable t) { + } + } + } + + return settedAttributes; + } + + @Override + public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, + ReflectionException { + + // Se o bean ainda não foi lido para determinar seus atributos, o faz agora. + if (this.delegateInfo == null) { + initializeMBeanInfo(); + } + + Management manager = Beans.getReference(Management.class); + return manager.invoke(managedType, actionName, params); + } + + /** + * Initialize the Managed information for this instance of Managed + */ + private void initializeMBeanInfo() { + // Aqui vamos armazenar nossos atributos + ArrayList attributes = new ArrayList(); + + // Aqui vamos armazenar nossas operações + ArrayList operations = new ArrayList(); + + // Para cada propriedade descoberta no ManagementController, cria um attributeInfo correspondente + for (Entry fieldEntry : managedType.getFields().entrySet()) { + + try { + + MBeanAttributeInfo attributeInfo = new MBeanAttributeInfo(fieldEntry.getKey(), fieldEntry.getValue() + .getDescription(), fieldEntry.getValue().getGetterMethod(), fieldEntry.getValue() + .getSetterMethod()); + attributes.add(attributeInfo); + + } catch (javax.management.IntrospectionException e) { + throw new DemoiselleException(bundle.getString("mbean-introspection-error", managedType.getType() + .getSimpleName())); + } + } + + // Para cada operação descoberta no ManagementController, cria um operationInfo correspondente + for (Entry methodEntry : managedType.getOperationMethods().entrySet()) { + + MethodDetail methodDetail = methodEntry.getValue(); + + ParameterDetail[] parameterTypes = methodDetail.getParameterTypers(); + + MBeanParameterInfo[] parameters = parameterTypes.length > 0 ? new MBeanParameterInfo[parameterTypes.length] + : null; + + if (parameters != null) { + + for (int i = 0; i < parameterTypes.length; i++) { + + parameters[i] = new MBeanParameterInfo(parameterTypes[i].getParameterName(), parameterTypes[i] + .getParameterType().getCanonicalName(), parameterTypes[i].getParameterDescription()); + } + } + + // Com todas as informações, criamos nossa instância de MBeanOperationInfo e + // acrescentamos na lista de todas as operações. + MBeanOperationInfo operation = new MBeanOperationInfo(methodDetail.getMethod().getName(), + methodDetail.getDescription(), parameters, methodDetail.getMethod().getReturnType().getName(), + MBeanOperationInfo.ACTION_INFO); + + operations.add(operation); + + } + + // Por fim criamos nosso bean info. + delegateInfo = new MBeanInfo(managedType.getType().getCanonicalName(), managedType.getDescription(), + attributes.toArray(new MBeanAttributeInfo[0]), null, operations.toArray(new MBeanOperationInfo[0]), + null); + + } + + @Override + public MBeanInfo getMBeanInfo() { + if (delegateInfo == null) { + initializeMBeanInfo(); + } + + return delegateInfo; + } + +} diff --git a/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanHelper.java b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanHelper.java new file mode 100644 index 0000000..ab941eb --- /dev/null +++ b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanHelper.java @@ -0,0 +1,121 @@ +/* + * 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.jmx.internal; + +import java.lang.management.ManagementFactory; +import java.util.Locale; + +import javax.management.MBeanServer; +import javax.management.ObjectInstance; +import javax.management.ObjectName; + +import org.slf4j.Logger; + +import br.gov.frameworkdemoiselle.DemoiselleException; +import br.gov.frameworkdemoiselle.internal.producer.LoggerProducer; +import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer; +import br.gov.frameworkdemoiselle.util.ResourceBundle; + +/** + * Class with common tools for registering MBeans into an Managed server + * + * @author SERPRO + */ +public class MBeanHelper { + + private static final Logger logger = LoggerProducer.create(MBeanHelper.class); + + private static ResourceBundle bundle = ResourceBundleProducer.create("demoiselle-jmx-bundle", Locale.getDefault()); + + private static final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + + // @Inject + // @Name("demoiselle-monitoring-bundle") + // private ResourceBundle bundle; + + /** + * Return the MBean Server instance. + * + * @return MBeanServer + */ + public static final MBeanServer getMBeanServer() { + return server; + } + + /** + * Register a given managed bean (MBean) with the specified name. + * + * @param mbean + * the managed bean to register + * @param name + * the name under which to register the bean + * @return the object name of the mbean, for later deregistration + */ + public static ObjectInstance register(final Object mbean, final String name) { + + logger.info(bundle.getString("mbean-registration",name)); + + ObjectInstance instance = null; + try { + ObjectName objectName = new ObjectName(name); + instance = server.registerMBean(mbean, objectName); + } catch (Exception e) { + logger.error(bundle.getString("mbean-registration-error",name),e); + throw new DemoiselleException(bundle.getString("mbean-registration-error",name), e); + } + + return instance; + } + + /** + * Remove the registration of a mbean. + * + * @param objectName + * the name of the bean to unregister + */ + public static void unregister(final ObjectName objectName) { + + logger.info(bundle.getString("mbean-deregistration",objectName.getCanonicalName())); + + try { + server.unregisterMBean(objectName); + } catch (Exception e) { + logger.error(bundle.getString("mbean-deregistration",objectName.getCanonicalName()),e); + throw new DemoiselleException(bundle.getString("mbean-deregistration",objectName.getCanonicalName()), e); + } + } +} diff --git a/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanManager.java b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanManager.java new file mode 100644 index 0000000..1d438c9 --- /dev/null +++ b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/MBeanManager.java @@ -0,0 +1,67 @@ +/* + * 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.jmx.internal; + +import java.util.Collection; +import java.util.HashMap; + +import javax.inject.Singleton; +import javax.management.ObjectInstance; + +@Singleton +public class MBeanManager { + + private HashMap registeredMBeans = new HashMap(); + + public void storeRegisteredMBean(ObjectInstance instance){ + registeredMBeans.put(instance.getObjectName().getCanonicalName(),instance); + } + + public Collection listRegisteredMBeans(){ + return registeredMBeans.values(); + } + + public ObjectInstance findMBeanInstance(String name){ + ObjectInstance instance = registeredMBeans.get(name); + return instance; + } + + public void cleanRegisteredMBeans(){ + registeredMBeans.clear(); + } + +} diff --git a/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcaster.java b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcaster.java new file mode 100644 index 0000000..0c2b605 --- /dev/null +++ b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcaster.java @@ -0,0 +1,86 @@ +/* + * 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.jmx.internal; + +import java.io.Serializable; + +import javax.management.AttributeChangeNotification; +import javax.management.Notification; +import javax.management.NotificationBroadcasterSupport; + +import br.gov.frameworkdemoiselle.internal.management.ManagementNotificationEvent; +import br.gov.frameworkdemoiselle.jmx.configuration.JMXConfig; +import br.gov.frameworkdemoiselle.management.NotificationManager; + +/** + * Implementation of the {@link NotificationBroadcaster} MBean. + * When the {@link NotificationManager} sends an event, a {@link NotificationEventListener} captures the notification and uses + * this MBean to send it as a JMX notification. + * + * @author serpro + * + */ +final class NotificationBroadcaster extends NotificationBroadcasterSupport implements NotificationBroadcasterMBean,Serializable { + + private static final long serialVersionUID = 1L; + + private int sequenceNumber = 1; + + /*public static final String NOTIFICATION_DEFAULT_MBEAN_NAME = NotificationBroadcaster.class.getPackage().getName() + +":name=" + +NotificationBroadcaster.class.getSimpleName();*/ + + private static final String NOTIFICATION_TYPE_GENERIC = "jmx.message"; + + protected void sendNotification( ManagementNotificationEvent event , JMXConfig config ) { + br.gov.frameworkdemoiselle.management.Notification demoiselleNotification = event.getNotification(); + Notification n = new Notification(NOTIFICATION_TYPE_GENERIC, config.getNotificationMBeanName(), sequenceNumber++, System.currentTimeMillis(), demoiselleNotification.getMessage().toString()); + sendNotification(n); + } + + protected void sendAttributeChangedMessage( ManagementNotificationEvent event , JMXConfig config ) { + br.gov.frameworkdemoiselle.management.AttributeChangeNotification demoiselleNotification = (br.gov.frameworkdemoiselle.management.AttributeChangeNotification)event.getNotification(); + + AttributeChangeNotification n = new AttributeChangeNotification(config.getNotificationMBeanName(), sequenceNumber++ + , System.currentTimeMillis(), demoiselleNotification.getMessage().toString() + , demoiselleNotification.getAttributeName(), demoiselleNotification.getAttributeType().getSimpleName() + , demoiselleNotification.getOldValue(), demoiselleNotification.getNewValue()); + + sendNotification(n); + } + +} diff --git a/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcasterMBean.java b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcasterMBean.java new file mode 100644 index 0000000..600646c --- /dev/null +++ b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationBroadcasterMBean.java @@ -0,0 +1,48 @@ +/* + * 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.jmx.internal; + + + +/** + * MBean interface responsible for sending MBean notifications to remote clients. + * + * @author serpro + * + */ +interface NotificationBroadcasterMBean { +} diff --git a/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationEventListener.java b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationEventListener.java new file mode 100644 index 0000000..f2ad079 --- /dev/null +++ b/impl/extension/jmx/src/main/java/br/gov/frameworkdemoiselle/jmx/internal/NotificationEventListener.java @@ -0,0 +1,80 @@ +/* + * 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.jmx.internal; + +import java.io.Serializable; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.event.Observes; + +import br.gov.frameworkdemoiselle.internal.management.ManagementNotificationEvent; +import br.gov.frameworkdemoiselle.internal.management.qualifier.AttributeChange; +import br.gov.frameworkdemoiselle.internal.management.qualifier.Generic; +import br.gov.frameworkdemoiselle.jmx.configuration.JMXConfig; +import br.gov.frameworkdemoiselle.management.NotificationManager; + +/** + * Listens to {@link NotificationManager} notification events and proxies them + * to a {@link NotificationBroadcaster} MBean. This MBean will send the notification to + * any JMX clients connected and listening. + * + * @author serpro + * + */ +@ApplicationScoped +@SuppressWarnings("serial") +public class NotificationEventListener implements Serializable { + + private NotificationBroadcaster notificationBroadcaster; + + public void sendNotification( @Observes @Generic ManagementNotificationEvent event , JMXConfig config ) { + createNotificationBroadcaster().sendNotification(event,config); + } + + public void sendAttributeChangedMessage( @Observes @AttributeChange ManagementNotificationEvent event , JMXConfig config ) { + createNotificationBroadcaster().sendAttributeChangedMessage(event, config); + } + + public NotificationBroadcaster createNotificationBroadcaster(){ + if (notificationBroadcaster==null){ + notificationBroadcaster = new NotificationBroadcaster(); + } + + return notificationBroadcaster; + } + +} diff --git a/impl/extension/jmx/src/main/resources/META-INF/beans.xml b/impl/extension/jmx/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000..3867c08 --- /dev/null +++ b/impl/extension/jmx/src/main/resources/META-INF/beans.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/impl/extension/jmx/src/main/resources/META-INF/persistence.xml b/impl/extension/jmx/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..ed0fcf6 --- /dev/null +++ b/impl/extension/jmx/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/impl/extension/jmx/src/main/resources/demoiselle-jmx-bundle.properties b/impl/extension/jmx/src/main/resources/demoiselle-jmx-bundle.properties new file mode 100644 index 0000000..303ae53 --- /dev/null +++ b/impl/extension/jmx/src/main/resources/demoiselle-jmx-bundle.properties @@ -0,0 +1,8 @@ +mbean-null-type-defined=A classe do MBean n\u00E3o pode ser null +mbean-introspection-error=Erro ao ler atributos do MBean {0} +mbean-registration=Registrando novo MBean usando o nome\: {0} +mbean-registration-error=Falha ao registrar MBean usando o nome\: {0} +mbean-deregistration=Removendo MBean de nome: {0} +mbean-deregistration-error=Falha ao remover MBean de nome: {0} +mbean-notification-registration=Registrando NotificationBroadcaster usando o nome\: {0} +mbean-notification-registration-error=Falha ao registrar NotificationBroadcaster usando o nome\: {0} \ No newline at end of file diff --git a/impl/extension/jmx/src/test/java/management/LocaleProducer.java b/impl/extension/jmx/src/test/java/management/LocaleProducer.java new file mode 100644 index 0000000..a5743dd --- /dev/null +++ b/impl/extension/jmx/src/test/java/management/LocaleProducer.java @@ -0,0 +1,51 @@ +/* + * 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 management; + +import java.util.Locale; + +import javax.enterprise.inject.Default; +import javax.enterprise.inject.Produces; + +public class LocaleProducer { + + @Default + @Produces + public Locale create() { + return Locale.getDefault(); + } +} diff --git a/impl/extension/jmx/src/test/java/management/domain/ManagedTestClass.java b/impl/extension/jmx/src/test/java/management/domain/ManagedTestClass.java new file mode 100644 index 0000000..eff1c54 --- /dev/null +++ b/impl/extension/jmx/src/test/java/management/domain/ManagedTestClass.java @@ -0,0 +1,73 @@ +/* + * 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 management.domain; + +import br.gov.frameworkdemoiselle.annotation.ManagedOperation; +import br.gov.frameworkdemoiselle.annotation.ManagedProperty; +import br.gov.frameworkdemoiselle.annotation.Name; +import br.gov.frameworkdemoiselle.annotation.OperationParameter; +import br.gov.frameworkdemoiselle.annotation.OperationType; +import br.gov.frameworkdemoiselle.stereotype.ManagementController; + +/** + * Classe usada para testar se o registro de classes Managed + * como MBeans está funcionando. + * + * @author SERPRO + * + */ +@ManagementController +@Name("ManagedTest") +public class ManagedTestClass { + + @ManagedProperty(description="Atributo de teste para testar registro de MBean") + private String attribute; + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + @ManagedOperation(type=OperationType.ACTION_INFO,description="Test Operation") + public String operation(@OperationParameter(name="parameter") String parameter){ + return "Operation called with parameter="+parameter+". Current attribute value is "+attribute; + } + +} diff --git a/impl/extension/jmx/src/test/java/management/tests/internal/DynamicMBeanProxyTestCase.java b/impl/extension/jmx/src/test/java/management/tests/internal/DynamicMBeanProxyTestCase.java new file mode 100644 index 0000000..2291308 --- /dev/null +++ b/impl/extension/jmx/src/test/java/management/tests/internal/DynamicMBeanProxyTestCase.java @@ -0,0 +1,175 @@ +/* + * 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 management.tests.internal; + +import java.io.File; +import java.lang.management.ManagementFactory; + +import javax.management.Attribute; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + +import junit.framework.Assert; +import management.LocaleProducer; +import management.domain.ManagedTestClass; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.FileAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import br.gov.frameworkdemoiselle.jmx.internal.MBeanManager; +import br.gov.frameworkdemoiselle.util.Beans; + +@RunWith(Arquillian.class) +public class DynamicMBeanProxyTestCase { + + @Deployment + public static JavaArchive createDeployment() { + JavaArchive mainDeployment = ShrinkWrap.create(JavaArchive.class); + mainDeployment + .addPackages(true, "br") + .addAsResource(new FileAsset(new File("src/test/resources/test/beans.xml")), "beans.xml") + .addAsResource(new FileAsset(new File("src/test/resources/configuration/demoiselle.properties")), + "demoiselle.properties").addPackages(false, DynamicMBeanProxyTestCase.class.getPackage()) + .addClasses(LocaleProducer.class, ManagedTestClass.class); + + return mainDeployment; + } + + /** + * Testa se o bootstrap está corretamente carregando e registrando classes anotadas com {@link Managed} como MBeans. + */ + @Test + public void testMBeanInitialization() { + MBeanManager manager = Beans.getReference(MBeanManager.class); + + Assert.assertNotNull(manager); + Assert.assertNotNull(manager.listRegisteredMBeans()); + + // O componente demoiselle-jmx sempre tem pelo menos um MBean, que é + // o NotificationBroadcaster. Qualquer classe gerenciada criada pelo usuário + // será adicionada a ela, então esperamos 2 MBeans aqui. + Assert.assertEquals(2, manager.listRegisteredMBeans().size()); + } + + @Test + public void testAttributeWrite() { + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + + ObjectName name = null; + try { + name = new ObjectName("br.gov.frameworkdemoiselle.jmx.domain:name=ManagedTest"); + } catch (MalformedObjectNameException e) { + Assert.fail(); + } + + try { + server.setAttribute(name, new Attribute("attribute", "New Value")); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } + + @Test + public void testAttributeRead() { + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + + ObjectName name = null; + try { + name = new ObjectName("br.gov.frameworkdemoiselle.jmx.domain:name=ManagedTest"); + } catch (MalformedObjectNameException e) { + Assert.fail(); + } + + try { + server.setAttribute(name, new Attribute("attribute", "New Value")); + + Object info = server.getAttribute(name, "attribute"); + + Assert.assertEquals("New Value", info); + } catch (Exception e) { + Assert.fail(); + } + } + + @Test + public void testOperationInvocation() { + + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + + ObjectName name = null; + try { + name = new ObjectName("br.gov.frameworkdemoiselle.jmx.domain:name=ManagedTest"); + } catch (MalformedObjectNameException e) { + Assert.fail(); + } + + try { + server.setAttribute(name, new Attribute("attribute", "Defined Value")); + + Object info = server.invoke(name, "operation", new Object[] { "Test" }, new String[] { "String" }); + Assert.assertEquals("Operation called with parameter=Test. Current attribute value is Defined Value", info); + } catch (Exception e) { + Assert.fail(); + } + + } + + @Test + public void testTryWriteOverReadOnly() { + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + + ObjectName name = null; + try { + name = new ObjectName("br.gov.frameworkdemoiselle.jmx.domain:name=ManagedTest"); + } catch (MalformedObjectNameException e) { + Assert.fail(); + } + + try { + server.setAttribute(name, new Attribute("attribute", "New Value")); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } + +} diff --git a/impl/extension/jmx/src/test/java/management/tests/internal/NotificationBroadcasterTestCase.java b/impl/extension/jmx/src/test/java/management/tests/internal/NotificationBroadcasterTestCase.java new file mode 100644 index 0000000..14a9e0b --- /dev/null +++ b/impl/extension/jmx/src/test/java/management/tests/internal/NotificationBroadcasterTestCase.java @@ -0,0 +1,207 @@ +/* + * 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 management.tests.internal; + +import java.io.File; +import java.lang.management.ManagementFactory; + +import javax.management.InstanceNotFoundException; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.NotificationListener; +import javax.management.ObjectInstance; +import javax.management.ObjectName; + +import junit.framework.Assert; +import management.LocaleProducer; +import management.domain.ManagedTestClass; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.FileAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import br.gov.frameworkdemoiselle.jmx.configuration.JMXConfig; +import br.gov.frameworkdemoiselle.jmx.internal.MBeanManager; +import br.gov.frameworkdemoiselle.management.AttributeChangeNotification; +import br.gov.frameworkdemoiselle.management.Notification; +import br.gov.frameworkdemoiselle.management.NotificationManager; +import br.gov.frameworkdemoiselle.util.Beans; + +@RunWith(Arquillian.class) +public class NotificationBroadcasterTestCase { + + @Deployment + public static JavaArchive createDeployment() { + JavaArchive mainDeployment = ShrinkWrap.create(JavaArchive.class); + mainDeployment + .addPackages(true, "br") + .addAsResource(new FileAsset(new File("src/test/resources/test/beans.xml")), "beans.xml") + .addAsResource(new FileAsset(new File("src/test/resources/configuration/demoiselle.properties")), + "demoiselle.properties").addPackages(false, DynamicMBeanProxyTestCase.class.getPackage()) + .addClasses(LocaleProducer.class, ManagedTestClass.class); + + return mainDeployment; + } + + /** + * Testa o envio de uma mensagem para clientes conectados + */ + @Test + public void sendMessageTest(){ + JMXConfig config = Beans.getReference(JMXConfig.class); + + //Obtém o servidor MBean onde anexaremos um listener para a notificação + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + + NotificationManager notificationManager = Beans.getReference(NotificationManager.class); + + //Aqui obtemos o MBean de notificações já registrado pelo bootstrap + StringBuffer notificationMBeanName = new StringBuffer() + .append( config.getNotificationDomain()!=null ? config.getNotificationDomain() : "br.gov.frameworkdemoiselle.jmx" ) + .append(":name=") + .append( config.getNotificationMBeanName()); + + ObjectName name = null; + try { + name = new ObjectName(notificationMBeanName.toString()); + } catch (MalformedObjectNameException e) { + Assert.fail(); + } + + //StringBuffer vazio + StringBuffer notificationBuffer = new StringBuffer(); + + //Este notification listener será chamado quando o Demoiselle enviar a notificação e vai colocar + //a mensagem enviada em "notificationBuffer" + NotificationListener listener = new TestNotificationListener(notificationBuffer); + + try { + //Anexa o listener no servidor MBean + server.addNotificationListener(name,listener,null,null); + } catch (InstanceNotFoundException e) { + Assert.fail(); + } + + //Manda a notificação pelo Demoiselle + Notification n = new Notification("Notification test successful"); + notificationManager.sendNotification(n); + + //Se o componente funcionou, o Demoiselle propagou a notificação para o servidor MBean e o listener preencheu + //o StringBuffer com nossa mensagem. + Assert.assertEquals("Notification test successful", notificationBuffer.toString()); + + } + + /** + * Testa o envio de uma mensagem de mudança de atributo para clientes conectados + */ + @Test + public void sendAttributeChangedMessageTest(){ + JMXConfig config = Beans.getReference(JMXConfig.class); + + //Obtém o servidor MBean onde anexaremos um listener para a notificação + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + + NotificationManager notificationManager = Beans.getReference(NotificationManager.class); + MBeanManager mBeanManager = Beans.getReference(MBeanManager.class); + + //Aqui obtemos o MBean de notificações já registrado pelo bootstrap + StringBuffer notificationMBeanName = new StringBuffer() + .append( config.getNotificationDomain()!=null ? config.getNotificationDomain() : "br.gov.frameworkdemoiselle.jmx" ) + .append(":name=") + .append( config.getNotificationMBeanName()); + ObjectInstance instance = mBeanManager.findMBeanInstance(notificationMBeanName.toString()); + + //StringBuffer vazio + StringBuffer notificationBuffer = new StringBuffer(); + + //Este notification listener será chamado quando o Demoiselle enviar a notificação e vai colocar + //a mensagem enviada em "notificationBuffer" + NotificationListener listener = new TestNotificationListener(notificationBuffer); + + try { + //Anexa o listener no servidor MBean + server.addNotificationListener(instance.getObjectName(),listener,null,null); + } catch (InstanceNotFoundException e) { + Assert.fail(); + } + + //Manda a notificação pelo Demoiselle + AttributeChangeNotification notification = new AttributeChangeNotification("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 + //o StringBuffer com nossa mensagem. + Assert.assertEquals("Attribute Changed: name = Demoiselle 2", notificationBuffer.toString()); + + } + + /** + * Implementação do {@link NotificationListener} do Java que vai por qualquer notificação recebida em um StringBuffer. + * + * @author serpro + * + */ + class TestNotificationListener implements NotificationListener { + + StringBuffer message; + + public TestNotificationListener(StringBuffer testMessage){ + this.message = testMessage; + } + + @Override + public void handleNotification(javax.management.Notification notification, Object handback) { + if (message!=null){ + message.append(notification.getMessage()); + + if (notification instanceof javax.management.AttributeChangeNotification){ + message.append(": ") + .append( ((javax.management.AttributeChangeNotification)notification).getAttributeName() ) + .append(" = ") + .append(((javax.management.AttributeChangeNotification)notification).getNewValue()); + } + } + } + + } + +} diff --git a/impl/extension/jmx/src/test/java/management/tests/internal/RemoteManagementTestCase.java b/impl/extension/jmx/src/test/java/management/tests/internal/RemoteManagementTestCase.java new file mode 100644 index 0000000..3e4321e --- /dev/null +++ b/impl/extension/jmx/src/test/java/management/tests/internal/RemoteManagementTestCase.java @@ -0,0 +1,90 @@ +package management.tests.internal; + +import java.io.File; + +import javax.management.Attribute; +import javax.management.MBeanServerConnection; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + +import management.LocaleProducer; +import management.domain.ManagedTestClass; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.FileAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * + * Tests remote management using JMX. + * + *

+ * TODO Currently you need to configure Eclipse Run configuration to pass + * system properties enabling remote management to the Java VM. Arquillian's + * current version doesn't support this. + *

+ * + *

+ * On a SUN virtual machine these properties need to be set to enable remote management: + *

    + *
  • com.sun.management.jmxremote.port=9999
  • + *
  • com.sun.management.jmxremote.authenticate=false
  • + *
  • com.sun.management.jmxremote.ssl=false
  • + *
+ *

+ * + * @author serpro + * + */ +@RunWith(Arquillian.class) +@Ignore +public class RemoteManagementTestCase { + + @Deployment(testable=false) + public static JavaArchive createDeployment() { + JavaArchive mainDeployment = ShrinkWrap.create(JavaArchive.class); + mainDeployment + .addPackages(true, "br") + .addAsResource(new FileAsset(new File("src/test/resources/test/beans.xml")), "beans.xml") + .addAsResource(new FileAsset(new File("src/test/resources/configuration/demoiselle.properties")), + "demoiselle.properties").addPackages(false, DynamicMBeanProxyTestCase.class.getPackage()) + .addClasses(LocaleProducer.class, ManagedTestClass.class); + + return mainDeployment; + } + + @Test + @RunAsClient + public void testRemotePropertyReading() { + try { + JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi"); + JMXConnector jmxc = JMXConnectorFactory.connect(url, null); + MBeanServerConnection mbsc = jmxc.getMBeanServerConnection(); + + ObjectName name = null; + try { + name = new ObjectName("br.gov.frameworkdemoiselle.jmx.domain:name=ManagedTest"); + } catch (MalformedObjectNameException e) { + Assert.fail(); + } + + mbsc.setAttribute(name, new Attribute("attribute", "New Value")); + Object info = mbsc.getAttribute(name, "attribute"); + + Assert.assertEquals("New Value", info); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } + +} diff --git a/impl/extension/jmx/src/test/resources/META-INF/beans.xml b/impl/extension/jmx/src/test/resources/META-INF/beans.xml new file mode 100644 index 0000000..bb028b1 --- /dev/null +++ b/impl/extension/jmx/src/test/resources/META-INF/beans.xml @@ -0,0 +1,7 @@ + + + + br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor + + diff --git a/impl/extension/jmx/src/test/resources/META-INF/persistence.xml b/impl/extension/jmx/src/test/resources/META-INF/persistence.xml new file mode 100644 index 0000000..0486d41 --- /dev/null +++ b/impl/extension/jmx/src/test/resources/META-INF/persistence.xml @@ -0,0 +1,22 @@ + + + + + + br.gov.frameworkdemoiselle.jmx.domain.PersistedTestClass + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/impl/extension/jmx/src/test/resources/arquillian.xml b/impl/extension/jmx/src/test/resources/arquillian.xml new file mode 100644 index 0000000..f0dc6fb --- /dev/null +++ b/impl/extension/jmx/src/test/resources/arquillian.xml @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/impl/extension/jmx/src/test/resources/configuration/demoiselle.properties b/impl/extension/jmx/src/test/resources/configuration/demoiselle.properties new file mode 100644 index 0000000..08a2880 --- /dev/null +++ b/impl/extension/jmx/src/test/resources/configuration/demoiselle.properties @@ -0,0 +1 @@ +frameworkdemoiselle.management.jmx.mbean.domain=br.gov.frameworkdemoiselle.jmx.domain \ No newline at end of file diff --git a/impl/extension/jmx/src/test/resources/log4j.properties b/impl/extension/jmx/src/test/resources/log4j.properties new file mode 100755 index 0000000..48a89ba --- /dev/null +++ b/impl/extension/jmx/src/test/resources/log4j.properties @@ -0,0 +1,42 @@ +# 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. + +log4j.rootCategory=INFO, stdout + +log4j.logger.br.gov.frameworkdemoiselle=TRACE + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%-5p [%c{1}] %m%n diff --git a/impl/extension/jmx/src/test/resources/test/beans.xml b/impl/extension/jmx/src/test/resources/test/beans.xml new file mode 100644 index 0000000..d85497f --- /dev/null +++ b/impl/extension/jmx/src/test/resources/test/beans.xml @@ -0,0 +1,11 @@ + + + + br.gov.frameworkdemoiselle.transaction.TransactionalInterceptor + br.gov.frameworkdemoiselle.security.RequiredPermissionInterceptor + br.gov.frameworkdemoiselle.security.RequiredRoleInterceptor + br.gov.frameworkdemoiselle.exception.ExceptionHandlerInterceptor + + + -- libgit2 0.21.2