radio interfaces view; strlwr function removed; header files made compatible with...
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 25 Apr 2013 14:14:05 +0000 (14:14 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 25 Apr 2013 14:14:05 +0000 (14:14 +0000)
30 files changed:
.gitattributes
ChangeLog
include/nms_common.h
include/nms_cscp.h
include/nms_util.h
include/unicode.h
src/java/netxms-base/src/main/java/org/netxms/base/NXCPCodes.java
src/java/netxms-client/src/main/java/org/netxms/client/objects/AccessPoint.java
src/java/netxms-client/src/main/java/org/netxms/client/topology/RadioInterface.java [new file with mode: 0644]
src/java/netxms-eclipse/NetworkMaps/src/org/netxms/ui/eclipse/networkmaps/views/helpers/ObjectTooltip.java
src/java/netxms-eclipse/ObjectBrowser/plugin.xml
src/java/netxms-eclipse/ObjectBrowser/schema/org.netxms.ui.eclipse.objectbrowser.objectActionValidators.exsd [new file with mode: 0644]
src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/ObjectActionValidator.java [new file with mode: 0644]
src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/SubtreeType.java [new file with mode: 0644]
src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/views/ObjectBrowser.java
src/java/netxms-eclipse/Topology/icons/radio_interfaces.png [new file with mode: 0644]
src/java/netxms-eclipse/Topology/plugin.xml
src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/actions/FindConnectionPoint.java
src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/actions/ShowRadioInterfaces.java [copied from src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/actions/FindConnectionPoint.java with 60% similarity]
src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/RadioInterfaces.java [new file with mode: 0644]
src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/RadioInterfaceComparator.java [new file with mode: 0644]
src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/RadioInterfaceLabelProvider.java [new file with mode: 0644]
src/libnetxms/dir.c
src/libnetxms/dirw.c
src/libnetxms/tools.cpp
src/server/core/accesspoint.cpp
src/server/core/id.cpp
src/server/core/session.cpp
src/server/drivers/symbol-ws/symbol-ws.cpp
src/server/tools/nxdbmgr/check.cpp

index 5b9aa7e..147e00d 100644 (file)
@@ -962,6 +962,7 @@ src/java/netxms-client/src/main/java/org/netxms/client/snmp/SnmpValue.java -text
 src/java/netxms-client/src/main/java/org/netxms/client/snmp/SnmpWalkListener.java -text
 src/java/netxms-client/src/main/java/org/netxms/client/topology/ConnectionPoint.java -text
 src/java/netxms-client/src/main/java/org/netxms/client/topology/Port.java -text
+src/java/netxms-client/src/main/java/org/netxms/client/topology/RadioInterface.java -text
 src/java/netxms-client/src/main/java/org/netxms/client/topology/VlanInfo.java -text
 src/java/netxms-client/src/test/java/org/netxms/client/AlarmTest.java -text
 src/java/netxms-client/src/test/java/org/netxms/client/ConnectionTest.java -text
@@ -1631,14 +1632,17 @@ src/java/netxms-eclipse/ObjectBrowser/icons/template_group.png -text
 src/java/netxms-eclipse/ObjectBrowser/icons/template_root.png -text
 src/java/netxms-eclipse/ObjectBrowser/icons/zone.gif -text
 src/java/netxms-eclipse/ObjectBrowser/plugin.xml -text
+src/java/netxms-eclipse/ObjectBrowser/schema/org.netxms.ui.eclipse.objectbrowser.objectActionValidators.exsd -text
 src/java/netxms-eclipse/ObjectBrowser/schema/org.netxms.ui.eclipse.objectbrowser.objectOpenHandlers.exsd -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/Activator.java -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/Messages.java -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/ObjectDecorator.java -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/PreferenceInitializer.java -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/actions/OpenObjectBrowser.java -text
+src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/ObjectActionValidator.java -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/ObjectOpenHandler.java -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/ObjectOpenListener.java -text
+src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/SubtreeType.java -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/dialogs/ChildObjectListDialog.java -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/dialogs/CreateObjectDialog.java -text
 src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/dialogs/IPAddressSelectionDialog.java -text
@@ -2019,6 +2023,7 @@ src/java/netxms-eclipse/Topology/.settings/org.eclipse.jdt.core.prefs -text
 src/java/netxms-eclipse/Topology/META-INF/MANIFEST.MF -text
 src/java/netxms-eclipse/Topology/build.properties -text
 src/java/netxms-eclipse/Topology/icons/ports.gif -text
+src/java/netxms-eclipse/Topology/icons/radio_interfaces.png -text
 src/java/netxms-eclipse/Topology/icons/search_history.png -text
 src/java/netxms-eclipse/Topology/icons/vlanview.gif -text
 src/java/netxms-eclipse/Topology/icons/wireless_stations.png -text
@@ -2027,14 +2032,18 @@ src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/Activator.ja
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/actions/FindConnectionPoint.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/actions/FindIpAddress.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/actions/FindMacAddress.java -text
+src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/actions/ShowRadioInterfaces.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/actions/ShowVlans.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/dialogs/EnterIpAddressDlg.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/dialogs/EnterMacAddressDlg.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/objecttabs/Ports.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/HostSearchResults.java -text
+src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/RadioInterfaces.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/VlanView.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/ConnectionPointComparator.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/ConnectionPointLabelProvider.java -text
+src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/RadioInterfaceComparator.java -text
+src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/RadioInterfaceLabelProvider.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/VlanLabelProvider.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/widgets/DeviceView.java -text
 src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/widgets/SlotView.java -text
index 84479a5..defad9f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,8 @@
 - New NXSL functions: CreateNode, GetSumDCIValue
 - New NXSL operator @ - safe get object's attribute
 - New MIBs added: ASTARO-MIB, CPQHOST-MIB, CPQPOWER-MIB
+- Special support for wireless switches
+- Driver for Motorola/Symbol wireless switches
 - Management console:
        - "Export to CSV" option added to most tabular data views
 - Fixed issues: #86, #199, #242, #249, #250, #251
index 6679cc9..d37e820 100644 (file)
 
 #include <netxms-version.h>
 
-
-//
-// Define __64BIT__ if compiling for 64bit platform with Visual C++
-//
-
+/**
+ * Define __64BIT__ if compiling for 64bit platform with Visual C++
+ */
 #if defined(_M_X64) || defined(_M_IA64)
 #ifndef __64BIT__
 #define __64BIT__
 typedef int bool;
 #endif
 
+/**
+ * Oracle Pro*C compatibility
+ */
+#ifdef ORACLE_PROC
+#undef BYTE
+#undef DWORD
+#endif
+
 
-//
-// Platform dependent includes and defines
-//
+/***** Platform dependent includes and defines *****/
 
 #if defined(_WIN32) || defined(UNDER_CE)
 
@@ -651,12 +655,10 @@ typedef struct hostent HOSTENT;
 #define CAST_TO_POINTER(v, t) ((t)(v))
 #endif
 
-
-//
-// OpenSSL
-//
-
-#ifdef _WITH_ENCRYPTION
+/**
+ * OpenSSL
+ */
+#if defined(_WITH_ENCRYPTION) && !defined(ORACLE_PROC)
 
 #include <openssl/crypto.h>
 #include <openssl/rsa.h>
@@ -703,20 +705,16 @@ typedef struct hostent HOSTENT;
 
 #endif
 
-
-//
-// open() flags compatibility
-//
-
+/**
+ * open() flags compatibility
+ */
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
 
-
-//
-// Windows-specific structures for non-Windows platforms
-// 
-
+/**
+ * Windows-specific structures for non-Windows platforms
+ */ 
 #ifndef _WIN32
 
 typedef struct tagPOINT
@@ -727,11 +725,9 @@ typedef struct tagPOINT
 
 #endif
 
-
-//
-// Event log severity codes
-//
-
+/**
+ * Event log severity codes
+ */
 #ifndef _WIN32
 #define EVENTLOG_SUCCESS                0x0000
 #define EVENTLOG_ERROR_TYPE             0x0001
@@ -746,11 +742,9 @@ typedef struct tagPOINT
 #define NXLOG_WARNING   EVENTLOG_WARNING_TYPE
 #define NXLOG_ERROR     EVENTLOG_ERROR_TYPE
 
-
-//
-// Interface types
-//
-
+/**
+ * Interface types
+ */
 #define IFTYPE_OTHER                1
 #define IFTYPE_REGULAR1822          2
 #define IFTYPE_HDH1822              3
index 0e22175..3ce6775 100644 (file)
@@ -909,6 +909,7 @@ typedef struct
 #define VID_GEOLOCATION_TIMESTAMP   ((DWORD)439)
 #define VID_SAMPLE_COUNT            ((DWORD)440)
 #define VID_HEIGHT                  ((DWORD)441)
+#define VID_RADIO_COUNT             ((DWORD)442)
 
 // Base variabe for single threshold in message
 #define VID_THRESHOLD_BASE          ((DWORD)0x00800000)
@@ -1071,6 +1072,8 @@ typedef struct
 
 #define VID_COMPONENT_LIST_BASE     ((DWORD)0x20000000)
 
+#define VID_RADIO_LIST_BASE         ((DWORD)0x30000000)
+
 
 //
 // Inline functions
index ff1de4e..736a615 100644 (file)
@@ -1044,11 +1044,6 @@ extern "C"
        WCHAR LIBNETXMS_EXPORTABLE *wcsdup(const WCHAR *src);
 #endif
 
-#if !HAVE_STRLWR && !defined(_WIN32)
-       char LIBNETXMS_EXPORTABLE *strlwr(char *str);
-       WCHAR LIBNETXMS_EXPORTABLE *wcslwr(WCHAR *str);
-#endif
-
 #ifdef _WIN32
 #ifdef UNICODE
     DIRW LIBNETXMS_EXPORTABLE *wopendir(const WCHAR *filename);
index 42c52c4..698ef58 100644 (file)
 #define _tcstod   wcstod
 #define _tcsdup   wcsdup
 #define _tcsupr   wcsupr
-#define _tcslwr   wcslwr
 #define _tcsspn   wcsspn
 #define _tcscspn  wcscspn
 #define _tcsstr   wcsstr
 #define _tcstod   strtod
 #define _tcsdup   strdup
 #define _tcsupr   strupr
-#define _tcslwr   strlwr
 #define _tcsspn   strspn
 #define _tcscspn  strcspn
 #define _tcsstr   strstr
index 3209c9e..c9af5c8 100644 (file)
@@ -743,6 +743,7 @@ public class NXCPCodes
        public static final long VID_GEOLOCATION_TIMESTAMP   = 439;\r
        public static final long VID_SAMPLE_COUNT            = 440;\r
        public static final long VID_HEIGHT                  = 441;\r
+       public static final long VID_RADIO_COUNT             = 442;\r
 \r
        public static final long VID_ACL_USER_BASE            = 0x00001000L;\r
        public static final long VID_ACL_USER_LAST            = 0x00001FFFL;\r
@@ -823,4 +824,5 @@ public class NXCPCodes
        public static final long VID_VLAN_LIST_BASE           = 0x10000000L;\r
        public static final long VID_NETWORK_PATH_BASE        = 0x40000000L;\r
        public static final long VID_COMPONENT_LIST_BASE      = 0x20000000L;\r
+       public static final long VID_RADIO_LIST_BASE          = 0x30000000L;\r
 }\r
index 0a12a09..d70c14b 100644 (file)
@@ -7,6 +7,7 @@ import org.netxms.base.NXCPCodes;
 import org.netxms.base.NXCPMessage;
 import org.netxms.client.MacAddress;
 import org.netxms.client.NXCSession;
+import org.netxms.client.topology.RadioInterface;
 
 /**
  * Access point class
@@ -18,6 +19,7 @@ public class AccessPoint extends GenericObject
        private String vendor;
        private String model;
        private String serialNumber;
+       private RadioInterface[] radios;
        
        /**
         * @param msg
@@ -31,6 +33,15 @@ public class AccessPoint extends GenericObject
                vendor = msg.getVariableAsString(NXCPCodes.VID_VENDOR);
                model = msg.getVariableAsString(NXCPCodes.VID_MODEL);
                serialNumber = msg.getVariableAsString(NXCPCodes.VID_SERIAL_NUMBER);
+               
+               int count = msg.getVariableAsInteger(NXCPCodes.VID_RADIO_COUNT);
+               radios = new RadioInterface[count];
+               long varId = NXCPCodes.VID_RADIO_LIST_BASE;
+               for(int i = 0; i < count; i++)
+               {
+                       radios[i] = new RadioInterface(this, msg, varId);
+                       varId += 10;
+               }
        }
 
        /* (non-Javadoc)
@@ -90,4 +101,12 @@ public class AccessPoint extends GenericObject
        {
                return model;
        }
+
+       /**
+        * @return the radios
+        */
+       public RadioInterface[] getRadios()
+       {
+               return radios;
+       }
 }
diff --git a/src/java/netxms-client/src/main/java/org/netxms/client/topology/RadioInterface.java b/src/java/netxms-client/src/main/java/org/netxms/client/topology/RadioInterface.java
new file mode 100644 (file)
index 0000000..9755bca
--- /dev/null
@@ -0,0 +1,99 @@
+/**\r
+ * \r
+ */\r
+package org.netxms.client.topology;\r
+\r
+import org.netxms.base.NXCPMessage;\r
+import org.netxms.client.MacAddress;\r
+import org.netxms.client.objects.AccessPoint;\r
+\r
+/**\r
+ * Radio interface information\r
+ */\r
+public class RadioInterface\r
+{\r
+       private AccessPoint accessPoint;\r
+       private int index;\r
+       private String name;\r
+       private MacAddress macAddress;\r
+       private int channel;\r
+       private int powerDBm;\r
+       private int powerMW;\r
+       \r
+       /**\r
+        * Create radio interface object from NXCP message\r
+        * \r
+        * @param msg\r
+        * @param baseId\r
+        */\r
+       public RadioInterface(AccessPoint ap, NXCPMessage msg, long baseId)\r
+       {\r
+               accessPoint = ap;\r
+               index = msg.getVariableAsInteger(baseId);\r
+               name = msg.getVariableAsString(baseId + 1);\r
+               macAddress = new MacAddress(msg.getVariableAsBinary(baseId + 2));\r
+               channel = msg.getVariableAsInteger(baseId + 3);\r
+               powerDBm = msg.getVariableAsInteger(baseId + 4);\r
+               powerMW = msg.getVariableAsInteger(baseId + 5);\r
+       }\r
+\r
+       /**\r
+        * @return the index\r
+        */\r
+       public int getIndex()\r
+       {\r
+               return index;\r
+       }\r
+\r
+       /**\r
+        * @return the name\r
+        */\r
+       public String getName()\r
+       {\r
+               return name;\r
+       }\r
+\r
+       /**\r
+        * @return the macAddress\r
+        */\r
+       public MacAddress getMacAddress()\r
+       {\r
+               return macAddress;\r
+       }\r
+\r
+       /**\r
+        * @return the channel\r
+        */\r
+       public int getChannel()\r
+       {\r
+               return channel;\r
+       }\r
+\r
+       /**\r
+        * Get transmitting power in dBm\r
+        * \r
+        * @return the powerDBm\r
+        */\r
+       public int getPowerDBm()\r
+       {\r
+               return powerDBm;\r
+       }\r
+\r
+       /**\r
+        * Get transmitting power in milliwatts\r
+        * \r
+        * @return the powerMW\r
+        */\r
+       public int getPowerMW()\r
+       {\r
+               return powerMW;\r
+       }\r
+\r
+       /**\r
+        * @return the accessPoint\r
+        */\r
+       public AccessPoint getAccessPoint()\r
+       {\r
+               return accessPoint;\r
+       }\r
+}\r
index 7dd4ab2..d761d4f 100644 (file)
@@ -36,6 +36,7 @@ import org.netxms.client.objects.AccessPoint;
 import org.netxms.client.objects.Container;\r
 import org.netxms.client.objects.AbstractObject;\r
 import org.netxms.client.objects.Node;\r
+import org.netxms.client.topology.RadioInterface;\r
 import org.netxms.ui.eclipse.charts.api.ChartColor;\r
 import org.netxms.ui.eclipse.charts.figures.BirtChartFigure;\r
 import org.netxms.ui.eclipse.console.resources.StatusDisplayInfo;\r
@@ -104,6 +105,17 @@ public class ObjectTooltip extends Figure
                                sb.append(mac.toString());\r
                        }\r
                        \r
+                       for(RadioInterface rif : ((AccessPoint)object).getRadios())\r
+                       {\r
+                               sb.append("\nRadio ");\r
+                               sb.append(rif.getIndex());\r
+                               sb.append(" (");\r
+                               sb.append(rif.getMacAddress().toString());\r
+                               sb.append(") TX power: ");\r
+                               sb.append(rif.getPowerMW());\r
+                               sb.append(" mW");\r
+                       }\r
+                       \r
                        Label info = new Label();\r
                        info.setText(sb.toString());\r
                        add(info);\r
index 86f4cff..5508f9c 100644 (file)
@@ -2,6 +2,7 @@
 <?eclipse version="3.4"?>\r
 <plugin>\r
    <extension-point id="org.netxms.ui.eclipse.objectbrowser.objectOpenHandlers" name="Object Open Handler" schema="schema/org.netxms.ui.eclipse.objectbrowser.objectOpenHandlers.exsd"/>\r
+   <extension-point id="org.netxms.ui.eclipse.objectbrowser.objectActionValidators" name="Object Action Validators" schema="schema/org.netxms.ui.eclipse.objectbrowser.objectActionValidators.exsd"/>\r
    <extension point="org.eclipse.core.runtime.preferences">\r
       <initializer class="org.netxms.ui.eclipse.objectbrowser.PreferenceInitializer"/>\r
    </extension>\r
diff --git a/src/java/netxms-eclipse/ObjectBrowser/schema/org.netxms.ui.eclipse.objectbrowser.objectActionValidators.exsd b/src/java/netxms-eclipse/ObjectBrowser/schema/org.netxms.ui.eclipse.objectbrowser.objectActionValidators.exsd
new file mode 100644 (file)
index 0000000..fe94ce6
--- /dev/null
@@ -0,0 +1,117 @@
+<?xml version='1.0' encoding='UTF-8'?>\r
+<!-- Schema file written by PDE -->\r
+<schema targetNamespace="org.netxms.ui.eclipse.objectbrowser" xmlns="http://www.w3.org/2001/XMLSchema">\r
+<annotation>\r
+      <appinfo>\r
+         <meta.schema plugin="org.netxms.ui.eclipse.objectbrowser" id="org.netxms.ui.eclipse.objectbrowser.objectActionValidators" name="Object Action Validators"/>\r
+      </appinfo>\r
+      <documentation>\r
+         Validators for actions on NetXMS objects in Object Browser\r
+      </documentation>\r
+   </annotation>\r
+\r
+   <element name="extension">\r
+      <annotation>\r
+         <appinfo>\r
+            <meta.element />\r
+         </appinfo>\r
+      </annotation>\r
+      <complexType>\r
+         <sequence>\r
+            <element ref="validator" minOccurs="1" maxOccurs="unbounded"/>\r
+         </sequence>\r
+         <attribute name="point" type="string" use="required">\r
+            <annotation>\r
+               <documentation>\r
+                  \r
+               </documentation>\r
+            </annotation>\r
+         </attribute>\r
+         <attribute name="id" type="string">\r
+            <annotation>\r
+               <documentation>\r
+                  \r
+               </documentation>\r
+            </annotation>\r
+         </attribute>\r
+         <attribute name="name" type="string">\r
+            <annotation>\r
+               <documentation>\r
+                  \r
+               </documentation>\r
+               <appinfo>\r
+                  <meta.attribute translatable="true"/>\r
+               </appinfo>\r
+            </annotation>\r
+         </attribute>\r
+      </complexType>\r
+   </element>\r
+\r
+   <element name="validator">\r
+      <complexType>\r
+         <attribute name="class" type="string" use="required">\r
+            <annotation>\r
+               <documentation>\r
+                  Implementing class\r
+               </documentation>\r
+               <appinfo>\r
+                  <meta.attribute kind="java" basedOn=":org.netxms.ui.eclipse.objectbrowser.api.ObjectActionValidator"/>\r
+               </appinfo>\r
+            </annotation>\r
+         </attribute>\r
+         <attribute name="priority" type="string">\r
+            <annotation>\r
+               <documentation>\r
+                  Validator&apos;s priority (0 is highest)\r
+               </documentation>\r
+            </annotation>\r
+         </attribute>\r
+      </complexType>\r
+   </element>\r
+\r
+   <annotation>\r
+      <appinfo>\r
+         <meta.section type="since"/>\r
+      </appinfo>\r
+      <documentation>\r
+         1.2.7\r
+      </documentation>\r
+   </annotation>\r
+\r
+   <annotation>\r
+      <appinfo>\r
+         <meta.section type="examples"/>\r
+      </appinfo>\r
+      <documentation>\r
+         [Enter extension point usage example here.]\r
+      </documentation>\r
+   </annotation>\r
+\r
+   <annotation>\r
+      <appinfo>\r
+         <meta.section type="apiinfo"/>\r
+      </appinfo>\r
+      <documentation>\r
+         [Enter API information here.]\r
+      </documentation>\r
+   </annotation>\r
+\r
+   <annotation>\r
+      <appinfo>\r
+         <meta.section type="implementation"/>\r
+      </appinfo>\r
+      <documentation>\r
+         [Enter information about supplied implementation of this extension point.]\r
+      </documentation>\r
+   </annotation>\r
+\r
+   <annotation>\r
+      <appinfo>\r
+         <meta.section type="copyright"/>\r
+      </appinfo>\r
+      <documentation>\r
+         Copyright (c) 2013 Raden Solutions\r
+      </documentation>\r
+   </annotation>\r
+\r
+</schema>\r
diff --git a/src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/ObjectActionValidator.java b/src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/ObjectActionValidator.java
new file mode 100644 (file)
index 0000000..ac99190
--- /dev/null
@@ -0,0 +1,41 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2013 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.objectbrowser.api;\r
+\r
+import org.netxms.client.objects.AbstractObject;\r
+\r
+/**\r
+ * Interface for validators of various actions on NetXMS objects\r
+ */\r
+public interface ObjectActionValidator\r
+{\r
+       public static final int APPROVE = 0;\r
+       public static final int REJECT = 1;\r
+       public static final int IGNORE = 2;\r
+       \r
+       /**\r
+        * Check if current selection is valid for moving object.\r
+        * \r
+        * @param subtree\r
+        * @param currentObject\r
+        * @param parentObject\r
+        * @return APPROVE, REJECT, or IGNORE\r
+        */\r
+       public int isValidSelectionForMove(SubtreeType subtree, AbstractObject currentObject, AbstractObject parentObject);\r
+}\r
diff --git a/src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/SubtreeType.java b/src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/api/SubtreeType.java
new file mode 100644 (file)
index 0000000..7a9cb1b
--- /dev/null
@@ -0,0 +1,27 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2013 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.objectbrowser.api;\r
+\r
+/**\r
+ * Object subtree type\r
+ */\r
+public enum SubtreeType\r
+{\r
+       NETWORK, INFRASTRUCTURE, TEMPLATES, DASHBOARDS, MAPS, BUSINESS_SERVICES\r
+}\r
index da3279a..dc3a1eb 100644 (file)
@@ -1,6 +1,6 @@
 /**\r
  * NetXMS - open source network management system\r
- * Copyright (C) 2003-2011 Victor Kirhenshtein\r
+ * Copyright (C) 2003-2013 Victor Kirhenshtein\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
  * it under the terms of the GNU General Public License as published by\r
@@ -59,12 +59,12 @@ import org.eclipse.ui.dialogs.PropertyDialogAction;
 import org.eclipse.ui.handlers.IHandlerService;\r
 import org.eclipse.ui.part.ViewPart;\r
 import org.netxms.client.NXCSession;\r
+import org.netxms.client.objects.AbstractObject;\r
 import org.netxms.client.objects.BusinessService;\r
 import org.netxms.client.objects.BusinessServiceRoot;\r
 import org.netxms.client.objects.Cluster;\r
 import org.netxms.client.objects.Condition;\r
 import org.netxms.client.objects.Container;\r
-import org.netxms.client.objects.AbstractObject;\r
 import org.netxms.client.objects.Node;\r
 import org.netxms.client.objects.Rack;\r
 import org.netxms.client.objects.ServiceRoot;\r
@@ -76,8 +76,10 @@ import org.netxms.ui.eclipse.actions.RefreshAction;
 import org.netxms.ui.eclipse.jobs.ConsoleJob;\r
 import org.netxms.ui.eclipse.objectbrowser.Activator;\r
 import org.netxms.ui.eclipse.objectbrowser.Messages;\r
+import org.netxms.ui.eclipse.objectbrowser.api.ObjectActionValidator;\r
 import org.netxms.ui.eclipse.objectbrowser.api.ObjectOpenHandler;\r
 import org.netxms.ui.eclipse.objectbrowser.api.ObjectOpenListener;\r
+import org.netxms.ui.eclipse.objectbrowser.api.SubtreeType;\r
 import org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog;\r
 import org.netxms.ui.eclipse.objectbrowser.widgets.ObjectTree;\r
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;\r
@@ -90,8 +92,6 @@ public class ObjectBrowser extends ViewPart
 {\r
        public static final String ID = "org.netxms.ui.eclipse.view.navigation.objectbrowser"; //$NON-NLS-1$\r
        \r
-       private enum SubtreeType { NETWORK, INFRASTRUCTURE, TEMPLATES, DASHBOARDS, MAPS, BUSINESS_SERVICES };\r
-       \r
        private ObjectTree objectTree;\r
        private Action actionShowFilter;\r
        private Action actionShowStatusIndicator;\r
@@ -108,6 +108,7 @@ public class ObjectBrowser extends ViewPart
        private boolean initShowStatus = true;\r
        private String initialObjectSelection = null;\r
        private List<OpenHandlerData> openHandlers = new ArrayList<OpenHandlerData>(0);\r
+       private ObjectActionValidator[] actionValidators;\r
        \r
        /* (non-Javadoc)\r
         * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)\r
@@ -125,6 +126,7 @@ public class ObjectBrowser extends ViewPart
                        initialObjectSelection = memento.getString("ObjectBrowser.selectedObject"); //$NON-NLS-1$\r
                }\r
                registerOpenHandlers();\r
+               registerActionValidators();\r
        }\r
 \r
        /**\r
@@ -475,32 +477,18 @@ public class ObjectBrowser extends ViewPart
                if (selection[0].getParentItem() == null)\r
                        return false;\r
                \r
-               final Object currentObject = selection[0].getData();\r
-               final Object parentObject = selection[0].getParentItem().getData();\r
+               final AbstractObject currentObject = (AbstractObject)selection[0].getData();\r
+               final AbstractObject parentObject = (AbstractObject)selection[0].getParentItem().getData();\r
                \r
-               switch(subtree)\r
+               for(ObjectActionValidator v : actionValidators)\r
                {\r
-                       case INFRASTRUCTURE:\r
-                               return ((currentObject instanceof Node) ||\r
-                           (currentObject instanceof Cluster) ||\r
-                                (currentObject instanceof Subnet) ||\r
-                           (currentObject instanceof Condition) ||\r
-                           (currentObject instanceof Rack) ||\r
-                                (currentObject instanceof Container)) &&\r
-                               ((parentObject instanceof Container) ||\r
-                                (parentObject instanceof ServiceRoot));\r
-                       case TEMPLATES:\r
-                               return ((currentObject instanceof Template) ||\r
-                                (currentObject instanceof TemplateGroup)) &&\r
-                               ((parentObject instanceof TemplateGroup) ||\r
-                                (parentObject instanceof TemplateRoot));\r
-                       case BUSINESS_SERVICES:\r
-                               return (currentObject instanceof BusinessService) &&\r
-                                      ((parentObject instanceof BusinessService) ||\r
-                                                 (parentObject instanceof BusinessServiceRoot));\r
-                       default:\r
+                       int result = v.isValidSelectionForMove(subtree, currentObject, parentObject);\r
+                       if (result == ObjectActionValidator.APPROVE)\r
+                               return true;\r
+                       if (result == ObjectActionValidator.REJECT)\r
                                return false;\r
                }\r
+               return false;\r
        }\r
        \r
        /**\r
@@ -587,7 +575,7 @@ public class ObjectBrowser extends ViewPart
                        }\r
                }\r
                \r
-               // Sort tabs by appearance order\r
+               // Sort handlers by priority\r
                Collections.sort(openHandlers, new Comparator<OpenHandlerData>() {\r
                        @Override\r
                        public int compare(OpenHandlerData arg0, OpenHandlerData arg1)\r
@@ -596,6 +584,78 @@ public class ObjectBrowser extends ViewPart
                        }\r
                });\r
        }\r
+\r
+       \r
+       /**\r
+        * Register object action validators\r
+        */\r
+       private void registerActionValidators()\r
+       {\r
+               List<ActionValidatorData> list = new ArrayList<ActionValidatorData>();\r
+               \r
+               // Read all registered extensions and create validators\r
+               final IExtensionRegistry reg = Platform.getExtensionRegistry();\r
+               IConfigurationElement[] elements = reg.getConfigurationElementsFor("org.netxms.ui.eclipse.objectbrowser.objectActionValidators");\r
+               for(int i = 0; i < elements.length; i++)\r
+               {\r
+                       try\r
+                       {\r
+                               final ActionValidatorData v = new ActionValidatorData();\r
+                               v.validator = (ObjectActionValidator)elements[i].createExecutableExtension("class");\r
+                               v.priority = safeParseInt(elements[i].getAttribute("priority"));\r
+                               list.add(v);\r
+                       }\r
+                       catch(CoreException e)\r
+                       {\r
+                               e.printStackTrace();\r
+                       }\r
+               }\r
+               \r
+               // Sort handlers by priority\r
+               Collections.sort(list, new Comparator<ActionValidatorData>() {\r
+                       @Override\r
+                       public int compare(ActionValidatorData arg0, ActionValidatorData arg1)\r
+                       {\r
+                               return arg0.priority - arg1.priority;\r
+                       }\r
+               });\r
+               \r
+               actionValidators = new ObjectActionValidator[list.size() + 1];\r
+               int i = 0;\r
+               for(ActionValidatorData v : list)\r
+                       actionValidators[i++] = v.validator;\r
+               \r
+               // Default validator\r
+               actionValidators[i] = new ObjectActionValidator() {\r
+                       @Override\r
+                       public int isValidSelectionForMove(SubtreeType subtree, AbstractObject currentObject, AbstractObject parentObject)\r
+                       {\r
+                               switch(subtree)\r
+                               {\r
+                                       case INFRASTRUCTURE:\r
+                                               return ((currentObject instanceof Node) ||\r
+                                                       (currentObject instanceof Cluster) ||\r
+                                                  (currentObject instanceof Subnet) ||\r
+                                             (currentObject instanceof Condition) ||\r
+                                             (currentObject instanceof Rack) ||\r
+                                                  (currentObject instanceof Container)) &&\r
+                                                 ((parentObject instanceof Container) ||\r
+                                                  (parentObject instanceof ServiceRoot)) ? APPROVE : REJECT;\r
+                                       case TEMPLATES:\r
+                                               return ((currentObject instanceof Template) ||\r
+                                                  (currentObject instanceof TemplateGroup)) &&\r
+                                                 ((parentObject instanceof TemplateGroup) ||\r
+                                                  (parentObject instanceof TemplateRoot)) ? APPROVE : REJECT;\r
+                                       case BUSINESS_SERVICES:\r
+                                               return (currentObject instanceof BusinessService) &&\r
+                                                      ((parentObject instanceof BusinessService) ||\r
+                                                                 (parentObject instanceof BusinessServiceRoot)) ? APPROVE : REJECT;\r
+                                       default:\r
+                                               return REJECT;\r
+                               }\r
+                       }\r
+               };\r
+       }\r
        \r
        /**\r
         * @param s\r
@@ -642,4 +702,13 @@ public class ObjectBrowser extends ViewPart
                int priority;\r
                Class<?> enabledFor;\r
        }\r
+\r
+       /**\r
+        * Internal data for object action validators\r
+        */\r
+       private class ActionValidatorData\r
+       {\r
+               ObjectActionValidator validator;\r
+               int priority;\r
+       }\r
 }\r
diff --git a/src/java/netxms-eclipse/Topology/icons/radio_interfaces.png b/src/java/netxms-eclipse/Topology/icons/radio_interfaces.png
new file mode 100644 (file)
index 0000000..b5e52ad
Binary files /dev/null and b/src/java/netxms-eclipse/Topology/icons/radio_interfaces.png differ
index cea7d15..1c27ed6 100644 (file)
                menubarPath="topology"\r
                style="push">\r
          </action>\r
+         <action\r
+               class="org.netxms.ui.eclipse.topology.actions.ShowRadioInterfaces"\r
+               enablesFor="1"\r
+               icon="icons/radio_interfaces.png"\r
+               id="org.netxms.ui.eclipse.topology.popupActions.RadioInterfaces"\r
+               label="Radio Interfaces"\r
+               menubarPath="topology"\r
+               style="push">\r
+         </action>\r
       </objectContribution>\r
       <objectContribution\r
             adaptable="false"\r
                style="push">\r
          </action>\r
       </objectContribution>\r
+      <objectContribution\r
+            adaptable="false"\r
+            id="org.netxms.ui.eclipse.topology.actions.popup.object.AccessPoint"\r
+            objectClass="org.netxms.client.objects.AccessPoint">\r
+         <action\r
+               class="org.netxms.ui.eclipse.topology.actions.FindConnectionPoint"\r
+               enablesFor="1"\r
+               id="org.netxms.ui.eclipse.topology.popupActions.FindConnectionPoint#AccessPoint"\r
+               label="Find &amp;switch port"\r
+               menubarPath="topology"\r
+               style="push">\r
+         </action>\r
+      </objectContribution>\r
    </extension>\r
    <extension\r
          point="org.eclipse.ui.commands">\r
             name="Wireless Stations"\r
             restorable="true">\r
       </view>\r
+      <view\r
+            allowMultiple="true"\r
+            category="org.netxms.ui.eclipse.viewcategory.tools"\r
+            class="org.netxms.ui.eclipse.topology.views.RadioInterfaces"\r
+            icon="icons/radio_interfaces.png"\r
+            id="org.netxms.ui.eclipse.topology.views.RadioInterfaces"\r
+            name="Radio Interfaces"\r
+            restorable="true">\r
+      </view>\r
    </extension>\r
    <extension\r
          point="org.eclipse.ui.bindings">\r
index 6d9b3e9..29ba678 100644 (file)
@@ -26,6 +26,7 @@ import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;\r
 import org.netxms.client.NXCSession;\r
 import org.netxms.client.objects.AbstractObject;\r
+import org.netxms.client.objects.AccessPoint;\r
 import org.netxms.client.objects.Interface;\r
 import org.netxms.client.objects.Node;\r
 import org.netxms.client.topology.ConnectionPoint;\r
@@ -82,7 +83,7 @@ public class FindConnectionPoint implements IObjectActionDelegate
                    (((IStructuredSelection)selection).size() == 1))\r
                {\r
                        Object obj = ((IStructuredSelection)selection).getFirstElement();\r
-                       if ((obj instanceof Node) || (obj instanceof Interface))\r
+                       if ((obj instanceof Node) || (obj instanceof Interface) || (obj instanceof AccessPoint))\r
                        {\r
                                action.setEnabled(true);\r
                                objectId = ((AbstractObject)obj).getObjectId();\r
@@ -1,6 +1,6 @@
 /**\r
  * NetXMS - open source network management system\r
- * Copyright (C) 2003-2012 Victor Kirhenshtein\r
+ * Copyright (C) 2003-2010 Victor Kirhenshtein\r
  *\r
  * This program is free software; you can redistribute it and/or modify\r
  * it under the terms of the GNU General Public License as published by\r
  */\r
 package org.netxms.ui.eclipse.topology.actions;\r
 \r
-import org.eclipse.core.runtime.IProgressMonitor;\r
 import org.eclipse.jface.action.IAction;\r
 import org.eclipse.jface.viewers.ISelection;\r
 import org.eclipse.jface.viewers.IStructuredSelection;\r
 import org.eclipse.ui.IObjectActionDelegate;\r
+import org.eclipse.ui.IWorkbenchPage;\r
 import org.eclipse.ui.IWorkbenchPart;\r
-import org.netxms.client.NXCSession;\r
+import org.eclipse.ui.IWorkbenchWindow;\r
+import org.eclipse.ui.PartInitException;\r
+import org.netxms.client.objects.AbstractNode;\r
 import org.netxms.client.objects.AbstractObject;\r
-import org.netxms.client.objects.Interface;\r
-import org.netxms.client.objects.Node;\r
-import org.netxms.client.topology.ConnectionPoint;\r
-import org.netxms.ui.eclipse.jobs.ConsoleJob;\r
-import org.netxms.ui.eclipse.shared.ConsoleSharedData;\r
-import org.netxms.ui.eclipse.topology.Activator;\r
-import org.netxms.ui.eclipse.topology.views.HostSearchResults;\r
+import org.netxms.ui.eclipse.tools.MessageDialogHelper;\r
+import org.netxms.ui.eclipse.topology.views.RadioInterfaces;\r
 \r
 /**\r
- * Find connection point for node or interface\r
- *\r
+ * Show wireless stations registered on wireless network controller\r
  */\r
-public class FindConnectionPoint implements IObjectActionDelegate\r
+public class ShowRadioInterfaces implements IObjectActionDelegate\r
 {\r
-       private IWorkbenchPart wbPart;\r
+       private IWorkbenchWindow window;\r
        private long objectId;\r
        \r
        /* (non-Javadoc)\r
@@ -49,27 +45,14 @@ public class FindConnectionPoint implements IObjectActionDelegate
        @Override\r
        public void run(IAction action)\r
        {\r
-               final NXCSession session = (NXCSession)ConsoleSharedData.getSession();\r
-               new ConsoleJob("Find connection point for object " + objectId, wbPart, Activator.PLUGIN_ID, null) {\r
-                       @Override\r
-                       protected void runInternal(IProgressMonitor monitor) throws Exception\r
-                       {\r
-                               final ConnectionPoint cp = session.findConnectionPoint(objectId);\r
-                               runInUIThread(new Runnable() {\r
-                                       @Override\r
-                                       public void run()\r
-                                       {\r
-                                               HostSearchResults.showConnection(cp);\r
-                                       }\r
-                               });\r
-                       }\r
-\r
-                       @Override\r
-                       protected String getErrorMessage()\r
-                       {\r
-                               return "Cannot get conection point information";\r
-                       }\r
-               }.start();\r
+               try\r
+               {\r
+                       window.getActivePage().showView(RadioInterfaces.ID, Long.toString(objectId), IWorkbenchPage.VIEW_ACTIVATE);\r
+               }\r
+               catch(PartInitException e)\r
+               {\r
+                       MessageDialogHelper.openError(window.getShell(), "Error", "Cannot open view: " + e.getLocalizedMessage());\r
+               }\r
        }\r
        \r
        /* (non-Javadoc)\r
@@ -82,7 +65,7 @@ public class FindConnectionPoint implements IObjectActionDelegate
                    (((IStructuredSelection)selection).size() == 1))\r
                {\r
                        Object obj = ((IStructuredSelection)selection).getFirstElement();\r
-                       if ((obj instanceof Node) || (obj instanceof Interface))\r
+                       if ((obj instanceof AbstractNode) && ((AbstractNode)obj).isWirelessController())\r
                        {\r
                                action.setEnabled(true);\r
                                objectId = ((AbstractObject)obj).getObjectId();\r
@@ -106,6 +89,6 @@ public class FindConnectionPoint implements IObjectActionDelegate
        @Override\r
        public void setActivePart(IAction action, IWorkbenchPart targetPart)\r
        {\r
-               wbPart = targetPart;\r
+               window = targetPart.getSite().getWorkbenchWindow();\r
        }\r
 }\r
diff --git a/src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/RadioInterfaces.java b/src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/RadioInterfaces.java
new file mode 100644 (file)
index 0000000..ac499a3
--- /dev/null
@@ -0,0 +1,230 @@
+/**\r
+ * \r
+ */\r
+package org.netxms.ui.eclipse.topology.views;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import org.eclipse.jface.action.Action;\r
+import org.eclipse.jface.action.GroupMarker;\r
+import org.eclipse.jface.action.IMenuListener;\r
+import org.eclipse.jface.action.IMenuManager;\r
+import org.eclipse.jface.action.IToolBarManager;\r
+import org.eclipse.jface.action.MenuManager;\r
+import org.eclipse.jface.action.Separator;\r
+import org.eclipse.jface.viewers.ArrayContentProvider;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.events.DisposeEvent;\r
+import org.eclipse.swt.events.DisposeListener;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Menu;\r
+import org.eclipse.ui.IActionBars;\r
+import org.eclipse.ui.IViewSite;\r
+import org.eclipse.ui.IWorkbenchActionConstants;\r
+import org.eclipse.ui.PartInitException;\r
+import org.eclipse.ui.part.ViewPart;\r
+import org.netxms.client.NXCSession;\r
+import org.netxms.client.objects.AbstractObject;\r
+import org.netxms.client.objects.AccessPoint;\r
+import org.netxms.client.objects.Node;\r
+import org.netxms.client.topology.RadioInterface;\r
+import org.netxms.ui.eclipse.actions.ExportToCsvAction;\r
+import org.netxms.ui.eclipse.actions.RefreshAction;\r
+import org.netxms.ui.eclipse.shared.ConsoleSharedData;\r
+import org.netxms.ui.eclipse.tools.WidgetHelper;\r
+import org.netxms.ui.eclipse.topology.Activator;\r
+import org.netxms.ui.eclipse.topology.views.helpers.RadioInterfaceComparator;\r
+import org.netxms.ui.eclipse.topology.views.helpers.RadioInterfaceLabelProvider;\r
+import org.netxms.ui.eclipse.widgets.SortableTableViewer;\r
+\r
+/**\r
+ * List of radio interfaces\r
+ */\r
+public class RadioInterfaces extends ViewPart\r
+{\r
+       public static final String ID = "org.netxms.ui.eclipse.topology.views.RadioInterfaces"; //$NON-NLS-1$\r
+       \r
+       public static final int COLUMN_AP_NAME = 0;\r
+       public static final int COLUMN_AP_MAC_ADDR = 1;\r
+       public static final int COLUMN_AP_VENDOR = 2;\r
+       public static final int COLUMN_AP_MODEL = 3;\r
+       public static final int COLUMN_AP_SERIAL = 4;\r
+       public static final int COLUMN_INDEX = 5;\r
+       public static final int COLUMN_NAME = 6;\r
+       public static final int COLUMN_MAC_ADDR = 7;\r
+       public static final int COLUMN_CHANNEL = 8;\r
+       public static final int COLUMN_TX_POWER_DBM = 9;\r
+       public static final int COLUMN_TX_POWER_MW = 10;\r
+       \r
+       private NXCSession session;\r
+       private long rootObject;\r
+       private SortableTableViewer viewer;\r
+       private Action actionRefresh;\r
+       private Action actionExportToCsv;\r
+       private Action actionExportAllToCsv;\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite)\r
+        */\r
+       @Override\r
+       public void init(IViewSite site) throws PartInitException\r
+       {\r
+               super.init(site);\r
+               try\r
+               {\r
+                       rootObject = Long.parseLong(site.getSecondaryId());\r
+               }\r
+               catch(NumberFormatException e)\r
+               {\r
+                       rootObject = 0;\r
+               }\r
+\r
+               session = (NXCSession)ConsoleSharedData.getSession();\r
+               setPartName("Radio Interfaces - " + session.getObjectName(rootObject));\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)\r
+        */\r
+       @Override\r
+       public void createPartControl(Composite parent)\r
+       {\r
+               final String[] names = { "AP Name", "AP MAC Address", "AP Vendor", "AP Model", "AP Serial", "Radio Index", "Radio Name", "Radio MAC Address", "Channel", "Tx Power dBm", "Tx Power mW" };\r
+               final int[] widths = { 120, 100, 140, 140, 100, 90, 120, 100, 90, 90, 90 };\r
+               viewer = new SortableTableViewer(parent, names, widths, 1, SWT.UP, SWT.FULL_SELECTION | SWT.MULTI);\r
+               viewer.setContentProvider(new ArrayContentProvider());\r
+               viewer.setLabelProvider(new RadioInterfaceLabelProvider());\r
+               viewer.setComparator(new RadioInterfaceComparator());\r
+               \r
+               WidgetHelper.restoreTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), "RadioInterfaces");\r
+               viewer.getTable().addDisposeListener(new DisposeListener() {\r
+                       @Override\r
+                       public void widgetDisposed(DisposeEvent e)\r
+                       {\r
+                               WidgetHelper.saveTableViewerSettings(viewer, Activator.getDefault().getDialogSettings(), "RadioInterfaces");\r
+                       }\r
+               });\r
+\r
+               createActions();\r
+               contributeToActionBars();\r
+               createPopupMenu();\r
+               \r
+               refresh();\r
+       }\r
+       /**\r
+        * Create actions\r
+        */\r
+       private void createActions()\r
+       {\r
+               actionRefresh = new RefreshAction(this) {\r
+                       @Override\r
+                       public void run()\r
+                       {\r
+                               refresh();\r
+                       }\r
+               };\r
+\r
+               actionExportToCsv = new ExportToCsvAction(this, viewer, true);\r
+               actionExportAllToCsv = new ExportToCsvAction(this, viewer, false);\r
+       }\r
+\r
+       /**\r
+        * Contribute actions to action bar\r
+        */\r
+       private void contributeToActionBars()\r
+       {\r
+               IActionBars bars = getViewSite().getActionBars();\r
+               fillLocalPullDown(bars.getMenuManager());\r
+               fillLocalToolBar(bars.getToolBarManager());\r
+       }\r
+\r
+       /**\r
+        * Fill local pull-down menu\r
+        * \r
+        * @param manager\r
+        *           Menu manager for pull-down menu\r
+        */\r
+       private void fillLocalPullDown(IMenuManager manager)\r
+       {\r
+               manager.add(actionExportAllToCsv);\r
+               manager.add(new Separator());\r
+               manager.add(actionRefresh);\r
+       }\r
+\r
+       /**\r
+        * Fill local tool bar\r
+        * \r
+        * @param manager\r
+        *           Menu manager for local toolbar\r
+        */\r
+       private void fillLocalToolBar(IToolBarManager manager)\r
+       {\r
+               manager.add(actionExportAllToCsv);\r
+               manager.add(actionRefresh);\r
+       }\r
+       \r
+       /**\r
+        * Create pop-up menu\r
+        */\r
+       private void createPopupMenu()\r
+       {\r
+               // Create menu manager.\r
+               MenuManager menuMgr = new MenuManager();\r
+               menuMgr.setRemoveAllWhenShown(true);\r
+               menuMgr.addMenuListener(new IMenuListener() {\r
+                       public void menuAboutToShow(IMenuManager mgr)\r
+                       {\r
+                               fillContextMenu(mgr);\r
+                       }\r
+               });\r
+\r
+               // Create menu.\r
+               Menu menu = menuMgr.createContextMenu(viewer.getControl());\r
+               viewer.getControl().setMenu(menu);\r
+\r
+               // Register menu for extension.\r
+               getSite().registerContextMenu(menuMgr, viewer);\r
+       }\r
+\r
+       /**\r
+        * Fill context menu\r
+        * @param mgr Menu manager\r
+        */\r
+       protected void fillContextMenu(IMenuManager manager)\r
+       {\r
+               manager.add(actionExportToCsv);\r
+               manager.add(new Separator());\r
+               manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.part.WorkbenchPart#setFocus()\r
+        */\r
+       @Override\r
+       public void setFocus()\r
+       {\r
+               viewer.getTable().setFocus();\r
+       }\r
+\r
+       /**\r
+        * Refresh content\r
+        */\r
+       private void refresh()\r
+       {\r
+               Node node = (Node)session.findObjectById(rootObject, Node.class);\r
+               if (node == null)\r
+                       return;\r
+               \r
+               List<RadioInterface> list = new ArrayList<RadioInterface>();\r
+               for(AbstractObject o : node.getAllChilds(AbstractObject.OBJECT_ACCESSPOINT))\r
+               {\r
+                       if (o instanceof AccessPoint)\r
+                       {\r
+                               for(RadioInterface rif : ((AccessPoint)o).getRadios())\r
+                                       list.add(rif);\r
+                       }\r
+               }\r
+               \r
+               viewer.setInput(list.toArray());\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/RadioInterfaceComparator.java b/src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/RadioInterfaceComparator.java
new file mode 100644 (file)
index 0000000..081b258
--- /dev/null
@@ -0,0 +1,84 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2013 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.topology.views.helpers;\r
+\r
+import org.eclipse.jface.viewers.Viewer;\r
+import org.eclipse.jface.viewers.ViewerComparator;\r
+import org.eclipse.swt.SWT;\r
+import org.netxms.client.topology.RadioInterface;\r
+import org.netxms.ui.eclipse.topology.views.RadioInterfaces;\r
+import org.netxms.ui.eclipse.widgets.SortableTableViewer;\r
+\r
+/**\r
+ * Comparator for radio interface list\r
+ */\r
+public class RadioInterfaceComparator extends ViewerComparator\r
+{\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)\r
+        */\r
+       @Override\r
+       public int compare(Viewer viewer, Object e1, Object e2)\r
+       {\r
+               RadioInterface rif1 = (RadioInterface)e1;\r
+               RadioInterface rif2 = (RadioInterface)e2;\r
+               \r
+               int result;\r
+               switch((Integer)((SortableTableViewer)viewer).getTable().getSortColumn().getData("ID")) //$NON-NLS-1$\r
+               {\r
+                       case RadioInterfaces.COLUMN_AP_MAC_ADDR:\r
+                               result = rif1.getAccessPoint().getMacAddress().compareTo(rif2.getAccessPoint().getMacAddress());\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_AP_MODEL:\r
+                               result = rif1.getAccessPoint().getModel().compareToIgnoreCase(rif2.getAccessPoint().getModel());\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_AP_NAME:\r
+                               result = rif1.getAccessPoint().getObjectName().compareToIgnoreCase(rif2.getAccessPoint().getObjectName());\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_AP_SERIAL:\r
+                               result = rif1.getAccessPoint().getSerialNumber().compareToIgnoreCase(rif2.getAccessPoint().getSerialNumber());\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_AP_VENDOR:\r
+                               result = rif1.getAccessPoint().getVendor().compareToIgnoreCase(rif2.getAccessPoint().getVendor());\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_CHANNEL:\r
+                               result = rif1.getChannel() - rif2.getChannel();\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_INDEX:\r
+                               result = rif1.getIndex() - rif2.getIndex();\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_MAC_ADDR:\r
+                               result = rif1.getMacAddress().compareTo(rif2.getMacAddress());\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_NAME:\r
+                               result = rif1.getName().compareToIgnoreCase(rif2.getName());\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_TX_POWER_DBM:\r
+                               result = rif1.getPowerDBm() - rif2.getPowerDBm();\r
+                               break;\r
+                       case RadioInterfaces.COLUMN_TX_POWER_MW:\r
+                               result = rif1.getPowerMW() - rif2.getPowerMW();\r
+                               break;\r
+                       default:\r
+                               result = 0;\r
+                               break;\r
+               }\r
+               return (((SortableTableViewer)viewer).getTable().getSortDirection() == SWT.DOWN) ? result : -result;\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/RadioInterfaceLabelProvider.java b/src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/views/helpers/RadioInterfaceLabelProvider.java
new file mode 100644 (file)
index 0000000..76e7af6
--- /dev/null
@@ -0,0 +1,75 @@
+/**\r
+ * NetXMS - open source network management system\r
+ * Copyright (C) 2003-2013 Victor Kirhenshtein\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ */\r
+package org.netxms.ui.eclipse.topology.views.helpers;\r
+\r
+import org.eclipse.jface.viewers.ITableLabelProvider;\r
+import org.eclipse.jface.viewers.LabelProvider;\r
+import org.eclipse.swt.graphics.Image;\r
+import org.netxms.client.topology.RadioInterface;\r
+import org.netxms.ui.eclipse.topology.views.RadioInterfaces;\r
+\r
+/**\r
+ * Label provider for radio interface list\r
+ */\r
+public class RadioInterfaceLabelProvider extends LabelProvider implements ITableLabelProvider\r
+{\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)\r
+        */\r
+       @Override\r
+       public Image getColumnImage(Object element, int columnIndex)\r
+       {\r
+               return null;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)\r
+        */\r
+       @Override\r
+       public String getColumnText(Object element, int columnIndex)\r
+       {\r
+               RadioInterface rif = (RadioInterface)element;\r
+               switch(columnIndex)\r
+               {\r
+                       case RadioInterfaces.COLUMN_AP_MAC_ADDR:\r
+                               return rif.getAccessPoint().getMacAddress().toString();\r
+                       case RadioInterfaces.COLUMN_AP_MODEL:\r
+                               return rif.getAccessPoint().getModel();\r
+                       case RadioInterfaces.COLUMN_AP_NAME:\r
+                               return rif.getAccessPoint().getObjectName();\r
+                       case RadioInterfaces.COLUMN_AP_SERIAL:\r
+                               return rif.getAccessPoint().getSerialNumber();\r
+                       case RadioInterfaces.COLUMN_AP_VENDOR:\r
+                               return rif.getAccessPoint().getVendor();\r
+                       case RadioInterfaces.COLUMN_CHANNEL:\r
+                               return Integer.toString(rif.getChannel());\r
+                       case RadioInterfaces.COLUMN_INDEX:\r
+                               return Integer.toString(rif.getIndex());\r
+                       case RadioInterfaces.COLUMN_MAC_ADDR:\r
+                               return rif.getMacAddress().toString();\r
+                       case RadioInterfaces.COLUMN_NAME:\r
+                               return rif.getName();\r
+                       case RadioInterfaces.COLUMN_TX_POWER_DBM:\r
+                               return Integer.toString(rif.getPowerDBm());\r
+                       case RadioInterfaces.COLUMN_TX_POWER_MW:\r
+                               return Integer.toString(rif.getPowerMW());\r
+               }\r
+               return null;\r
+       }\r
+}\r
index 4a01924..a20c67f 100644 (file)
@@ -128,10 +128,6 @@ DIR *opendir(const char *filename)
             return NULL;
         }
         strcpy(&p->start[idx], FindData.cFileName);
-        /*
-         * if (downcase) 
-         * *        strlwr(&p->start[idx]);
-         */
         p->nfiles++;
         idx += len + 1;
     }
index bf69209..e09aca1 100644 (file)
@@ -101,10 +101,6 @@ DIRW *wopendir(const WCHAR *filename)
         return NULL;
     }
     wcscpy(p->start, FindData.cFileName);
-    /*
-     * if(downcase)
-     * *    strlwr(p->start);
-     */
     p->nfiles = 0;
 
     /*
index ef55c0a..83860d5 100644 (file)
@@ -2035,38 +2035,3 @@ int LIBNETXMS_EXPORTABLE wcscat_s(WCHAR *dst, size_t dstSize, const WCHAR *src)
 }
 
 #endif
-
-
-//
-// strlwr implementation
-//
-
-#if !defined(_WIN32) && !HAVE_STRLWR
-
-char LIBNETXMS_EXPORTABLE *strlwr(char *str)
-{
-       char *s = str;
-       while(*s != 0)
-       {
-               if (isupper(*s))
-                       *s = tolower(*s);
-               ++s;
-       }
-
-       return str;
-}
-
-WCHAR LIBNETXMS_EXPORTABLE *wcslwr(WCHAR *str)
-{
-       WCHAR *s = str;
-       while(*s != 0)
-       {
-               if (iswupper(*s))
-                       *s = towlower(*s);
-               ++s;
-       }
-
-       return str;
-}
-
-#endif
index 90f2e71..b2c99a6 100644 (file)
@@ -203,6 +203,27 @@ void AccessPoint::CreateMessage(CSCPMessage *msg)
        msg->SetVariable(VID_VENDOR, CHECK_NULL_EX(m_vendor));
        msg->SetVariable(VID_MODEL, CHECK_NULL_EX(m_model));
        msg->SetVariable(VID_SERIAL_NUMBER, CHECK_NULL_EX(m_serialNumber));
+
+   if (m_radioInterfaces != NULL)
+   {
+      msg->SetVariable(VID_RADIO_COUNT, (WORD)m_radioInterfaces->size());
+      DWORD varId = VID_RADIO_LIST_BASE;
+      for(int i = 0; i < m_radioInterfaces->size(); i++)
+      {
+         RadioInterfaceInfo *rif = m_radioInterfaces->get(i);
+         msg->SetVariable(varId++, (DWORD)rif->index);
+         msg->SetVariable(varId++, rif->name);
+         msg->SetVariable(varId++, rif->macAddr, MAC_ADDR_LENGTH);
+         msg->SetVariable(varId++, rif->channel);
+         msg->SetVariable(varId++, (DWORD)rif->powerDBm);
+         msg->SetVariable(varId++, (DWORD)rif->powerMW);
+         varId += 4;
+      }
+   }
+   else
+   {
+      msg->SetVariable(VID_RADIO_COUNT, (WORD)0);
+   }
 }
 
 /**
index 930e2b3..f9433ad 100644 (file)
@@ -1,6 +1,6 @@
 /* 
 ** NetXMS - Network Management System
-** Copyright (C) 2003-2012 Victor Kirhenshtein
+** Copyright (C) 2003-2013 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -196,6 +196,14 @@ BOOL InitIdTable()
                                                    DBGetFieldULong(hResult, 0, 0) + 1);
       DBFreeResult(hResult);
    }
+   hResult = DBSelect(g_hCoreDB, _T("SELECT max(id) FROM access_points"));
+   if (hResult != NULL)
+   {
+      if (DBGetNumRows(hResult) > 0)
+         m_dwFreeIdTable[IDG_NETWORK_OBJECT] = max(m_dwFreeIdTable[IDG_NETWORK_OBJECT],
+                                                   DBGetFieldULong(hResult, 0, 0) + 1);
+      DBFreeResult(hResult);
+   }
 
    // Get first available container category id
    hResult = DBSelect(g_hCoreDB, _T("SELECT max(category) FROM container_categories"));
index 18b24b3..1f9a276 100644 (file)
@@ -10695,6 +10695,14 @@ void ClientSession::findNodeConnection(CSCPMessage *request)
                                iface = FindInterfaceConnectionPoint(localMacAddr, &exactMatch);
                                msg.SetVariable(VID_RCC, RCC_SUCCESS);
                        }
+         else if (object->Type() == OBJECT_ACCESSPOINT)
+                       {
+                               localNodeId = 0;
+                               localIfId = 0;
+                               memcpy(localMacAddr, ((AccessPoint *)object)->getMacAddr(), MAC_ADDR_LENGTH);
+                               iface = FindInterfaceConnectionPoint(localMacAddr, &exactMatch);
+                               msg.SetVariable(VID_RCC, RCC_SUCCESS);
+                       }
                        else
                        {
                                msg.SetVariable(VID_RCC, RCC_INCOMPATIBLE_OPERATION);
index b72d76c..4ea95fa 100644 (file)
@@ -281,8 +281,11 @@ static DWORD HandlerAccessPointListAdopted(DWORD version, SNMP_Variable *var, SN
       DWORD channelOid[] = { 1, 3, 6, 1, 4, 1, 388, 14, 3, 2, 1, 11, 11, 1, 6, 0 }; // wsCcRfRadioStatusCurrChannel
       DWORD currentPowerDbOid[] = { 1, 3, 6, 1, 4, 1, 388, 14, 3, 2, 1, 11, 11, 1, 7, 0 }; // wsCcRfRadioStatusCurrPowerDb
       DWORD currentPowerMwOid[] = { 1, 3, 6, 1, 4, 1, 388, 14, 3, 2, 1, 11, 11, 1, 8, 0 }; // wsCcRfRadioStatusCurrPowerMw
-      descOid[(sizeof(descOid) / sizeof(descOid[0])) - 1] = radioIndex[i];
-      macOid[(sizeof(macOid) / sizeof(macOid[0])) - 1] = radioIndex[i];
+      descOid[(sizeof(descOid) / sizeof(DWORD)) - 1] = radioIndex[i];
+      macOid[(sizeof(macOid) / sizeof(DWORD)) - 1] = radioIndex[i];
+      channelOid[(sizeof(channelOid) / sizeof(DWORD)) - 1] = radioIndex[i];
+      currentPowerDbOid[(sizeof(currentPowerDbOid) / sizeof(DWORD)) - 1] = radioIndex[i];
+      currentPowerMwOid[(sizeof(currentPowerMwOid) / sizeof(DWORD)) - 1] = radioIndex[i];
 
       RadioInterfaceInfo *radioInfo = new RadioInterfaceInfo;
       radioInfo->index = radioIndex[i];
index b447b8c..ce85b57 100644 (file)
@@ -307,9 +307,9 @@ static void CheckNodes()
                              _T("last_modified,status_calc_alg,status_prop_alg,")
                              _T("status_fixed_val,status_shift,status_translation,")
                              _T("status_single_threshold,status_thresholds,location_type,")
-                                                                         _T("latitude,longitude,image) VALUES ")
+                                                                         _T("latitude,longitude,location_accuracy,location_timestamp,image,submap_id) VALUES ")
                              _T("(%d,'%s','lost_node_%d',5,0,0,1,") TIME_T_FMT _T(",0,0,0,0,0,0,'00000000',0,")
-                                                                         _T("'0.000000','0.000000','00000000-0000-0000-0000-000000000000')"),
+                                                                         _T("'0.000000','0.000000',0,0,'00000000-0000-0000-0000-000000000000',0)"),
                                                                          (int)dwId, uuid_to_string(guid, guidText), (int)dwId, TIME_T_FCAST(time(NULL)));
                   if (SQLQuery(szQuery))
                      m_iNumFixes++;