Package org.jboss.jmx.adaptor.snmp.config.notification

Examples of org.jboss.jmx.adaptor.snmp.config.notification.Mapping


      this.notificationWrapperCache =
         new ArrayList(notificationMapList.size());
       
      for (Iterator i = notificationMapList.iterator(); i.hasNext(); )
      {
         Mapping mapping = (Mapping)i.next();
        
         // Compile and add the regular expression
         String notificationType = mapping.getNotificationType();
        
         try
         {
            Pattern re = Pattern.compile(notificationType);
            this.mappingRegExpCache.add(re);
         }
         catch (PatternSyntaxException e)
         {
            // Fill the slot to keep index count correct
            this.mappingRegExpCache.add(null);
               
            log.warn("Error compiling notification mapping for type: " + notificationType, e);
         }
           
         // Instantiate and add the wrapper
         // Read wrapper class name
         String wrapperClassName = mapping.getVarBindList().getWrapperClass();
               
         log.debug("notification wrapper class: " + wrapperClassName);
        
         try
         {
View Full Code Here


      {
         throw new MappingFailedException("No mapping found for notification type: '" +
                    n.getType() + "'");
      }
       
      Mapping m = (Mapping)this.notificationMapList.get(index);
       
      // Create trap
      SnmpPduTrap trapPdu = new SnmpPduTrap();
       
      trapPdu.setTimeStamp(this.clock.uptime());
       
      // Organise the 'variable' payload
      trapPdu.setGeneric(m.getGeneric());
      trapPdu.setSpecific(m.getSpecific());
      trapPdu.setEnterprise(m.getEnterprise());
       
      // Append the specified varbinds. Get varbinds from mapping and for
      // each one of the former use the wrapper to get the corresponding
      // values

      // Get the coresponding wrapper to get access to notification payload
      NotificationWrapper wrapper =
         (NotificationWrapper)this.notificationWrapperCache.get(index);
       
      if(wrapper != null)
      {
         // Prime the wrapper with the notification contents
         wrapper.prime(n);
           
         // Iterate through mapping specified varbinds and organise values
         // for each
         List vbList = m.getVarBindList().getVarBindList();
        
         for (int i = 0; i < vbList.size(); i++)
         {
            VarBind vb = (VarBind)vbList.get(i);
               
            // Append the var bind. Interrogate read vb for OID and
            // variable tag. The later is used as the key passed to the
            // wrapper in order for it to locate the required value. That
            // value and the aforementioned OID are used to generate the
            // variable binding
            trapPdu.addVarBind(
               this.snmpVBFactory.make(vb.getOid(), wrapper.get(vb.getTag())));
         }
      }
      else
      {
         throw new MappingFailedException(
            "Varbind mapping failure: null wrapper defined for " +
            " notification type '" + m.getNotificationType() + "'" );
      }
      return trapPdu;       
   }
View Full Code Here

      {
         throw new MappingFailedException(
            "No mapping found for notification type: '" + n.getType() + "'");
      }
       
      Mapping m = (Mapping)this.notificationMapList.get(index);
     
      // Create trap
      SnmpPduRequest trapPdu = new SnmpPduRequest(SnmpPduPacket.V2TRAP);
       
      // Append the specified varbinds. Get varbinds from mapping and for
      // each one of the former use the wrapper to get data from the
      // notification

      // Get the coresponding wrapper
      NotificationWrapper wrapper =
         (NotificationWrapper)this.notificationWrapperCache.get(index);
       
      if (wrapper != null)
      {
         // Prime the wrapper with the notification contents
         wrapper.prime(n);
           
         List vbList = m.getVarBindList().getVarBindList();
        
         for (int i = 0; i < vbList.size(); i++)
         {
            VarBind vb = (VarBind)vbList.get(i);
               
            // Append the var bind. Interrogate read vb for OID and
            // variable tag. The later is used as the key passed to the
            // wrapper in order for it to locate the required value. That
            // value and the aforementioned OID are used to generate the
            // variable binding
            trapPdu.addVarBind(
               this.snmpVBFactory.make(vb.getOid(), wrapper.get(vb.getTag())));
         }
      }
      else
      {
         log.warn("Varbind mapping failure: null wrapper defined for " +
                  " notification type '" + m.getNotificationType() + "'" );
      }
      return trapPdu;
   }
View Full Code Here

      {
         Object child = null;

         if ("mapping".equals(localName))
         {
            Mapping m = new Mapping();
            child = m;
         }
         else if ("var-bind-list".equals(localName))
         {
            VarBindList vblist = new VarBindList();
View Full Code Here

               notifList.add(child);
            }
         }
         else if (parent instanceof Mapping)
         {
            Mapping m = (Mapping)parent;
           
            if (child instanceof VarBindList)
            {
               m.setVarBindList((VarBindList)child);
            }
         }
         else if (parent instanceof VarBindList)
         {
            VarBindList vblist = (VarBindList)parent;
View Full Code Here

      public void setValue(Object o, UnmarshallingContext navigator, String namespaceURI,
                           String localName, String value)
      {
         if (o instanceof Mapping)
         {
            Mapping m = (Mapping)o;
           
            if ("notification-type".equals(localName))
            {
               m.setNotificationType(value);
            }
            else if ("generic".equals(localName))
            {
               m.setGeneric(Integer.parseInt(value));
            }
            else if ("specific".equals(localName))
            {
               m.setSpecific(Integer.parseInt(value));
            }
            else if ("enterprise".equals(localName))
            {
               m.setEnterprise(value);
            }
         }
         else if (o instanceof VarBind)
         {
            VarBind vb = (VarBind)o;
View Full Code Here

      this.notificationWrapperCache =
         new ArrayList(notificationMapList.size());
       
      for (Iterator i = notificationMapList.iterator(); i.hasNext(); )
      {
         Mapping mapping = (Mapping)i.next();
        
         // Compile and add the regular expression
         String notificationType = mapping.getNotificationType();
        
         try
         {
            Pattern re = Pattern.compile(notificationType);
            this.mappingRegExpCache.add(re);
         }
         catch (PatternSyntaxException e)
         {
            // Fill the slot to keep index count correct
            this.mappingRegExpCache.add(null);
               
            log.warn("Error compiling notification mapping for type: " + notificationType, e);
         }
           
         // Instantiate and add the wrapper
         // Read wrapper class name
         String wrapperClassName = mapping.getVarBindList().getWrapperClass();
               
         log.debug("notification wrapper class: " + wrapperClassName);
        
         try
         {
View Full Code Here

      {
         throw new MappingFailedException("No mapping found for notification type: '" +
                    n.getType() + "'");
      }
       
      Mapping m = (Mapping)this.notificationMapList.get(index);
       
      // Create trap
      SnmpPduTrap trapPdu = new SnmpPduTrap();
       
      trapPdu.setTimeStamp(this.clock.uptime());
       
      // Organise the 'variable' payload
      trapPdu.setGeneric(m.getGeneric());
      trapPdu.setSpecific(m.getSpecific());
      trapPdu.setEnterprise(m.getEnterprise());
       
      // Append the specified varbinds. Get varbinds from mapping and for
      // each one of the former use the wrapper to get the corresponding
      // values

      // Get the coresponding wrapper to get access to notification payload
      NotificationWrapper wrapper =
         (NotificationWrapper)this.notificationWrapperCache.get(index);
       
      if(wrapper != null)
      {
         // Prime the wrapper with the notification contents
         wrapper.prime(n);
           
         // Iterate through mapping specified varbinds and organise values
         // for each
         List vbList = m.getVarBindList().getVarBindList();
        
         for (int i = 0; i < vbList.size(); i++)
         {
            VarBind vb = (VarBind)vbList.get(i);
               
            // Append the var bind. Interrogate read vb for OID and
            // variable tag. The later is used as the key passed to the
            // wrapper in order for it to locate the required value. That
            // value and the aforementioned OID are used to generate the
            // variable binding
            trapPdu.addVarBind(
               this.snmpVBFactory.make(vb.getOid(), wrapper.get(vb.getTag())));
         }
      }
      else
      {
         throw new MappingFailedException(
            "Varbind mapping failure: null wrapper defined for " +
            " notification type '" + m.getNotificationType() + "'" );
      }
      return trapPdu;       
   }
View Full Code Here

      {
         throw new MappingFailedException(
            "No mapping found for notification type: '" + n.getType() + "'");
      }
       
      Mapping m = (Mapping)this.notificationMapList.get(index);
     
      // Create trap
      SnmpPduRequest trapPdu = new SnmpPduRequest(SnmpPduPacket.V2TRAP);
       
      // Append the specified varbinds. Get varbinds from mapping and for
      // each one of the former use the wrapper to get data from the
      // notification

      // Get the coresponding wrapper
      NotificationWrapper wrapper =
         (NotificationWrapper)this.notificationWrapperCache.get(index);
       
      if (wrapper != null)
      {
         // Prime the wrapper with the notification contents
         wrapper.prime(n);
           
         List vbList = m.getVarBindList().getVarBindList();
        
         for (int i = 0; i < vbList.size(); i++)
         {
            VarBind vb = (VarBind)vbList.get(i);
               
            // Append the var bind. Interrogate read vb for OID and
            // variable tag. The later is used as the key passed to the
            // wrapper in order for it to locate the required value. That
            // value and the aforementioned OID are used to generate the
            // variable binding
            trapPdu.addVarBind(
               this.snmpVBFactory.make(vb.getOid(), wrapper.get(vb.getTag())));
         }
      }
      else
      {
         log.warn("Varbind mapping failure: null wrapper defined for " +
                  " notification type '" + m.getNotificationType() + "'" );
      }
      return trapPdu;
   }
View Full Code Here

      {
         Object child = null;

         if ("mapping".equals(localName))
         {
            Mapping m = new Mapping();
            child = m;
         }
         else if ("var-bind-list".equals(localName))
         {
            VarBindList vblist = new VarBindList();
View Full Code Here

TOP

Related Classes of org.jboss.jmx.adaptor.snmp.config.notification.Mapping

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.