Package net.xeoh.plugins.base

Examples of net.xeoh.plugins.base.Plugin


            timer.schedule(lateMessage, 250);

            // Instanciate the plugin
            final Constructor constructor = c.getDeclaredConstructor();
            constructor.setAccessible(true);
            final Plugin spawnedPlugin = (Plugin) constructor.newInstance();
           
            // In here spawning of the plugin worked
            final SpawnResult spawnResult = new SpawnResult(spawnedPlugin);
            spawnResult.metaInformation.pluginStatus = PluginStatus.SPAWNED;
            spawnResult.metaInformation.spawnTime = System.currentTimeMillis();
View Full Code Here


     * @return
     */
    @SuppressWarnings("unchecked")
    Plugin getEntityForType(Class<?> type, String...capabilities) {
        // We need that anyways.
        Plugin plugin = this.pluginManager.getPlugin((Class<Plugin>) getTrueDependencyInterfaceType(type), new OptionCapabilities(capabilities));
       
        // First check if the requested type is an anctual interface or not. If it is, we simply treat
        // it as a plugin, if it is not (i.e., a ordinary class), we treat it as a util wrapper.
        if(type.isInterface()) {
            return plugin;
View Full Code Here

        System.out.println("GO");
        ExportResult exportPlugin = p.exportPlugin(p2);
        System.out.println("1");
        Assert.assertNotNull(exportPlugin);
        System.out.println("2");
        Plugin rp = p.getRemoteProxy(new URI("discover://nearest"), TestAnnotations.class);
        System.out.println(rp);
        Plugin remoteProxy = p.getRemoteProxy(new URI("discover://any"), Plugin.class);

        Assert.assertNotNull(remoteProxy);
        TestAnnotations remoteProxy2 = p.getRemoteProxy(new URI("discover://nearest"), TestAnnotations.class);
        Assert.assertNotNull(remoteProxy2);
        String injectionStatus = remoteProxy2.getInjectionStatus();
        Assert.assertEquals(injectionStatus, "INJECTION OK");
        System.out.println("YO");
        Plugin youngest = p.getRemoteProxy(new URI("discover://youngest"), Plugin.class);
        Assert.assertNotNull(youngest);
        Plugin oldest = p.getRemoteProxy(new URI("discover://oldest"), Plugin.class);
        Assert.assertNotNull(oldest);

    }
View Full Code Here

        if (p.spawnType != SpawnType.PLUGIN)
            throw new IllegalStateException("May only hook plugins!");

        this.pluginListLock.lock();
        try {
            Plugin plugin = (Plugin) p.pluggable;

            // Only do something if the plugins is not this
            if (plugin != this && plugin != this.pluginSupervisor) {
                // Wrap plugin inside meta handler, if enabled
                if (this.wrapPluginsInMetaProxy) {

                    final Class<?>[] internalInterfaces = plugin.getClass().getInterfaces();
                    final Class<?>[] interfaces = new Class[internalInterfaces.length + 1];

                    System.arraycopy(internalInterfaces, 0, interfaces, 0, internalInterfaces.length);

                    interfaces[interfaces.length - 1] = PluginWrapper.class;

                    plugin = (Plugin) Proxy.newProxyInstance(plugin.getClass().getClassLoader(), interfaces, new PluginMetaHandler(this.pluginSupervisor, plugin));
                }
            }

            // 1. Process plugin loaded information
            processPluginLoadedAnnotationForThisPlugin(p);
View Full Code Here

TOP

Related Classes of net.xeoh.plugins.base.Plugin

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.