Return-Path: Delivered-To: apmail-jakarta-avalon-cvs-archive@apache.org Received: (qmail 42880 invoked from network); 8 Sep 2002 14:37:01 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 8 Sep 2002 14:37:01 -0000 Received: (qmail 20314 invoked by uid 97); 8 Sep 2002 14:37:36 -0000 Delivered-To: qmlist-jakarta-archive-avalon-cvs@jakarta.apache.org Received: (qmail 20298 invoked by uid 97); 8 Sep 2002 14:37:35 -0000 Mailing-List: contact avalon-cvs-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list avalon-cvs@jakarta.apache.org Received: (qmail 20281 invoked by uid 97); 8 Sep 2002 14:37:35 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: 8 Sep 2002 14:36:57 -0000 Message-ID: <20020908143657.42592.qmail@icarus.apache.org> From: mcconnell@apache.org To: jakarta-avalon-excalibur-cvs@apache.org Subject: cvs commit: jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/service DefaultServiceManagementContext.java InvalidPathException.java ServiceManagementContext.java UnknownServiceException.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N mcconnell 2002/09/08 07:36:57 Modified: assembly/src/etc project.mf assembly/src/etc/activator server.xml assembly/src/java/org/apache/excalibur/merlin/container ContainerHelper.java assembly/src/java/org/apache/excalibur/merlin/kernel DefaultKernel.java assembly/src/java/org/apache/excalibur/merlin/service DefaultServiceManagementContext.java InvalidPathException.java ServiceManagementContext.java UnknownServiceException.java Log: Updated service management resources to take URL based arguments instead of URIs. Revision Changes Path 1.18 +0 -6 jakarta-avalon-excalibur/assembly/src/etc/project.mf Index: project.mf =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/etc/project.mf,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- project.mf 7 Sep 2002 19:05:40 -0000 1.17 +++ project.mf 8 Sep 2002 14:36:56 -0000 1.18 @@ -43,9 +43,3 @@ Name: org/apache/excalibur/merlin/kernel/DefaultKernel.class Avalon: Type -Name: org/apache/excalibur/merlin/activation/DefaultServiceResolver.class -Avalon: Type - -Name: org/apache/excalibur/merlin/activation/DefaultRemoteResourceFactory.class -Avalon: Type - 1.3 +1 -1 jakarta-avalon-excalibur/assembly/src/etc/activator/server.xml Index: server.xml =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/etc/activator/server.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- server.xml 7 Sep 2002 19:05:41 -0000 1.2 +++ server.xml 8 Sep 2002 14:36:56 -0000 1.3 @@ -63,7 +63,7 @@ - + 1.2 +11 -8 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ContainerHelper.java Index: ContainerHelper.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/container/ContainerHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ContainerHelper.java 7 Sep 2002 07:27:11 -0000 1.1 +++ ContainerHelper.java 8 Sep 2002 14:36:56 -0000 1.2 @@ -87,7 +87,7 @@ * container reference instances. * * @param manager the context type manager - * @param logging the logging manager + * @param context the service management context */ public ContainerHelper( ContainerManager manager, @@ -102,7 +102,7 @@ * * @param manager the context type manager * @param lifestyles the lifestyle manager - * @param context the service management context + * @param context the parent service management context * @exception NullPointerException if the manager arguments is null */ public ContainerHelper( @@ -161,6 +161,9 @@ final ContainerManager manager = m_manager.createContainerManager( descriptor, classpath, m_lifestyles ); + final ServiceManagementContext registry = + m_registry.createChild( name ); + // // populate the descriptor with component profiles // @@ -192,8 +195,7 @@ // Map map = new Hashtable(); - ContainerHelper factory = new ContainerHelper( - manager, m_registry.createChild( descriptor.getName() ) ); + ContainerHelper factory = new ContainerHelper( manager, registry ); factory.enableLogging( getLogger().getChildLogger( descriptor.getName() ) ); Configuration[] containers = config.getChildren("container"); @@ -205,7 +207,7 @@ descriptor.addContainer( child ); map.put( child, resource ); } - return createContainerResource( descriptor, manager, map ); + return createContainerResource( descriptor, manager, map, registry ); } catch( Throwable e ) @@ -218,7 +220,8 @@ private ContainerResource createContainerResource( ContainerDescriptor descriptor, ContainerManager manager, - Map services ) throws Exception + Map services, + ServiceManagementContext registry ) throws Exception { // // create the container context @@ -228,7 +231,7 @@ context.put( Container.MANAGER_KEY, manager ); context.put( Container.DESCRIPTOR_KEY, descriptor ); context.put( Container.SERVICES_KEY, services ); - context.put( Container.REGISTRY_KEY, m_registry ); + context.put( Container.REGISTRY_KEY, registry ); // // assemble the descriptor to ensure that all dependecies are 1.49 +4 -31 jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java Index: DefaultKernel.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/assembly/src/java/org/apache/excalibur/merlin/kernel/DefaultKernel.java,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- DefaultKernel.java 7 Sep 2002 07:27:11 -0000 1.48 +++ DefaultKernel.java 8 Sep 2002 14:36:56 -0000 1.49 @@ -187,11 +187,9 @@ */ private String m_base; - private ContainerManager m_parent; - private File m_baseDirectory; - private ServiceManagementContext m_registry; + private DefaultServiceManagementContext m_registry; //======================================================================= // Contextualizable @@ -299,33 +297,9 @@ // can access. // - if( classloader instanceof ContainerManager ) - { - ContainerManager manager = (ContainerManager) classloader; - - m_base = manager.getPath().replace('/','.').substring(1) + "." + name; - m_logger = getLoggingManager().getLoggerForCategory( m_base ); - m_localLogger = m_logger.getChildLogger("kernel"); - - ContainerHelper factory = new ContainerHelper( manager, m_registry ); - factory.enableLogging( m_logger ); - - ContainerResource resource = factory.build( config ); - m_container = (Container) resource.access(); - - m_initialized = true; - return; - } - - // - // Otherwise this is a full root kernel under which we need to establish - // the singleton logging system, extension, etc. - // - try { - LoggingDescriptor logging = m_creator.createLoggingDescriptor( m_config.getChild("logging"), name ); c_logging = new DefaultLoggerManager( logging, m_baseDirectory ); @@ -346,8 +320,7 @@ // Create the service management context. // - m_registry = new DefaultServiceManagementContext( null, "/" ); - URL.setURLStreamHandlerFactory( new ServiceURLFactory( domain, m_registry ) ); + m_registry = new DefaultServiceManagementContext( domain ); // // Set up the ThreadManager that the CommandManager uses @@ -414,7 +387,7 @@ m_manager.contextualize( ctx ); m_manager.initialize(); - Thread.currentThread().setContextClassLoader( m_manager ); + //Thread.currentThread().setContextClassLoader( m_manager ); getLogger().info("kernel established: " + name ); // 1.5 +48 -34 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DefaultServiceManagementContext.java 8 Sep 2002 10:46:41 -0000 1.4 +++ DefaultServiceManagementContext.java 8 Sep 2002 14:36:56 -0000 1.5 @@ -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; @@ -29,9 +29,9 @@ //============================================================= /** - * The context name. + * The context url. */ - private URI m_base; + private URL m_base; /** * A parent context. @@ -60,37 +60,44 @@ * @param name the context name * @exception NullPointerException if the supplied name is null */ + public DefaultServiceManagementContext( final String domain ) + throws NullPointerException, MalformedURLException + { + URL.setURLStreamHandlerFactory( new ServiceURLFactory( domain, this ) ); + m_base = new URL("service", domain, -1, "/"); + } + + /** + * 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 + throws NullPointerException, MalformedURLException { if( name == null ) { - throw new NullPointerException("name"); + throw new NullPointerException( "name" ); + } + if( parent == null ) + { + throw new NullPointerException( "parent" ); } m_parent = parent; + URL base = m_parent.getBase(); + String path = base.getPath(); - if( parent == null ) + + if( name.endsWith("/") ) { - if( name.endsWith("/") ) - { - m_base = new URI( name ); - } - else - { - m_base = new URI( name + "/" ); - } + m_base = new URL( base, path + name ); } else { - if( name.endsWith("/") ) - { - m_base = m_parent.getBase().resolve( name ); - } - else - { - m_base = m_parent.getBase().resolve( name + "/" ); - } + m_base = new URL( base, path + name + "/" ); } } @@ -99,11 +106,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 +121,11 @@ * @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 ) { @@ -132,9 +140,7 @@ ServiceManagementContext context = new DefaultServiceManagementContext( this, name ); - m_children.put( name, context ); - return context; } @@ -180,15 +186,22 @@ /** * 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, - * and frasgment are protocol dependent. + * supplied in the form of a URI String. Interpritation relative to URI path, query, + * and fragment are protocol dependent. * * @param uri the service uri * @exception Exception is an install error occurs */ - public Resource locate( URI uri ) throws UnknownServiceException, InvalidPathException + public Resource locate( String uri ) throws UnknownServiceException, InvalidPathException { + System.out.println("## uri: '" + uri + "'"); + + throw new UnsupportedOperationException(); + +/* + URI path = m_base.relativize( uri ); + System.out.println("## base: '" + m_base + "'"); System.out.println("## locating: '" + path + "'"); if( path.getPath().indexOf("/") > -1 ) { @@ -222,6 +235,7 @@ final String error = "Could not locate the requested service."; throw new UnknownServiceException( uri, error ); } +*/ } } 1.4 +9 -9 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- InvalidPathException.java 8 Sep 2002 10:46:41 -0000 1.3 +++ InvalidPathException.java 8 Sep 2002 14:36:56 -0000 1.4 @@ -8,7 +8,7 @@ package org.apache.excalibur.merlin.service; -import java.net.URI; +import java.net.URL; /** * Exception to indicate that service URI is invalid. @@ -19,25 +19,25 @@ public final class InvalidPathException extends Exception { - private final URI m_path; + private final URL m_path; /** * Construct a new InvalidPathException 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 the url " + getPath(); } } 1.4 +13 -11 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ServiceManagementContext.java 8 Sep 2002 10:46:41 -0000 1.3 +++ ServiceManagementContext.java 8 Sep 2002 14:36:56 -0000 1.4 @@ -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,22 @@ 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. @@ -51,13 +52,14 @@ /** * 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, - * and reference elements are protocol dependent. + * supplied in the form of a String. Interpritation of string follows + * normal URI semantics (path, query, and reference elements are protocol + * dependent). * * @param uri the service uri * @exception Exception is an install error occurs */ - Resource locate( URI uri ) throws UnknownServiceException, InvalidPathException; + Resource locate( String uri ) throws UnknownServiceException, InvalidPathException; } 1.4 +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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- UnknownServiceException.java 8 Sep 2002 10:46:41 -0000 1.3 +++ UnknownServiceException.java 8 Sep 2002 14:36:56 -0000 1.4 @@ -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 UnknownServiceException 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 the url " + getPath(); } } -- To unsubscribe, e-mail: For additional commands, e-mail: