@Test public void testPluginTest() { LogUtil.info(getClass().getName(), " ===testPluginTest=== "); pluginManager.testPlugin(getSamplePlugin(), getSamplePluginFile(), null, true); }
public void testPlugin(String name, String location, Map properties, boolean override) { LogUtil.info(PluginManager.class.getName(), "====testPlugin===="); Plugin plugin = getPlugin(name); boolean existing = (plugin != null); boolean install = (location != null && location.trim().length() > 0); if (install && (!existing || override)) { InputStream in = null; try { LogUtil.info(PluginManager.class.getName(), " ===install=== "); File file = new File(location); if (file.exists()) { in = new FileInputStream(file); upload(file.getName(), in); } } catch (Exception ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } } } LogUtil.info(PluginManager.class.getName(), " ===execute=== "); Object result = execute(name, properties); LogUtil.info(PluginManager.class.getName(), " result: " + result); if (install && (!existing || override)) { LogUtil.info(PluginManager.class.getName(), " ===uninstall=== "); uninstall(name); } LogUtil.info(PluginManager.class.getName(), "====testPlugin end===="); }
PluginManager implements ApplicationContextAware { public void testPlugin(String name, String location, Map properties, boolean override) { LogUtil.info(PluginManager.class.getName(), "====testPlugin===="); Plugin plugin = getPlugin(name); boolean existing = (plugin != null); boolean install = (location != null && location.trim().length() > 0); if (install && (!existing || override)) { InputStream in = null; try { LogUtil.info(PluginManager.class.getName(), " ===install=== "); File file = new File(location); if (file.exists()) { in = new FileInputStream(file); upload(file.getName(), in); } } catch (Exception ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } } } LogUtil.info(PluginManager.class.getName(), " ===execute=== "); Object result = execute(name, properties); LogUtil.info(PluginManager.class.getName(), " result: " + result); if (install && (!existing || override)) { LogUtil.info(PluginManager.class.getName(), " ===uninstall=== "); uninstall(name); } LogUtil.info(PluginManager.class.getName(), "====testPlugin end===="); } }
PluginManager implements ApplicationContextAware { public void testPlugin(String name, String location, Map properties, boolean override) { LogUtil.info(PluginManager.class.getName(), "====testPlugin===="); Plugin plugin = getPlugin(name); boolean existing = (plugin != null); boolean install = (location != null && location.trim().length() > 0); if (install && (!existing || override)) { InputStream in = null; try { LogUtil.info(PluginManager.class.getName(), " ===install=== "); File file = new File(location); if (file.exists()) { in = new FileInputStream(file); upload(file.getName(), in); } } catch (Exception ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } } } LogUtil.info(PluginManager.class.getName(), " ===execute=== "); Object result = execute(name, properties); LogUtil.info(PluginManager.class.getName(), " result: " + result); if (install && (!existing || override)) { LogUtil.info(PluginManager.class.getName(), " ===uninstall=== "); uninstall(name); } LogUtil.info(PluginManager.class.getName(), "====testPlugin end===="); } PluginManager();  PluginManager(String baseDirectory); }
PluginManager implements ApplicationContextAware { public void testPlugin(String name, String location, Map properties, boolean override) { LogUtil.info(PluginManager.class.getName(), "====testPlugin===="); Plugin plugin = getPlugin(name); boolean existing = (plugin != null); boolean install = (location != null && location.trim().length() > 0); if (install && (!existing || override)) { InputStream in = null; try { LogUtil.info(PluginManager.class.getName(), " ===install=== "); File file = new File(location); if (file.exists()) { in = new FileInputStream(file); upload(file.getName(), in); } } catch (Exception ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } } } LogUtil.info(PluginManager.class.getName(), " ===execute=== "); Object result = execute(name, properties); LogUtil.info(PluginManager.class.getName(), " result: " + result); if (install && (!existing || override)) { LogUtil.info(PluginManager.class.getName(), " ===uninstall=== "); uninstall(name); } LogUtil.info(PluginManager.class.getName(), "====testPlugin end===="); } PluginManager();  PluginManager(String baseDirectory); String getBaseDirectory(); void refresh(); Collection<Plugin> list(); boolean disable(String name); boolean upload(String filename, InputStream in); void uninstallAll(boolean deleteFiles); boolean uninstall(String name); boolean uninstall(String name, boolean deleteFile); Plugin getPlugin(String name); Object execute(String name, Map properties); void shutdown(); @Override void finalize(); void testPlugin(String name, String location, Map properties, boolean override); static void main(String[] args); Object getBean(String beanName); void setApplicationContext(ApplicationContext appContext); }
PluginManager implements ApplicationContextAware { public void testPlugin(String name, String location, Map properties, boolean override) { LogUtil.info(PluginManager.class.getName(), "====testPlugin===="); Plugin plugin = getPlugin(name); boolean existing = (plugin != null); boolean install = (location != null && location.trim().length() > 0); if (install && (!existing || override)) { InputStream in = null; try { LogUtil.info(PluginManager.class.getName(), " ===install=== "); File file = new File(location); if (file.exists()) { in = new FileInputStream(file); upload(file.getName(), in); } } catch (Exception ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { LogUtil.error(PluginManager.class.getName(), ex, ""); } } } LogUtil.info(PluginManager.class.getName(), " ===execute=== "); Object result = execute(name, properties); LogUtil.info(PluginManager.class.getName(), " result: " + result); if (install && (!existing || override)) { LogUtil.info(PluginManager.class.getName(), " ===uninstall=== "); uninstall(name); } LogUtil.info(PluginManager.class.getName(), "====testPlugin end===="); } PluginManager();  PluginManager(String baseDirectory); String getBaseDirectory(); void refresh(); Collection<Plugin> list(); boolean disable(String name); boolean upload(String filename, InputStream in); void uninstallAll(boolean deleteFiles); boolean uninstall(String name); boolean uninstall(String name, boolean deleteFile); Plugin getPlugin(String name); Object execute(String name, Map properties); void shutdown(); @Override void finalize(); void testPlugin(String name, String location, Map properties, boolean override); static void main(String[] args); Object getBean(String beanName); void setApplicationContext(ApplicationContext appContext);  }