From 3f6825d0778ee430f591803f91af44aab2cfc13d Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Tue, 19 Feb 2013 17:18:07 +0200 Subject: [PATCH] minor changes --- .../fortsoft/pf4j/DefaultExtensionFinder.java | 10 ++--- .../fortsoft/pf4j/DefaultPluginManager.java | 38 +++++++++---------- .../ro/fortsoft/pf4j/DependencyResolver.java | 6 +-- .../java/ro/fortsoft/pf4j/PluginLoader.java | 14 +++---- .../java/ro/fortsoft/pf4j/util/Unzip.java | 6 +-- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java index 66c896c..492a701 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultExtensionFinder.java @@ -30,7 +30,7 @@ import net.java.sezpoz.IndexItem; */ public class DefaultExtensionFinder implements ExtensionFinder { - private static final Logger LOG = LoggerFactory.getLogger(DefaultExtensionFinder.class); + private static final Logger log = LoggerFactory.getLogger(DefaultExtensionFinder.class); private volatile List> indices; private ClassLoader classLoader; @@ -41,7 +41,7 @@ public class DefaultExtensionFinder implements ExtensionFinder { @Override public List> find(Class type) { - LOG.debug("Find extensions for " + type); + log.debug("Find extensions for " + type); List> result = new ArrayList>(); getIndices(); // System.out.println("indices = "+ indices); @@ -49,16 +49,16 @@ public class DefaultExtensionFinder implements ExtensionFinder { try { AnnotatedElement element = item.element(); Class extensionType = (Class) element; - LOG.debug("Checking extension type " + extensionType); + log.debug("Checking extension type " + extensionType); if (type.isAssignableFrom(extensionType)) { Object instance = item.instance(); if (instance != null) { - LOG.debug("Added extension " + extensionType); + log.debug("Added extension " + extensionType); result.add(new ExtensionWrapper(type.cast(instance), item.annotation().ordinal())); } } } catch (InstantiationException e) { - LOG.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java index 9dcfcc7..067264f 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java @@ -36,7 +36,7 @@ import ro.fortsoft.pf4j.util.ZipFilter; */ public class DefaultPluginManager implements PluginManager { - private static final Logger LOG = LoggerFactory.getLogger(DefaultPluginManager.class); + private static final Logger log = LoggerFactory.getLogger(DefaultPluginManager.class); /** * The plugins repository. @@ -160,12 +160,12 @@ public class DefaultPluginManager implements PluginManager { public void startPlugins() { for (PluginWrapper pluginWrapper : resolvedPlugins) { try { - LOG.info("Start plugin '" + pluginWrapper.getDescriptor().getPluginId() + "'"); + log.info("Start plugin '" + pluginWrapper.getDescriptor().getPluginId() + "'"); pluginWrapper.getPlugin().start(); pluginWrapper.setPluginState(PluginState.STARTED); startedPlugins.add(pluginWrapper); } catch (PluginException e) { - LOG.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } } @@ -179,11 +179,11 @@ public class DefaultPluginManager implements PluginManager { Collections.reverse(startedPlugins); for (PluginWrapper pluginWrapper : startedPlugins) { try { - LOG.info("Stop plugin '" + pluginWrapper.getDescriptor().getPluginId() + "'"); + log.info("Stop plugin '" + pluginWrapper.getDescriptor().getPluginId() + "'"); pluginWrapper.getPlugin().stop(); pluginWrapper.setPluginState(PluginState.STOPPED); } catch (PluginException e) { - LOG.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } } @@ -195,7 +195,7 @@ public class DefaultPluginManager implements PluginManager { public void loadPlugins() { // check for plugins directory if (!pluginsDirectory.exists() || !pluginsDirectory.isDirectory()) { - LOG.error("No '" + pluginsDirectory + "' directory"); + log.error("No '" + pluginsDirectory + "' directory"); return; } @@ -206,7 +206,7 @@ public class DefaultPluginManager implements PluginManager { try { expandPluginArchive(zipFile); } catch (IOException e) { - LOG.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } @@ -217,13 +217,13 @@ public class DefaultPluginManager implements PluginManager { try { loadPlugin(directory); } catch (PluginException e) { - LOG.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } // check for no plugins if (directories.length == 0) { - LOG.info("No plugins"); + log.info("No plugins"); return; } @@ -231,7 +231,7 @@ public class DefaultPluginManager implements PluginManager { try { resolvePlugins(); } catch (PluginException e) { - LOG.error(e.getMessage(), e); + log.error(e.getMessage(), e); } } @@ -289,22 +289,22 @@ public class DefaultPluginManager implements PluginManager { } // retrieves the plugin descriptor - LOG.debug("Find plugin descriptor '" + pluginPath + "'"); + log.debug("Find plugin descriptor '" + pluginPath + "'"); PluginDescriptor pluginDescriptor = pluginDescriptorFinder.find(pluginDirectory); - LOG.debug("Descriptor " + pluginDescriptor); + log.debug("Descriptor " + pluginDescriptor); String pluginClassName = pluginDescriptor.getPluginClass(); - LOG.debug("Class '" + pluginClassName + "'" + " for plugin '" + pluginPath + "'"); + log.debug("Class '" + pluginClassName + "'" + " for plugin '" + pluginPath + "'"); // load plugin - LOG.debug("Loading plugin '" + pluginPath + "'"); + log.debug("Loading plugin '" + pluginPath + "'"); PluginLoader pluginLoader = new PluginLoader(this, pluginDescriptor, pluginDirectory); pluginLoader.load(); - LOG.debug("Loaded plugin '" + pluginPath + "'"); + log.debug("Loaded plugin '" + pluginPath + "'"); // create the plugin wrapper - LOG.debug("Creating wrapper for plugin '" + pluginPath + "'"); + log.debug("Creating wrapper for plugin '" + pluginPath + "'"); PluginWrapper pluginWrapper = new PluginWrapper(pluginDescriptor, pluginPath, pluginLoader.getPluginClassLoader()); - LOG.debug("Created wrapper '" + pluginWrapper + "' for plugin '" + pluginPath + "'"); + log.debug("Created wrapper '" + pluginWrapper + "' for plugin '" + pluginPath + "'"); String pluginId = pluginDescriptor.getPluginId(); @@ -324,7 +324,7 @@ public class DefaultPluginManager implements PluginManager { File pluginDirectory = new File(pluginsDirectory, pluginName); // check if exists directory or the '.zip' file is "newer" than directory if (!pluginDirectory.exists() || (pluginArchiveDate > pluginDirectory.lastModified())) { - LOG.debug("Expand plugin archive '" + pluginArchiveFile + "' in '" + pluginDirectory + "'"); + log.debug("Expand plugin archive '" + pluginArchiveFile + "' in '" + pluginDirectory + "'"); // create directorie for plugin pluginDirectory.mkdirs(); @@ -346,7 +346,7 @@ public class DefaultPluginManager implements PluginManager { for (PluginWrapper pluginWrapper : resolvedPlugins) { unresolvedPlugins.remove(pluginWrapper); compoundClassLoader.addLoader(pluginWrapper.getPluginClassLoader()); - LOG.info("Plugin '" + pluginWrapper.getDescriptor().getPluginId() + "' resolved"); + log.info("Plugin '" + pluginWrapper.getDescriptor().getPluginId() + "' resolved"); } } diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DependencyResolver.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DependencyResolver.java index 70c1b90..8611fef 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/DependencyResolver.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DependencyResolver.java @@ -25,7 +25,7 @@ import ro.fortsoft.pf4j.util.DirectedGraph; */ class DependencyResolver { - private static final Logger LOG = LoggerFactory.getLogger(DependencyResolver.class); + private static final Logger log = LoggerFactory.getLogger(DependencyResolver.class); private List plugins; @@ -51,14 +51,14 @@ class DependencyResolver { } } - LOG.debug("Graph: " + graph); + log.debug("Graph: " + graph); List pluginsId = graph.reverseTopologicalSort(); if (pluginsId == null) { throw new CyclicDependencyException("Cyclic dependences !!!" + graph.toString()); } - LOG.debug("Plugins order: " + pluginsId); + log.debug("Plugins order: " + pluginsId); List sortedPlugins = new ArrayList(); for (String pluginId : pluginsId) { sortedPlugins.add(getPlugin(pluginId)); diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginLoader.java b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginLoader.java index 7533f57..78603f4 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/PluginLoader.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/PluginLoader.java @@ -33,7 +33,7 @@ import ro.fortsoft.pf4j.util.JarFilter; */ class PluginLoader { - private static final Logger LOG = LoggerFactory.getLogger(PluginLoader.class); + private static final Logger log = LoggerFactory.getLogger(PluginLoader.class); /* * The plugin repository. @@ -58,7 +58,7 @@ class PluginLoader { libDirectory = new File(pluginRepository, "lib"); ClassLoader parent = getClass().getClassLoader(); pluginClassLoader = new PluginClassLoader(pluginManager, pluginDescriptor, parent); - LOG.debug("Created class loader " + pluginClassLoader); + log.debug("Created class loader " + pluginClassLoader); } public File getPluginRepository() { @@ -100,14 +100,14 @@ class PluginLoader { classesDirectory = classesDirectory.getAbsoluteFile(); if (classesDirectory.exists() && classesDirectory.isDirectory()) { - LOG.debug("Found '" + classesDirectory.getPath() + "' directory"); + log.debug("Found '" + classesDirectory.getPath() + "' directory"); try { pluginClassLoader.addURL(classesDirectory.toURI().toURL()); - LOG.debug("Added '" + classesDirectory + "' to the class loader path"); + log.debug("Added '" + classesDirectory + "' to the class loader path"); } catch (MalformedURLException e) { e.printStackTrace(); - LOG.error(e.getMessage(), e); + log.error(e.getMessage(), e); return false; } } @@ -128,10 +128,10 @@ class PluginLoader { File jarFile = new File(libDirectory, jar); try { pluginClassLoader.addURL(jarFile.toURI().toURL()); - LOG.debug("Added '" + jarFile + "' to the class loader path"); + log.debug("Added '" + jarFile + "' to the class loader path"); } catch (MalformedURLException e) { e.printStackTrace(); - LOG.error(e.getMessage(), e); + log.error(e.getMessage(), e); return false; } } diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/util/Unzip.java b/pf4j/src/main/java/ro/fortsoft/pf4j/util/Unzip.java index 4a2c9a3..e3f3ed3 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/util/Unzip.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/util/Unzip.java @@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory; */ public class Unzip { - private static final Logger LOG = LoggerFactory.getLogger(Unzip.class); + private static final Logger log = LoggerFactory.getLogger(Unzip.class); /** * Holds the destination directory. @@ -61,7 +61,7 @@ public class Unzip { } public void extract() throws IOException { - LOG.debug("Extract content of " + source + " to " + destination); + log.debug("Extract content of " + source + " to " + destination); // delete destination file if exists removeDirectory(destination); @@ -91,7 +91,7 @@ public class Unzip { fos.close(); } } catch (FileNotFoundException e) { - LOG.error("File '" + zipEntry.getName() + "' not found"); + log.error("File '" + zipEntry.getName() + "' not found"); } } -- 2.39.5