maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mkle...@apache.org
Subject svn commit: r577900 - in /maven/plugins/trunk/maven-toolchains-plugin: ./ src/main/java/org/apache/maven/plugin/toolchain/
Date Thu, 20 Sep 2007 20:05:26 GMT
Author: mkleint
Date: Thu Sep 20 13:05:26 2007
New Revision: 577900

URL: http://svn.apache.org/viewvc?rev=577900&view=rev
Log:
reformat

Removed:
    maven/plugins/trunk/maven-toolchains-plugin/catalog.xml
Modified:
    maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainConverter.java
    maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
    maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/Toolchains.java

Modified: maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainConverter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainConverter.java?rev=577900&r1=577899&r2=577900&view=diff
==============================================================================
--- maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainConverter.java
(original)
+++ maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainConverter.java
Thu Sep 20 13:05:26 2007
@@ -34,9 +34,11 @@
  *
  * @author mkleint
  */
-public class ToolchainConverter extends AbstractConfigurationConverter {
+public class ToolchainConverter
+    extends AbstractConfigurationConverter
+{
 
-    public static final String ROLE = ConfigurationConverter.class.getName();
+    public static final String ROLE = ConfigurationConverter.class.getName(  );
 
     /**
      * @see org.codehaus.plexus.component.configurator.converters.ConfigurationConverter#canConvert(java.lang.Class)
@@ -49,39 +51,47 @@
     /**
      * @see org.codehaus.plexus.component.configurator.converters.ConfigurationConverter#fromConfiguration(org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup,
org.codehaus.plexus.configuration.PlexusConfiguration, java.lang.Class, java.lang.Class, java.lang.ClassLoader,
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator, org.codehaus.plexus.component.configurator.ConfigurationListener)
      */
-    public Object fromConfiguration( ConverterLookup converterLookup, PlexusConfiguration
configuration, Class type,
-                                    Class baseType, ClassLoader classLoader, ExpressionEvaluator
expressionEvaluator,
-                                    ConfigurationListener listener )
+    public Object fromConfiguration( ConverterLookup converterLookup,
+                                     PlexusConfiguration configuration,
+                                     Class type, Class baseType,
+                                     ClassLoader classLoader,
+                                     ExpressionEvaluator expressionEvaluator,
+                                     ConfigurationListener listener )
         throws ComponentConfigurationException
     {
-        Toolchains retValue = new Toolchains();
-        processConfiguration( retValue, configuration, expressionEvaluator  );
+        Toolchains retValue = new Toolchains(  );
+        processConfiguration( retValue, configuration, expressionEvaluator );
 
         return retValue;
     }
 
-    private void processConfiguration( Toolchains chain, PlexusConfiguration configuration,
-                                      ExpressionEvaluator expressionEvaluator  )
+    private void processConfiguration( Toolchains chain,
+                                       PlexusConfiguration configuration,
+                                       ExpressionEvaluator expressionEvaluator )
         throws ComponentConfigurationException
     {
-        HashMap map = new HashMap();
-        PlexusConfiguration[] tools = configuration.getChildren();
+        HashMap map = new HashMap(  );
+        PlexusConfiguration[] tools = configuration.getChildren(  );
         for ( int i = 0; i < tools.length; i++ )
         {
-            String type = tools[i].getName();
-            PlexusConfiguration[] params = tools[i].getChildren();
-            HashMap parameters = new HashMap();
-            for (int j = 0; j <params.length; j++) {
-                try {
-                    String name = params[j].getName();
-                    String val = params[j].getValue();
-                    parameters.put(name, val);
-                } catch (PlexusConfigurationException ex) {
-                    throw new ComponentConfigurationException(ex);
+            String type = tools[i].getName(  );
+            PlexusConfiguration[] params = tools[i].getChildren(  );
+            HashMap parameters = new HashMap(  );
+            for ( int j = 0; j < params.length; j++ )
+            {
+                try
+                {
+                    String name = params[j].getName(  );
+                    String val = params[j].getValue(  );
+                    parameters.put( name, val );
+                }
+                catch ( PlexusConfigurationException ex )
+                {
+                    throw new ComponentConfigurationException( ex );
                 }
             }
-            map.put(type, parameters);
+            map.put( type, parameters );
         }
         chain.toolchains = map;
     }
-}
+}
\ No newline at end of file

Modified: maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java?rev=577900&r1=577899&r2=577900&view=diff
==============================================================================
--- maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
(original)
+++ maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/ToolchainMojo.java
Thu Sep 20 13:05:26 2007
@@ -40,100 +40,122 @@
  *
  * @author mkleint
  */
-public class ToolchainMojo extends AbstractMojo {
+public class ToolchainMojo
+    extends AbstractMojo
+{
 
     /**
      *
      * @component
      */
     private ToolchainManager toolchainManager;
-    
+
     /**
      *
      * @component
      */
     private BuildContextManager buildContextManager;
-    
+
     /**
      * @parameter
      * @required
-     */ 
+     */
     private Toolchains toolchains;
-    
-    public ToolchainMojo() {
+
+    public ToolchainMojo( )
+    {
     }
-    
-    
 
-    public void execute() throws MojoExecutionException, MojoFailureException {
-        if (toolchains != null) {
-            Iterator en = toolchains.getToolchainsTypes().iterator();
-            List nonMatchedTypes = new ArrayList();
-            while (en.hasNext()) {
-                try {
+    public void execute( )
+        throws MojoExecutionException, MojoFailureException
+    {
+        if ( toolchains != null )
+        {
+            Iterator en = toolchains.getToolchainsTypes(  ).iterator(  );
+            List nonMatchedTypes = new ArrayList(  );
+            while ( en.hasNext(  ) )
+            {
+                try
+                {
                     String type = (String) en.next();
-                    getLog().info("Type:" + type);
-                    Map params = toolchains.getParams(type);
-                    ToolchainPrivate[] tcs = toolchainManager.getToolchainsForType(type);
+                    getLog(  ).info( "Type:" + type );
+                    Map params = toolchains.getParams( type );
+                    ToolchainPrivate[] tcs = toolchainManager.getToolchainsForType( type
);
                     boolean matched = false;
-                    for (int i = 0; i < tcs.length; i++) {
-                        if (toolchainMatchesRequirements(tcs[i], params)) {
-                            getLog().info("Toolchain (" + type + ") matched:" + tcs[i]);
-                            toolchainManager.storeToolchainToBuildContext(tcs[i], buildContextManager.readBuildContext(true));
+                    for ( int i = 0; i < tcs.length; i++ )
+                    {
+                        if ( toolchainMatchesRequirements( tcs[i], params ) )
+                        {
+                            getLog(  ).info( "Toolchain (" + type + ") matched:" + tcs[i]
);
+                            toolchainManager.storeToolchainToBuildContext( tcs[i],
+                                buildContextManager.readBuildContext( true ) );
                             matched = true;
                             break;
                         }
                     }
-                    if (!matched) {
-                        nonMatchedTypes.add(type);
+                    if ( !matched )
+                    {
+                        nonMatchedTypes.add( type );
                     }
-                } catch (MisconfiguredToolchainException ex) {
-                    throw new MojoExecutionException("Misconfigured toolchains.", ex);
+                }
+                catch ( MisconfiguredToolchainException ex )
+                {
+                    throw new MojoExecutionException( "Misconfigured toolchains.",
+                        ex );
                 }
             }
-            if (!nonMatchedTypes.isEmpty()) {
+            if ( !nonMatchedTypes.isEmpty(  ) )
+            {
                 //TODO add the default toolchain instance if defined??
                 String str = "Cannot find matching toolchain definitions for the following
toolchain types:";
-                Iterator it = nonMatchedTypes.iterator();
-                while (it.hasNext()) {
+                Iterator it = nonMatchedTypes.iterator(  );
+                while ( it.hasNext(  ) )
+                {
                     String type = (String) it.next();
                     str = str + "\n" + type;
-                    Map params = toolchains.getParams(type);
-                    if (params.size() > 0) {
-                        Iterator it2 = params.keySet().iterator();
+                    Map params = toolchains.getParams( type );
+                    if ( params.size(  ) > 0 )
+                    {
+                        Iterator it2 = params.keySet(  ).iterator(  );
                         str = str + " [";
-                        while (it2.hasNext()) {
-                            String string = (String)it2.next();
-                            str = str + " " + string + "='" + params.get(string) + "' ";
+                        while ( it2.hasNext(  ) )
+                        {
+                            String string = (String) it2.next();
+                            str = str + " " + string + "='" + params.get( string ) + "' ";
                         }
                         str = str + "]";
-                        
                     }
                 }
-                getLog().error(str);
-                throw new MojoFailureException("Please make sure you define the required
toolchains in your ~/.m2/toolchains.xml file.");
+                getLog(  ).error( str );
+                throw new MojoFailureException( "Please make sure you define the required
toolchains in your ~/.m2/toolchains.xml file." );
             }
-        } else {
+        }
+        else
+        {
             //can that happen?
         }
-                
     }
 
-    private boolean toolchainMatchesRequirements(ToolchainPrivate toolchain, Map params)
{
-        Map matchers = toolchain.getRequirementMatchers();
-        Iterator it = params.keySet().iterator();
-        while (it.hasNext()) {
-            String key = (String)it.next();
+    private boolean toolchainMatchesRequirements( ToolchainPrivate toolchain,
+                                                  Map params )
+    {
+        Map matchers = toolchain.getRequirementMatchers(  );
+        Iterator it = params.keySet(  ).iterator(  );
+        while ( it.hasNext(  ) )
+        {
+            String key = (String) it.next();
             RequirementMatcher matcher = (RequirementMatcher) matchers.get(key);
-            if (matcher == null) {
-                getLog().debug("Toolchain " + toolchain + " is missing required property:
" + key);
+            if ( matcher == null )
+            {
+                getLog(  ).debug( "Toolchain "  + toolchain + " is missing required property:
"  + key );
                 return false;
             }
-            if (!matcher.matches((String)params.get(key))) {
-                getLog().debug("Toolchain " + toolchain + " doesn't match required property:
" + key);
+            if ( !matcher.matches( (String) params.get(key) ) )
+            {
+                getLog(  ).debug( "Toolchain "  + toolchain + " doesn't match required property:
"  + key );
                 return false;
             }
         }
         return true;
     }
-}
+}
\ No newline at end of file

Modified: maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/Toolchains.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/Toolchains.java?rev=577900&r1=577899&r2=577900&view=diff
==============================================================================
--- maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/Toolchains.java
(original)
+++ maven/plugins/trunk/maven-toolchains-plugin/src/main/java/org/apache/maven/plugin/toolchain/Toolchains.java
Thu Sep 20 13:05:26 2007
@@ -27,16 +27,19 @@
  *
  * @author mkleint
  */
-public final class Toolchains {
+public final class Toolchains
+{
+
     /** <String type, Map<String param, String value>> */
     Map toolchains;
-    
-    public final Set getToolchainsTypes() {
-        return Collections.unmodifiableSet(toolchains.keySet());
+
+    public final Set getToolchainsTypes( )
+    {
+        return Collections.unmodifiableSet( toolchains.keySet(  ) );
     }
-    
-    public final Map getParams(String type) {
-        return Collections.unmodifiableMap((Map)toolchains.get(type));
+
+    public final Map getParams( String type )
+    {
+        return Collections.unmodifiableMap( (Map) toolchains.get(type) );
     }
-    
-}
+}
\ No newline at end of file



Mime
View raw message