Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.maven.configuration;
  
  /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
 
A basic bean configuration request.

Author(s):
Benjamin Bentmann
 
     implements BeanConfigurationRequest
 {
 
     private Object bean;
 
     private Object configuration;
 
     private String configurationElement;
 
     private ClassLoader classLoader;
 
 
 
     public Object getBean()
     {
         return ;
     }
 
     public DefaultBeanConfigurationRequest setBeanObject bean )
     {
         this. = bean;
         return this;
     }
 
     public Object getConfiguration()
     {
         return ;
     }
 
     public String getConfigurationElement()
     {
         return ;
     }
 
     public DefaultBeanConfigurationRequest setConfigurationObject configuration )
     {
         return setConfigurationconfigurationnull );
     }
 
     public DefaultBeanConfigurationRequest setConfigurationObject configurationString element )
     {
         this. = configuration;
         this. = element;
         return this;
     }

    
Sets the configuration to the configuration taken from the specified build plugin in the POM. First, the build plugins will be searched for the specified plugin, if that fails, the plugin management section will be searched.

Parameters:
model The POM to extract the plugin configuration from, may be null.
pluginGroupId The group id of the plugin whose configuration should be used, must not be null or empty.
pluginArtifactId The artifact id of the plugin whose configuration should be used, must not be null or empty.
pluginExecutionId The id of a plugin execution whose configuration should be used, may be null or empty to use the general plugin configuration.
Returns:
This request for chaining, never null.
 
     public DefaultBeanConfigurationRequest setConfigurationModel modelString pluginGroupId,
                                                              String pluginArtifactIdString pluginExecutionId )
     {
         Plugin plugin = findPluginmodelpluginGroupIdpluginArtifactId );
        if ( plugin != null )
        {
            if ( StringUtils.isNotEmptypluginExecutionId ) )
            {
                for ( PluginExecution execution : plugin.getExecutions() )
                {
                    if ( pluginExecutionId.equalsexecution.getId() ) )
                    {
                        setConfigurationexecution.getConfiguration() );
                        break;
                    }
                }
            }
            else
            {
                setConfigurationplugin.getConfiguration() );
            }
        }
        return this;
    }
    private Plugin findPluginModel modelString groupIdString artifactId )
    {
        if ( StringUtils.isEmptygroupId ) )
        {
            throw new IllegalArgumentException"group id for plugin has not been specified" );
        }
        if ( StringUtils.isEmptyartifactId ) )
        {
            throw new IllegalArgumentException"artifact id for plugin has not been specified" );
        }
        if ( model != null )
        {
            Build build = model.getBuild();
            if ( build != null )
            {
                for ( Plugin plugin : build.getPlugins() )
                {
                    if ( groupId.equalsplugin.getGroupId() ) && artifactId.equalsplugin.getArtifactId() ) )
                    {
                        return plugin;
                    }
                }
                PluginManagement mngt = build.getPluginManagement();
                if ( mngt != null )
                {
                    for ( Plugin plugin : mngt.getPlugins() )
                    {
                        if ( groupId.equalsplugin.getGroupId() ) && artifactId.equalsplugin.getArtifactId() ) )
                        {
                            return plugin;
                        }
                    }
                }
            }
        }
        return null;
    }
    public ClassLoader getClassLoader()
    {
        return ;
    }
    {
        this. = classLoader;
        return this;
    }
    {
        return ;
    }
    {
        this. = valuePreprocessor;
        return this;
    }
    {
        return ;
    }
    {
        this. = pathTranslator;
        return this;
    }
New to GrepCode? Check out our FAQ X