Package org.lilyproject.plugin

Examples of org.lilyproject.plugin.PluginException


            }
        }

        public void addPlugin(String name, T plugin) {
            if (name == null || name.trim().length() == 0) {
                throw new PluginException("Null, empty or whitespace argument: name");
            }

            if (plugin == null) {
                throw new IllegalArgumentException("Null argument: plugin");
            }

            if (!type.isAssignableFrom(plugin.getClass())) {
                throw new PluginException("Plugin does not implement its plugin type. Plugin \"" + name + "\" of type " + type.getName());
            }

            PluginEntry<T> newEntry = new PluginEntry<T>(name, plugin);

            for (PluginEntry entry : plugins) {
                if (entry.equals(newEntry)) {
                    throw new PluginException("This plugin instance is already registered. Plugin \"" + name + "\" of type " + type.getName());
                }
                if (entry.name.equals(newEntry.name)) {
                    throw new PluginException("There is already another plugin registered with this name: \"" + name + "\".");
                }
            }

            plugins.add(newEntry);
View Full Code Here


                    break;
                }
            }

            if (!found) {
                throw new PluginException("It is not possible to remove an plugin which is not registered. Plugin \"" + name + "\".");
            }

            notifyPluginRemoved(removedEntry);
        }
View Full Code Here

            notifyPluginRemoved(removedEntry);
        }

        public void setPluginUser(PluginUser<T> pluginUser) {
            if (this.user != null) {
                throw new PluginException("Error setting plugin user: there can be only one PluginUser per plugin type. Type = " + type.getName());
            }

            this.user = pluginUser;

            for (PluginEntry<T> entry : plugins) {
View Full Code Here

            }
        }

        public void unsetPluginUser(PluginUser<T> pluginUser) {
            if (this.user != pluginUser) {
                throw new PluginException("Error removing plugin user: the current plugin user does not correspond to the specified plugin user.");
            }

            this.user = null;
        }
View Full Code Here

TOP

Related Classes of org.lilyproject.plugin.PluginException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.