Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   *        JacORB - a free Java ORB
   *
   *   Copyright (C) 1999-2012 Gerald Brose / The JacORB Team.
   *
   *   This library is free software; you can redistribute it and/or
   *   modify it under the terms of the GNU Library General Public
   *   License as published by the Free Software Foundation; either
   *   version 2 of the License, or (at your option) any later version.
  *
  *   This library 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
  *   Library General Public License for more details.
  *
  *   You should have received a copy of the GNU Library General Public
  *   License along with this library; if not, write to the Free
  *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
 
 package org.jacorb.notification.jmx;
 
 
 
 {
 
     private final DynamicMBean delegate_;
 
     private final String[] types_;
 
     private int notificationSequence_ = 0;
 
     public BroadcastSupportMBeanDecorator(JMXManageable manageable)
             throws NotCompliantMBeanExceptionClassNotFoundException
     {
         super();
         
          = manageable.getJMXNotificationTypes();
 
          = new StandardMBean(manageablegetManagementInterface(manageable.getClass()));
 
         manageable.setJMXCallback(new JMXManageable.JMXCallback()
         {
             public void sendJMXNotification(String typeString message)
             {
                 sendNotification(typemessage);
             }
 
             public void sendJMXAttributeChanged(String nameObject oldValueObject newValue)
             {
                 sendAttributeChanged(nameoldValuenewValue);
             }
 
             public void sendJMXNotification(String typeString messageObject payload)
             {
                 sendNotification(typemessagepayload);
             }
         });
     }
 
     private Class getManagementInterface(Class clazzthrows IllegalArgumentException,
             ClassNotFoundException
     {
         final String managementInterfaceName = clazz.getName() + "MBean";
 
         if (clazz.getClassLoader() != null)
         {
             return clazz.getClassLoader().loadClass(managementInterfaceName);
         }
         
         return ObjectUtil.classForName(managementInterfaceName);
     }
 
     public Object getAttribute(String attributethrows AttributeNotFoundExceptionMBeanException,
             ReflectionException
     {
        return .getAttribute(attribute);
    }
    public AttributeList getAttributes(String[] attributes)
    {
        return .getAttributes(attributes);
    }
    public MBeanInfo getMBeanInfo()
    {
        MBeanInfo _info = .getMBeanInfo();
        if ( != null && . > 0)
        {
            return new MBeanInfo(_info.getClassName(), _info.getDescription(), _info
                    .getAttributes(), _info.getConstructors(), _info.getOperations(),
                    getNotificationInfo());
        }
        return _info;
    }
    public Object invoke(String methodObject[] argumentsString[] paramsthrows MBeanException,
            ReflectionException
    {
        return .invoke(methodargumentsparams);
    }
    public void setAttribute(Attribute attributethrows AttributeNotFoundException,
    {
        .setAttribute(attribute);
    }
    public AttributeList setAttributes(AttributeList attributes)
    {
        return .setAttributes(attributes);
    }
    public void addNotificationListener(NotificationListener listenerNotificationFilter filter,
            Object handbackthrows IllegalArgumentException
    {
        .addNotificationListener(listenerfilterhandback);
    }
    public void removeNotificationListener(NotificationListener listener)
            throws ListenerNotFoundException
    {
        .removeNotificationListener(listener);
    }
    {
        return new MBeanNotificationInfo[] {
                new MBeanNotificationInfo(
                        Notification.class.getName(),
                        "User Notifications"),
                new MBeanNotificationInfo(new String[] { . },
                        AttributeChangeNotification.class.getName(),
                        "User attribute change notification") };
    }
    public void sendNotification(String typeString messageObject payload)
    {
        final Notification _jmxNotification = new Notification(type,// type
                this// source
                ++// seq. number
                message // message
                );
        if (payload != null)
        {
            _jmxNotification.setUserData(payload);
        }
        .sendNotification(_jmxNotification);
    }
    
    public void sendNotification(String typeString message)
    {
        final Notification _jmxNotification = new Notification(type,// type
                this// source
                ++// seq. number
                message // message
                );
        .sendNotification(_jmxNotification);
    }
    public void removeNotificationListener(NotificationListener listener,
            NotificationFilter filterObject handbackthrows ListenerNotFoundException
    {
        .removeNotificationListener(listenerfilterhandback);
    }
    public void sendAttributeChanged(String nameObject oldValueObject newValue)
    {
                ++
                System.currentTimeMillis(), 
                "Attribute value changed",
                name
                oldValue == null ? null : oldValue.getClass().getName(), 
                oldValue
                newValue));
    }
New to GrepCode? Check out our FAQ X