Пример #1
0
 public PropertyDescriptor[] getPropertyDescriptors() {
   PropertyDescriptor[] pds = super.properties;
   PropertyDescriptor[] ps = new PropertyDescriptor[pds.length + properties.length];
   System.arraycopy(pds, 0, ps, 0, pds.length);
   System.arraycopy(properties, 0, ps, pds.length, properties.length);
   return ps;
 }
 /** publishes only requested sensor data */
 public void publishdata() {
   RootFactory theRF = getFactory();
   if (!currentlypublishing.isEmpty()) {
     Task sensortask = null;
     SensorDataObj sensordata = null;
     for (int i = 0; i < currentlypublishing.size(); i++) {
       String type = (String) currentlypublishing.elementAt(i);
       System.out.println("In Sensor Plugin publishdata Type is :::::::::::::" + type);
       if (type.equalsIgnoreCase("SecurityException")) {
         if (fi.length > 0) {
           for (int z = 0; z < fi.length; z++) {
             Vector data = getsecurityevent(fi[z]);
             if (!data.isEmpty()) {
               for (int j = 0; j < data.size(); j++) {
                 sensordata =
                     new SensorDataObj(
                         (String) currentlypublishing.elementAt(i),
                         new Date(System.currentTimeMillis()),
                         (String) data.elementAt(j),
                         nodename[z]);
                 sensortask =
                     MonitoringUtils.createTask(
                         theRF,
                         sensordata,
                         MonitoringUtils.Send_SensorData_Preposition,
                         MonitoringUtils.Send_Sensor_Data);
                 publishAdd(sensortask);
                 if (MonitoringUtils.debug > 0)
                   System.out.println(
                       "*****In sensor Plugin  publishing security excep::****************************");
               }
             } else {
               if (MonitoringUtils.debug > 0)
                 System.out.println(
                     "In Sensor Plugin  got data vector for publishing security empty ********************************");
             }
           }
         }
       } else {
         if (MonitoringUtils.debug > 0)
           System.out.println(
               "Currently publishing::::" + (String) currentlypublishing.elementAt(i));
         sensordata =
             new SensorDataObj(
                 (String) currentlypublishing.elementAt(i),
                 new Date(System.currentTimeMillis()),
                 (String) currentlypublishing.elementAt(i));
         sensortask =
             MonitoringUtils.createTask(
                 theRF,
                 sensordata,
                 MonitoringUtils.Send_SensorData_Preposition,
                 MonitoringUtils.Send_Sensor_Data);
         publishAdd(sensortask);
       }
     }
   }
 }