public void configure()

in src/main/java/org/apache/maven/plugins/ear/util/ArtifactTypeMappingService.java [67:113]


    public void configure( final PlexusConfiguration plexusConfiguration )
        throws EarPluginException, PlexusConfigurationException
    {

        // No user defined configuration
        if ( plexusConfiguration == null )
        {
            return;
        }

        // Inject users configuration
        final PlexusConfiguration[] artifactTypeMappings =
            plexusConfiguration.getChildren( ARTIFACT_TYPE_MAPPING_ELEMENT );
        for ( PlexusConfiguration artifactTypeMapping : artifactTypeMappings )
        {
            final String customType = artifactTypeMapping.getAttribute( TYPE_ATTRIBUTE );
            final String mapping = artifactTypeMapping.getAttribute( MAPPING_ATTRIBUTE );

            if ( customType == null )
            {
                throw new EarPluginException( "Invalid artifact type mapping, type attribute should be set." );
            }
            else if ( mapping == null )
            {
                throw new EarPluginException( "Invalid artifact type mapping, mapping attribute should be set." );
            }
            else if ( !EarModuleFactory.isStandardArtifactType( mapping ) )
            {
                throw new EarPluginException( "Invalid artifact type mapping, mapping[" + mapping
                    + "] must be a standard Ear artifact type[" + EarModuleFactory.getStandardArtifactTypes() + "]" );
            }
            else if ( customMappings.containsKey( customType ) )
            {
                throw new EarPluginException( "Invalid artifact type mapping, type[" + customType
                    + "] is already registered." );
            }
            else
            {
                // Add the custom mapping
                customMappings.put( customType, mapping );

                // Register the custom mapping to its standard type
                List<String> typeMapping = typeMappings.get( mapping );
                typeMapping.add( customType );
            }
        }
    }