From 2cd10e1343aef22c03444d6a7cd82e943ed021f1 Mon Sep 17 00:00:00 2001 From: Vincent Siveton Date: Thu, 24 May 2007 05:44:44 +0000 Subject: [PATCH] merged 541186 from branch (MNG-2461: Write JavaDoc documentation) git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@541187 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/settings/MavenSettingsBuilder.java | 12 +++ .../apache/maven/settings/RuntimeInfo.java | 90 ++++++++++++++----- .../apache/maven/settings/SettingsUtils.java | 37 +++++++- maven-settings/src/main/mdo/settings.mdo | 75 +++++++++++----- 4 files changed, 167 insertions(+), 47 deletions(-) diff --git a/maven-settings/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java b/maven-settings/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java index b64cd381fc..7ac7045777 100644 --- a/maven-settings/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java +++ b/maven-settings/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java @@ -25,6 +25,12 @@ import java.io.IOException; /** + * Builder for the user or global settings. By default, the settings files are located: + * + * * @author jdcasey * @version $Id$ */ @@ -33,6 +39,12 @@ public interface MavenSettingsBuilder String ROLE = MavenSettingsBuilder.class.getName(); /** + * + * @param userSettingsFile + * @param globalSettingsFile + * @return a Settings object from the user and global settings file. + * @throws IOException if any + * @throws XmlPullParserException if any * @since 2.1 */ Settings buildSettings( File userSettingsFile, File globalSettingsFile ) diff --git a/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java b/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java index 08f15316d6..b8116a7dfc 100644 --- a/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java +++ b/maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java @@ -24,74 +24,107 @@ import java.util.List; import java.util.Map; +/** + * To handle runtime informations like local repository or profiles. + * + * @version $Id$ + */ public class RuntimeInfo { - private List locations = new ArrayList(); - + // using Boolean for 3VL (null for not-set, otherwise override with value) private Boolean pluginUpdateForced; - + // using Boolean for 3VL (null, true-to-all, false-to-all) private Boolean applyToAllPluginUpdates; - + // private boolean pluginRegistryActive = true; - + // using Boolean for 3VL (null for not-set, otherwise override with value) // private Boolean checkLatest; - + private Map activeProfileToSourceLevel = new HashMap(); - + private String localRepositorySourceLevel = TrackableBase.USER_LEVEL; - + private Map pluginGroupIdSourceLevels = new HashMap(); - + private final Settings settings; + /** + * @param settings + */ public RuntimeInfo( Settings settings ) { this.settings = settings; } - + + /** + * @param path + */ public void addLocation( String path ) { this.locations.add( path ); } - + + /** + * @return + */ public List getLocations() { return locations; } - + + /** + * @param pluginUpdateForced + */ public void setPluginUpdateOverride( Boolean pluginUpdateForced ) { this.pluginUpdateForced = pluginUpdateForced; } - + + /** + * @return + */ public Boolean getPluginUpdateOverride() { return pluginUpdateForced; } + /** + * @return + */ public Boolean getApplyToAllPluginUpdates() { return applyToAllPluginUpdates; } + /** + * @param applyToAll + */ public void setApplyToAllPluginUpdates( Boolean applyToAll ) { this.applyToAllPluginUpdates = applyToAll; } - + + /** + * @param activeProfile + * @param sourceLevel + */ public void setActiveProfileSourceLevel( String activeProfile, String sourceLevel ) { activeProfileToSourceLevel.put( activeProfile, sourceLevel ); } - + + /** + * @param activeProfile + * @return + */ public String getSourceLevelForActiveProfile( String activeProfile ) { String sourceLevel = (String) activeProfileToSourceLevel.get( activeProfile ); - + if ( sourceLevel != null ) { return sourceLevel; @@ -101,16 +134,24 @@ public String getSourceLevelForActiveProfile( String activeProfile ) return settings.getSourceLevel(); } } - + + /** + * @param pluginGroupId + * @param sourceLevel + */ public void setPluginGroupIdSourceLevel( String pluginGroupId, String sourceLevel ) { pluginGroupIdSourceLevels.put( pluginGroupId, sourceLevel ); } - + + /** + * @param pluginGroupId + * @return + */ public String getSourceLevelForPluginGroupId( String pluginGroupId ) { String sourceLevel = (String) pluginGroupIdSourceLevels.get( pluginGroupId ); - + if ( sourceLevel != null ) { return sourceLevel; @@ -120,15 +161,20 @@ public String getSourceLevelForPluginGroupId( String pluginGroupId ) return settings.getSourceLevel(); } } - + + /** + * @param localRepoSourceLevel + */ public void setLocalRepositorySourceLevel( String localRepoSourceLevel ) { this.localRepositorySourceLevel = localRepoSourceLevel; } - + + /** + * @return + */ public String getLocalRepositorySourceLevel() { return localRepositorySourceLevel; } - } diff --git a/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java b/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java index aa66fcb384..3971460ab2 100644 --- a/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java +++ b/maven-settings/src/main/java/org/apache/maven/settings/SettingsUtils.java @@ -28,6 +28,12 @@ import java.util.List; import java.util.Map; +/** + * Several convenience methods to handle settings + * + * @author Vincent Siveton + * @version $Id$ + */ public final class SettingsUtils { private SettingsUtils() @@ -35,6 +41,11 @@ private SettingsUtils() // don't allow construction. } + /** + * @param dominant + * @param recessive + * @param recessiveSourceLevel + */ public static void merge( Settings dominant, Settings recessive, String recessiveSourceLevel ) { if ( dominant == null || recessive == null ) @@ -70,14 +81,14 @@ public static void merge( Settings dominant, Settings recessive, String recessiv } } } - + if ( dominant.getRuntimeInfo() != null && recessive.getRuntimeInfo() != null ) { List recessiveLocations = recessive.getRuntimeInfo().getLocations(); for ( Iterator it = recessiveLocations.iterator(); it.hasNext(); ) { String path = (String) it.next(); - + dominant.getRuntimeInfo().addLocation( path ); } } @@ -126,6 +137,11 @@ public static void merge( Settings dominant, Settings recessive, String recessiv } + /** + * @param dominant + * @param recessive + * @param recessiveSourceLevel + */ private static void shallowMergeById( List dominant, List recessive, String recessiveSourceLevel ) { Map dominantById = mapById( dominant ); @@ -143,6 +159,10 @@ private static void shallowMergeById( List dominant, List recessive, String rece } } + /** + * @param identifiables + * @return a map + */ private static Map mapById( List identifiables ) { Map byId = new HashMap(); @@ -157,6 +177,10 @@ private static Map mapById( List identifiables ) return byId; } + /** + * @param settingsProfile + * @return a profile + */ public static org.apache.maven.model.Profile convertFromSettingsProfile( Profile settingsProfile ) { org.apache.maven.model.Profile profile = new org.apache.maven.model.Profile(); @@ -239,6 +263,10 @@ public static org.apache.maven.model.Profile convertFromSettingsProfile( Profile return profile; } + /** + * @param settingsRepo + * @return a repository + */ private static org.apache.maven.model.Repository convertFromSettingsRepository( Repository settingsRepo ) { org.apache.maven.model.Repository repo = new org.apache.maven.model.Repository(); @@ -260,6 +288,10 @@ private static org.apache.maven.model.Repository convertFromSettingsRepository( return repo; } + /** + * @param settingsPolicy + * @return a RepositoryPolicy + */ private static org.apache.maven.model.RepositoryPolicy convertRepositoryPolicy( RepositoryPolicy settingsPolicy ) { org.apache.maven.model.RepositoryPolicy policy = new org.apache.maven.model.RepositoryPolicy(); @@ -268,5 +300,4 @@ private static org.apache.maven.model.RepositoryPolicy convertRepositoryPolicy( policy.setChecksumPolicy( settingsPolicy.getChecksumPolicy() ); return policy; } - } diff --git a/maven-settings/src/main/mdo/settings.mdo b/maven-settings/src/main/mdo/settings.mdo index d6dd57ec4f..3c5293cda3 100644 --- a/maven-settings/src/main/mdo/settings.mdo +++ b/maven-settings/src/main/mdo/settings.mdo @@ -89,6 +89,10 @@ IdentifiableBase TrackableBase 1.0.0 + + Mirror, Profile, Proxy and Server. + ]]> id @@ -272,11 +276,17 @@ private Proxy activeProxy; + /** + * Reset the activeProxy field to null + */ public void flushActiveProxy() { this.activeProxy = null; } + /** + * @return the first active proxy + */ public synchronized Proxy getActiveProxy() { if(activeProxy == null) @@ -351,11 +361,18 @@ private java.util.Map profileMap; + /** + * Reset the profileMap field to null + */ public void flushProfileMap() { this.profileMap = null; } + /** + * @return a Map of profiles field with Profile#getId() as key + * @see org.apache.maven.settings.Profile#getId() + */ public java.util.Map getProfilesAsMap() { if ( profileMap == null ) @@ -428,6 +445,10 @@ Proxy 1.0.0 IdentifiableBase + + <proxy> element contains informations required to a proxy settings. + ]]> active @@ -510,6 +531,10 @@ Server 1.0.0 IdentifiableBase + + <server> element contains informations required to a server settings. + ]]> username @@ -847,19 +872,22 @@ 1.0.0 @@ -902,10 +930,13 @@ 1.0.0 @@ -942,7 +973,7 @@ 1.0.0 What to do when verification of an artifact checksum fails - - warn, fail, etc. Valid values are "fail" or "warn" + warn, fail, etc. Valid values are "fail" or "warn". String @@ -966,7 +997,7 @@ String true - The name of the property to be used to activate a profile + The name of the property to be used to activate a profile. @@ -974,7 +1005,7 @@ 1.0.0 String - The value of the property to be used to activate a profile + The value of the property to be used to activate a profile. @@ -994,7 +1025,7 @@ 1.0.0 String - The name of the OS to be used to activate a profile + The name of the OS to be used to activate a profile. @@ -1011,7 +1042,7 @@ 1.0.0 String - The architecture of the OS to be used to activate a profile + The architecture of the OS to be used to activate a profile. @@ -1019,7 +1050,7 @@ 1.0.0 String - The version of the OS to be used to activate a profile + The version of the OS to be used to activate a profile. @@ -1041,7 +1072,7 @@ String The name of the file that should be missing to activate a - profile + profile. @@ -1049,7 +1080,7 @@ 1.0.0 String - The name of the file that should exist to activate a profile + The name of the file that should exist to activate a profile.