Package br.gov.frameworkdemoiselle.internal.configuration

Examples of br.gov.frameworkdemoiselle.internal.configuration.JMXConfig


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());
View Full Code Here


  }
 
  @Override
  public void initialize(List<ManagedType> 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){
View Full Code Here

  /**
   * Testa o envio de uma mensagem para clientes conectados
   */
  @Test
  public void sendMessage() {
    JMXConfig config = Beans.getReference(JMXConfig.class);

    // Este será o lado cliente. Este manager é usado para enviar notificações a partir do código da aplicação
    NotificationManager notificationManager = Beans.getReference(NotificationManager.class);

    // Obtém o servidor MBean onde anexaremos um listener para a notificação
    MBeanServer server = ManagementFactory.getPlatformMBeanServer();

    // 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) {
View Full Code Here

   * Testa o envio de uma mensagem de mudança de atributo para clientes conectados
   */
  @Test
  public void sendAttributeChangedMessage() {
   
    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();

View Full Code Here

TOP

Related Classes of br.gov.frameworkdemoiselle.internal.configuration.JMXConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.