avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance DefaultApplianceRepository.java
Date Sun, 13 Apr 2003 02:21:15 GMT
mcconnell    2003/04/12 19:21:15

  Modified:    merlin/assembly/src/java/org/apache/avalon/assembly/appliance
                        DefaultApplianceRepository.java
  Log:
  Updated to ensure that a request for URL resolution does not return a null value.
  
  Revision  Changes    Path
  1.6       +28 -4     avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultApplianceRepository.java
  
  Index: DefaultApplianceRepository.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultApplianceRepository.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultApplianceRepository.java	11 Apr 2003 19:26:01 -0000	1.5
  +++ DefaultApplianceRepository.java	13 Apr 2003 02:21:15 -0000	1.6
  @@ -185,7 +185,7 @@
       }
   
       /**
  -     * Return the set of appliance istances capable of supporting the supplied dependency.
  +     * Return the set of appliance instances capable of supporting the supplied dependency.
        * @param dependency a service dependency descriptor
        * @return a matching appliance
        */
  @@ -226,6 +226,14 @@
           return (Appliance[]) list.toArray( new Appliance[0] );
       }
   
  +    /**
  +     * Return the set of locally registered appliance instances.
  +     * @return a set of appliances
  +     */
  +    public Appliance[] getAppliances()
  +    {
  +        return (Appliance[]) m_appliances.values().toArray( new Appliance[0] );
  +    }
   
       /**
        * Return the set of appliance instances that provide the supplied extension.
  @@ -373,6 +381,7 @@
   
               String path = uri.substring( m_url.getPath().length() );
   
  +
               if( path.indexOf( "/" ) > -1 )
               {
                   // looking for a child
  @@ -382,12 +391,27 @@
                   {
                       return child.resolve( uri );
                   }
  +
  +                final String error = 
  +                  "Unresolvable path: " + uri;
  +                throw new IllegalArgumentException( error );
               } else
               {
                   // looking for an appliance
  -                return (Appliance) m_appliances.get( path );
  +                Appliance appliance = (Appliance) m_appliances.get( path );
  +                if( appliance != null )
  +                {
  +                    return appliance;
  +                }
  +                final String error = 
  +                  "Unresolvable uri: " + uri + " path: '" + path + "'. in: " + this;
  +                throw new IllegalArgumentException( error );
               }
  +        } else
  +        {
  +            final String error = 
  +              "Invalid path: " + uri;
  +            throw new IllegalArgumentException( error );
           }
  -        return null;
       }
   }
  
  
  

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


Mime
View raw message