Package play

Examples of play.PlayPlugin


                    //no constructors in plugin
                    //using getDeclaredConstructors() instead of getConstructors() to make it work for plugins without constructor
                    constructors = pluginClazz.getDeclaredConstructors();
                }

                PlayPlugin newPlugin = (PlayPlugin) constructors[0].newInstance();
                newPlugin.index = plugin.index;
                //replace this plugin
                replacePlugin(plugin, newPlugin);
                reloadedPlugins.add(newPlugin);
            }
View Full Code Here


                String pluginClassName = (String)e.getValue();
                //try to find this class..
                Class<? extends PlayPlugin> clazz = resolveClass(pluginClassName);
                if( clazz != null ){

                    PlayPlugin pluginInstance = Play.pluginCollection.getPluginInstance( clazz );

                    if( pluginInstance != null ){

                        //try to disable it
                        //must remember that we have tries to disabled this plugin
View Full Code Here

        Collections.sort(pluginsToLoad);

        for (LoadingPluginInfo info : pluginsToLoad) {
            Logger.trace("Loading plugin %s", info.name);
            try {
                PlayPlugin plugin = (PlayPlugin)Play.classloader.loadClass(info.name).newInstance();
                plugin.index = info.index;
                if (addPlugin(plugin)) {
                    Logger.trace("Plugin %s loaded", plugin);
                } else {
                    Logger.warn("Did not load plugin %s. Already loaded", plugin);
View Full Code Here

                    // No constructors in plugin
                    // using getDeclaredConstructors() instead of getConstructors() to make it work for plugins without constructor
                    constructors = pluginClazz.getDeclaredConstructors();
                }

                PlayPlugin newPlugin = (PlayPlugin) constructors[0].newInstance();
                newPlugin.index = plugin.index;
                // Replace this plugin
                replacePlugin(plugin, newPlugin);
                reloadedPlugins.add(newPlugin);
            }
View Full Code Here

        //make sure we load custom play.plugins-file
        pc.play_plugins_resourceName = "play/plugins/custom-play-with-blank-lines.plugins";

        pc.loadPlugins();

        PlayPlugin corePlugin_first_instance = pc.getPluginInstance(CorePlugin.class);
        PlayPlugin testPlugin_first_instance = pc.getPluginInstance(TestPlugin.class);

        assertThat(pc.getAllPlugins()).containsExactly(
                corePlugin_first_instance,
                testPlugin_first_instance);
View Full Code Here

        //make sure we load custom play.plugins-file
        pc.play_plugins_resourceName = "play/plugins/custom-play.plugins";

        pc.loadPlugins();

        PlayPlugin corePlugin_first_instance = pc.getPluginInstance(CorePlugin.class);
        PlayPlugin testPlugin_first_instance = pc.getPluginInstance(TestPlugin.class);

        //the following plugin-list should match the list in the file 'play.plugins'
        assertThat(pc.getEnabledPlugins()).containsExactly(
                corePlugin_first_instance,
                testPlugin_first_instance);
        assertThat(pc.getAllPlugins()).containsExactly(
                corePlugin_first_instance,
                testPlugin_first_instance);

        pc.reloadApplicationPlugins();

        PlayPlugin testPlugin_second_instance = pc.getPluginInstance(TestPlugin.class);

        assertThat(pc.getPluginInstance(CorePlugin.class)).isEqualTo( corePlugin_first_instance);
        assertThat(testPlugin_second_instance).isNotEqualTo( testPlugin_first_instance);

    }
View Full Code Here

    @Test
    public void verifyThatDisabelingPluginsTheOldWayStillWorks(){
        PluginCollection pc = new PluginCollection();


        PlayPlugin legacyPlugin = new LegacyPlugin();

        pc.addPlugin( legacyPlugin );
        pc.addPlugin( new TestPlugin() );

        pc.initializePlugin( legacyPlugin );
View Full Code Here

    @SuppressWarnings({"deprecation"})
    @Override
    public void onLoad() {
        //find TestPlugin in Play.plugins-list and remove it to disable it
        PlayPlugin pluginToRemove = null;
        for( PlayPlugin pp : Play.plugins){
            if( pp.getClass().equals( TestPlugin.class)){
                pluginToRemove = pp;
                break;
            }
View Full Code Here

    public void verify_that_the_plugin_gets_loaded(){
        PluginCollection pc = new PluginCollection();

        new PlayBuilder().build();
        pc.loadPlugins();
        PlayPlugin pi = pc.getPluginInstance(ConfigurablePluginDisablingPlugin.class);
        assertThat(pi).isInstanceOf(ConfigurablePluginDisablingPlugin.class);
        assertThat(pc.getEnabledPlugins()).contains( pi );
    }
View Full Code Here

  }

  @Override
  public void onConfigurationRead()
  {
    PlayPlugin jpaPlugin = Play.pluginCollection.getPluginInstance(JPAPlugin.class);
    if (jpaPlugin != null && Play.pluginCollection.isEnabled(jpaPlugin)) {
      Logger.debug("EBEAN: Disabling JPAPlugin in order to replace JPA implementation");
      Play.pluginCollection.disablePlugin(jpaPlugin);
    }
  }
View Full Code Here

TOP

Related Classes of play.PlayPlugin

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.