44import java .io .IOException ;
55import java .io .InputStream ;
66import java .lang .reflect .InvocationTargetException ;
7- import java .lang .reflect .Method ;
8- import java .net .MalformedURLException ;
9- import java .net .URL ;
10- import java .net .URLClassLoader ;
117import java .sql .ResultSet ;
128import java .sql .SQLException ;
139import java .sql .Timestamp ;
7167import com .logicaldoc .util .config .ContextProperties ;
7268import com .logicaldoc .util .config .LogConfigurator ;
7369import com .logicaldoc .util .config .PluginDescriptorConfigurator ;
74- import com .logicaldoc .util .exec .Exec ;
7570import com .logicaldoc .util .io .FileUtil ;
7671import com .logicaldoc .util .io .ZipUtil ;
7772import com .logicaldoc .util .plugin .LogicalDOCPlugin ;
@@ -603,7 +598,7 @@ public List<GUIHistory> search(Long userId, Date from, Date till, int maxResult,
603598 query .append (" union " );
604599 query .append (
605600 "select A.ld_username, A.ld_event, A.ld_date, A.ld_filename, A.ld_folderid, A.ld_path, A.ld_sessionid, A.ld_docid, A.ld_userid, A.ld_ip as ip, A.ld_userlogin, A.ld_comment, A.ld_reason, A.ld_device, A.ld_geolocation, A.ld_keylabel from TABLE A where A.ld_tenantid = "
606- .replace ("TABLE" , table ).replace ("A" , tableAlias ) + session .getTenantId ());
601+ .replace ("TABLE" , table ).replace ("A" , tableAlias ) + session .getTenantId ());
607602 appendUserCondition (tableAlias , userId , query );
608603 appendSessionCondition (tableAlias , historySid , query );
609604 appendDatesCondition (tableAlias , from , till , query );
@@ -820,18 +815,6 @@ public void uninstallPlugin(String pluginId) throws ServerException {
820815 // Nothing to do
821816 }
822817
823- try {
824- if (pluginJarFile .exists ()) {
825- if (new Exec ().isWindows ())
826- Runtime .getRuntime ().exec (
827- new String [] { "cmd.exe" , "/c" , "del /F /Q \" " + pluginJarFile .getAbsolutePath () + "\" " });
828- else
829- Runtime .getRuntime ().exec (new String [] { "rm" , "-rf" , pluginJarFile .getAbsolutePath () });
830- }
831- } catch (IOException e ) {
832- throwServerException (session , log , e );
833- }
834-
835818 if (pluginJarFile .exists ())
836819 throw new ServerException ("Cannot remove plugin file " + pluginJarFile .getAbsolutePath ()
837820 + ". Please stop the application and delete that file manually." );
@@ -940,21 +923,6 @@ public void installPlugin() throws ServerException {
940923 log .info ("Deleted existing plugin home {}" , pluginHome .getAbsolutePath ());
941924 }
942925
943- File libFolder = new File (new File (rootFolder , "WEB-INF" ), "lib" );
944- File pluginJarFile = new File (libFolder , pluginJar );
945-
946- /*
947- * Append the plugin jar in the classpath
948- */
949- appendPluginJarInClasspath (pluginJarFile );
950-
951- /*
952- * Initialize the plugin
953- */
954- PluginRegistry pluginRegistry = PluginRegistry .getInstance ();
955- pluginRegistry .init (libFolder .getAbsolutePath ());
956- initializePlugin (pluginId );
957-
958926 /*
959927 * Copy the plugin archive as .installed so it will be maintained
960928 * over the updates
@@ -963,30 +931,14 @@ public void installPlugin() throws ServerException {
963931 File targetFile = new File (pluginsDir , pluginId + "-" + pluginVersion + "-plugin.zip.installed" );
964932 log .info ("Copying plugin package {} into {}" , pluginPackage .getName (), targetFile .getAbsolutePath ());
965933 FileUtil .copyFile (pluginPackage , targetFile );
966-
967- if (pluginRegistry .isRestartRequired ())
968- ApplicationListener .restartRequired ();
969- } catch (ServerException | IOException | NoSuchMethodException | IllegalArgumentException
970- | InvocationTargetException | PluginException e ) {
934+ ApplicationListener .restartRequired ();
935+ } catch (ServerException | IOException | IllegalArgumentException e ) {
971936 throwServerException (session , log , e );
972937 } finally {
973938 UploadServlet .cleanUploads (session .getSid ());
974939 }
975940 }
976941
977- private void appendPluginJarInClasspath (File pluginJarFile )
978- throws NoSuchMethodException , InvocationTargetException , MalformedURLException {
979- final ClassLoader sysloader = this .getClass ().getClassLoader ();
980- final Class <URLClassLoader > sysclass = URLClassLoader .class ;
981- final Method method = sysclass .getDeclaredMethod ("addURL" , URL .class );
982-
983- try {
984- method .invoke (sysloader , pluginJarFile .toURI ().toURL ());
985- } catch (IllegalAccessException iae ) {
986- log .warn (iae .getMessage (), iae );
987- }
988- }
989-
990942 @ Override
991943 public List <GUIValue > getPlugins () throws ServerException {
992944 validateSession ();
0 commit comments