You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2004/01/01 14:08:56 UTC

cvs commit: avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl DefaultContainmentModel.java

mcconnell    2004/01/01 05:08:56

  Modified:    merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
                        DefaultContainmentModel.java
  Log:
  Add support for relative source references when including blocks.
  
  Revision  Changes    Path
  1.13      +19 -4     avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
  
  Index: DefaultContainmentModel.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultContainmentModel.java	29 Dec 2003 14:31:21 -0000	1.12
  +++ DefaultContainmentModel.java	1 Jan 2004 13:08:56 -0000	1.13
  @@ -284,7 +284,6 @@
           }
       }
   
  -
      /**
       * Return the logging categories. 
       * @return the logging categories
  @@ -327,6 +326,9 @@
   
       public Model addModel( Profile profile ) throws ModelException
       {
  +        if( null == profile )
  +          throw new NullPointerException( "profile" );
  +
           Model model = null;
           final String name = profile.getName();
           if( profile instanceof ContainmentProfile )
  @@ -466,6 +468,8 @@
       private DeploymentModel createDeploymentModel( final DeploymentProfile profile ) 
         throws ModelException
       {
  +        if( null == profile ) 
  +          throw new NullPointerException( "profile" );
   
           final String name = profile.getName();
           final String partition = getPartition();
  @@ -699,10 +703,20 @@
       {
           final String name = directive.getName();
           final String path = directive.getPath();
  +
           try
           {
  -            URL url = new URL( path );
  -            return createContainmentModel( name, url );
  +            if( path.indexOf( ":" ) < 0 )
  +            {
  +                URL anchor = m_context.getSystemContext().getBaseDirectory().toURL();
  +                URL url = new URL( anchor, path );
  +                return createContainmentModel( name, url );
  +            }
  +            else
  +            {
  +                URL url = new URL( path );
  +                return createContainmentModel( name, url );
  +            }
           }
           catch( MalformedURLException e )
           {
  @@ -726,6 +740,7 @@
         throws ModelException
       {
           final String path = url.toString();
  +
           try
           {
               if( path.endsWith( ".jar" ) )
  
  
  

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