Examples of PluginContainer


Examples of org.apache.maven.model.PluginContainer

     *
     *   X -> Y -> A -> B -> C -> D -> E -> F
     */
    public void testShouldPreserveOrderingOfPluginsAfterProfileMerge()
    {
        PluginContainer profile = new PluginContainer();

        profile.addPlugin( createPlugin( "group", "artifact", "1.0", Collections.EMPTY_MAP ) );
        profile.addPlugin( createPlugin( "group2", "artifact2", "1.0", Collections.singletonMap( "key", "value" ) ) );

        PluginContainer model = new PluginContainer();

        model.addPlugin( createPlugin( "group3", "artifact3", "1.0", Collections.EMPTY_MAP ) );
        model.addPlugin( createPlugin( "group2", "artifact2", "1.0", Collections.singletonMap( "key2", "value2" ) ) );

        new DefaultProfileInjector().injectPlugins( profile, model );

        List results = model.getPlugins();

        assertEquals( 3, results.size() );

        Plugin result1 = (Plugin) results.get( 0 );

View Full Code Here

Examples of org.apache.maven.project.PluginContainer

     * @param parser
     */
    private PluginContainer parsePluginContainer(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        PluginContainer pluginContainer = new PluginContainer();
        pluginContainer.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        while ( parser.nextTag() == XmlPullParser.START_TAG )
        {
            if ( strict )
            {
View Full Code Here

Examples of org.gradle.api.plugins.PluginContainer

        earPluginConvention.setAppDirName("src/main/application");

        wireEarTaskConventions(project, earPluginConvention);
        configureConfigurations(project);

        PluginContainer plugins = project.getPlugins();

        setupEarTask(project, earPluginConvention);

        configureWithJavaPluginApplied(project, earPluginConvention, plugins);
        configureWithNoJavaPluginApplied(project, earPluginConvention);
View Full Code Here

Examples of org.jasen.core.PluginContainer

                plugins = new Vector(config.getPluginConfigurations().size());

                JasenPlugin plugin = null;
                ProbabilityCalculator pluginCalc = null;
                PluginContainer container = null;
                Properties props = null;
                JasenPluginConfiguration pluginConfig = null;

                while(i.hasNext()) {
                    pluginConfig = (JasenPluginConfiguration)i.next();

                    plugin = (JasenPlugin)Class.forName(pluginConfig.getType(), true, loader).newInstance();

                    logger.debug("Initialising plugin: " + plugin.getClass().getName());

                    // initialise the plugin
                    if(pluginConfig.getProperties() != null) {
                        props = new Properties();
                        props.load(this.getClass().getClassLoader().getResourceAsStream(pluginConfig.getProperties()));
                    }
                    else {
                        props = null;
                    }

                    plugin.init(props);

                    if(pluginConfig.getCalculator() != null) {
                        pluginCalc = (ProbabilityCalculator)Class.forName(pluginConfig.getCalculator(), true, loader).newInstance();
                    }

                    // Add the plugin to a container
                    container = new PluginContainer();
                    container.setName(pluginConfig.getName());
                    container.setDisplayName(pluginConfig.getDisplayName());
                    container.setDescription(pluginConfig.getDescription());
                    container.setCalculator(pluginCalc);
                    container.setPlugin(plugin);

                    // Add the container to the list
                    plugins.add(container);
                }
            }
View Full Code Here

Examples of org.rhq.core.pc.PluginContainer

            out.println(MSG.getMsg(AgentI18NResourceKeys.INVENTORY_ID_AND_DUMP_TYPES_SPECIFIED));
            out.println(MSG.getMsg(AgentI18NResourceKeys.HELP_SYNTAX_LABEL, getSyntax()));
            return;
        }

        PluginContainer pc = PluginContainer.getInstance();

        // to get inventory data, the PC must be started
        if (!agent.isStarted() || !pc.isStarted()) {
            out.println(MSG.getMsg(AgentI18NResourceKeys.INVENTORY_MUST_BE_STARTED));
            return;
        }

        PrintWriter exportWriter = out; // default is to dump to console out
        if (exportFile != null) {
            try {
                FileOutputStream fos = new FileOutputStream(new File(exportFile));
                exportWriter = new PrintWriter(fos);
            } catch (Exception e) {
                out.println(MSG.getMsg(AgentI18NResourceKeys.INVENTORY_BAD_EXPORT_FILE, exportFile, e));
                return;
            }
        }

        // process the inventory
        try {
            if (inventoryBinaryFile == null) {
                if (dumpTypesOnly) {
                    Set<ResourceType> rootTypes = pc.getPluginManager().getMetadataManager().getRootTypes();
                    InventoryPrinter.outputAllResourceTypes(exportWriter, dumpXml, rootTypes);
                } else {
                    ResourceContainer rc = null;
                    if (id != null) {
                        rc = pc.getInventoryManager().getResourceContainer(id);
                        if (rc == null) {
                            out.println(MSG.getMsg(AgentI18NResourceKeys.INVENTORY_INVALID_RESOURCE_ID, id));
                            return;
                        }
                    }
View Full Code Here

Examples of org.rhq.core.pc.PluginContainer

                // If the server thinks we are down, we need to do some things to get this agent in sync
                // with the server. Anything we do in here should be very fast.
                boolean serverThinksWeAreDown = request.isReplyAgentIsBackfilled();
                if (serverThinksWeAreDown) {
                    LOG.warn(AgentI18NResourceKeys.SERVER_THINKS_AGENT_IS_DOWN);
                    PluginContainer pluginContainer = PluginContainer.getInstance();
                    if (pluginContainer.isStarted()) {
                        // tell the plugin container to send a full avail report up so the server knows we are UP
                        pluginContainer.getInventoryManager().requestFullAvailabilityReport();
                    }
                }

            } catch (Throwable t) {
                // If the ping fails, typically do to a CannotConnectException, and we're not using autodiscovery,
View Full Code Here

Examples of org.rhq.core.pc.PluginContainer

        return;
    }

    private void discovery(String pcName, PrintWriter out, String pluginName, String resourceTypeName, boolean verbose)
        throws Exception {
        PluginContainer pc = PluginContainer.getInstance();
        PluginMetadataManager metadataManager = pc.getPluginManager().getMetadataManager();
        Set<ResourceType> typesToDiscover = new TreeSet<ResourceType>(new PluginPrimaryResourceTypeComparator());

        // make sure the plugin exists first (if one was specified)
        Set<String> allPlugins = metadataManager.getPluginNames();
        if (pluginName != null) {
            if (!allPlugins.contains(pluginName)) {
                out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_BAD_PLUGIN_NAME, pluginName));
                return;
            }
        }

        // determine which resource types are to be discovered
        Set<ResourceType> allTypes = metadataManager.getAllTypes();
        if (resourceTypeName != null) {
            for (ResourceType type : allTypes) {
                if (type.getName().equals(resourceTypeName)) {
                    if ((pluginName == null) || (pluginName.equals(type.getPlugin()))) {
                        typesToDiscover.add(type);
                    }
                }
            }
        } else {
            // if a plugin was specified, only discover its types; otherwise, discover ALL types
            if (pluginName != null) {
                for (ResourceType type : allTypes) {
                    if (pluginName.equals(type.getPlugin())) {
                        typesToDiscover.add(type);
                    }
                }
            } else {
                typesToDiscover.addAll(allTypes);
            }
        }

        if (typesToDiscover.size() == 0) {
            if (pluginName == null) {
                out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_BAD_RESOURCE_TYPE_NAME, resourceTypeName));
            } else {
                out.println(MSG.getMsg(AgentI18NResourceKeys.DISCOVERY_BAD_PLUGIN_RESOURCE_TYPE_NAME, pluginName,
                    resourceTypeName));
            }

            return;
        }

        InventoryManager inventoryManager = pc.getInventoryManager();
        HashSet<ResourceType> blacklist = inventoryManager.getDiscoveryComponentProxyFactory()
            .getResourceTypeBlacklist();
        Iterator<ResourceType> iterator = blacklist.iterator();
        while (iterator.hasNext()) {
            ResourceType type = iterator.next();
View Full Code Here

Examples of org.rhq.core.pc.PluginContainer

            // we got too many arguments on the command line
            out.println(MSG.getMsg(AgentI18NResourceKeys.HELP_SYNTAX_LABEL, getSyntax()));
            return;
        }

        PluginContainer pc = PluginContainer.getInstance();

        // the PC must be started
        if (!agent.isStarted() || !pc.isStarted()) {
            out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_MUST_BE_STARTED));
            return;
        }

        // process the inventory
        InventoryManager inventoryManager = pc.getInventoryManager();
        AvailabilityReport report = inventoryManager.executeAvailabilityScanImmediately(changedOnly, force);

        if (report == null) {
            out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_NO_COMMITTED_INVENTORY));
            return;
View Full Code Here

Examples of org.rhq.core.pc.PluginContainer

        //this is just a dummy method that other classes can call to force the static
        //initialization of this class.
    }
   
    public static PluginContainer switchPluginContainer(String deploymentName) throws Exception {
        PluginContainer oldInstance = PluginContainer.getInstance();
        Method setInstance = PluginContainer.class.getMethod("setContainerInstance", String.class);
        setInstance.invoke(null, deploymentName);
        PluginContainer newInstance = PluginContainer.getInstance();

        if (newInstance != oldInstance) {
            Boolean enableNativeInfo = NATIVE_SYSTEM_INFO_ENABLEMENT_PER_PC.get(deploymentName);

            if (enableNativeInfo == null || !enableNativeInfo.booleanValue()) {
View Full Code Here

Examples of org.rhq.core.pc.PluginContainer

        if (wasStarted) {
            startPc();
        }

        PluginContainer pc = PluginContainer.getInstance();
        String pluginName = getPluginName(pluginArchive);
        PluginEnvironment plugin = pc.getPluginManager().getPlugin(pluginName);
        if (plugin == null) {
            throw new RuntimeException("Failed to deploy plugin '" + pluginName + "' (" + pluginArchive.getName()
                    + ") - check the log above for an error (and big stack trace) from PluginManager.initialize().");
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.