initial code for dashboard plugin
authorVictor Kirhenshtein <victor@netxms.org>
Fri, 29 Jan 2010 12:38:10 +0000 (12:38 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Fri, 29 Jan 2010 12:38:10 +0000 (12:38 +0000)
16 files changed:
.gitattributes
src/java/netxms-client/src/main/java/org/netxms/client/NXCSession.java
src/java/netxms-eclipse/Dashboard/.classpath [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/.project [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/META-INF/MANIFEST.MF [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/build.properties [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/icons/dashboard.png [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/icons/server_stats.png [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/plugin.xml [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/Activator.java [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/perspectives/DashboardPerspective.java [new file with mode: 0644]
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/views/ServerStats.java [new file with mode: 0644]
src/java/netxms-eclipse/EPP/src/org/netxms/ui/eclipse/epp/dialogs/EditCommentsDlg.java
src/java/netxms-eclipse/core/plugin_customization.ini
src/java/netxms-eclipse/core/src/org/netxms/ui/eclipse/console/perspectives/DefaultPerspective.java

index 21736b6..41c82f6 100644 (file)
@@ -329,6 +329,17 @@ src/java/netxms-eclipse/Charts/src/org/netxms/ui/eclipse/charts/preferencepages/
 src/java/netxms-eclipse/Charts/src/org/netxms/ui/eclipse/charts/views/HistoryGraph.java -text
 src/java/netxms-eclipse/Charts/src/org/netxms/ui/eclipse/charts/views/helpers/DCIInfo.java -text
 src/java/netxms-eclipse/Charts/src/org/netxms/ui/eclipse/charts/widgets/HistoricDataChart.java -text
+src/java/netxms-eclipse/Dashboard/.classpath -text
+src/java/netxms-eclipse/Dashboard/.project -text
+src/java/netxms-eclipse/Dashboard/.settings/org.eclipse.jdt.core.prefs -text
+src/java/netxms-eclipse/Dashboard/META-INF/MANIFEST.MF -text
+src/java/netxms-eclipse/Dashboard/build.properties -text
+src/java/netxms-eclipse/Dashboard/icons/dashboard.png -text
+src/java/netxms-eclipse/Dashboard/icons/server_stats.png -text
+src/java/netxms-eclipse/Dashboard/plugin.xml -text
+src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/Activator.java -text
+src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/perspectives/DashboardPerspective.java -text
+src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/views/ServerStats.java -text
 src/java/netxms-eclipse/DataCollection/.settings/org.eclipse.jdt.core.prefs -text
 src/java/netxms-eclipse/DataCollection/META-INF/MANIFEST.MF -text
 src/java/netxms-eclipse/DataCollection/build.properties -text
index 593075e..bafdd42 100644 (file)
@@ -2822,4 +2822,50 @@ public class NXCSession
                sendMessage(msg);\r
                waitForRCC(msg.getMessageId());\r
        }\r
+       \r
+       /**\r
+        * Get server stats. Returns set of named properties. The following properties could be found in result set:\r
+        * String: VERSION\r
+        * Integer: UPTIME, SESSION_COUNT, DCI_COUNT, OBJECT_COUNT, NODE_COUNT, PHYSICAL_MEMORY_USED, VIRTUAL_MEMORY_USED,\r
+        * QSIZE_CONDITION_POLLER, QSIZE_CONF_POLLER, QSIZE_DCI_POLLER, QSIZE_DBWRITER, QSIZE_EVENT, QSIZE_DISCOVERY,\r
+        * QSIZE_NODE_POLLER, QSIZE_ROUTE_POLLER, QSIZE_STATUS_POLLER, ALARM_COUNT\r
+        * long[]: ALARMS_BY_SEVERITY\r
+        * \r
+        * @return Server stats as set of named properties.\r
+        * @throws IOException if socket I/O error occurs\r
+        * @throws NXCException if NetXMS server returns an error or operation was timed out\r
+        */\r
+       public Map<String, Object> getServerStats() throws IOException, NXCException\r
+       {\r
+               final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_SERVER_STATS);\r
+               sendMessage(msg);\r
+               final NXCPMessage response = waitForRCC(msg.getMessageId());\r
+               \r
+               Map<String, Object> stats = new HashMap<String, Object>();\r
+               stats.put("VERSION", response.getVariableAsString(NXCPCodes.VID_SERVER_VERSION));\r
+               stats.put("UPTIME", response.getVariableAsInteger(NXCPCodes.VID_SERVER_UPTIME));\r
+               stats.put("SESSION_COUNT", response.getVariableAsInteger(NXCPCodes.VID_NUM_SESSIONS));\r
+               \r
+               stats.put("DCI_COUNT", response.getVariableAsInteger(NXCPCodes.VID_NUM_ITEMS));\r
+               stats.put("OBJECT_COUNT", response.getVariableAsInteger(NXCPCodes.VID_NUM_OBJECTS));\r
+               stats.put("NODE_COUNT", response.getVariableAsInteger(NXCPCodes.VID_NUM_NODES));\r
+               \r
+               stats.put("PHYSICAL_MEMORY_USED", response.getVariableAsInteger(NXCPCodes.VID_NETXMSD_PROCESS_WKSET));\r
+               stats.put("VIRTUAL_MEMORY_USED", response.getVariableAsInteger(NXCPCodes.VID_NETXMSD_PROCESS_VMSIZE));\r
+               \r
+               stats.put("QSIZE_CONDITION_POLLER", response.getVariableAsInteger(NXCPCodes.VID_QSIZE_CONDITION_POLLER));\r
+               stats.put("QSIZE_CONF_POLLER", response.getVariableAsInteger(NXCPCodes.VID_QSIZE_CONF_POLLER));\r
+               stats.put("QSIZE_DCI_POLLER", response.getVariableAsInteger(NXCPCodes.VID_QSIZE_DCI_POLLER));\r
+               stats.put("QSIZE_DBWRITER", response.getVariableAsInteger(NXCPCodes.VID_QSIZE_DBWRITER));\r
+               stats.put("QSIZE_EVENT", response.getVariableAsInteger(NXCPCodes.VID_QSIZE_EVENT));\r
+               stats.put("QSIZE_DISCOVERY", response.getVariableAsInteger(NXCPCodes.VID_QSIZE_DISCOVERY));\r
+               stats.put("QSIZE_NODE_POLLER", response.getVariableAsInteger(NXCPCodes.VID_QSIZE_NODE_POLLER));\r
+               stats.put("QSIZE_ROUTE_POLLER", response.getVariableAsInteger(NXCPCodes.VID_QSIZE_ROUTE_POLLER));\r
+               stats.put("QSIZE_STATUS_POLLER", response.getVariableAsInteger(NXCPCodes.VID_QSIZE_STATUS_POLLER));\r
+\r
+               stats.put("ALARM_COUNT", response.getVariableAsInteger(NXCPCodes.VID_NUM_ALARMS));\r
+               stats.put("ALARMS_BY_SEVERITY", response.getVariableAsUInt32Array(NXCPCodes.VID_ALARMS_BY_SEVERITY));\r
+               \r
+               return stats;\r
+       }\r
 }\r
diff --git a/src/java/netxms-eclipse/Dashboard/.classpath b/src/java/netxms-eclipse/Dashboard/.classpath
new file mode 100644 (file)
index 0000000..8a8f166
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+       <classpathentry kind="src" path="src"/>\r
+       <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
diff --git a/src/java/netxms-eclipse/Dashboard/.project b/src/java/netxms-eclipse/Dashboard/.project
new file mode 100644 (file)
index 0000000..fc675f5
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>nxmc-dashboard</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.ManifestBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.eclipse.pde.SchemaBuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.pde.PluginNature</nature>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/src/java/netxms-eclipse/Dashboard/.settings/org.eclipse.jdt.core.prefs b/src/java/netxms-eclipse/Dashboard/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..5b04706
--- /dev/null
@@ -0,0 +1,8 @@
+#Fri Jan 29 13:02:02 EET 2010\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.6\r
diff --git a/src/java/netxms-eclipse/Dashboard/META-INF/MANIFEST.MF b/src/java/netxms-eclipse/Dashboard/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..0615c3a
--- /dev/null
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: NXMC Dashboard
+Bundle-SymbolicName: org.netxms.ui.eclipse.dashboard;singleton:=true
+Bundle-Version: 1.1.0
+Bundle-Activator: org.netxms.ui.eclipse.dashboard.Activator
+Bundle-Vendor: netxms.org
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.netxms.ui.eclipse.library;bundle-version="1.1.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/src/java/netxms-eclipse/Dashboard/build.properties b/src/java/netxms-eclipse/Dashboard/build.properties
new file mode 100644 (file)
index 0000000..67665fa
--- /dev/null
@@ -0,0 +1,7 @@
+source.. = src/\r
+output.. = bin/\r
+bin.includes = META-INF/,\\r
+               .,\\r
+               plugin.xml,\\r
+               icons/dashboard.png,\\r
+               icons/server_stats.png\r
diff --git a/src/java/netxms-eclipse/Dashboard/icons/dashboard.png b/src/java/netxms-eclipse/Dashboard/icons/dashboard.png
new file mode 100644 (file)
index 0000000..3bc0bd3
Binary files /dev/null and b/src/java/netxms-eclipse/Dashboard/icons/dashboard.png differ
diff --git a/src/java/netxms-eclipse/Dashboard/icons/server_stats.png b/src/java/netxms-eclipse/Dashboard/icons/server_stats.png
new file mode 100644 (file)
index 0000000..1128d3f
Binary files /dev/null and b/src/java/netxms-eclipse/Dashboard/icons/server_stats.png differ
diff --git a/src/java/netxms-eclipse/Dashboard/plugin.xml b/src/java/netxms-eclipse/Dashboard/plugin.xml
new file mode 100644 (file)
index 0000000..19c50b2
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<?eclipse version="3.4"?>\r
+<plugin>\r
+\r
+   <extension\r
+         point="org.eclipse.ui.perspectives">\r
+      <perspective\r
+            name="Dashboard"\r
+            icon="icons/dashboard.png"\r
+            class="org.netxms.ui.eclipse.dashboard.perspectives.DashboardPerspective"\r
+            id="org.netxms.ui.eclipse.dashboard.DashboardPerspective">\r
+      </perspective>\r
+   </extension>\r
+\r
+</plugin>\r
diff --git a/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/Activator.java b/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/Activator.java
new file mode 100644 (file)
index 0000000..d0fd807
--- /dev/null
@@ -0,0 +1,92 @@
+/**\r
+ * NetXMS - open source network management system\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
+ * 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.dashboard;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.eclipse.ui.plugin.AbstractUIPlugin;\r
+import org.osgi.framework.BundleContext;\r
+\r
+/**\r
+ * The activator class controls the plug-in life cycle\r
+ */\r
+public class Activator extends AbstractUIPlugin\r
+{\r
+\r
+       // The plug-in ID\r
+       public static final String PLUGIN_ID = "org.netxms.ui.eclipse.dashboard";\r
+\r
+       // The shared instance\r
+       private static Activator plugin;\r
+\r
+       /**\r
+        * The constructor\r
+        */\r
+       public Activator()\r
+       {\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see\r
+        * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext\r
+        * )\r
+        */\r
+       public void start(BundleContext context) throws Exception\r
+       {\r
+               super.start(context);\r
+               plugin = this;\r
+       }\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see\r
+        * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext\r
+        * )\r
+        */\r
+       public void stop(BundleContext context) throws Exception\r
+       {\r
+               plugin = null;\r
+               super.stop(context);\r
+       }\r
+\r
+       /**\r
+        * Returns the shared instance\r
+        * \r
+        * @return the shared instance\r
+        */\r
+       public static Activator getDefault()\r
+       {\r
+               return plugin;\r
+       }\r
+\r
+       /**\r
+        * Returns an image descriptor for the image file at the given plug-in\r
+        * relative path\r
+        * \r
+        * @param path\r
+        *           the path\r
+        * @return the image descriptor\r
+        */\r
+       public static ImageDescriptor getImageDescriptor(String path)\r
+       {\r
+               return imageDescriptorFromPlugin(PLUGIN_ID, path);\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/perspectives/DashboardPerspective.java b/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/perspectives/DashboardPerspective.java
new file mode 100644 (file)
index 0000000..5d2153f
--- /dev/null
@@ -0,0 +1,38 @@
+/**\r
+ * NetXMS - open source network management system\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
+ * 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.dashboard.perspectives;\r
+\r
+import org.eclipse.ui.IPageLayout;\r
+import org.eclipse.ui.IPerspectiveFactory;\r
+\r
+/**\r
+ * Dashboard perspective\r
+ *\r
+ */\r
+public class DashboardPerspective implements IPerspectiveFactory\r
+{\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)\r
+        */\r
+       @Override\r
+       public void createInitialLayout(IPageLayout layout)\r
+       {\r
+               layout.setEditorAreaVisible(false);\r
+       }\r
+}\r
diff --git a/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/views/ServerStats.java b/src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/views/ServerStats.java
new file mode 100644 (file)
index 0000000..c69cffc
--- /dev/null
@@ -0,0 +1,49 @@
+/**\r
+ * NetXMS - open source network management system\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
+ * 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.dashboard.views;\r
+\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.ui.part.ViewPart;\r
+\r
+/**\r
+ * Server stats view\r
+ *\r
+ */\r
+public class ServerStats extends ViewPart\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
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.part.WorkbenchPart#setFocus()\r
+        */\r
+       @Override\r
+       public void setFocus()\r
+       {\r
+               // TODO Auto-generated method stub\r
+\r
+       }\r
+\r
+}\r
index aab2398..054e145 100644 (file)
@@ -30,7 +30,7 @@ import org.eclipse.swt.widgets.Text;
 import org.netxms.ui.eclipse.tools.WidgetHelper;\r
 \r
 /**\r
- * @author victor\r
+ * Dialog for editing rule comments\r
  *\r
  */\r
 public class EditCommentsDlg extends Dialog\r
index b3d4cbc..55f3bc3 100644 (file)
@@ -1,3 +1,4 @@
 org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight\r
 org.eclipse.ui/SHOW_MEMORY_MONITOR = true\r
 org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true\r
+org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS = org.netxms.ui.eclipse.dashboard.DashboardPerspective\r
index 494b1c0..4032da0 100644 (file)
@@ -1,5 +1,20 @@
 /**\r
- * \r
+ * NetXMS - open source network management system\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
+ * 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.console.perspectives;\r
 \r
@@ -7,7 +22,7 @@ import org.eclipse.ui.IPageLayout;
 import org.eclipse.ui.IPerspectiveFactory;\r
 \r
 /**\r
- * @author Victor\r
+ * Default perspective\r
  *\r
  */\r
 public class DefaultPerspective implements IPerspectiveFactory\r