Advertisement
Guest User

Untitled

a guest
Dec 6th, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.32 KB | None | 0 0
  1. /*
  2.  * ApplicationMBeanImpl.java
  3.  *
  4.  * Created on 6 grudzień 2012, 11:59
  5.  */
  6. package lab7;
  7.  
  8. import javax.management.*;
  9.  
  10. /**
  11.  * Class ApplicationMBeanImpl
  12.  *
  13.  * @author buharin
  14.  */
  15. public class ApplicationMBeanImpl implements ApplicationMBeanImplMBean, NotificationEmitter {
  16.     private NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport();
  17.     private long seqNumber;
  18.     /**
  19.      * Attribute : Name
  20.      */
  21.     private String name = "Daniel";
  22.     /**
  23.      * Attribute : Kraj
  24.      */
  25.     private String kraj = "EN";
  26.     /**
  27.      * Attribute : Sex
  28.      */
  29.     private String sex = "M";
  30.    
  31.     public ApplicationMBeanImpl() {
  32.     }
  33.  
  34.    
  35.  
  36.     /**
  37.      * Get Atrytub opisuje plec
  38.      */
  39.     public String getSex() {
  40.         return sex;
  41.     }
  42.  
  43.     /**
  44.      * Set Atrytub opisuje plec
  45.      */
  46.     public void setSex(String value) {
  47.         sex = value;
  48.     }
  49.  
  50.     /**
  51.      * Get Atrybut opisuje imie
  52.      */
  53.     public String getName() {
  54.         return name;
  55.     }
  56.  
  57.     /**
  58.      * Set Atrybut opisuje imie
  59.      */
  60.     public void setName(String value) {
  61.         name = value;
  62.     }
  63.  
  64.     /**
  65.      * Get Opisuje kraj
  66.      */
  67.     public String getKraj() {
  68.         return kraj;
  69.     }
  70.  
  71.     /**
  72.      * Set Opisuje kraj
  73.      */
  74.     public void setKraj(String value) {
  75.         kraj = value;
  76.     }
  77.  
  78.     public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException {
  79.         broadcaster.addNotificationListener(listener, filter, handback);
  80.     }
  81.  
  82.     public MBeanNotificationInfo[] getNotificationInfo() {
  83.         return new MBeanNotificationInfo[]{new MBeanNotificationInfo(new String[]{}, javax.management.Notification.class.getName(), "NewNotification Description")};
  84.     }
  85.  
  86.     public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException {
  87.         broadcaster.removeNotificationListener(listener);
  88.     }
  89.  
  90.     public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException {
  91.         broadcaster.removeNotificationListener(listener, filter, handback);
  92.     }
  93.  
  94.     public synchronized long getNextSeqNumber() {
  95.         return seqNumber++;
  96.     }
  97.  
  98.    
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement