You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/09/08 12:32:45 UTC

cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/activation DefaultServiceResolver.java

leosimons    2002/09/08 03:32:45

  Modified:    assembly/src/java/org/apache/excalibur/merlin/service
                        DefaultServiceManagementContext.java
                        InvalidPathException.java
                        ServiceManagementContext.java
                        UnknownServiceException.java
               assembly/src/java/org/apache/excalibur/merlin/activation
                        DefaultServiceResolver.java
  Log:
  Remove dependcy on the java.net.URI class, which wasn't introduced until JDK 1.4 (by replacing all uses with the java.net.URL class). This should make merlin compile against jdk 1.3.1.
  
  Revision  Changes    Path
  1.3       +25 -25    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/service/DefaultServiceManagementContext.java
  
  Index: DefaultServiceManagementContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/service/DefaultServiceManagementContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultServiceManagementContext.java	7 Sep 2002 19:05:41 -0000	1.2
  +++ DefaultServiceManagementContext.java	8 Sep 2002 10:32:45 -0000	1.3
  @@ -7,8 +7,8 @@
    */
   package org.apache.excalibur.merlin.service;
   
  -import java.net.URI;
  -import java.net.URISyntaxException;
  +import java.net.URL;
  +import java.net.MalformedURLException;
   import java.util.Map;
   import java.util.Hashtable;
   import java.util.Iterator;
  @@ -31,7 +31,7 @@
      /**
       * The context name.
       */
  -    private URI m_base;
  +    private URL m_base;
   
      /**
       * A parent context.
  @@ -55,13 +55,13 @@
   
      /**
       * Creation of a new service management context.
  -    * 
  +    *
       * @param parent a possibly null parent context
       * @param name the context name
       * @exception NullPointerException if the supplied name is null
       */
  -    public DefaultServiceManagementContext( final ServiceManagementContext parent, final String name ) 
  -      throws NullPointerException, URISyntaxException
  +    public DefaultServiceManagementContext( final ServiceManagementContext parent, final String name )
  +      throws NullPointerException, MalformedURLException
       {
           if( name == null )
           {
  @@ -74,11 +74,11 @@
           {
               if( name.endsWith("/") )
               {
  -                m_base = new URI( name );
  +                m_base = new URL( name );
               }
               else
               {
  -                m_base = new URI( name + "/" );
  +                m_base = new URL( name + "/" );
               }
           }
           else
  @@ -99,11 +99,11 @@
       //=============================================================
   
      /**
  -    * Returns the base context URI.
  +    * Returns the base context URL.
       *
  -    * @return the context uri
  +    * @return the context url
       */
  -    public URI getBase()
  +    public URL getBase()
       {
           return m_base;
       }
  @@ -114,10 +114,10 @@
       * @param name the relative name
       * @return the service context object
       * @exception NullPointerException if the supplied name is null
  -    * @exception URISyntaxException if the name is invalid
  +    * @exception MalformedURLException if the name is invalid
       * @exception IllegalArgumentException if the name is already in use
       */
  -    public ServiceManagementContext createChild( String name ) throws URISyntaxException, IllegalArgumentException
  +    public ServiceManagementContext createChild( String name ) throws MalformedURLException, IllegalArgumentException
       {
           if( name == null )
           {
  @@ -130,7 +130,7 @@
               throw new IllegalArgumentException( error );
           }
   
  -        ServiceManagementContext context = 
  +        ServiceManagementContext context =
             new DefaultServiceManagementContext( this, name );
   
           m_children.put( name, context );
  @@ -141,7 +141,7 @@
      /**
       * Bind a resource to the naming context.
       *
  -    * @exception IllegalArgumentException if the supplied resource 
  +    * @exception IllegalArgumentException if the supplied resource
       *  name already exists within the immediate context
       */
       public void bind( Resource resource )
  @@ -158,7 +158,7 @@
      /**
       * Unbind a resource from the naming context.
       *
  -    * @exception IllegalArgumentException if the supplied resource is 
  +    * @exception IllegalArgumentException if the supplied resource is
       *   unknown within the immediate scope of the context
       */
       public void unbind( Resource resource )
  @@ -179,16 +179,16 @@
       }
   
      /**
  -    * Select a set of service based on a supplied filter.  A filter is 
  -    * supplied in the form of a URI.  Interpritation of URI path, query,
  +    * Select a set of service based on a supplied filter.  A filter is
  +    * supplied in the form of a URL.  Interpritation of URL path, query,
       * and frasgment are protocol dependent.
       *
  -    * @param uri the service uri
  +    * @param url the service url
       * @exception Exception is an install error occurs
       */
  -    public Resource locate( URI uri ) throws UnknownServiceException, InvalidPathException
  +    public Resource locate( URL url ) throws UnknownServiceException, InvalidPathException
       {
  -        URI path = m_base.relativize( uri );
  +        URL path = m_base.relativize( url );
           System.out.println("## locating: '" + path + "'");
           if( path.getPath().indexOf("/") > -1 )
           {
  @@ -200,12 +200,12 @@
               ServiceManagementContext child = (ServiceManagementContext) m_children.get( name );
               if( child != null )
               {
  -                return child.locate( uri );
  +                return child.locate( url );
               }
               else
               {
                   final String error = "Invalid path element: " + name;
  -                throw new InvalidPathException( uri, error );
  +                throw new InvalidPathException( url, error );
               }
           }
           else
  @@ -220,7 +220,7 @@
                   return resource;
               }
               final String error = "Could not locate the requested service.";
  -            throw new UnknownServiceException( uri, error );
  +            throw new UnknownServiceException( url, error );
           }
       }
   }
  
  
  
  1.2       +10 -10    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/service/InvalidPathException.java
  
  Index: InvalidPathException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/service/InvalidPathException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InvalidPathException.java	7 Sep 2002 07:27:12 -0000	1.1
  +++ InvalidPathException.java	8 Sep 2002 10:32:45 -0000	1.2
  @@ -8,10 +8,10 @@
   
   package org.apache.excalibur.merlin.service;
   
  -import java.net.URI;
  +import java.net.URL;
   
   /**
  - * Exception to indicate that service URI is invalid.
  + * Exception to indicate that service URL is invalid.
    *
    * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
    * @version $Revision$ $Date$
  @@ -19,25 +19,25 @@
   public final class InvalidPathException
       extends Exception
   {
  -     private final URI m_path;
  +     private final URL m_path;
   
       /**
        * Construct a new <code>InvalidPathException</code> instance.
        *
  -     * @param path The supplied URI path.
  +     * @param path The supplied URL path.
        * @param message The detail message for this exception.
        */
  -    public InvalidPathException( final URI path, final String message )
  +    public InvalidPathException( final URL path, final String message )
       {
           super( message );
           m_path = path;
       }
   
      /**
  -    * Return the URI path from which the exception was raised.
  -    * @return the path URI
  +    * Return the URL path from which the exception was raised.
  +    * @return the path URL
       */
  -    public URI getPath()
  +    public URL getPath()
       {
           return m_path;
       }
  @@ -48,7 +48,7 @@
       */
       public String getMessage()
       {
  -        return super.getMessage() + " from uri " + getPath();
  +        return super.getMessage() + " from url " + getPath();
       }
   }
   
  
  
  
  1.2       +12 -12    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/service/ServiceManagementContext.java
  
  Index: ServiceManagementContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/service/ServiceManagementContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServiceManagementContext.java	7 Sep 2002 07:27:12 -0000	1.1
  +++ ServiceManagementContext.java	8 Sep 2002 10:32:45 -0000	1.2
  @@ -7,8 +7,8 @@
    */
   package org.apache.excalibur.merlin.service;
   
  -import java.net.URI;
  -import java.net.URISyntaxException;
  +import java.net.URL;
  +import java.net.MalformedURLException;
   
   import org.apache.excalibur.merlin.model.Resource;
   
  @@ -21,21 +21,21 @@
   public interface ServiceManagementContext
   {
      /**
  -    * Returns the base context URI.
  +    * Returns the base context URL.
       *
  -    * @return the context uri
  +    * @return the context url
       */
  -    public URI getBase();
  +    public URL getBase();
   
      /**
       * Creation of a subsidiary service context.
       *
       * @param name the relative name
       * @return the service context object
  -    * @exception URISyntaxException if the name is invalid
  +    * @exception MalformedURLException if the name is invalid
       * @exception IllegalArgumentException if the name is already in use
       */
  -    public ServiceManagementContext createChild( String name ) throws URISyntaxException, IllegalArgumentException;
  +    public ServiceManagementContext createChild( String name ) throws MalformedURLException, IllegalArgumentException;
   
      /**
       * Bind a resource to the naming context.
  @@ -50,14 +50,14 @@
       public void unbind( Resource resource );
   
      /**
  -    * Select a set of service based on a supplied filter.  A filter is 
  -    * supplied in the form of a URI.  Interpritation of URI path, query,
  +    * Select a set of service based on a supplied filter.  A filter is
  +    * supplied in the form of a URL.  Interpritation of URL path, query,
       * and reference elements are protocol dependent.
       *
  -    * @param uri the service uri
  +    * @param url the service url
       * @exception Exception is an install error occurs
       */
  -    Resource locate( URI uri ) throws UnknownServiceException, InvalidPathException;
  +    Resource locate( URL url ) throws UnknownServiceException, InvalidPathException;
   
   
   }
  
  
  
  1.2       +9 -9      jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/service/UnknownServiceException.java
  
  Index: UnknownServiceException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/service/UnknownServiceException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UnknownServiceException.java	7 Sep 2002 07:27:12 -0000	1.1
  +++ UnknownServiceException.java	8 Sep 2002 10:32:45 -0000	1.2
  @@ -7,7 +7,7 @@
    */
   package org.apache.excalibur.merlin.service;
   
  -import java.net.URI;
  +import java.net.URL;
   
   /**
    * Exception to indicate that a requested service is unknown.
  @@ -18,25 +18,25 @@
   public final class UnknownServiceException
       extends Exception
   {
  -     private final URI m_path;
  +     private final URL m_path;
   
       /**
        * Construct a new <code>UnknownServiceException</code> instance.
        *
  -     * @param path The supplied URI path.
  +     * @param path The supplied URL path.
        * @param message The detail message for this exception.
        */
  -    public UnknownServiceException( final URI path, final String message )
  +    public UnknownServiceException( final URL path, final String message )
       {
           super( message );
           m_path = path;
       }
   
      /**
  -    * Return the URI path from which the exception was raised.
  -    * @return the path URI
  +    * Return the URL path from which the exception was raised.
  +    * @return the path URL
       */
  -    public URI getPath()
  +    public URL getPath()
       {
           return m_path;
       }
  @@ -47,7 +47,7 @@
       */
       public String getMessage()
       {
  -        return super.getMessage() + " from uri " + getPath();
  +        return super.getMessage() + " from url " + getPath();
       }
   
   }
  
  
  
  1.3       +34 -36    jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/activation/DefaultServiceResolver.java
  
  Index: DefaultServiceResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/activation/DefaultServiceResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultServiceResolver.java	7 Sep 2002 19:05:41 -0000	1.2
  +++ DefaultServiceResolver.java	8 Sep 2002 10:32:45 -0000	1.3
  @@ -3,9 +3,7 @@
   
   import java.io.Serializable;
   import java.net.URL;
  -import java.net.URI;
   import java.net.MalformedURLException;
  -import java.net.URISyntaxException;
   
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.context.ContextException;
  @@ -46,7 +44,7 @@
   
   /**
    * Implementation of a container that provides support for remotely
  - * accessible services.  Services managed by this container my be 
  + * accessible services.  Services managed by this container my be
    * accessed using a corbaloc URL.  The implemetation handles the management
    * of incomming requests by redirecting requests to servant implementation
    * exposing remotely accessible services.
  @@ -73,7 +71,7 @@
       private Context m_context;
   
      /**
  -    * The server ORB used to locate the corbaloc service, POA service, and 
  +    * The server ORB used to locate the corbaloc service, POA service, and
       * handle POA activation.
       */
       private ORB m_orb;
  @@ -89,7 +87,7 @@
       private POA m_poa;
   
      /**
  -    * Internal reference to the object reference to this server. 
  +    * Internal reference to the object reference to this server.
       */
       private ServiceResolver m_resolver;
   
  @@ -107,7 +105,7 @@
       * The container's resource registry.
       */
       private ServiceManagementContext m_registry;
  -    
  +
       //=================================================================
       // Contextualizable
       //=================================================================
  @@ -115,7 +113,7 @@
      /**
       * Method invoked by the ORB initializer to declare the runtime context.
       * @param context runtime application context
  -    * @exception ContextException if the supplied context does not meet 
  +    * @exception ContextException if the supplied context does not meet
       *   contextulization criteria
       */
       public void contextualize( Context context ) throws ContextException
  @@ -129,7 +127,7 @@
       //=======================================================================
       // Configurable
       //=======================================================================
  -    
  +
      /**
       * Method invoked by the ORB initializer to declare the static configuration.
       * @param config application static configuration
  @@ -145,7 +143,7 @@
       //=======================================================================
       // Serviceable
       //=======================================================================
  -    
  +
      /**
       * Method invoked by the container to provide dependent services.
       * @param manager the service manager
  @@ -161,18 +159,18 @@
       //=======================================================================
   
      /**
  -    * Initialization of the server.  The initialization validates that a 
  -    * logging channel is available, that configuration exists, and that 
  -    * context is not null.  Folowing validation, the implementation 
  +    * Initialization of the server.  The initialization validates that a
  +    * logging channel is available, that configuration exists, and that
  +    * context is not null.  Folowing validation, the implementation
       * creates an ORB based on a child configuration named 'orb' supplied
  -    * during Initializer establishment.  Once the ORB is obtained, the 
  +    * during Initializer establishment.  Once the ORB is obtained, the
       * implementation handles the establishment of the POA and servant.
       *
       * @exception Exception if initialization fails
       */
       public void initialize()
       throws Exception
  -    {       
  +    {
           super.initialize();
   
           //
  @@ -194,8 +192,8 @@
                 new Policy[]
                 {
                    m_root.create_id_assignment_policy( IdAssignmentPolicyValue.USER_ID ),
  -                 m_root.create_lifespan_policy( LifespanPolicyValue.PERSISTENT ) 
  -              } 
  +                 m_root.create_lifespan_policy( LifespanPolicyValue.PERSISTENT )
  +              }
               );
   
               Servant servant = new ServiceResolverPOATie( this );
  @@ -219,7 +217,7 @@
       //=======================================================================
       // Startable
       //=======================================================================
  -    
  +
       /**
        * Start the container.
        * @exception Exception if a startup error occurs
  @@ -244,7 +242,7 @@
           }
           catch( Throwable e )
           {
  -            if( getLogger().isWarnEnabled() ) 
  +            if( getLogger().isWarnEnabled() )
               {
                   getLogger().warn( "ignoring POA related exception" );
               }
  @@ -258,7 +256,7 @@
   
       /**
        * Process a corbaloc request.
  -     * 
  +     *
        * @param path a path relative to this container
        * @return an object reference
        * @exception  InvalidQuery if the supplied path is invalid
  @@ -274,32 +272,32 @@
   
           if( path.equals("") )
           {
  -            // 
  -            // the URI is refering to ourselves
  +            //
  +            // the URL is refering to ourselves
               //
   
               return m_resolver;
           }
   
           //
  -        // convert the relative corbaloc path to an absolute path relative to the 
  -        // the registries base path (i.e. transform from the corbaloc namespace to 
  +        // convert the relative corbaloc path to an absolute path relative to the
  +        // the registries base path (i.e. transform from the corbaloc namespace to
           // the container namespace)
           //
   
  -        URI base = m_registry.getBase();
  -        URI uri = base.resolve( path );
  +        URL base = m_registry.getBase();
  +        URL url = base.resolve( path );
   
           getLogger().info("path: '" + path + "'");
  -        getLogger().info("resolved: " + uri );
  +        getLogger().info("resolved: " + url );
   
           try
           {
  -            Resource resource = m_registry.locate( uri );
  +            Resource resource = m_registry.locate( url );
               getLogger().info("## located a resource: " + resource );
   
               //
  -            // we have located a resource matching the resolved uri
  +            // we have located a resource matching the resolved url
               // so we need to verify if the object type backing the resource
               // can be passed back to the client inside an any
               //
  @@ -313,7 +311,7 @@
                   // this resource does not implement an adaptrive interface
                   //
   
  -                final String error = 
  +                final String error =
                     "Service is not IIOP addressable.";
                   throw new InvalidReference( m_url, error );
               }
  @@ -321,7 +319,7 @@
               {
                   //
                   // get the object - if it is a corba object reference
  -                // then return it otherwise 
  +                // then return it otherwise
                   //
   
                   try
  @@ -362,7 +360,7 @@
       //=======================================================================
       // Disposable
       //=======================================================================
  -    
  +
      /**
       * Disposal of the server.  This method is triggered by a shutdown hook
       * becuase initializers are not cleared by an ORB on shutdown.
  @@ -375,20 +373,20 @@
       //=======================================================================
       // implementation
       //=======================================================================
  -    
  +
      /**
       * Pack a value in an.
  -    * @param any the Any 
  +    * @param any the Any
       * @return Object the any contents as a Java Object
       */
       private Any putResult( Any any, Object object )
       {
           if( any == null )
  -        { 
  +        {
               throw new NullPointerException("any");
           }
           if( object == null )
  -        { 
  +        {
               throw new NullPointerException("object");
           }
   
  @@ -404,7 +402,7 @@
           }
           else
           {
  -           throw new IllegalStateException( 
  +           throw new IllegalStateException(
                 "Object type: " + any.type().kind().value() + " unsupported.");
           }
       }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>