New object tool type "server script"
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 19 Sep 2016 06:49:53 +0000 (09:49 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Mon, 19 Sep 2016 06:49:53 +0000 (09:49 +0300)
57 files changed:
ChangeLog
include/nms_cscp.h
include/nms_util.h
include/nxtools.h
src/java/client/netxms-base/src/main/java/org/netxms/base/NXCPCodes.java
src/java/client/netxms-client/src/main/java/org/netxms/client/NXCSession.java
src/java/client/netxms-client/src/main/java/org/netxms/client/objecttools/ObjectTool.java
src/java/netxms-eclipse/ObjectTools/META-INF/MANIFEST.MF
src/java/netxms-eclipse/ObjectTools/OSGI-INF/l10n/bundle.properties
src/java/netxms-eclipse/ObjectTools/OSGI-INF/l10n/bundle_cs.properties
src/java/netxms-eclipse/ObjectTools/OSGI-INF/l10n/bundle_de.properties
src/java/netxms-eclipse/ObjectTools/OSGI-INF/l10n/bundle_es.properties
src/java/netxms-eclipse/ObjectTools/OSGI-INF/l10n/bundle_fr.properties
src/java/netxms-eclipse/ObjectTools/OSGI-INF/l10n/bundle_pt.properties
src/java/netxms-eclipse/ObjectTools/OSGI-INF/l10n/bundle_ru.properties
src/java/netxms-eclipse/ObjectTools/OSGI-INF/l10n/bundle_zh_CN.properties
src/java/netxms-eclipse/ObjectTools/plugin.xml
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/Messages.java
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/api/ObjectToolExecutor.java
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages.properties
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_cs.properties
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_de.properties
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_es.properties
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_fr.properties
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_pt.properties
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_ru.properties
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_zh_CN.properties
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/propertypages/General.java
src/java/netxms-eclipse/ObjectTools/src/org/netxms/ui/eclipse/objecttools/views/helpers/ObjectToolsLabelProvider.java
src/libnetxms/nxcp.cpp
src/libnetxms/tools.cpp
src/server/core/objtools.cpp
src/server/core/session.cpp
src/server/include/nms_core.h
webui/webapp/ObjectTools/META-INF/MANIFEST.MF
webui/webapp/ObjectTools/OSGI-INF/l10n/bundle.properties
webui/webapp/ObjectTools/OSGI-INF/l10n/bundle_cs.properties
webui/webapp/ObjectTools/OSGI-INF/l10n/bundle_de.properties
webui/webapp/ObjectTools/OSGI-INF/l10n/bundle_es.properties
webui/webapp/ObjectTools/OSGI-INF/l10n/bundle_fr.properties
webui/webapp/ObjectTools/OSGI-INF/l10n/bundle_pt.properties
webui/webapp/ObjectTools/OSGI-INF/l10n/bundle_ru.properties
webui/webapp/ObjectTools/OSGI-INF/l10n/bundle_zh_CN.properties
webui/webapp/ObjectTools/plugin.xml
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/Messages.java
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/ObjectToolsAdapterFactory.java
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/api/ObjectToolExecutor.java
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages.properties
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_cs.properties
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_de.properties
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_es.properties
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_fr.properties
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_pt.properties
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_ru.properties
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/messages_zh_CN.properties
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/propertypages/General.java
webui/webapp/ObjectTools/src/org/netxms/ui/eclipse/objecttools/views/helpers/ObjectToolsLabelProvider.java

index bc969df..f7f4482 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
 - Agent effective user and group can be set in configuration file
 - Agent environment variables can be set in configuration file
 - Added method "getResourceOwner" and attribute "nodes" to NXSL "Cluster" class
+- New object tool type "server script"
 - New agent metrics for self-monitoring:
        Agent.SyslogProxy.IsEnabled, Agent.SyslogProxy.ReceivedMessages, Agent.SyslogProxy.QueueSize
 - Management console
index 377218f..af3abe8 100644 (file)
@@ -319,7 +319,7 @@ typedef struct
 #define CMD_DELETE_ACTION              0x0052
 #define CMD_ACTION_DATA                0x0053
 #define CMD_SETUP_AGENT_TUNNEL         0x0054
-//UNUSED: #define CMD_CONTAINER_CAT_DATA         0x0055
+#define CMD_EXECUTE_LIBRARY_SCRIPT     0x0055
 //UNUSED: #define CMD_DELETE_CONTAINER_CAT       0x0056
 //UNUSED: #define CMD_CREATE_CONTAINER_CAT       0x0057
 //UNUSED: #define CMD_MODIFY_CONTAINER_CAT       0x0058
index 77b300b..f37481e 100644 (file)
@@ -2004,6 +2004,8 @@ bool LIBNETXMS_EXPORTABLE XMLGetAttrBoolean(const char **attrs, const char *name
 String LIBNETXMS_EXPORTABLE EscapeStringForJSON(const TCHAR *s);
 String LIBNETXMS_EXPORTABLE EscapeStringForAgent(const TCHAR *s);
 
+StringList LIBNETXMS_EXPORTABLE *ParseCommandLine(const TCHAR *cmdline);
+
 #if !defined(_WIN32) && !defined(_NETWARE) && defined(NMS_THREADS_H_INCLUDED)
 void LIBNETXMS_EXPORTABLE StartMainLoop(ThreadFunction pfSignalHandler, ThreadFunction pfMain);
 #endif
index dc52dbe..a74bc43 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** NetXMS - Network Management System
-** Copyright (C) 2003-2014 Victor Kirhenshtein
+** Copyright (C) 2003-2016 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
 #ifndef _nxtools_h
 #define _nxtools_h
 
-
-//
-// Tool types
-//
-
+/**
+ * Tool types
+ */
 #define TOOL_TYPE_INTERNAL          0
 #define TOOL_TYPE_ACTION            1
 #define TOOL_TYPE_TABLE_SNMP        2
@@ -35,6 +33,8 @@
 #define TOOL_TYPE_URL               4
 #define TOOL_TYPE_COMMAND           5
 #define TOOL_TYPE_SERVER_COMMAND    6
+#define TOOL_TYPE_FILE_DOWNLOAD     7
+#define TOOL_TYPE_SERVER_SCRIPT     8
 
 
 //
index cbe8665..69d10a1 100644 (file)
@@ -108,10 +108,10 @@ public class NXCPCodes
        public static final int CMD_DELETE_ACTION = 0x0052;
        public static final int CMD_ACTION_DATA = 0x0053;
        public static final int CMD_GET_CONTAINER_CAT_LIST = 0x0054;
-       public static final int CMD_CONTAINER_CAT_DATA = 0x0055;
-       public static final int CMD_DELETE_CONTAINER_CAT = 0x0056;
-       public static final int CMD_CREATE_CONTAINER_CAT = 0x0057;
-       public static final int CMD_MODIFY_CONTAINER_CAT = 0x0058;
+       public static final int CMD_EXECUTE_LIBRARY_SCRIPT = 0x0055;
+       // UNUSED: public static final int CMD_DELETE_CONTAINER_CAT = 0x0056;
+       // UNUSED: public static final int CMD_CREATE_CONTAINER_CAT = 0x0057;
+       // UNUSED: public static final int CMD_MODIFY_CONTAINER_CAT = 0x0058;
        public static final int CMD_POLL_NODE = 0x0059;
        public static final int CMD_POLLING_INFO = 0x005A;
        public static final int CMD_COPY_DCI = 0x005B;
index a1b9442..0016a01 100644 (file)
@@ -5386,62 +5386,111 @@ public class NXCSession
    }
    
    /**
-    * Execute script.
-    *
-    * @param nodeId     ID of the node object to test script on
-    * @param script     script source code
-    * @return test execution results
-    * @throws IOException  if socket I/O error occurs
+    * Process server script execution.
+    * 
+    * @param msg prepared request message
+    * @param listener script output listener or null if caller not interested in script output
+    * @throws IOException if socket I/O error occurs
     * @throws NXCException if NetXMS server returns an error or operation was timed out
     */
-   public void executeScript(long nodeId, String script, final TextOutputListener listener) throws IOException, NXCException
+   private void processScriptExecution(NXCPMessage msg, final TextOutputListener listener) throws IOException, NXCException
    {
-      NXCPMessage msg = newMessage(NXCPCodes.CMD_EXECUTE_SCRIPT);
-      msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
-      msg.setField(NXCPCodes.VID_SCRIPT, script);
-
-      MessageHandler handler = new MessageHandler() {
-         @Override
-         public boolean processMessage(NXCPMessage m)
-         {
-            if (m.getFieldAsInt32(NXCPCodes.VID_RCC) != RCC.SUCCESS)
+      MessageHandler handler = null;
+      if (listener != null)
+      {
+         handler = new MessageHandler() {
+            @Override
+            public boolean processMessage(NXCPMessage m)
             {
-               String errorMessage = m.getFieldAsString(NXCPCodes.VID_ERROR_TEXT);
-               if ((errorMessage != null) && (listener != null))
+               if (m.getFieldAsInt32(NXCPCodes.VID_RCC) != RCC.SUCCESS)
                {
-                  listener.messageReceived(errorMessage + "\n\n");
+                  String errorMessage = m.getFieldAsString(NXCPCodes.VID_ERROR_TEXT);
+                  if ((errorMessage != null) && (listener != null))
+                  {
+                     listener.messageReceived(errorMessage + "\n\n");
+                  }
                }
+               
+               String text = m.getFieldAsString(NXCPCodes.VID_MESSAGE);
+               if ((text != null) && (listener != null))
+               {
+                  listener.messageReceived(text);
+               }
+               
+               if (m.isEndOfSequence())
+                  setComplete();
+               return true;
             }
-            
-            String text = m.getFieldAsString(NXCPCodes.VID_MESSAGE);
-            if ((text != null) && (listener != null))
-            {
-               listener.messageReceived(text);
-            }
-            
-            if (m.isEndOfSequence())
-               setComplete();
-            return true;
-         }
-      };
-      addMessageSubscription(NXCPCodes.CMD_EXECUTE_SCRIPT_UPDATE, msg.getMessageId(), handler);
+         };
+         addMessageSubscription(NXCPCodes.CMD_EXECUTE_SCRIPT_UPDATE, msg.getMessageId(), handler);
+      }
       sendMessage(msg);
       waitForRCC(msg.getMessageId());
-      synchronized(handler)
+      if (listener != null)
       {
-         if (!handler.isComplete())
+         synchronized(handler)
          {
-            try
-            {
-               handler.wait();
-            }
-            catch(InterruptedException e)
+            if (!handler.isComplete())
             {
+               try
+               {
+                  handler.wait();
+               }
+               catch(InterruptedException e)
+               {
+               }
             }
          }
+         if (handler.isTimeout())
+            throw new NXCException(RCC.TIMEOUT);
       }
-      if (handler.isTimeout())
-         throw new NXCException(RCC.TIMEOUT);
+   }
+   
+   /**
+    * Execute library script on object. Script name interpreted as command line with server-side macro substitution. Map inputValues
+    * can be used to pass data for %() macros.
+    * 
+    * @param nodeId node ID to execute script on
+    * @param script script name and parameters
+    * @param inputFields input values map for %() macro substitution (can be null)
+    * @param listener script output listener
+    * @throws IOException if socket I/O error occurs
+    * @throws NXCException if NetXMS server returns an error or operation was timed out
+    */
+   public void executeLibraryScript(long nodeId, String script, Map<String, String> inputFields, final TextOutputListener listener) throws IOException, NXCException
+   {
+      NXCPMessage msg = newMessage(NXCPCodes.CMD_EXECUTE_LIBRARY_SCRIPT);
+      msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int)nodeId);
+      msg.setField(NXCPCodes.VID_SCRIPT, script);
+      msg.setField(NXCPCodes.VID_RECEIVE_OUTPUT, listener != null);
+      if (inputFields != null)
+      {
+         msg.setFieldInt16(NXCPCodes.VID_NUM_FIELDS, inputFields.size());
+         long fieldId = NXCPCodes.VID_FIELD_LIST_BASE;
+         for(Entry<String, String> e : inputFields.entrySet())
+         {
+            msg.setField(fieldId++, e.getKey());
+            msg.setField(fieldId++, e.getValue());
+         }
+      }
+      processScriptExecution(msg, listener);
+   }
+   
+   /**
+    * Execute script.
+    *
+    * @param nodeId ID of the node object to test script on
+    * @param script script source code
+    * @param listener script output listener
+    * @throws IOException if socket I/O error occurs
+    * @throws NXCException if NetXMS server returns an error or operation was timed out
+    */
+   public void executeScript(long nodeId, String script, final TextOutputListener listener) throws IOException, NXCException
+   {
+      NXCPMessage msg = newMessage(NXCPCodes.CMD_EXECUTE_SCRIPT);
+      msg.setFieldInt32(NXCPCodes.VID_OBJECT_ID, (int)nodeId);
+      msg.setField(NXCPCodes.VID_SCRIPT, script);
+      processScriptExecution(msg, listener);
    }
 
    /**
index 7351e38..b797917 100644 (file)
@@ -44,18 +44,19 @@ public class ObjectTool
        public static final int TYPE_LOCAL_COMMAND  = 5;
        public static final int TYPE_SERVER_COMMAND = 6;
        public static final int TYPE_FILE_DOWNLOAD  = 7;
+   public static final int TYPE_SERVER_SCRIPT  = 8;
        
-       public static final int REQUIRES_SNMP             = 0x00000001;
-       public static final int REQUIRES_AGENT            = 0x00000002;
-       public static final int REQUIRES_OID_MATCH        = 0x00000004;
-       public static final int ASK_CONFIRMATION          = 0x00000008;
-       public static final int GENERATES_OUTPUT          = 0x00000010;
-       public static final int DISABLED                  = 0x00000020;
-       public static final int SHOW_IN_COMMANDS          = 0x00000040;
-   public static final int REQUIRES_NODE_OS_MATCH  = 0x00000080;
-   public static final int REQUIRES_TEMPLATE_MATCH   = 0x00000100;
-       public static final int SNMP_INDEXED_BY_VALUE     = 0x00010000;
-       public static final int REQUIRES_WORKSTATION_OS_MATCH   = 0x00020000;
+       public static final int REQUIRES_SNMP                 = 0x00000001;
+       public static final int REQUIRES_AGENT                = 0x00000002;
+       public static final int REQUIRES_OID_MATCH            = 0x00000004;
+       public static final int ASK_CONFIRMATION              = 0x00000008;
+       public static final int GENERATES_OUTPUT              = 0x00000010;
+       public static final int DISABLED                      = 0x00000020;
+       public static final int SHOW_IN_COMMANDS              = 0x00000040;
+   public static final int REQUIRES_NODE_OS_MATCH        = 0x00000080;
+   public static final int REQUIRES_TEMPLATE_MATCH       = 0x00000100;
+       public static final int SNMP_INDEXED_BY_VALUE         = 0x00010000;
+       public static final int REQUIRES_WORKSTATION_OS_MATCH = 0x00020000;
        
        protected long id;
        protected String name;
index 54a5391..3e0d39a 100644 (file)
@@ -2,18 +2,18 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: NXMC Object Tools plugin
 Bundle-SymbolicName: org.netxms.ui.eclipse.objecttools;singleton:=true
-Bundle-Version: 2.0.8
+Bundle-Version: 2.1.0
 Bundle-Activator: org.netxms.ui.eclipse.objecttools.Activator
 Bundle-Vendor: netxms.org
 Require-Bundle: org.eclipse.ui;bundle-version="3.8.2",
  org.eclipse.core.runtime;bundle-version="3.8.0",
  org.eclipse.core.expressions;bundle-version="3.4.400",
  org.eclipse.ui.console;bundle-version="3.5.100",
- org.netxms.ui.eclipse.clientlibrary;bundle-version="2.0.10",
- org.netxms.ui.eclipse.console;bundle-version="2.0.10",
+ org.netxms.ui.eclipse.clientlibrary;bundle-version="2.1.0",
+ org.netxms.ui.eclipse.console;bundle-version="2.1.0",
  org.netxms.ui.eclipse.usermanager;bundle-version="2.0.8",
  org.netxms.ui.eclipse.snmp;bundle-version="2.0.0",
- org.netxms.ui.eclipse.objectbrowser;bundle-version="2.0.7",
+ org.netxms.ui.eclipse.objectbrowser;bundle-version="2.1.0",
  org.netxms.ui.eclipse.filemanager;bundle-version="2.0.6"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
index 79a51cf..107ba80 100644 (file)
@@ -6,6 +6,7 @@ view.name.WebBrowser = Web Browser
 view.name.LocalCommand = Local Command
 view.name.AgentAction=Agent Action
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 command.description.ObjectTools = Open object tools editor
 command.name.ObjectTools = Object Tools
 command.description.Terminate = Terminate running external command
index 0032d01..ed0f46e 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer=Prohl\u00ed\u017ee\u010d soubor\u016f
 view.name.LocalCommand=Lok\u00e1ln\u00ed p\u0159\u00edkaz
 view.name.ObjectTools=N\u00e1stroje objekt\u016f
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults=Tabulka n\u00e1stroj\u016f v\u00fdsledky
 view.name.WebBrowser=Web prohl\u00ed\u017ee\u010d
index c26146b..b13d2bf 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer= File Viewer
 view.name.LocalCommand= Local Command
 view.name.ObjectTools= Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults= Table Tool Results
 view.name.WebBrowser= Web Browser
index ba367eb..898ebed 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer=File Viewer
 view.name.LocalCommand=Local Command
 view.name.ObjectTools=Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults=Table Tool Results
 view.name.WebBrowser=Web Browser
index 0b8abcf..759dfd3 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer= File Viewer
 view.name.LocalCommand= Local Command
 view.name.ObjectTools= Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults= Table Tool Results
 view.name.WebBrowser= Web Browser
index 0b8abcf..759dfd3 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer= File Viewer
 view.name.LocalCommand= Local Command
 view.name.ObjectTools= Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults= Table Tool Results
 view.name.WebBrowser= Web Browser
index 8ccc4eb..99bce54 100644 (file)
@@ -17,6 +17,7 @@ view.name.AgentAction=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0
 view.name.FileViewer=\u0421\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0444\u0430\u0439\u043b\u043e\u0432
 view.name.LocalCommand=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e)
 view.name.ObjectTools=\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432
-view.name.ServerCommand=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
+view.name.ServerCommand=\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
+view.name.ServerScript=\u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
 view.name.TableResults=\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432
 view.name.WebBrowser=\u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440
index eeb7da5..292bb66 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer=File Viewer
 view.name.LocalCommand=Local Command
 view.name.ObjectTools=Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults=Table Tool Results
 view.name.WebBrowser=Web Browser
index 22c240a..6d82263 100644 (file)
             name="%view.name.ServerCommand"
             restorable="false">
       </view>
+      <view
+            allowMultiple="true"
+            class="org.netxms.ui.eclipse.objecttools.views.ServerScriptResults"
+            icon="icons/console.png"
+            id="org.netxms.ui.eclipse.objecttools.views.ServerScriptResults"
+            name="%view.name.ServerScript"
+            restorable="false">
+      </view>
    </extension>
    <extension
          point="org.eclipse.ui.commands">
index b52d377..bcd123c 100644 (file)
@@ -79,6 +79,7 @@ public class Messages extends NLS
    public static String General_RegExp;
    public static String General_RemoteFileName;
    public static String General_RequiresConfirmation;
+   public static String General_Script;
    public static String General_Select;
    public static String General_ShowInCommands;
    public static String General_ShowInCommandsTooltip;
@@ -124,6 +125,8 @@ public class Messages extends NLS
    public static String ObjectToolsDynamicMenu_MultipleNodes;
    public static String ObjectToolsDynamicMenu_ServerCmdExecError;
    public static String ObjectToolsDynamicMenu_ServerCommandExecuted;
+   public static String ObjectToolsDynamicMenu_ServerScriptExecError;
+   public static String ObjectToolsDynamicMenu_ServerScriptExecuted;
    public static String ObjectToolsDynamicMenu_ToolExecution;
    public static String ObjectToolsDynamicMenu_TopLevelLabel;
    public static String ObjectToolsEditor_AckToDisableObjectTool;
@@ -160,6 +163,7 @@ public class Messages extends NLS
    public static String ObjectToolsLabelProvider_TypeInternal;
    public static String ObjectToolsLabelProvider_TypeLocalCmd;
    public static String ObjectToolsLabelProvider_TypeServerCmd;
+   public static String ObjectToolsLabelProvider_TypeServerScript;
    public static String ObjectToolsLabelProvider_TypeSNMPList;
    public static String ObjectToolsLabelProvider_TypeURL;
    public static String OpenObjectToolsEditor_Error;
index 7e1a198..f6784bb 100644 (file)
@@ -50,6 +50,7 @@ import org.netxms.ui.eclipse.objecttools.views.AgentActionResults;
 import org.netxms.ui.eclipse.objecttools.views.BrowserView;
 import org.netxms.ui.eclipse.objecttools.views.LocalCommandResults;
 import org.netxms.ui.eclipse.objecttools.views.ServerCommandResults;
+import org.netxms.ui.eclipse.objecttools.views.ServerScriptResults;
 import org.netxms.ui.eclipse.objecttools.views.TableToolResults;
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;
 import org.netxms.ui.eclipse.tools.MessageDialogHelper;
@@ -252,6 +253,9 @@ public final class ObjectToolExecutor
          case ObjectTool.TYPE_SERVER_COMMAND:
             executeServerCommand(node, tool, inputValues);
             break;
+         case ObjectTool.TYPE_SERVER_SCRIPT:
+            executeServerScript(node, tool, inputValues);
+            break;
          case ObjectTool.TYPE_TABLE_AGENT:
          case ObjectTool.TYPE_TABLE_SNMP:
             executeTableTool(node, tool);
@@ -468,6 +472,55 @@ public final class ObjectToolExecutor
    }
    
    /**
+    * Execute server script
+    * 
+    * @param node
+    * @param tool
+    * @param inputValues 
+    */
+   private static void executeServerScript(final NodeInfo node, final ObjectTool tool, final Map<String, String> inputValues)
+   {
+      final NXCSession session = (NXCSession)ConsoleSharedData.getSession();
+      if ((tool.getFlags() & ObjectTool.GENERATES_OUTPUT) == 0)
+      {      
+         new ConsoleJob("Execute server script", null, Activator.PLUGIN_ID, null) {
+            @Override
+            protected void runInternal(IProgressMonitor monitor) throws Exception
+            {
+               session.executeLibraryScript(node.object.getObjectId(), tool.getData(), inputValues, null);
+               runInUIThread(new Runnable() {
+                  @Override
+                  public void run()
+                  {
+                     MessageDialogHelper.openInformation(null, Messages.get().ObjectToolsDynamicMenu_Information, Messages.get().ObjectToolsDynamicMenu_ServerScriptExecuted);
+                  }
+               });
+            }
+            
+            @Override
+            protected String getErrorMessage()
+            {
+               return Messages.get().ObjectToolsDynamicMenu_ServerScriptExecError;
+            }
+         }.start();
+      }
+      else
+      {
+         final String secondaryId = Long.toString(node.object.getObjectId()) + "&" + Long.toString(tool.getId()); //$NON-NLS-1$
+         final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+         try
+         {
+            ServerScriptResults view = (ServerScriptResults)window.getActivePage().showView(ServerScriptResults.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
+            view.executeScript(tool.getData(), inputValues);
+         }
+         catch(Exception e)
+         {
+            MessageDialogHelper.openError(window.getShell(), Messages.get().ObjectToolsDynamicMenu_Error, String.format(Messages.get().ObjectToolsDynamicMenu_ErrorOpeningView, e.getLocalizedMessage()));
+         }
+      }
+   }
+   
+   /**
     * Execute local command
     * 
     * @param node
index 5622fc1..0fd09a6 100644 (file)
@@ -72,6 +72,7 @@ General_Parameter=Parameter
 General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -115,8 +116,10 @@ ObjectToolsDynamicMenu_ExecuteServerCmd=Execute server command
 ObjectToolsDynamicMenu_HandlerNotDefined=Cannot execute object tool: handler not defined
 ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
-ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
+ObjectToolsDynamicMenu_ServerCmdExecError=Cannot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -153,6 +156,7 @@ ObjectToolsLabelProvider_TypeDownloadFile=Download File
 ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
index 717cc38..c8082e9 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regul\u00e1rn\u00ed v\u00fdraz
 General_RemoteFileName=N\u00e1zev vzd\u00e1len\u00e9ho souboru
 General_RequiresConfirmation=Tento n\u00e1stroj pot\u0159ebuje potvrzen\u00ed p\u0159ed spu\u0161t\u011bn\u00edm
 General_SNMPListOptions=Mo\u017enosti SNMP tabulky
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Informace
 ObjectToolsDynamicMenu_MultipleNodes=<v\u00edce prvk\u016f>
 ObjectToolsDynamicMenu_ServerCmdExecError=Nelze spustit p\u0159\u00edkaz na serveru
 ObjectToolsDynamicMenu_ServerCommandExecuted=P\u0159\u00edkaz serveru usp\u011b\u0161n\u011b spu\u0161t\u011bn
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=N\u00e1stroj spu\u0161t\u011bn\u00ed
 ObjectToolsDynamicMenu_TopLevelLabel=&N\u00e1stroje
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Intern\u00ed
 ObjectToolsLabelProvider_TypeLocalCmd=Lok\u00e1ln\u00ed p\u0159\u00edkaz
 ObjectToolsLabelProvider_TypeSNMPList=SNMP tabulka
 ObjectToolsLabelProvider_TypeServerCmd=Serverov\u00fd p\u0159\u00edkaz
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Chyba
 OpenObjectToolsEditor_ErrorOpenView=Chyba p\u0159i otev\u00edr\u00e1n\u00ed\:
index f08184d..005cd51 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view: 
index 86168da..d6fe2b5 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view:
index f08184d..005cd51 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view: 
index f08184d..005cd51 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view: 
index b224418..64ca438 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u04
 General_RemoteFileName=\u0418\u043c\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430
 General_RequiresConfirmation=\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435
 General_SNMPListOptions=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u043f\u0438\u0441\u043a\u0430 SNMP
+General_Script=\u0421\u043a\u0440\u0438\u043f\u0442
 General_Select=\u0412\u044b\u0431\u0440\u0430\u0442\u044c...
 General_ShowInCommands=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u0430\u0445
 General_ShowInCommandsTooltip=\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u0443\u0437\u043b\u0430
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0
 ObjectToolsDynamicMenu_MultipleNodes=<\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u0437\u043b\u043e\u0432>
 ObjectToolsDynamicMenu_ServerCmdExecError=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
 ObjectToolsDynamicMenu_ServerCommandExecuted=\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e
+ObjectToolsDynamicMenu_ServerScriptExecError=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
+ObjectToolsDynamicMenu_ServerScriptExecuted=\u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0443\u0441\u043f\u0435\u0448\u043d\u043e
 ObjectToolsDynamicMenu_ToolExecution=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430
 ObjectToolsDynamicMenu_TopLevelLabel=&\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b
 ObjectToolsEditor_AckToDisableObjectTool=\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442?
@@ -153,7 +156,8 @@ ObjectToolsLabelProvider_TypeDownloadFile=\u0417\u0430\u0433\u0440\u0443\u0437\u
 ObjectToolsLabelProvider_TypeInternal=\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430
 ObjectToolsLabelProvider_TypeLocalCmd=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e)
 ObjectToolsLabelProvider_TypeSNMPList=\u0421\u043f\u0438\u0441\u043e\u043a SNMP
-ObjectToolsLabelProvider_TypeServerCmd=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
+ObjectToolsLabelProvider_TypeServerCmd=\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
+ObjectToolsLabelProvider_TypeServerScript=\u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=\u041e\u0448\u0438\u0431\u043a\u0430
 OpenObjectToolsEditor_ErrorOpenView=\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f:
index 86168da..d6fe2b5 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view:
index 5d0368c..0efaf11 100644 (file)
@@ -139,6 +139,10 @@ public class General extends PropertyPage
                                textData.setLabel(Messages.get().General_Command);
                                createOutputGroup(dialogArea);
                                break;
+         case ObjectTool.TYPE_SERVER_SCRIPT:
+            textData.setLabel(Messages.get().General_Script);
+            createOutputGroup(dialogArea);
+            break;
                        case ObjectTool.TYPE_ACTION:
                                textData.setLabel(Messages.get().General_AgentCommand);
                                createOutputGroup(dialogArea);
@@ -537,6 +541,7 @@ public class General extends PropertyPage
                
                if ((objectTool.getType() == ObjectTool.TYPE_LOCAL_COMMAND) ||
                    (objectTool.getType() == ObjectTool.TYPE_SERVER_COMMAND) ||
+          (objectTool.getType() == ObjectTool.TYPE_SERVER_SCRIPT) ||
                    (objectTool.getType() == ObjectTool.TYPE_ACTION))
                {
                        if (checkOutput.getSelection())
index d6bed90..e42eee6 100644 (file)
@@ -40,10 +40,11 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
                Messages.get().ObjectToolsLabelProvider_TypeURL,
                Messages.get().ObjectToolsLabelProvider_TypeLocalCmd,
                Messages.get().ObjectToolsLabelProvider_TypeServerCmd,
-               Messages.get().ObjectToolsLabelProvider_TypeDownloadFile
+               Messages.get().ObjectToolsLabelProvider_TypeDownloadFile,
+      Messages.get().ObjectToolsLabelProvider_TypeServerScript
        };
        
-       private Image[] toolTypeImages = new Image[toolTypes.length+1];
+       private Image[] toolTypeImages = new Image[toolTypes.length + 1];
        
        /**
         * The constructor
@@ -58,7 +59,8 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
                toolTypeImages[5] = Activator.getImageDescriptor("icons/console.png").createImage(); //$NON-NLS-1$
                toolTypeImages[6] = Activator.getImageDescriptor("icons/console.png").createImage(); //$NON-NLS-1$
                toolTypeImages[7] = Activator.getImageDescriptor("icons/file_download.png").createImage(); //$NON-NLS-1$
-               toolTypeImages[8] = Activator.getImageDescriptor("icons/stop.png").createImage(); //$NON-NLS-1$
+      toolTypeImages[8] = Activator.getImageDescriptor("icons/script.png").createImage(); //$NON-NLS-1$
+               toolTypeImages[9] = Activator.getImageDescriptor("icons/stop.png").createImage(); //$NON-NLS-1$
        }
        
        /* (non-Javadoc)
@@ -72,13 +74,13 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
 
                try
                {
-                  if((((ObjectTool)element).getFlags() & ObjectTool.DISABLED)== 0)
+                  if ((((ObjectTool)element).getFlags() & ObjectTool.DISABLED) == 0)
                   {
                      return toolTypeImages[((ObjectTool)element).getType()];
                   }
                   else
                   {
-                     return toolTypeImages[8];
+                     return toolTypeImages[toolTypeImages.length - 1];
                   }
                }
                catch(ArrayIndexOutOfBoundsException e)
@@ -107,7 +109,7 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
                                }
                                catch(ArrayIndexOutOfBoundsException e)
                                {
-                                       return "?unknown?"; //$NON-NLS-1$
+                                       return "<unknown>"; //$NON-NLS-1$
                                }
                        case ObjectToolsEditor.COLUMN_DESCRIPTION:
                                return tool.getDescription();
@@ -139,7 +141,7 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
                }
                catch(ArrayIndexOutOfBoundsException e)
                {
-                       return "?unknown?"; //$NON-NLS-1$
+                       return "<unknown>"; //$NON-NLS-1$
                }
        }
        
index 614ce41..31e49ad 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ** NetXMS - Network Management System
 ** NetXMS Foundation Library
-** Copyright (C) 2003-2015 Victor Kirhenshtein
+** Copyright (C) 2003-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published
@@ -120,7 +120,7 @@ TCHAR LIBNETXMS_EXPORTABLE *NXCPMessageCodeName(WORD code, TCHAR *pszBuffer)
       _T("CMD_DELETE_ACTION"),
       _T("CMD_ACTION_DATA"),
       _T("CMD_SETUP_AGENT_TUNNEL"),
-      _T("<unused>"),
+      _T("CMD_EXECUTE_LIBRARY_SCRIPT"),
       _T("<unused>"),
       _T("<unused>"),
       _T("<unused>"),
index 7fa466b..a00b08f 100644 (file)
@@ -2723,3 +2723,74 @@ String LIBNETXMS_EXPORTABLE EscapeStringForAgent(const TCHAR *s)
    }
    return out;
 }
+
+/**
+ * Parse command line into argumen list considering single and double quotes
+ */
+StringList LIBNETXMS_EXPORTABLE *ParseCommandLine(const TCHAR *cmdline)
+{
+   StringList *args = new StringList();
+
+   TCHAR *temp = _tcsdup(cmdline);
+   int state = 0;
+
+   TCHAR *curr = temp;
+   while(*curr == ' ')
+      curr++;
+
+   if (*curr != 0)
+   {
+      int len = (int)_tcslen(temp);
+      for(int i = (int)(curr - temp); i < len; i++)
+      {
+         switch(temp[i])
+         {
+            case ' ':
+               if (state == 0)
+               {
+                  temp[i] = 0;
+                  args->add(curr);
+                  while(temp[i + 1] == ' ')
+                     i++;
+                  curr = &temp[i + 1];
+               }
+               break;
+            case '"':
+               if (state == 2)
+                  break;   // within single quoted string
+               if (state == 0)
+               {
+                  state = 1;
+               }
+               else
+               {
+                  state = 0;
+               }
+               memmove(&temp[i], &temp[i + 1], (len - i) * sizeof(TCHAR));
+               i--;
+               break;
+            case '\'':
+               if (state == 1)
+                  break;   // within double quoted string
+               if (state == 0)
+               {
+                  state = 2;
+               }
+               else
+               {
+                  state = 0;
+               }
+               memmove(&temp[i], &temp[i + 1], (len - i) * sizeof(TCHAR));
+               i--;
+               break;
+            default:
+               break;
+         }
+      }
+
+      if (*curr != 0)
+         args->add(curr);
+   }
+   free(temp);
+   return args;
+}
index 099fc09..de2347b 100644 (file)
@@ -104,11 +104,9 @@ BOOL IsTableTool(UINT32 toolId)
    return bResult;
 }
 
-
 /**
  * Check if user has access to the tool
  */
-
 BOOL CheckObjectToolAccess(UINT32 toolId, UINT32 userId)
 {
    DB_RESULT hResult;
index fdf33d4..421e361 100644 (file)
@@ -154,6 +154,7 @@ DEFINE_THREAD_STARTER(clearDCIData)
 DEFINE_THREAD_STARTER(createObject)
 DEFINE_THREAD_STARTER(executeAction)
 DEFINE_THREAD_STARTER(executeScript)
+DEFINE_THREAD_STARTER(executeLibraryScript)
 DEFINE_THREAD_STARTER(fileManagerControl)
 DEFINE_THREAD_STARTER(findIpAddress)
 DEFINE_THREAD_STARTER(findMacAddress)
@@ -1272,6 +1273,9 @@ void ClientSession::processingThread()
                        case CMD_EXECUTE_SCRIPT:
             CALL_IN_NEW_THREAD(executeScript, pMsg);
                                break;
+         case CMD_EXECUTE_LIBRARY_SCRIPT:
+            CALL_IN_NEW_THREAD(executeLibraryScript, pMsg);
+            break;
                        case CMD_GET_JOB_LIST:
                                sendJobList(pMsg->getId());
                                break;
@@ -11189,6 +11193,195 @@ void ClientSession::executeScript(NXCPMessage *request)
 }
 
 /**
+ * Library script execution data
+ */
+class LibraryScriptExecutionData
+{
+public:
+   NXSL_VM *vm;
+   ObjectArray<NXSL_Value> args;
+   TCHAR *name;
+
+   LibraryScriptExecutionData(NXSL_VM *_vm, StringList *_args) : args(16, 16, false)
+   {
+      vm = _vm;
+      for(int i = 1; i < _args->size(); i++)
+         args.add(new NXSL_Value(_args->get(i)));
+      name = _tcsdup(_args->get(0));
+   }
+   ~LibraryScriptExecutionData()
+   {
+      delete vm;
+      free(name);
+   }
+};
+
+/**
+ * Callback for executing library script on separate thread pool
+ */
+static void ExecuteLibraryScript(void *arg)
+{
+   LibraryScriptExecutionData *d = (LibraryScriptExecutionData *)arg;
+   nxlog_debug(6, _T("Starting background execution of library script %s"), d->name);
+   if (d->vm->run(&d->args))
+   {
+      nxlog_debug(6, _T("Background execution of library script %s completed"), d->name);
+   }
+   else
+   {
+      nxlog_debug(6, _T("Background execution of library script %s failed (%s)"), d->name, d->vm->getErrorText());
+   }
+   delete d;
+}
+
+/**
+ * Execute library script in object's context
+ */
+void ClientSession::executeLibraryScript(NXCPMessage *request)
+{
+   NXCPMessage msg;
+   bool success = false;
+   NXSL_VM *vm = NULL;
+   StringList *args = NULL;
+   bool withOutput = request->getFieldAsBoolean(VID_RECEIVE_OUTPUT);
+
+   // Prepare response message
+   msg.setCode(CMD_REQUEST_COMPLETED);
+   msg.setId(request->getId());
+
+   // Get node id and check object class and access rights
+   NetObj *object = FindObjectById(request->getFieldAsUInt32(VID_OBJECT_ID));
+   if (object != NULL)
+   {
+      if ((object->getObjectClass() == OBJECT_NODE) ||
+          (object->getObjectClass() == OBJECT_CLUSTER) ||
+          (object->getObjectClass() == OBJECT_MOBILEDEVICE) ||
+          (object->getObjectClass() == OBJECT_CHASSIS) ||
+          (object->getObjectClass() == OBJECT_CONTAINER) ||
+          (object->getObjectClass() == OBJECT_ZONE) ||
+          (object->getObjectClass() == OBJECT_SUBNET))
+      {
+         if (object->checkAccessRights(m_dwUserId, OBJECT_ACCESS_CONTROL))
+         {
+            TCHAR *script = request->getFieldAsString(VID_SCRIPT);
+            if (script != NULL)
+            {
+               // Do macro expansion if target object is a node
+               if (object->getObjectClass() == OBJECT_NODE)
+               {
+                  StringMap *inputFields;
+                  int count = request->getFieldAsInt16(VID_NUM_FIELDS);
+                  if (count > 0)
+                  {
+                     inputFields = new StringMap();
+                     UINT32 fieldId = VID_FIELD_LIST_BASE;
+                     for(int i = 0; i < count; i++)
+                     {
+                        TCHAR *name = request->getFieldAsString(fieldId++);
+                        TCHAR *value = request->getFieldAsString(fieldId++);
+                        inputFields->setPreallocated(name, value);
+                     }
+                  }
+                  else
+                  {
+                     inputFields = NULL;
+                  }
+
+                  TCHAR *expScript = ((Node *)object)->expandText(script, inputFields, m_loginName);
+                  free(script);
+                  script = expScript;
+                  delete inputFields;
+               }
+
+               args = ParseCommandLine(script);
+               if (args->size() > 0)
+               {
+                  NXSL_Environment *env = withOutput ? new NXSL_ClientSessionEnv(this, &msg) : new NXSL_ServerEnv();
+                  vm = g_pScriptLibrary->createVM(args->get(0), env);
+                  if (vm != NULL)
+                  {
+                     vm->setGlobalVariable(_T("$object"), object->createNXSLObject());
+                     if(object->getObjectClass() == OBJECT_NODE)
+                     {
+                        vm->setGlobalVariable(_T("$node"), new NXSL_Value(new NXSL_Object(&g_nxslNodeClass, object)));
+                     }
+                     msg.setField(VID_RCC, RCC_SUCCESS);
+                     sendMessage(&msg);
+                     success = true;
+                  }
+                  else
+                  {
+                     msg.setField(VID_RCC, RCC_INVALID_SCRIPT_NAME);
+                  }
+               }
+               else
+               {
+                  msg.setField(VID_RCC, RCC_INVALID_ARGUMENT);
+               }
+            }
+            else
+            {
+               msg.setField(VID_RCC, RCC_INVALID_ARGUMENT);
+            }
+         }
+         else  // User doesn't have CONTROL rights on object
+         {
+            msg.setField(VID_RCC, RCC_ACCESS_DENIED);
+         }
+      }
+      else     // Object is not a node
+      {
+         msg.setField(VID_RCC, RCC_INCOMPATIBLE_OPERATION);
+      }
+   }
+   else  // No object with given ID
+   {
+      msg.setField(VID_RCC, RCC_INVALID_OBJECT_ID);
+   }
+
+   // start execution
+   if (success)
+   {
+      if (withOutput)
+      {
+         ObjectArray<NXSL_Value> sargs(args->size() - 1, 1, false);
+         for(int i = 1; i < args->size(); i++)
+            sargs.add(new NXSL_Value(args->get(i)));
+         msg.setCode(CMD_EXECUTE_SCRIPT_UPDATE);
+         if (vm->run(&sargs))
+         {
+            TCHAR buffer[1024];
+            const TCHAR *value = vm->getResult()->getValueAsCString();
+            _sntprintf(buffer, 1024, _T("\n\n*** FINISHED ***\n\nResult: %s\n\n"), CHECK_NULL(value));
+            msg.setField(VID_MESSAGE, buffer);
+            msg.setField(VID_RCC, RCC_SUCCESS);
+            msg.setEndOfSequence();
+            sendMessage(&msg);
+         }
+         else
+         {
+            msg.setField(VID_ERROR_TEXT, vm->getErrorText());
+            msg.setField(VID_RCC, RCC_NXSL_EXECUTION_ERROR);
+            msg.setEndOfSequence();
+            sendMessage(&msg);
+         }
+         delete vm;
+      }
+      else
+      {
+         ThreadPoolExecute(g_mainThreadPool, ExecuteLibraryScript, new LibraryScriptExecutionData(vm, args));
+      }
+   }
+   else
+   {
+      // Send response
+      sendMessage(&msg);
+   }
+
+   delete args;
+}
+
+/**
  * Send list of server jobs
  */
 void ClientSession::sendJobList(UINT32 dwRqId)
index 052aa7a..d14405b 100644 (file)
@@ -463,6 +463,7 @@ private:
    DECLARE_THREAD_STARTER(createObject)
    DECLARE_THREAD_STARTER(executeAction)
    DECLARE_THREAD_STARTER(executeScript)
+   DECLARE_THREAD_STARTER(executeLibraryScript)
    DECLARE_THREAD_STARTER(fileManagerControl)
    DECLARE_THREAD_STARTER(findIpAddress)
    DECLARE_THREAD_STARTER(findMacAddress)
@@ -715,6 +716,7 @@ private:
    void getLocationHistory(NXCPMessage *request);
    void getScreenshot(NXCPMessage *request);
        void executeScript(NXCPMessage *request);
+   void executeLibraryScript(NXCPMessage *request);
    void compileScript(NXCPMessage *request);
        void resyncAgentDciConfiguration(NXCPMessage *request);
    void cleanAgentDciConfiguration(NXCPMessage *request);
index a5303d5..bc17e97 100644 (file)
@@ -2,20 +2,20 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: NXMC Object Tools plugin
 Bundle-SymbolicName: org.netxms.ui.eclipse.objecttools;singleton:=true
-Bundle-Version: 2.0.8
+Bundle-Version: 2.1.0
 Bundle-Activator: org.netxms.ui.eclipse.objecttools.Activator
 Bundle-Vendor: netxms.org
 Require-Bundle: org.eclipse.rap.ui;bundle-version="2.3.1",
  org.eclipse.core.runtime;bundle-version="3.8.0",
  org.eclipse.core.expressions;bundle-version="3.4.401",
- org.netxms.ui.eclipse.clientlibrary;bundle-version="2.0.10",
- org.netxms.webui.core;bundle-version="2.0.10",
+ org.netxms.ui.eclipse.clientlibrary;bundle-version="2.1.0",
+ org.netxms.webui.core;bundle-version="2.1.0",
  org.netxms.ui.eclipse.usermanager;bundle-version="2.0.8",
  org.netxms.ui.eclipse.snmp;bundle-version="2.0.0",
- org.netxms.ui.eclipse.objectbrowser;bundle-version="2.0.7",
+ org.netxms.ui.eclipse.objectbrowser;bundle-version="2.1.0",
  org.netxms.ui.eclipse.filemanager;bundle-version="2.0.6",
  org.eclipse.rap.filedialog;bundle-version="3.1.0",
- org.eclipse.rap.ui.workbench
+ org.eclipse.rap.ui.workbench;bundle-version="3.1.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Export-Package: org.netxms.ui.eclipse.objecttools.api
index 79a51cf..107ba80 100644 (file)
@@ -6,6 +6,7 @@ view.name.WebBrowser = Web Browser
 view.name.LocalCommand = Local Command
 view.name.AgentAction=Agent Action
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 command.description.ObjectTools = Open object tools editor
 command.name.ObjectTools = Object Tools
 command.description.Terminate = Terminate running external command
index 0032d01..ed0f46e 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer=Prohl\u00ed\u017ee\u010d soubor\u016f
 view.name.LocalCommand=Lok\u00e1ln\u00ed p\u0159\u00edkaz
 view.name.ObjectTools=N\u00e1stroje objekt\u016f
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults=Tabulka n\u00e1stroj\u016f v\u00fdsledky
 view.name.WebBrowser=Web prohl\u00ed\u017ee\u010d
index c26146b..b13d2bf 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer= File Viewer
 view.name.LocalCommand= Local Command
 view.name.ObjectTools= Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults= Table Tool Results
 view.name.WebBrowser= Web Browser
index ba367eb..898ebed 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer=File Viewer
 view.name.LocalCommand=Local Command
 view.name.ObjectTools=Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults=Table Tool Results
 view.name.WebBrowser=Web Browser
index 0b8abcf..759dfd3 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer= File Viewer
 view.name.LocalCommand= Local Command
 view.name.ObjectTools= Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults= Table Tool Results
 view.name.WebBrowser= Web Browser
index 0b8abcf..759dfd3 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer= File Viewer
 view.name.LocalCommand= Local Command
 view.name.ObjectTools= Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults= Table Tool Results
 view.name.WebBrowser= Web Browser
index b51757f..99bce54 100644 (file)
@@ -13,10 +13,11 @@ page.name.Columns=\u0421\u0442\u043e\u043b\u0431\u0446\u044b
 page.name.Filter=\u0424\u0438\u043b\u044c\u0442\u0440
 page.name.General=\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435
 page.name.InputFields=\u041f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430
-view.name.AgentAction=Agent Action
+view.name.AgentAction=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0430\u0433\u0435\u043d\u0442\u0435
 view.name.FileViewer=\u0421\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0444\u0430\u0439\u043b\u043e\u0432
-view.name.LocalCommand=\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430
+view.name.LocalCommand=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e)
 view.name.ObjectTools=\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432
-view.name.ServerCommand=Server Command
+view.name.ServerCommand=\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
+view.name.ServerScript=\u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
 view.name.TableResults=\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432
 view.name.WebBrowser=\u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440
index eeb7da5..292bb66 100644 (file)
@@ -18,5 +18,6 @@ view.name.FileViewer=File Viewer
 view.name.LocalCommand=Local Command
 view.name.ObjectTools=Object Tools
 view.name.ServerCommand=Server Command
+view.name.ServerScript=Server Script
 view.name.TableResults=Table Tool Results
 view.name.WebBrowser=Web Browser
index 797f04a..c7d1d4e 100644 (file)
             name="%view.name.ServerCommand"
             restorable="false">
       </view>
+      <view
+            allowMultiple="true"
+            class="org.netxms.ui.eclipse.objecttools.views.ServerScriptResults"
+            icon="icons/console.png"
+            id="org.netxms.ui.eclipse.objecttools.views.ServerScriptResults"
+            name="%view.name.ServerScript"
+            restorable="false">
+      </view>
    </extension>
    <extension
          point="org.eclipse.ui.commands">
index 9344385..6e6691f 100644 (file)
@@ -82,6 +82,7 @@ public class Messages extends NLS
    public String General_RegExp;
    public String General_RemoteFileName;
    public String General_RequiresConfirmation;
+   public String General_Script;
    public String General_Select;
    public String General_ShowInCommands;
    public String General_ShowInCommandsTooltip;
@@ -127,6 +128,8 @@ public class Messages extends NLS
    public String ObjectToolsDynamicMenu_MultipleNodes;
    public String ObjectToolsDynamicMenu_ServerCmdExecError;
    public String ObjectToolsDynamicMenu_ServerCommandExecuted;
+   public String ObjectToolsDynamicMenu_ServerScriptExecError;
+   public String ObjectToolsDynamicMenu_ServerScriptExecuted;
    public String ObjectToolsDynamicMenu_ToolExecution;
    public String ObjectToolsDynamicMenu_TopLevelLabel;
    public String ObjectToolsEditor_AckToDisableObjectTool;
@@ -163,6 +166,7 @@ public class Messages extends NLS
    public String ObjectToolsLabelProvider_TypeInternal;
    public String ObjectToolsLabelProvider_TypeLocalCmd;
    public String ObjectToolsLabelProvider_TypeServerCmd;
+   public String ObjectToolsLabelProvider_TypeServerScript;
    public String ObjectToolsLabelProvider_TypeSNMPList;
    public String ObjectToolsLabelProvider_TypeURL;
    public String OpenObjectToolsEditor_Error;
index 730b9a2..fb8f099 100644 (file)
@@ -105,7 +105,7 @@ public class ObjectToolsAdapterFactory implements IAdapterFactory
        /* (non-Javadoc)
         * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
         */
-       @SuppressWarnings("rawtypes")
+       @SuppressWarnings({ "rawtypes", "unchecked" })
        @Override
        public Object getAdapter(Object adaptableObject, Class adapterType)
        {
@@ -171,7 +171,7 @@ public class ObjectToolsAdapterFactory implements IAdapterFactory
        /* (non-Javadoc)
         * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
         */
-       @SuppressWarnings("rawtypes")
+       @SuppressWarnings({ "rawtypes", "unchecked" })
        @Override
        public Class[] getAdapterList()
        {
index 652bdb7..fa72756 100644 (file)
@@ -48,6 +48,7 @@ import org.netxms.ui.eclipse.objecttools.Messages;
 import org.netxms.ui.eclipse.objecttools.dialogs.ObjectToolInputDialog;
 import org.netxms.ui.eclipse.objecttools.views.AgentActionResults;
 import org.netxms.ui.eclipse.objecttools.views.ServerCommandResults;
+import org.netxms.ui.eclipse.objecttools.views.ServerScriptResults;
 import org.netxms.ui.eclipse.objecttools.views.TableToolResults;
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;
 import org.netxms.ui.eclipse.tools.MessageDialogHelper;
@@ -247,6 +248,9 @@ public final class ObjectToolExecutor
          case ObjectTool.TYPE_SERVER_COMMAND:
             executeServerCommand(node, tool, inputValues);
             break;
+         case ObjectTool.TYPE_SERVER_SCRIPT:
+            executeServerScript(node, tool, inputValues);
+            break;
          case ObjectTool.TYPE_TABLE_AGENT:
          case ObjectTool.TYPE_TABLE_SNMP:
             executeTableTool(node, tool);
@@ -425,35 +429,84 @@ public final class ObjectToolExecutor
       final NXCSession session = (NXCSession)ConsoleSharedData.getSession();
       if ((tool.getFlags() & ObjectTool.GENERATES_OUTPUT) == 0)
       {      
-      new ConsoleJob(Messages.get().ObjectToolsDynamicMenu_ExecuteServerCmd, null, Activator.PLUGIN_ID, null) {
-         @Override
-         protected void runInternal(IProgressMonitor monitor) throws Exception
-         {
+         new ConsoleJob(Messages.get().ObjectToolsDynamicMenu_ExecuteServerCmd, null, Activator.PLUGIN_ID, null) {
+            @Override
+            protected void runInternal(IProgressMonitor monitor) throws Exception
+            {
                session.executeServerCommand(node.object.getObjectId(), tool.getData(), inputValues);
-            runInUIThread(new Runnable() {
-               @Override
-               public void run()
-               {
-                  MessageDialogHelper.openInformation(null, Messages.get().ObjectToolsDynamicMenu_Information, Messages.get().ObjectToolsDynamicMenu_ServerCommandExecuted);
-               }
-            });
+               runInUIThread(new Runnable() {
+                  @Override
+                  public void run()
+                  {
+                     MessageDialogHelper.openInformation(null, Messages.get().ObjectToolsDynamicMenu_Information, Messages.get().ObjectToolsDynamicMenu_ServerCommandExecuted);
+                  }
+               });
+            }
+            
+            @Override
+            protected String getErrorMessage()
+            {
+               return Messages.get().ObjectToolsDynamicMenu_ServerCmdExecError;
+            }
+         }.start();
+      }
+      else
+      {
+         final String secondaryId = Long.toString(node.object.getObjectId()) + "&" + Long.toString(tool.getId()); //$NON-NLS-1$
+         final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+         try
+         {
+            ServerCommandResults view = (ServerCommandResults)window.getActivePage().showView(ServerCommandResults.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
+            view.executeCommand(tool.getData(), inputValues);
          }
-
-         @Override
-         protected String getErrorMessage()
+         catch(Exception e)
          {
-            return Messages.get().ObjectToolsDynamicMenu_ServerCmdExecError;
+            MessageDialogHelper.openError(window.getShell(), Messages.get().ObjectToolsDynamicMenu_Error, String.format(Messages.get().ObjectToolsDynamicMenu_ErrorOpeningView, e.getLocalizedMessage()));
          }
-      }.start();
+      }
    }
+   
+   /**
+    * Execute server script
+    * 
+    * @param node
+    * @param tool
+    * @param inputValues 
+    */
+   private static void executeServerScript(final NodeInfo node, final ObjectTool tool, final Map<String, String> inputValues)
+   {
+      final NXCSession session = (NXCSession)ConsoleSharedData.getSession();
+      if ((tool.getFlags() & ObjectTool.GENERATES_OUTPUT) == 0)
+      {      
+         new ConsoleJob("Execute server script", null, Activator.PLUGIN_ID, null) {
+            @Override
+            protected void runInternal(IProgressMonitor monitor) throws Exception
+            {
+               session.executeLibraryScript(node.object.getObjectId(), tool.getData(), inputValues, null);
+               runInUIThread(new Runnable() {
+                  @Override
+                  public void run()
+                  {
+                     MessageDialogHelper.openInformation(null, Messages.get().ObjectToolsDynamicMenu_Information, Messages.get().ObjectToolsDynamicMenu_ServerScriptExecuted);
+                  }
+               });
+            }
+            
+            @Override
+            protected String getErrorMessage()
+            {
+               return Messages.get().ObjectToolsDynamicMenu_ServerScriptExecError;
+            }
+         }.start();
+      }
       else
       {
          final String secondaryId = Long.toString(node.object.getObjectId()) + "&" + Long.toString(tool.getId()); //$NON-NLS-1$
          final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
          try
          {
-            ServerCommandResults view = (ServerCommandResults)window.getActivePage().showView(ServerCommandResults.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
-            view.executeCommand(tool.getData(), inputValues);
+            ServerScriptResults view = (ServerScriptResults)window.getActivePage().showView(ServerScriptResults.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
+            view.executeScript(tool.getData(), inputValues);
          }
          catch(Exception e)
          {
index 5622fc1..0fd09a6 100644 (file)
@@ -72,6 +72,7 @@ General_Parameter=Parameter
 General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -115,8 +116,10 @@ ObjectToolsDynamicMenu_ExecuteServerCmd=Execute server command
 ObjectToolsDynamicMenu_HandlerNotDefined=Cannot execute object tool: handler not defined
 ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
-ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
+ObjectToolsDynamicMenu_ServerCmdExecError=Cannot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -153,6 +156,7 @@ ObjectToolsLabelProvider_TypeDownloadFile=Download File
 ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
index 717cc38..c8082e9 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regul\u00e1rn\u00ed v\u00fdraz
 General_RemoteFileName=N\u00e1zev vzd\u00e1len\u00e9ho souboru
 General_RequiresConfirmation=Tento n\u00e1stroj pot\u0159ebuje potvrzen\u00ed p\u0159ed spu\u0161t\u011bn\u00edm
 General_SNMPListOptions=Mo\u017enosti SNMP tabulky
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Informace
 ObjectToolsDynamicMenu_MultipleNodes=<v\u00edce prvk\u016f>
 ObjectToolsDynamicMenu_ServerCmdExecError=Nelze spustit p\u0159\u00edkaz na serveru
 ObjectToolsDynamicMenu_ServerCommandExecuted=P\u0159\u00edkaz serveru usp\u011b\u0161n\u011b spu\u0161t\u011bn
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=N\u00e1stroj spu\u0161t\u011bn\u00ed
 ObjectToolsDynamicMenu_TopLevelLabel=&N\u00e1stroje
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Intern\u00ed
 ObjectToolsLabelProvider_TypeLocalCmd=Lok\u00e1ln\u00ed p\u0159\u00edkaz
 ObjectToolsLabelProvider_TypeSNMPList=SNMP tabulka
 ObjectToolsLabelProvider_TypeServerCmd=Serverov\u00fd p\u0159\u00edkaz
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Chyba
 OpenObjectToolsEditor_ErrorOpenView=Chyba p\u0159i otev\u00edr\u00e1n\u00ed\:
index f08184d..005cd51 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view: 
index 86168da..d6fe2b5 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view:
index f08184d..005cd51 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view: 
index f08184d..005cd51 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view: 
index 0da6a66..64ca438 100644 (file)
@@ -23,27 +23,27 @@ EditColumnDialog_FmtFloat=\u0414\u0440\u043e\u0431\u043d\u043e\u0435 \u0447\u043
 EditColumnDialog_FmtIfIndex=\u0418\u043d\u0434\u0435\u043a\u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430
 EditColumnDialog_FmtInt=\u0426\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e
 EditColumnDialog_FmtIpAddr=IP \u0430\u0434\u0440\u0435\u0441
-EditColumnDialog_FmtMacAddr=MAC\u0430\u0434\u0440\u0435\u0441
+EditColumnDialog_FmtMacAddr=MAC \u0430\u0434\u0440\u0435\u0441
 EditColumnDialog_FmtString=\u0421\u0442\u0440\u043e\u043a\u0430
 EditColumnDialog_Format=\u0424\u043e\u0440\u043c\u0430\u0442
 EditColumnDialog_Name=\u0418\u043c\u044f
 EditColumnDialog_SNMP_OID=SNMP OID
 EditColumnDialog_SubstrIndex=\u0418\u043d\u0434\u0435\u043a\u0441 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438 (\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 1)
 EditColumnDialog_Warning=\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435
-EditInputFieldDialog_AddInputField=Add Input Field
-EditInputFieldDialog_DisplayName=Display name
-EditInputFieldDialog_EditInputField=Edit Input Field
-EditInputFieldDialog_Name=Name
-EditInputFieldDialog_Number=Number
-EditInputFieldDialog_Password=Password
-EditInputFieldDialog_Text=Text
-EditInputFieldDialog_Type=Type
-EditInputFieldDialog_ValidatePassword=Validate password after entry
+EditInputFieldDialog_AddInputField=\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430
+EditInputFieldDialog_DisplayName=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0438\u043c\u044f
+EditInputFieldDialog_EditInputField=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430
+EditInputFieldDialog_Name=\u0418\u043c\u044f
+EditInputFieldDialog_Number=\u0427\u0438\u0441\u043b\u043e
+EditInputFieldDialog_Password=\u041f\u0430\u0440\u043e\u043b\u044c
+EditInputFieldDialog_Text=\u0422\u0435\u043a\u0441\u0442
+EditInputFieldDialog_Type=\u0422\u0438\u043f
+EditInputFieldDialog_ValidatePassword=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u0441\u043b\u0435 \u0432\u0432\u043e\u0434\u0430
 Filter_AgentNeeded=\u0410\u0433\u0435\u043d\u0442 NetXMS \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d
 Filter_OIDShouldMatch=\u0423\u0437\u0435\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c SNMP OID, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443:
 Filter_OSShouldMatch=\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u041e\u0421 \u0443\u0437\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443(\u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u044f\u0442\u044b\u043c\u0438):
 Filter_SNMPNeeded=\u0423\u0437\u0435\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c SNMP
-Filter_TemplateShouldMatch=Parent template name should match this template(coma separated regular expression list):
+Filter_TemplateShouldMatch=\u0418\u043c\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443(\u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u044f\u0442\u044b\u043c\u0438):
 General_AgentCommand=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0430\u0433\u0435\u043d\u0442\u0430
 General_AllFiles=\u0412\u0441\u0435 \u0444\u0430\u0439\u043b\u044b
 General_CannotLoadImage=\u041e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f: %s
@@ -73,20 +73,21 @@ General_RegExp=\u0420\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u04
 General_RemoteFileName=\u0418\u043c\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430
 General_RequiresConfirmation=\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435
 General_SNMPListOptions=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u043f\u0438\u0441\u043a\u0430 SNMP
+General_Script=\u0421\u043a\u0440\u0438\u043f\u0442
 General_Select=\u0412\u044b\u0431\u0440\u0430\u0442\u044c...
 General_ShowInCommands=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u0430\u0445
 General_ShowInCommandsTooltip=\u041f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445 \u0443\u0437\u043b\u0430
 General_Title=\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a
 General_URL=URL
 General_UseAsIndex=\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0438\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432:
-InputFieldLabelProvider_Number=Number
-InputFieldLabelProvider_Password=Password
-InputFieldLabelProvider_Text=Text
-InputFields_DisplayName=Display name
-InputFields_Down=&Down
-InputFields_Name=Name
-InputFields_Type=Type
-InputFields_Up=&Up
+InputFieldLabelProvider_Number=\u0427\u0438\u0441\u043b\u043e
+InputFieldLabelProvider_Password=\u041f\u0430\u0440\u043e\u043b\u044c
+InputFieldLabelProvider_Text=\u0422\u0435\u043a\u0441\u0442
+InputFields_DisplayName=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0438\u043c\u044f
+InputFields_Down=&\u041d\u0438\u0436\u0435
+InputFields_Name=\u0418\u043c\u044f
+InputFields_Type=\u0422\u0438\u043f
+InputFields_Up=&\u0412\u044b\u0448\u0435
 LocalCommandResults_ClearConsole=\u041e&\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c
 LocalCommandResults_Copy=&\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c
 LocalCommandResults_JobError=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443
@@ -96,10 +97,10 @@ LocalCommandResults_ScrollLock=\u041f&\u0440\u043e\u043a\u0440\u0443\u0442\u043a
 LocalCommandResults_SelectAll=\u0412\u044b\u0431\u0440\u0430\u0442\u044c &\u0432\u0441\u0435
 LocalCommandResults_Terminate=\u041f\u0440&\u0435\u0440\u0432\u0430\u0442\u044c
 LocalCommandResults_Terminated=\n\n*** \u041f\u0420\u0415\u0420\u0412\u0410\u041d\u041e ***\n
-ObjectToolExecutor_ErrorText=Password entered in input field "%s" is not valid
-ObjectToolExecutor_ErrorTitle=Password Validation Failed
-ObjectToolExecutor_JobName=Validate passwords
-ObjectToolExecutor_PasswordValidationFailed=Password validation failed
+ObjectToolExecutor_ErrorText=\u041f\u0430\u0440\u043e\u043b\u044c, \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u043f\u043e\u043b\u0435 "%s" \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c
+ObjectToolExecutor_ErrorTitle=\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430
+ObjectToolExecutor_JobName=\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0430\u0440\u043e\u043b\u044f
+ObjectToolExecutor_PasswordValidationFailed=\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430
 ObjectToolsAdapterFactory_Error=\u041e\u0448\u0438\u0431\u043a\u0430
 ObjectToolsAdapterFactory_LoaderErrorText=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430: %s
 ObjectToolsDynamicMenu_CannotExecuteOnNode=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0443\u0437\u043b\u0435 %s
@@ -117,13 +118,15 @@ ObjectToolsDynamicMenu_Information=\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0
 ObjectToolsDynamicMenu_MultipleNodes=<\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u0437\u043b\u043e\u0432>
 ObjectToolsDynamicMenu_ServerCmdExecError=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
 ObjectToolsDynamicMenu_ServerCommandExecuted=\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e
+ObjectToolsDynamicMenu_ServerScriptExecError=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
+ObjectToolsDynamicMenu_ServerScriptExecuted=\u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0443\u0441\u043f\u0435\u0448\u043d\u043e
 ObjectToolsDynamicMenu_ToolExecution=\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430
 ObjectToolsDynamicMenu_TopLevelLabel=&\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b
 ObjectToolsEditor_AckToDisableObjectTool=\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442?
 ObjectToolsEditor_AckToEnableObjTool=\u0412\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442?
-ObjectToolsEditor_Clone=Clone
-ObjectToolsEditor_CloneError=Cannot clone object tool
-ObjectToolsEditor_CloneObjectTool=Clone object tool
+ObjectToolsEditor_Clone=\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c
+ObjectToolsEditor_CloneError=\u041e\u0448\u0438\u0431\u043a\u0430 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430
+ObjectToolsEditor_CloneObjectTool=\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430
 ObjectToolsEditor_ColDescr=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435
 ObjectToolsEditor_ColId=\u041a\u043e\u0434
 ObjectToolsEditor_ColName=\u0418\u043c\u044f
@@ -146,14 +149,15 @@ ObjectToolsEditor_JobNewIdError=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436
 ObjectToolsEditor_JobSave=\u0421\u043e\u0437\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430
 ObjectToolsEditor_JobSaveError=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430
 ObjectToolsEditor_New=&\u041d\u043e\u0432\u044b\u0439...
-ObjectToolsEditor_ObjectTool=Object tool
-ObjectToolsLabelProvider_TypeAgentCmd=\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u0430\u0433\u0435\u043d\u0442\u0435
+ObjectToolsEditor_ObjectTool=\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442
+ObjectToolsLabelProvider_TypeAgentCmd=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u0430\u0433\u0435\u043d\u0442\u0435
 ObjectToolsLabelProvider_TypeAgentTable=\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0430\u0433\u0435\u043d\u0442\u0430
 ObjectToolsLabelProvider_TypeDownloadFile=\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u0430
 ObjectToolsLabelProvider_TypeInternal=\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044f\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430
-ObjectToolsLabelProvider_TypeLocalCmd=\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435
+ObjectToolsLabelProvider_TypeLocalCmd=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e)
 ObjectToolsLabelProvider_TypeSNMPList=\u0421\u043f\u0438\u0441\u043e\u043a SNMP
 ObjectToolsLabelProvider_TypeServerCmd=\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
+ObjectToolsLabelProvider_TypeServerScript=\u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=\u041e\u0448\u0438\u0431\u043a\u0430
 OpenObjectToolsEditor_ErrorOpenView=\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f:
index 86168da..d6fe2b5 100644 (file)
@@ -73,6 +73,7 @@ General_RegExp=Regular expression
 General_RemoteFileName=Remote file name
 General_RequiresConfirmation=This tool requires confirmation before execution
 General_SNMPListOptions=SNMP List Options
+General_Script=Script
 General_Select=Select...
 General_ShowInCommands=Show in commands
 General_ShowInCommandsTooltip=Show this tool in node commands
@@ -117,6 +118,8 @@ ObjectToolsDynamicMenu_Information=Information
 ObjectToolsDynamicMenu_MultipleNodes=<multiple nodes>
 ObjectToolsDynamicMenu_ServerCmdExecError=Canot execute command on server
 ObjectToolsDynamicMenu_ServerCommandExecuted=Server command executed successfully
+ObjectToolsDynamicMenu_ServerScriptExecError=Cannot execute script on server
+ObjectToolsDynamicMenu_ServerScriptExecuted=Server script executed successfully
 ObjectToolsDynamicMenu_ToolExecution=Tool Execution
 ObjectToolsDynamicMenu_TopLevelLabel=&Tools
 ObjectToolsEditor_AckToDisableObjectTool=Are you sure you want to disable this Object Tool?
@@ -154,6 +157,7 @@ ObjectToolsLabelProvider_TypeInternal=Internal
 ObjectToolsLabelProvider_TypeLocalCmd=Local Command
 ObjectToolsLabelProvider_TypeSNMPList=SNMP List
 ObjectToolsLabelProvider_TypeServerCmd=Server Command
+ObjectToolsLabelProvider_TypeServerScript=Server Script
 ObjectToolsLabelProvider_TypeURL=URL
 OpenObjectToolsEditor_Error=Error
 OpenObjectToolsEditor_ErrorOpenView=Error opening view:
index 0fbba0e..462fcd8 100644 (file)
@@ -63,7 +63,7 @@ public class General extends PropertyPage
        private LabeledText textRegexp;
        private Button checkOutput;
        private Button checkConfirmation;
-       private LabeledText textConfirmation;
+   private LabeledText textConfirmation;
        private Button checkDisable;
        private Button checkFollow;
        private Button checkCommand;
@@ -139,6 +139,10 @@ public class General extends PropertyPage
                                textData.setLabel(Messages.get().General_Command);
                                createOutputGroup(dialogArea);
                                break;
+         case ObjectTool.TYPE_SERVER_SCRIPT:
+            textData.setLabel(Messages.get().General_Script);
+            createOutputGroup(dialogArea);
+            break;
                        case ObjectTool.TYPE_ACTION:
                                textData.setLabel(Messages.get().General_AgentCommand);
                                createOutputGroup(dialogArea);
@@ -356,7 +360,7 @@ public class General extends PropertyPage
                checkOutput.setText(Messages.get().General_GeneratesOutput);
                checkOutput.setSelection((objectTool.getFlags() & ObjectTool.GENERATES_OUTPUT) != 0);
        }
-
+       
        /**
         * Create icon
         */
@@ -535,6 +539,7 @@ public class General extends PropertyPage
                
                if ((objectTool.getType() == ObjectTool.TYPE_LOCAL_COMMAND) ||
                    (objectTool.getType() == ObjectTool.TYPE_SERVER_COMMAND) ||
+          (objectTool.getType() == ObjectTool.TYPE_SERVER_SCRIPT) ||
                    (objectTool.getType() == ObjectTool.TYPE_ACTION))
                {
                        if (checkOutput.getSelection())
index 18bb758..fb64c8c 100644 (file)
@@ -40,10 +40,11 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
                Messages.get().ObjectToolsLabelProvider_TypeURL,
                Messages.get().ObjectToolsLabelProvider_TypeLocalCmd,
                Messages.get().ObjectToolsLabelProvider_TypeServerCmd,
-               Messages.get().ObjectToolsLabelProvider_TypeDownloadFile
+               Messages.get().ObjectToolsLabelProvider_TypeDownloadFile,
+      Messages.get().ObjectToolsLabelProvider_TypeServerScript
        };
        
-       private Image[] toolTypeImages = new Image[toolTypes.length+1];
+       private Image[] toolTypeImages = new Image[toolTypes.length + 1];
        
        /**
         * The constructor
@@ -58,7 +59,8 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
                toolTypeImages[5] = Activator.getImageDescriptor("icons/console.png").createImage(); //$NON-NLS-1$
                toolTypeImages[6] = Activator.getImageDescriptor("icons/console.png").createImage(); //$NON-NLS-1$
                toolTypeImages[7] = Activator.getImageDescriptor("icons/file_download.png").createImage(); //$NON-NLS-1$
-               toolTypeImages[8] = Activator.getImageDescriptor("icons/stop.png").createImage(); //$NON-NLS-1$
+      toolTypeImages[8] = Activator.getImageDescriptor("icons/script.png").createImage(); //$NON-NLS-1$
+               toolTypeImages[9] = Activator.getImageDescriptor("icons/stop.png").createImage(); //$NON-NLS-1$
        }
        
        /* (non-Javadoc)
@@ -72,13 +74,13 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
 
                try
                {
-                  if((((ObjectTool)element).getFlags() & ObjectTool.DISABLED)== 0)
+                  if ((((ObjectTool)element).getFlags() & ObjectTool.DISABLED) == 0)
                   {
                      return toolTypeImages[((ObjectTool)element).getType()];
                   }
                   else
                   {
-                     return toolTypeImages[8];
+                     return toolTypeImages[toolTypeImages.length - 1];
                   }
                }
                catch(ArrayIndexOutOfBoundsException e)
@@ -107,7 +109,7 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
                                }
                                catch(ArrayIndexOutOfBoundsException e)
                                {
-                                       return "?unknown?"; //$NON-NLS-1$
+                                       return "<unknown>"; //$NON-NLS-1$
                                }
                        case ObjectToolsEditor.COLUMN_DESCRIPTION:
                                return tool.getDescription();
@@ -139,7 +141,7 @@ public class ObjectToolsLabelProvider extends LabelProvider implements ITableLab
                }
                catch(ArrayIndexOutOfBoundsException e)
                {
-                       return "?unknown?"; //$NON-NLS-1$
+                       return "<unknown>"; //$NON-NLS-1$
                }
        }