Examples of PluginMetadataParser


Examples of org.apache.maven.plugin.tools.model.PluginMetadataParser

                                                                       PluginToolsRequest request )
        throws ExtractionException, InvalidPluginDescriptorException
    {
        List<MojoDescriptor> descriptors = new ArrayList<MojoDescriptor>();

        PluginMetadataParser parser = new PluginMetadataParser();

        for ( Map.Entry<String, Set<File>> entry : metadataFilesKeyedByBasedir.entrySet() )
        {
            String basedir = entry.getKey();
            Set<File> metadataFiles = entry.getValue();

            for ( File metadataFile : metadataFiles )
            {
                String basename = metadataFile.getName();
                basename = basename.substring( 0, basename.length() - METADATA_FILE_EXTENSION.length() );

                File scriptFile = new File( metadataFile.getParentFile(), basename + SCRIPT_FILE_EXTENSION );

                if ( !scriptFile.exists() )
                {
                    throw new InvalidPluginDescriptorException(
                        "Found orphaned plugin metadata file: " + metadataFile );
                }

                String relativePath = scriptFile.getPath().substring( basedir.length() ).replace( '\\', '/' );
               
                if ( relativePath.startsWith( "/" ) )
                {
                    relativePath = relativePath.substring( 1 );
                }

                try
                {
                    Set<MojoDescriptor> mojoDescriptors = parser.parseMojoDescriptors( metadataFile );

                    for ( MojoDescriptor descriptor : mojoDescriptors )
                    {
                        @SuppressWarnings( "unchecked" )
                        Map<String, ?> paramMap = descriptor.getParameterMap();
View Full Code Here

Examples of org.apache.maven.plugin.tools.model.PluginMetadataParser

    protected List extractMojoDescriptorsFromMetadata( Map metadataFilesKeyedByBasedir, PluginDescriptor pluginDescriptor )
        throws ExtractionException, InvalidPluginDescriptorException
    {
        List descriptors = new ArrayList();

        PluginMetadataParser parser = new PluginMetadataParser();

        for ( Iterator mapIterator = metadataFilesKeyedByBasedir.entrySet().iterator(); mapIterator.hasNext(); )
        {
            Map.Entry entry = (Map.Entry) mapIterator.next();

            String basedir = (String) entry.getKey();
            Set metadataFiles = (Set) entry.getValue();

            for ( Iterator it = metadataFiles.iterator(); it.hasNext(); )
            {
                File metadataFile = (File) it.next();

                String basename = metadataFile.getName();
                basename = basename.substring( 0, basename.length() - METADATA_FILE_EXTENSION.length() );

                File scriptFile = new File( metadataFile.getParentFile(), basename + SCRIPT_FILE_EXTENSION );

                if ( !scriptFile.exists() )
                {
                    throw new InvalidPluginDescriptorException( "Found orphaned plugin metadata file: "
                        + metadataFile );
                }

                String relativePath = null;

                if ( basedir.endsWith( "/" ) )
                {
                    basedir = basedir.substring( 0, basedir.length() - 2 );
                }

                relativePath = scriptFile.getPath().substring( basedir.length() );

                relativePath = relativePath.replace( '\\', '/' );

                try
                {
                    Set mojoDescriptors = parser.parseMojoDescriptors( metadataFile );

                    for ( Iterator discoveredMojoIterator = mojoDescriptors.iterator(); discoveredMojoIterator
                        .hasNext(); )
                    {
                        MojoDescriptor descriptor = (MojoDescriptor) discoveredMojoIterator.next();
View Full Code Here

Examples of org.apache.maven.plugin.tools.model.PluginMetadataParser

                                                       PluginToolsRequest request )
        throws ExtractionException, InvalidPluginDescriptorException
    {
        List<MojoDescriptor> descriptors = new ArrayList<MojoDescriptor>();

        PluginMetadataParser parser = new PluginMetadataParser();

        for ( Map.Entry<String, Set<File>> entry : metadataFilesKeyedByBasedir.entrySet() )
        {
            String basedir = (String) entry.getKey();
            Set<File> metadataFiles = entry.getValue();

            for ( File metadataFile : metadataFiles )
            {
                String basename = metadataFile.getName();
                basename = basename.substring( 0, basename.length() - METADATA_FILE_EXTENSION.length() );

                File scriptFile = new File( metadataFile.getParentFile(), basename + SCRIPT_FILE_EXTENSION );

                if ( !scriptFile.exists() )
                {
                    throw new InvalidPluginDescriptorException(
                        "Found orphaned plugin metadata file: " + metadataFile );
                }

                String relativePath = null;

                relativePath = scriptFile.getPath().substring( basedir.length() );
                relativePath = relativePath.replace( '\\', '/' );
               
                if ( relativePath.startsWith( "/" ) )
                {
                    relativePath = relativePath.substring( 1 );
                }

                try
                {
                    Set<MojoDescriptor> mojoDescriptors = parser.parseMojoDescriptors( metadataFile );

                    for ( MojoDescriptor descriptor : mojoDescriptors )
                    {
                        @SuppressWarnings( "unchecked" )
                        Map<String, ?> paramMap = descriptor.getParameterMap();
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginMetadataParser

        return null;
    }
   
    private static List<ResourceType> getResourceTypesInPlugin(String pluginUri) throws Exception {
        PluginDescriptor descriptor = AgentPluginDescriptorUtil.loadPluginDescriptorFromUrl(new URI(pluginUri).toURL());
        PluginMetadataParser parser = new PluginMetadataParser(descriptor,
            Collections.<String, PluginMetadataParser> emptyMap());
   
        return parser.getAllTypes();
    }
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginMetadataParser

            "          class='TestServer'" + //
            "          discovery='TestServerDiscoveryComponent'/>" + //
            "</plugin>");

        Map<String, PluginMetadataParser> parsersByPlugin = new HashMap<String, PluginMetadataParser>(0);
        PluginMetadataParser parser = new PluginMetadataParser(pluginDescriptor, parsersByPlugin);

        ResourceType resourceType = findResourceType(parser, "testServer");

        String componentClass = parser.getComponentClass(resourceType);

        assertEquals(componentClass, "org.rhq.plugins.test.TestServer",
            "Expected the package name from the 'package' attribute of the <plugin> element to be included when the "
                + "package is not included in the 'class' attribute.");
    }
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginMetadataParser

            "          class='org.rhq.plugins.test.TestServer'" + //
            "          discovery='org.rhq.plugins.test.TestServerDiscoveryComponent'/>" + //
            "</plugin>");

        Map<String, PluginMetadataParser> parsersByPlugin = new HashMap<String, PluginMetadataParser>(0);
        PluginMetadataParser parser = new PluginMetadataParser(pluginDescriptor, parsersByPlugin);

        ResourceType resourceType = findResourceType(parser, "testServer");

        String discoveryComponent = parser.getDiscoveryComponentClass(resourceType);

        assertEquals(discoveryComponent, "org.rhq.plugins.test.TestServerDiscoveryComponent",
            "Expected the package and class name from 'discovery' attribute when it includes the package name.");
    }
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginMetadataParser

            "          class='TestServer'" + //
            "          discovery='TestServerDiscoveryComponent'/>" + //
            "</plugin>");

        Map<String, PluginMetadataParser> parsersByPlugin = new HashMap<String, PluginMetadataParser>(0);
        PluginMetadataParser parser = new PluginMetadataParser(pluginDescriptor, parsersByPlugin);

        ResourceType resourceType = findResourceType(parser, "testServer");

        String discoveryComponent = parser.getDiscoveryComponentClass(resourceType);

        assertEquals(discoveryComponent, "org.rhq.plugins.test.TestServerDiscoveryComponent",
            "Expected the package name from the 'package' attribute of the <plugin> element to be included when the "
                + "pacage is not included in the 'discovery' attribute.");
    }
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginMetadataParser

            "             discovery='TestServiceDiscoveryComponent'/>" + //
            "  </server>" + //
            "</plugin>");

        Map<String, PluginMetadataParser> parsersByPlugin = new HashMap<String, PluginMetadataParser>(0);
        PluginMetadataParser parser = new PluginMetadataParser(pluginDescriptor, parsersByPlugin);

        ResourceType serverResourceType = findResourceType(parser, "testServer");
        Set<ResourceType> childResourceTypes = serverResourceType.getChildResourceTypes();
        ResourceType child = null;
        for (ResourceType resourceType : childResourceTypes) {
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginMetadataParser

            "    </resource-configuration>" + //
            "  </server>" + //
            "</plugin>");

        Map<String, PluginMetadataParser> parsersByPlugin = new HashMap<String, PluginMetadataParser>(0);
        PluginMetadataParser parser = new PluginMetadataParser(pluginDescriptor, parsersByPlugin);

        ResourceType serverResourceType = findResourceType(parser, "testServer");

        assertNotNull(serverResourceType.getResourceConfigurationDefinition(),
            "Expected resource type to have a resource configuration definition.");
View Full Code Here

Examples of org.rhq.core.clientapi.agent.metadata.PluginMetadataParser

            "    </resource-configuration>" + //
            "  </server>" + //
            "</plugin>");

        Map<String, PluginMetadataParser> parsersByPlugin = new HashMap<String, PluginMetadataParser>(0);
        PluginMetadataParser parser = new PluginMetadataParser(pluginDescriptor, parsersByPlugin);

        ResourceType serverResourceType = findResourceType(parser, "testServer");
        ConfigurationDefinition resourceConfigurationDefinition = serverResourceType
            .getResourceConfigurationDefinition();
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.