mcconnell    2003/02/17 04:06:03

  Modified:    assembly/src/java/org/apache/avalon/assembly/appliance
                        DefaultAppliance.java
  Log:
  Updated appliance URL creation so that the base url comes from the appliance 
manager instead of the appliance context.
  
  Revision  Changes    Path
  1.33      +25 -17    
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultAppliance.java
  
  Index: DefaultAppliance.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultAppliance.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- DefaultAppliance.java     8 Feb 2003 08:52:11 -0000       1.32
  +++ DefaultAppliance.java     17 Feb 2003 12:06:03 -0000      1.33
  @@ -327,18 +327,11 @@
               throw new ApplianceException( error, e );
           }
   
  -        try
  -        {
  -            getLogger().debug( "creating appliance URL from base repository: 
" + m_repository.getURL() + 
  -              " for name: " + m_name );
  -            m_url = new URL( m_repository.getURL(), m_name );
  -            getLogger().debug( "created URL: " + m_url );
  -        }
  -        catch( Throwable e )
  +        if( getLogger().isDebugEnabled() )
           {
  -            final String error = 
  -              "Unexpected lifestyle handler establishment failure in 
appliance: " + this;
  -            throw new ApplianceException( error, e );
  +            final String message = 
  +              "created appliance: " + getURL();
  +            getLogger().debug( message );
           }
       }
   
  @@ -410,6 +403,20 @@
       */
       public URL getURL()
       {
  +        if( m_url == null )
  +        {
  +            try
  +            {
  +                URL base = m_repository.getURL();
  +                m_url = new URL( base, base.getPath() + m_name );
  +            }
  +            catch( Throwable e )
  +            {
  +                final String error = 
  +                 "Unexpected url creation error in appliance: " + this;
  +                throw new ApplianceRuntimeException( error, e );
  +            }
  +        }
           return m_url;
       }
   
  @@ -418,7 +425,7 @@
       */
       public String getPartitionName()
       {
  -        return m_applianceContext.getPartitionName();
  +        return getURL().getPath();
       }
   
      /**
  @@ -626,7 +633,8 @@
               //
   
               map.put( "urn:avalon:name", m_name );
  -            map.put( "urn:avalon:partition.name", 
m_applianceContext.getPartitionName() );
  +            //map.put( "urn:avalon:partition.name", 
m_applianceContext.getPartitionName() );
  +            map.put( "urn:avalon:partition.name", getURL().getPath() );
   
               //
               // setup the home and working directory for the components but 
don't 
  @@ -831,7 +839,7 @@
               try
               {
                   supplier = 
  -                  m_engine.resolve( graph, stage, getPartitionName() );
  +                  m_engine.resolve( graph, stage, getURL().getPath() );
               }
               catch( Throwable e )
               {
  @@ -880,7 +888,7 @@
   
                   try
                   {
  -                    supplier = m_engine.resolve( graph, dependency, 
getPartitionName() );
  +                    supplier = m_engine.resolve( graph, dependency, 
getURL().getPath() );
                   }
                   catch( Throwable e )
                   {
  @@ -931,7 +939,7 @@
   
                   try
                   {
  -                    supplier = m_engine.resolve( graph, stage, 
getPartitionName() );
  +                    supplier = m_engine.resolve( graph, stage, 
getURL().getPath() );
                   }
                   catch( Throwable e )
                   {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to