Login Form






Lost Password?
No account yet? Register
Home
NetDirector Plugin Development FAQ

NetDirector Plugin Developer's FAQ

How can I create a plug-in service for Netdirector?

To create a plugin, first create a new class extended from the abtract class called “com.emu.plugin. NetdirectorPlugin”. This will serve as the plug-in’s main service component. This abstract class/entity contains already basic function/method that can be used to communicate with the Agent. For complete list of the method please refer to the Javadoc files of Netdirector.

 

 


Are there other components that the plugin-in may reuse or utilize from Netdirector?

There are many. The list includes (but is not limited to): ServiceImpl, ServerImpl, ConfigParser, ServiceFilePreparserQuery and QueryAgent  - (XML-RPC ) Agent Client Object. For a complete list, refer to the javadoc and other resources.

Is there any XML file, needed before the plugin service can be installed?

There is a file called “plugin.xml” that needs to be bundled together with the plug-in service components and resources.


The details and structure of this file is discussed at the end of this document.

How will the plug-in service components and resources be bundled or package?

The following is the recommend structure of the package or bundle.

            ----- <service-root-folder>

                        + --- img   ------------------ images

                        + --- js      ------------------ javascript files

                        + --- css    ------------------ css files

                        + --- jsp    ------------------ jsp files

                        + --- lib     ------------------ this should contain the service classes bundled in a jar ( preferred name:  plug-in-<service-name>.jar). The content from this directory will be move to the WEB-INF/lib folder of Netdirector.

                        + --- plugin.xml ------------ this is a required file.

                       

An example is shown below for a Red Hat Network module:


 


This should be bundled either in “JAR” or “WAR” file format.

 

Note: By default, the plug-in service will be installed under the root directory of Netdirector under the folder called /PLUGIN/<SERVICE-NAME>.

 

Hence the installed structure would look like this:

 


 


It also recommended that during development and testing to follow the installed structure for much easier coding and testing especially, when accessing resources from the plug-in service path.

How will the plug-in service be administered per server?

The plug-in service shall provide a mini server-service admin page (INNER BODY TAGS ONLY – no HTML HEADER TAGS). This page may contain any information that may be required the plug-in service. This page is loaded via an AJAX/DWR function. Select “SERVICES” under the “Manage Server option”. Then from the Server Administration select the appropriate service plug-in to administer.

 

 

Here is a sample of the SSH Admin page code:

 

 


 


How will the plug-in service be installed/uninstalled?

On the admin function there an option regarding “Manage Plugin” , use the browse button to locate the installable component. Next, click on the “install” button.

 

 


 


How do I know the assigned service ID of the my pluggable service?

Use the PluginManager.getInstance() method with a parameter  the classname of the extended Netdirector plugin object. Or  you may get it from the request object when the  startURLforAdminManagement” OR “startURLforManagement” pages is triggered or called by Netdirector.

 

These attributes are defined in the plugin.xml file. The following request attributes are sent to the called/triggered/loaded page - SERVER_ID, SERVICE_ID(startURLforAdminManagement) and SERVICE_ID ,SERVICE_NAME (startURLforManagement).  Hence the receiving/called page might have a code like this:

 

 


 

 

From these pages, it’s up to you to propagate this information through the process of the service.

Are there any javascript functions I need to override or that I can utilize or reuse?

  1. getServerSelection() – returns a series of server id’s in the following formats

&SERVER_ID=1&SERVER_ID=2&SERVER_ID=nnn

  1. getServerSelectionWithName - returns a series of server id’s with server names in the following formats

&SERVER_ID=1_SERVERNAME&SERVER_ID=2_SERVERNAME &SERVER_ID=nnn_SERVERNAME

  1. disableTree() – disable the server tree panel check boxes

 

I want to trigger a javascript function specific to my plug-in when I select/unselect a server/s in the Server Tree Panel. How can I do this?

Create an anonymous function with expected three parameters namely Server ID, Service Id and Server Name and passed it as a parameter to the following function  SpecialFunc.setOnSelectServer() –for the select function and SpecialFunc.setOnDeSelectServer() – for unselect function.

i.e  SpecialFunc.setOnSelectServer( function(serverId,serviceId,serverName){

                .. your select processing here

            }

        );

SpecialFunc.setOnDeSelectServer(function(serverId, serviceId,serverName){

                .. your unselect processing here

            }

        );

What is inside the plugin.xml file?

This file contains all information needed for the service plug-in to be installed.

 

<!--

Attn: This service will be installed in /netdirector/plugin/<service name>

-->

  <plugin>

   <service>

      <!-- Service Name-->

       <name>Ssh</name>

       <!-- Service main icon location-->

       <!-- This icon will be palced in the service Pane-->

       <icon>/img/ssh.jpg</icon>

       <!--True if this service will be included during the add server -->

       <!--And the extended class must implement the addService method  -->

       <include-In-Add-Server>true</include-In-Add-Server>

       <!--The component/class name that extended the NetdirectorPlugin class -->

       <pluginClass>com.emu.ssh.SshPlugin</pluginClass>     

   </service>

   <!-- This defines the page that will be loaded (AJAX/DWR) for server-service admin purposes-->

   <!-- This page is loaded under an HTML TAG object with ID 'pluginArea' -->

   <startURLforAdminManagement>/jsp/ssh/sshAdmin.jsp</startURLforAdminManagement>

     

   <!--Since the said page(admin page) above conatins only INNER BODY TAGS -->

   <!--Needed javascript/css files shall be defined on this attribute. Netdirector will dynamically load this included files -->

   <!--It is also advised to prefix all functions and variables with a short code for the plugin service -->

   <!--to avoid conflicting entries-->

   <AdminManagementpage_include>

           <script type="text/javascript" relative-plugin-src="/js/ssh.js"></script>

           <link rel="stylesheet" relative-plugin-href="/css/ssh.css" type="text/css"/>

           <script type='text/javascript' xsrc='/netdirector/dwr/interface/managessh.js'></script>

   </AdminManagementpage_include>

      <!-- This defines the page that will be loaded (AJAX/DWR) for user management purposes (MAIN PAGE)-->

      <!-- This page is loaded under the an HTML TAG object with ID 'configContent' -->

   <startURLforManagement>/jsp/ssh/sshMain.jsp</startURLforManagement>

      <!--Since the said page(config management page) above conatins only INNER BODY TAGS -->

      <!--Needed javascript/css files shall be defined on this attribute. Netdirector will dynamically load this included files -->

      <!--It is also advised to prefix all functions and variables with a short code for the plugin service -->

      <!--to avoid conflicting entries-->

   <Managementpage_include>

           <script type="text/javascript" relative-plugin-src="/js/ssh.js"></script>

           <link rel="stylesheet" relative-plugin-href="/css/ssh.css" type="text/css"/>

           <script type='text/javascript' xsrc='/netdirector/dwr/interface/managessh.js'></script>

   </Managementpage_include>

   <!-- In case the plugin service follows the same framework as the Netdirector uses-->

   <!-- attributes needed to be placed in a file called mapping.xml will be placed here-->  

   <mapping-xml>

      <modules>

      </modules>

      <additional-parameters-items/>

   </mapping-xml>

   <!-- In case the plugin service uses DWR  -->

   <!-- attributes needed to be placed in a file called dwr.xml will be placed here-->  

   <dwr-xml>

        <allow>

            <create creator="new" javascript="managessh" scope="session">

                  <param name="class" value="com.emu.ssh.SshDwrWrapper" />

            </create>        

        </allow>

   </dwr-xml>

      <!-- In case the plugin service needs item to be in included web.xml  -->

      <!-- This items/attributes needs to be defined here-->

      <!-- follow the structure of web.xml when defining attributes-->

   <web-xml>

      <servlet>

            <servlet-name>SSH Proxy</servlet-name>

            <display-name>SSH Proxy</display-name>

            <servlet-class>com.emu.ssh.SshProxyServerInit</servlet-class>

            <init-param>

                  <param-name>userely</param-name>

                  <param-value>true</param-value>

            </init-param>

            <init-param>

                  <param-name>port</param-name>

                  <param-value>8503</param-value>

            </init-param>

                  <init-param>

                  <param-name>debug</param-name>

                  <param-value>false</param-value>

            </init-param>

            <load-on-startup>4</load-on-startup>

      </servlet>

      <servlet-mapping>

      </servlet-mapping>

      <env-entry>

      </env-entry>

   </web-xml>

   <!--This attribute will contains all database script needed by the plug-in service during installation-->

   <!--It should contain approppriate statements for MYSQL/POSTGRES -->

   <db-install>

       <mysql>

               <sql>

            CREATE TABLE tb_ssh (

              serverID int(10) unsigned zerofill NOT NULL default '0000000000',

              SSHXML longblob NOT NULL,

              dtSaved datetime NOT NULL default '0000-00-00 00:00:00',

              isCrntlyDplyd tinyint(1) NOT NULL default '0',

              isManaged tinyint(1) NOT NULL default '0',

              version tinyint(4) NOT NULL default '-1',

              userID varchar(20) NOT NULL default '',

              KEY ssh_ind (serverID),

              CONSTRAINT tb_ssh_ibfk_2 FOREIGN KEY (serverID) REFERENCES tb_server (serverID) ON DELETE CASCADE

            ) TYPE=InnoDB;

               </sql>  

               <sql>

            CREATE TABLE tb_sshusers (

              serverid int(10) unsigned zerofill NOT NULL default '0000000000',

              userID varchar(20) NOT NULL default '',

              sshuserid varchar(45) NOT NULL default '',

              sshpwd varchar(45) NOT NULL default '',

              PRIMARY KEY  (serverid,userID),

              CONSTRAINT FK_tb_sshusers_1 FOREIGN KEY (serverid) REFERENCES tb_server (serverID) ON DELETE CASCADE ON UPDATE CASCADE

            ) TYPE=InnoDB;

               </sql>

       </mysql>

       <postgres>

            <sql>

            CREATE TABLE tb_ssh(

              serverID integer REFERENCES tb_server (serverID) ON DELETE CASCADE,

              sshXML  text  NOT NULL,

              dtSaved timestamp,

              isCrntlyDplyd integer default '0',

              isManaged integer default '0',

              version integer  default '-1',

              userID text

            );

            </sql>

            <sql>

            CREATE TABLE tb_sshusers(

               serverID integer REFERENCES tb_server (serverID) ON DELETE CASCADE,

               userId varchar(20) NOT NULL default '',

               sshuserid varchar(45) NOT NULL default '',

               sshpassword varchar(45) NOT NULL default '',

               PRIMARY KEY (userId,sshuserid)

            );

            </sql>

       </postgres>

   </db-install>

   <!--This attribute will contains all database script needed by the plug-in service when service uninstalled-->

   <!--It should contain approppriate statements for MYSQL/POSTGRES -->

   <db-uninstall>

       <mysql>

             <sql>

                  DROP TABLE tb_sshusers;

             </sql>

             <sql>

                 DROP TABLE tb_ssh;  

             </sql>

       </mysql>

       <postgres>

             <sql>

                  DROP TABLE tb_sshusers;

             </sql>

             <sql>

                 DROP TABLE tb_ssh;  

             </sql>

       </postgres>

   </db-uninstall>

</plugin>   <service>

        <!--     

       <name>Ssh</name>

       <icon>/img/ssh.jpg</icon>

       <include-In-Add-Server>true</include-In-Add-Server>

       <pluginClass>com.emu.ssh.SshPlugin</pluginClass>     

   </service>

   <startURLforAdminManagement>/jsp/ssh/sshAdmin.jsp</startURLforAdminManagement>

   <AdminManagementpage_include>

           <script type="text/javascript" relative-plugin-src="/js/ssh.js"></script>

           <link rel="stylesheet" relative-plugin-href="/css/ssh.css" type="text/css"/>

           <script type='text/javascript' xsrc='/netdirector/dwr/interface/managessh.js'></script>

   </AdminManagementpage_include>

   <startURLforManagement>/jsp/ssh/sshMain.jsp</startURLforManagement>

   <Managementpage_include>

           <script type="text/javascript" relative-plugin-src="/js/ssh.js"></script>

           <link rel="stylesheet" relative-plugin-href="/css/ssh.css" type="text/css"/>

           <script type='text/javascript' xsrc='/netdirector/dwr/interface/managessh.js'></script>

   </Managementpage_include>

   <mapping-xml>

      <modules>

      </modules>

      <additional-parameters-items/>

   </mapping-xml>

   <dwr-xml>

        <allow>

            <create creator="new" javascript="managessh" scope="session">

                  <param name="class" value="com.emu.ssh.SshDwrWrapper" />

            </create>        

        </allow>

   </dwr-xml>

   <web-xml>

      <servlet>

            <servlet-name>SSH Proxy</servlet-name>

            <display-name>SSH Proxy</display-name>

            <servlet-class>com.emu.ssh.SshProxyServerInit</servlet-class>

            <init-param>

                  <param-name>userely</param-name>

                  <param-value>true</param-value>

            </init-param>

            <init-param>

                  <param-name>port</param-name>

                  <param-value>8503</param-value>

            </init-param>

                  <init-param>

                  <param-name>debug</param-name>

                  <param-value>false</param-value>

            </init-param>

            <load-on-startup>4</load-on-startup>

      </servlet>

   

  

      <servlet-mapping>

      </servlet-mapping>

      <env-entry>

      </env-entry>

   </web-xml>

   <db-install>

       <mysql>

               <sql>

            CREATE TABLE tb_ssh (

              serverID int(10) unsigned zerofill NOT NULL default '0000000000',

              SSHXML longblob NOT NULL,

              dtSaved datetime NOT NULL default '0000-00-00 00:00:00',

              isCrntlyDplyd tinyint(1) NOT NULL default '0',

              isManaged tinyint(1) NOT NULL default '0',

              version tinyint(4) NOT NULL default '-1',

              userID varchar(20) NOT NULL default '',

              KEY ssh_ind (serverID),

              CONSTRAINT tb_ssh_ibfk_2 FOREIGN KEY (serverID) REFERENCES tb_server (serverID) ON DELETE CASCADE

            ) TYPE=InnoDB;

               </sql>  

               <sql>

            CREATE TABLE tb_sshusers (

              serverid int(10) unsigned zerofill NOT NULL default '0000000000',

              userID varchar(20) NOT NULL default '',

              sshuserid varchar(45) NOT NULL default '',

              sshpwd varchar(45) NOT NULL default '',

              PRIMARY KEY  (serverid,userID),

              CONSTRAINT FK_tb_sshusers_1 FOREIGN KEY (serverid) REFERENCES tb_server (serverID) ON DELETE CASCADE ON UPDATE CASCADE

            ) TYPE=InnoDB;

               </sql>

       </mysql>

       <postgres>

            <sql>

            CREATE TABLE tb_ssh(

              serverID integer REFERENCES tb_server (serverID) ON DELETE CASCADE,

              sshXML  text  NOT NULL,

              dtSaved timestamp,

              isCrntlyDplyd integer default '0',

              isManaged integer default '0',

              version integer  default '-1',

              userID text

            );

            </sql>

            <sql>

            CREATE TABLE tb_sshusers(

               serverID integer REFERENCES tb_server (serverID) ON DELETE CASCADE,

               userId varchar(20) NOT NULL default '',

               sshuserid varchar(45) NOT NULL default '',

               sshpassword varchar(45) NOT NULL default '',

               PRIMARY KEY (userId,sshuserid)

            );

            </sql>

       </postgres>

   </db-install>

   <db-uninstall>

       <mysql>

             <sql>

                  DROP TABLE tb_sshusers;

             </sql>

             <sql>

                 DROP TABLE tb_ssh;  

             </sql>

       </mysql>

       <postgres>

             <sql>

                  DROP TABLE tb_sshusers;

             </sql>

             <sql>

                 DROP TABLE tb_ssh;  

             </sql>

       </postgres>

   </db-uninstall>

 
nddownload

NetDirector Developer Sponsors
 
Emu Software
 
phenixlogo
 
picture_1
 

Data Center Hosting generously provided by: 

logo-cnl
Performance testing and analysis for the computing, networking and software industry
 
 

Industry Affiliations

 Open Solutions Alliance
 
SourceForge.net Logo
 

Polls

The next feature in NetDirector should be: