avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject svn commit: rev 22634 - avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model
Date Tue, 06 Jul 2004 16:55:13 GMT
Author: mcconnell
Date: Tue Jul  6 09:55:12 2004
New Revision: 22634

Modified:
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java
   avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Info.java
Log:
more on docs

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Context.java	Tue Jul 
6 09:55:12 2004
@@ -464,11 +464,20 @@
         return m_docs;
     }
 
+   /**
+    * Reserve a path under the target directory.
+    * @param path the path to reserve
+    */
     public File setBuildPath( final String path )
     {
         return setBuildPath( path, path );
     }
 
+   /**
+    * Reserve a path under the target directory.
+    * @param key the logic path identifier
+    * @param path the path to reserve
+    */
     public File setBuildPath( final String key, final String path )
     {
         if( null == key )
@@ -491,28 +500,21 @@
         return build;
     }
 
+   /**
+    * Return a build path matching a supplied key.
+    * @return the target path
+    */
     public File getBuildPath( final String key )
     {
-        return getBuildPath( key, true );
-    }
-
-    public File getBuildPath( final String key, final boolean fail )
-    {
         if( m_map.containsKey( key ) )
         {
             return (File) m_map.get( key ) ;
         }
-        else if( fail )
-        {
-            final String error = 
-              "Unknown build key '" 
-              + key + "'.";
-            throw new BuildException( error );
-        }
-        else
-        {
-            return null;
-        }
+        
+        final String error = 
+          "Unknown build key '" 
+          + key + "'.";
+        throw new BuildException( error );
     }
 
     //--------------------------------------------------------------------

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java	Tue Jul  6 09:55:12
2004
@@ -184,11 +184,21 @@
         return (Resource[]) m_resources.values().toArray( new Resource[0] );
     }
 
+   /**
+    * Return TRUE if the suppied resource ref references a project
+    * definition.
+    * @return TRUE is the resource is a definition
+    */
     public boolean isaDefinition( final ResourceRef ref )
     {
         return ( getResource( ref ) instanceof Definition );
     }
 
+   /**
+    * Return all definitions with the home.
+    *
+    * @return array of know definitions
+    */
     public Definition[] getDefinitions()
       throws BuildException
     {
@@ -205,6 +215,11 @@
         return (Definition[]) list.toArray( new Definition[0] );
     }
 
+   /**
+    * Return a resource matching the supplied key.
+    * @return the resource mathing the key
+    * @exception BuildException if the resource is unknown
+    */
     public Resource getResource( final String key )
       throws BuildException
     {
@@ -212,6 +227,11 @@
         return getResource( ref );
     }
 
+   /**
+    * Return a resource matching the supplied reference.
+    * @return the resource mathing the reference
+    * @exception BuildException if the resource is unknown
+    */
     public Resource getResource( final ResourceRef ref )
       throws BuildException
     {
@@ -224,6 +244,11 @@
         return resource;
     }
 
+   /**
+    * Return a definition matching the supplied key.
+    * @return the definition mathing the key
+    * @exception BuildException if the definition is unknown
+    */
     public Definition getDefinition( final String key )
       throws BuildException
     {
@@ -231,6 +256,11 @@
         return getDefinition( ref );
     }
 
+   /**
+    * Return a definition matching the supplied reference.
+    * @return the definition mathing the reference
+    * @exception BuildException if the definition is unknown
+    */
     public Definition getDefinition( final ResourceRef ref )
       throws BuildException
     {
@@ -247,6 +277,11 @@
         }
     }
 
+   /**
+    * Return a plugin matching the supplied reference.
+    * @return the plugin mathing the reference
+    * @exception BuildException if the plugin is unknown
+    */
     public Plugin getPlugin( final ResourceRef ref )
       throws BuildException
     {
@@ -523,7 +558,6 @@
         //
         
         throw new UnsupportedOperationException();
-
     }
 
     /*

Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Info.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Info.java	(original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Info.java	Tue Jul  6 09:55:12
2004
@@ -27,10 +27,23 @@
  */
 public class Info 
 {
+   /**
+    * The static immutable element value to declare a SNAPSHOT artifact.
+    */
     public static final String SNAPSHOT = "SNAPSHOT";
  
+   /**
+    * The static immutable value of the artifact protocol.
+    */
     public static final String PROTOCOL = "artifact";
 
+   /**
+    * Creation of a new info instance relative to a supplied home 
+    * and artifact specification.
+    * @param home the home
+    * @param id the artiact identifier
+    * @return the immutable info descriptor
+    */
     public static Info create( Home home, final String id )
     {
         final int i = id.indexOf( ":" );
@@ -45,6 +58,14 @@
         return Info.create( home, protocol, spec );
     }
 
+   /**
+    * Creation of a new info instance relative to a supplied home, 
+    * type, and artifact specification.
+    * @param home the home
+    * @param type the artifact type
+    * @param id the artiact identifier
+    * @return the immutable info descriptor
+    */
     public static Info create( Home home, final String type, final String id )
     {
         final int n = getGroupIndex( id );
@@ -56,6 +77,16 @@
           SNAPSHOT.equalsIgnoreCase( version ) );
     }
 
+   /**
+    * Creation of a new info instance relative to a supplied set of parameters.
+    * @param home the home
+    * @param group the artifact group
+    * @param name the artifact name
+    * @param version the artifact version
+    * @param type the artifact type
+    * @param snapshot the artiact snapshot status
+    * @return the immutable info descriptor
+    */
     public static Info create(
       final Home home, final String group, final String name, final String version, 
       final String type, boolean snapshot )
@@ -91,19 +122,31 @@
         m_snapshot = snapshot;
     }
 
+   /**
+    * Return the name of the artifact group.
+    * @return the group name
+    */
     public String getGroup()
     {
         return m_group;
     }
     
+   /**
+    * Return the name of the artifact.
+    * @return the artifact name
+    */
     public String getName()
     {
         return m_name;
     }
 
    /**
-    * Return the version identifier.
-    * @return a string identifying the build version.
+    * Return the version identifier. If the build policy is SNAPSHOT
+    * the version value returned is appended with "-DEV".  If the version is 
+    * is null and SNAPSHOT policy is enabled the returned version is DEV otherwise
+    * the versiojn returned is null.
+    *
+    * @return a string identifying the build version. 
     */
     public String getVersion()
     {
@@ -125,7 +168,7 @@
     }
 
    /**
-    * Return the snampshot staus of this artifact.
+    * Return the snapshot staus of this artifact.
     * @return true if this artifact is marked as a snapshot
     */
     public boolean isaSnapshot()
@@ -133,6 +176,10 @@
         return m_snapshot;
     }
 
+   /**
+    * Return a string identifying the aritfact type.
+    * @return the artifact type
+    */
     public String getType()
     {
         if( null == m_type )
@@ -145,6 +192,11 @@
         } 
     }
 
+   /**
+    * Return a string corresponding to the name and version of this artifact
+    * without type information.
+    * @return the artifact short name
+    */
     public String getShortFilename()
     {
         final StringBuffer buffer = new StringBuffer( getName() );
@@ -156,6 +208,12 @@
         return buffer.toString();
     }
 
+   /**
+    * Return the full filename of the artifact in the form
+    * [name]-[version].[type] or in the case of a null version 
+    * [name].[type].
+    * @return the artifact filename
+    */
     public String getFilename()
     {
         final String shortFilename = getShortFilename();
@@ -165,6 +223,10 @@
         return buffer.toString();
     }
 
+   /**
+    * Return the path to the artifact in the form [group]/[type]s/[filename].
+    * @return the artifact relative path
+    */
     public String getPath()
     {
         final String filename = getFilename();
@@ -176,6 +238,10 @@
         return buffer.toString();
     }
 
+   /**
+    * Return the artifact uri in the form "artifact:[type]:[spec].
+    * @return the artifact uri
+    */
     public String getURI()
     {
         final StringBuffer buffer = new StringBuffer( PROTOCOL );
@@ -186,11 +252,22 @@
         return buffer.toString();
     }
 
+   /**
+    * Return the artifact specification in the form [group]/[name]#[version].
+    * @return the artifact spec
+    */
     public String getSpec()
     {
         return getSpecification( "/", "#" );
     }
 
+   /**
+    * Return the artifact specification using the supplied group and 
+    * version separators.
+    * @param groupSeparator the group separator
+    * @param versionSeparator the version separator
+    * @return a derived specification
+    */
     public String getSpecification( 
       String groupSeparator, String versionSeparator )
     {
@@ -205,11 +282,20 @@
         return buffer.toString();
     }
 
+   /**
+    * Return the string representation of this info instance.
+    * @return a string representation
+    */
     public String toString()
     {
         return getURI();
     }
 
+   /**
+    * Return true if this info instance is equal to the supplied object.
+    * @param other the object to compare against this instance
+    * @return TRUE if equal
+    */
     public boolean equals( final Object other )
     {
         if( other instanceof Info )
@@ -233,6 +319,10 @@
             return false;
         }
     }
+
+    //-------------------------------------------------------------------
+    // internal
+    //-------------------------------------------------------------------
 
     private void assertNotNull( final String key, final Object object )
     {

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message