Changeset 3175
- Timestamp:
- Mar 8, 2007, 10:57:25 AM (16 years ago)
- Location:
- trunk/doc/src/docbook
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/src/docbook/admindoc/plugin_installation.xml
r3161 r3175 28 28 29 29 <chapter id="plugin_installation"> 30 <title>Installing plugins</title> 31 <sect1> 32 <title></title> 33 <para></para> 34 </sect1> 30 <title id="plugin_installation.title">Installing plugins</title> 31 32 <para> 33 We recommend that each plugin or group of related plugins are compiled separately. To be 34 able to use the plugin it must be put in a JAR file. Place the JAR file on the server 35 <emphasis>outside</emphasis> 36 the web servers classpath, ie. not in the 37 <filename class="directory">WEB-INF/lib</filename> 38 . Our recommendation is to place the plugin JAR in 39 <filename class="directory"> 40 <replaceable><base-dir></replaceable> 41 /plugins/ 42 <replaceable><name-of-plugin></replaceable> 43 / 44 </filename> 45 </para> 46 47 <para> 48 The main benefit from placing the JAR file outside the classpath is that 49 Base uses it's own classloader that supports unloading of the classes as well. 50 This means that you may replace the JAR file with a new version without 51 restarting the web server. 52 </para> 53 54 <para> 55 Then, to install the plugin log in a an administrator and go to the 56 <menuchoice> 57 <guimenu>Administrate</guimenu> 58 <guisubmenu>Plugins</guisubmenu> 59 <guimenuitem>Definitions</guimenuitem> 60 </menuchoice> 61 page. Click the 62 <guibutton>New</guibutton> 63 button and enter the class name and the path to the JAR file in the form that opens in the 64 popup window. 65 </para> 66 67 <para> 68 When you click save, the Base class loader will load the specified JAR file and class and 69 check that it implements the 70 <interfacename>Plugin</interfacename> 71 interface. Then, it creates an instance of that class, calls 72 <methodname>Plugin.getAbout()</methodname> 73 and 74 <methodname>Plugin.getMainType()</methodname> 75 . If it is an 76 <interfacename>InteractivePlugin</interfacename> 77 it will also call 78 <methodname>InteractivePlugin.getGuiContexts()</methodname> 79 . This information is stored in the database. 80 </para> 81 82 <para> 83 The installation will do one more thing. It will check which other interfaces the plugin 84 implements and check against the list of registered 85 <classname>PluginType</classname> 86 s. The 87 <classname>PluginType</classname> 88 system has not really been put into use yet. The core defines the 89 <interfacename>AutoDetectingImporter</interfacename> 90 which can be used for all import plugins that supports automatic detection of file formats. 91 Read more about this in the 92 <xref linkend="plugin_developer.import_plugins"/> 93 chapter. 94 </para> 95 96 97 <para> 98 Now the administrator may continue by creating a new configuration for the plugin (assuming 99 that is an 100 <interfacename>InteractivePlugin</interfacename> 101 ). When the administrator starts the configuration sequence the following will happen: 102 </para> 103 104 <itemizedlist> 105 <listitem> 106 <simpara>The core creates a new instance of the plugin.</simpara> 107 </listitem> 108 <listitem> 109 <simpara> 110 Call the 111 <methodname>Plugin.init</methodname> 112 () method. 113 </simpara> 114 </listitem> 115 <listitem> 116 <simpara> 117 Call the 118 <methodname>InteractivePlugin.getRequestInformation()</methodname> 119 method, with 120 <varname>command</varname> 121 <literal>=</literal> 122 <constant>Request.COMMAND_CONFIGURE_PLUGIN</constant> 123 and a null 124 <classname>GuiContext</classname> 125 . 126 </simpara> 127 </listitem> 128 <listitem> 129 <simpara>Display the list of parameters and let the user enter values.</simpara> 130 </listitem> 131 <listitem> 132 <simpara> 133 Call 134 <methodname>InteractivePlugin.configure()</methodname> 135 . 136 </simpara> 137 </listitem> 138 <listitem> 139 <simpara> 140 If the plugin wants more parameters the above two steps are repeated but with the 141 command returned in the response. Note! Be careful so you don't create infinite 142 loops. 143 </simpara> 144 </listitem> 145 <listitem> 146 <simpara> 147 If the plugin reports that it is done, 148 <methodsynopsis> 149 <methodname>done</methodname> 150 <void/> 151 </methodsynopsis> 152 <methodname>Plugin.done()</methodname> 153 is called and the plugin instance is discarded. 154 </simpara> 155 </listitem> 156 </itemizedlist> 157 158 <para> 159 The steps for creating a new job follows the same procedure except that the first command is 160 <classname>Request.</classname> 161 <constant>COMMAND_CONFIGURE_JOB</constant> 162 and the 163 <classname>GuiContext</classname> 164 isn't null. 165 </para> 166 35 167 </chapter> -
trunk/doc/src/docbook/developerdoc/plugin_developer.xml
r3170 r3175 335 335 failed. Not setting a response is considered a failure by the core. From 336 336 the run method it is only allowed to use the 337 <methodname>setDone </methodname>338 ()or the339 <methodname>setError </methodname>340 ()methods.337 <methodname>setDone()</methodname> 338 or the 339 <methodname>setError()</methodname> 340 methods. 341 341 </para> 342 342 <example id="net.sf.basedb.core.plugin.Plugin.run"> … … 344 344 Here is a skeleton that we recommend each plugin to use in it's 345 345 implementation of the 346 <methodname>run </methodname>346 <methodname>run()</methodname> 347 347 method 348 348 </title> … … 397 397 contains an implementation of this method which simply sets the 398 398 parameters passed to the 399 <methodname>init </methodname>399 <methodname>init()</methodname> 400 400 method to null 401 401 </title> … … 459 459 <classname>net.sf.basedb.core.Item</classname> 460 460 enumeration and the type is either 461 <c lassname>Type.LIST</classname>461 <constant>Type.LIST</constant> 462 462 or 463 <c lassname>Type.ITEM</classname>463 <constant>Type.ITEM</constant> 464 464 . 465 465 </para> … … 467 467 For example, the 468 468 <varname>GuiContext</varname> 469 = (469 <literal>= (</literal> 470 470 <constant>Item.REPORTER</constant> 471 ,471 <literal>,</literal> 472 472 <constant>Type.LIST</constant> 473 ) tells a client application that this plugin can be plugged in whenever 474 a list of reporters is displayed. The 473 <literal>)</literal> 474 tells a client application that this plugin can be plugged in whenever a 475 list of reporters is displayed. The 475 476 <varname>GuiContext</varname> 476 477 = ( … … 910 911 <classname>AbstractPlugin</classname> 911 912 class it is very easy to validate the parameters using it's 912 <methodname>validateRequestParameters </methodname>913 ()method. This method takes the same list of913 <methodname>validateRequestParameters()</methodname> 914 method. This method takes the same list of 914 915 <classname>PluginParameter</classname> 915 916 's used in the … … 923 924 When the parameters have been validated they need to be stored. Once 924 925 again, it is very easy if you use one of the 925 <classname>AbstractPlugin.</classname> 926 <methodname>storeValue</methodname> 927 () or 928 <classname>AbstractPlugin.</classname> 929 <methodname>storeValues</methodname> 930 () methods. 926 <methodname>AbstractPlugin.storeValue()</methodname> 927 or 928 <methodname>AbstractPlugin.storeValues()</methodname> 929 methods. 931 930 </para> 932 931 <para> 933 932 The configure method works much like the 934 <classname>Plugin.</classname> 935 <methodname>run</methodname> 936 () method. It must return the result in the 933 <methodname>Plugin.run()</methodname> 934 method. It must return the result in the 937 935 <classname>Response</classname> 938 936 object, i.e. it shouldn't trow any exceptions. … … 982 980 <para> 983 981 Note that the 984 <methodname>setDone </methodname>985 ()has a second parameter982 <methodname>setDone()</methodname> 983 has a second parameter 986 984 <classname>Job.ExecutionTime</classname> 987 985 . It is an indication about how long time it will take to execute the … … 990 988 blocking the entire system. Please try to use this parameter wisely and 991 989 not use the 992 <constant> SHORT</constant>990 <constant>Job.ExecutionTime.SHORT</constant> 993 991 value out of old habit all the time. 994 992 </para> 995 993 <para> 996 994 The response also has a 997 <methodname>setContinue </methodname>998 ()method which tells the core that the plugin needs more parameters,995 <methodname>setContinue()</methodname> 996 method which tells the core that the plugin needs more parameters, 999 997 i.e. the core will then call 1000 <methodname>getRequestInformation </methodname>1001 ()again with the new command, let the user enter values, and the call1002 <methodname>configure </methodname>1003 ()with the new values. This process is repeated until the plugin998 <methodname>getRequestInformation()</methodname> 999 again with the new command, let the user enter values, and the call 1000 <methodname>configure()</methodname> 1001 with the new values. This process is repeated until the plugin 1004 1002 reports that it is done or an error occurs. 1005 1003 </para> … … 1008 1006 of the plugin that is used. However, no parameter values are stored in 1009 1007 the database until 1010 <methodname>setDone</methodname> 1011 () is called. Then, the plugin instance is usually discarded. The 1012 execution of the plugin happens in a new instance and maybe on a 1013 different server. 1008 <methodname>setDone()</methodname> 1009 is called. Then, the plugin instance is usually discarded. The execution 1010 of the plugin happens in a new instance and maybe on a different server. 1014 1011 </para> 1015 1012 <tip> … … 1059 1056 </sect2> 1060 1057 1061 <sect2 id="plugin_developer.organize. build">1058 <sect2 id="plugin_developer.organize.ant"> 1062 1059 <title>Ant build file</title> 1063 1060 <para> … … 1125 1122 </sect2> 1126 1123 1127 <sect2 >1124 <sect2 id="plugin_developer.organize.build"> 1128 1125 <title>Building the plugin</title> 1129 1126 <para> … … 1138 1135 files (if any). Place all files together in the same directory. Then follow the 1139 1136 instructions in chapter 1140 < link linkend="plugin_installation" endterm="plugin_installation.title"></link>1137 <xref linkend="plugin_installation" /> 1141 1138 . 1142 1139 </para> … … 1238 1235 </sect1> 1239 1236 1237 <sect1 id="plugin_developer.import_plugins"> 1238 <title id="plugin_developer.import_plugins.title">Plugins for importing data</title> 1239 <para></para> 1240 </sect1> 1241 1240 1242 </chapter>
Note: See TracChangeset
for help on using the changeset viewer.