avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject cvs commit: jakarta-avalon/src/proposal/resolver Query.java Resolvable.java Resolver.java ResolverException.java Token.java
Date Tue, 26 Feb 2002 02:13:52 GMT
leif        02/02/25 18:13:52

  Modified:    src/proposal/resolver Query.java Resolvable.java
                        Resolver.java ResolverException.java Token.java
  Log:
  Fix files which were checked in with ^m^j Line Feeds.
  There were no other changes in this commit.
  
  Revision  Changes    Path
  1.5       +68 -68    jakarta-avalon/src/proposal/resolver/Query.java
  
  Index: Query.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/proposal/resolver/Query.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Query.java	12 Feb 2002 18:23:44 -0000	1.4
  +++ Query.java	26 Feb 2002 02:13:52 -0000	1.5
  @@ -1,68 +1,68 @@
  -/*
  - * Copyright (C) The Apache Software Foundation. All rights reserved.
  - *
  - * This software is published under the terms of the Apache Software License
  - * version 1.1, a copy of which has been included with this distribution in
  - * the LICENSE.txt file.
  - */
  -package org.apache.avalon.framework.resolver;
  -
  -import org.apache.avalon.framework.context.Context;
  -
  -/**
  - * A <code>Query</code> will identify all the objects needed for a specific
lookup.
  - * The <code>Query</code> will help the resolver obtain reference to the necessary
  - * objects in order.  In other words, if we asked for three objects, the order of
  - * the objects returned by the <code>Resolver</code> will match the order that
the
  - * keys were added to the <code>Query</code> object.
  - *
  - * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - */
  -public interface Query
  -{
  -
  -    /**
  -     * Add a lookup key.  The Lookup key consists of a psuedo protocol, and the key
  -     * value.  That way, we can ensure that the object you get is the proper type.
  -     * The required psuedo protocols include "component", "service", and "object".
  -     *
  -     * <p>Example:</p>
  -     * <pre>
  -     *   query.addKey( "component:org.apache.avalon.excalibur.datasource.DataSourceComponent"
);
  -     *   query.addKey( "service:org.apache.avalon.cornerstone.services.ConnectionManager"
);
  -     *   query.addKey( "object:foo-object" );
  -     * </pre>
  -     */
  -    void addKey( String value );
  -
  -    /**
  -     * Remove a lookup key.  This facilitates a quick test/resolve approach.  The
  -     * <code>Query</code> object can be initialized in the constructor complete
with
  -     * references to optional components.  Your code can then call
  -     * <code>hasReferences</code> and remove any optional keys from the Query
that the
  -     * <code>Resolver</code> cannot handle.
  -     */
  -    void removeKey( String value );
  -
  -    /**
  -     * You can add further hints, or attributes to the query that can help the
  -     * <code>Resolver</code> get the specific instance you want.  It is important
  -     * to note that the attributes do apply to all the key values.  The
  -     * <code>Resolver</code> does have the right to ignore any or all of the
  -     * attributes if it wants.
  -     */
  -    void addAttribute( String name, Object value );
  -
  -    /**
  -     * You can remove hints, or attributes to the query that can help the
  -     * <code>Resolver</code> get the specific instance you want.
  -     */
  -    void removeAttribute( String name );
  -
  -    /**
  -     * This obtains a reference to the attribute context used by the
  -     * code>Resolver</code>.  The context uses resolveable entryies to determine
  -     * the keys, and what types they are.
  -     */
  -    Context queryContext();
  -}
  +/*
  + * Copyright (C) The Apache Software Foundation. All rights reserved.
  + *
  + * This software is published under the terms of the Apache Software License
  + * version 1.1, a copy of which has been included with this distribution in
  + * the LICENSE.txt file.
  + */
  +package org.apache.avalon.framework.resolver;
  +
  +import org.apache.avalon.framework.context.Context;
  +
  +/**
  + * A <code>Query</code> will identify all the objects needed for a specific
lookup.
  + * The <code>Query</code> will help the resolver obtain reference to the necessary
  + * objects in order.  In other words, if we asked for three objects, the order of
  + * the objects returned by the <code>Resolver</code> will match the order that
the
  + * keys were added to the <code>Query</code> object.
  + *
  + * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  + */
  +public interface Query
  +{
  +
  +    /**
  +     * Add a lookup key.  The Lookup key consists of a psuedo protocol, and the key
  +     * value.  That way, we can ensure that the object you get is the proper type.
  +     * The required psuedo protocols include "component", "service", and "object".
  +     *
  +     * <p>Example:</p>
  +     * <pre>
  +     *   query.addKey( "component:org.apache.avalon.excalibur.datasource.DataSourceComponent"
);
  +     *   query.addKey( "service:org.apache.avalon.cornerstone.services.ConnectionManager"
);
  +     *   query.addKey( "object:foo-object" );
  +     * </pre>
  +     */
  +    void addKey( String value );
  +
  +    /**
  +     * Remove a lookup key.  This facilitates a quick test/resolve approach.  The
  +     * <code>Query</code> object can be initialized in the constructor complete
with
  +     * references to optional components.  Your code can then call
  +     * <code>hasReferences</code> and remove any optional keys from the Query
that the
  +     * <code>Resolver</code> cannot handle.
  +     */
  +    void removeKey( String value );
  +
  +    /**
  +     * You can add further hints, or attributes to the query that can help the
  +     * <code>Resolver</code> get the specific instance you want.  It is important
  +     * to note that the attributes do apply to all the key values.  The
  +     * <code>Resolver</code> does have the right to ignore any or all of the
  +     * attributes if it wants.
  +     */
  +    void addAttribute( String name, Object value );
  +
  +    /**
  +     * You can remove hints, or attributes to the query that can help the
  +     * <code>Resolver</code> get the specific instance you want.
  +     */
  +    void removeAttribute( String name );
  +
  +    /**
  +     * This obtains a reference to the attribute context used by the
  +     * code>Resolver</code>.  The context uses resolveable entryies to determine
  +     * the keys, and what types they are.
  +     */
  +    Context queryContext();
  +}
  
  
  
  1.2       +24 -24    jakarta-avalon/src/proposal/resolver/Resolvable.java
  
  Index: Resolvable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/proposal/resolver/Resolvable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resolvable.java	12 Feb 2002 18:23:44 -0000	1.1
  +++ Resolvable.java	26 Feb 2002 02:13:52 -0000	1.2
  @@ -1,24 +1,24 @@
  -/*
  - * Copyright (C) The Apache Software Foundation. All rights reserved.
  - *
  - * This software is published under the terms of the Apache Software License
  - * version 1.1, a copy of which has been included with this distribution in
  - * the LICENSE.txt file.
  - */
  -package org.apache.avalon.framework.resolver;
  -
  -/**
  - * A <code>Resolveable</code> will pass a reference of the <code>Resolver</code>
  - * to your component.
  - *
  - * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - */
  -public interface Resolvable
  -{
  -    /**
  -     * Provide the reference to the resolver.
  -     */
  -    void setResolver( Resolver resolver )
  -        throws ResolverException;
  -
  -}
  +/*
  + * Copyright (C) The Apache Software Foundation. All rights reserved.
  + *
  + * This software is published under the terms of the Apache Software License
  + * version 1.1, a copy of which has been included with this distribution in
  + * the LICENSE.txt file.
  + */
  +package org.apache.avalon.framework.resolver;
  +
  +/**
  + * A <code>Resolveable</code> will pass a reference of the <code>Resolver</code>
  + * to your component.
  + *
  + * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  + */
  +public interface Resolvable
  +{
  +    /**
  +     * Provide the reference to the resolver.
  +     */
  +    void setResolver( Resolver resolver )
  +        throws ResolverException;
  +
  +}
  
  
  
  1.5       +52 -52    jakarta-avalon/src/proposal/resolver/Resolver.java
  
  Index: Resolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/proposal/resolver/Resolver.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Resolver.java	12 Feb 2002 18:23:44 -0000	1.4
  +++ Resolver.java	26 Feb 2002 02:13:52 -0000	1.5
  @@ -1,52 +1,52 @@
  -/*
  - * Copyright (C) The Apache Software Foundation. All rights reserved.
  - *
  - * This software is published under the terms of the Apache Software License
  - * version 1.1, a copy of which has been included with this distribution in
  - * the LICENSE.txt file.
  - */
  -package org.apache.avalon.framework.resolver;
  -
  -/**
  - * A <code>Resolver</code> will resolve one or more objects and return a token.
  - * The responsibility of the Resolver is to get all references identified by the
  - * <code>Query</code> object and return a <code>Token</code>. 
The <code>Token</code>
  - * then is responsible for releasing any objects that need to be returned to a
  - * pool or properly decommissioned.
  - *
  - * <p>The types of objects returned by the Resolver are usually components and services,
  - * but can be any arbitrary type.</p>
  - *
  - * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - */
  -public interface Resolver
  -{
  -    /**
  -     * Resolve an <code>Object</code>/<code>Component</code>/<code>Service</code>
  -     * from a lookup parameter.  The Lookup parameter has a core value and attributes
  -     * associated with it.
  -     */
  -    Token lookup( Query query )
  -        throws ResolverException;
  -
  -    /**
  -     * Resolve an <code>Object</code>/<code>Component</code>/<code>Service</code>
  -     * from a lookup parameter.  The Lookup parameter translates a URI into the
  -     * requested Object type.  The Resolver is free to directly resolve this uriQuery
  -     * directly, or it may create an interim Query object.
  -     *
  -     * <p>
  -     *  The psuedo-protocols that must be supported are: "component", "service", and
  -     *  "object".  Further protocols may be "jndi", "orb", etc.
  -     * </p>
  -     */
  -    Token lookup( String uriQuery )
  -        throws ResolverException;
  -
  -    /**
  -     * Test to see if the <code>Resolver</code> can resolve all the keys in
the
  -     * <code>Query</code> object.  The order of boolean responses matches the
order
  -     * of <code>Query</code> keys.
  -     */
  -    boolean[] hasReferences( Query query );
  -}
  +/*
  + * Copyright (C) The Apache Software Foundation. All rights reserved.
  + *
  + * This software is published under the terms of the Apache Software License
  + * version 1.1, a copy of which has been included with this distribution in
  + * the LICENSE.txt file.
  + */
  +package org.apache.avalon.framework.resolver;
  +
  +/**
  + * A <code>Resolver</code> will resolve one or more objects and return a token.
  + * The responsibility of the Resolver is to get all references identified by the
  + * <code>Query</code> object and return a <code>Token</code>. 
The <code>Token</code>
  + * then is responsible for releasing any objects that need to be returned to a
  + * pool or properly decommissioned.
  + *
  + * <p>The types of objects returned by the Resolver are usually components and services,
  + * but can be any arbitrary type.</p>
  + *
  + * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  + */
  +public interface Resolver
  +{
  +    /**
  +     * Resolve an <code>Object</code>/<code>Component</code>/<code>Service</code>
  +     * from a lookup parameter.  The Lookup parameter has a core value and attributes
  +     * associated with it.
  +     */
  +    Token lookup( Query query )
  +        throws ResolverException;
  +
  +    /**
  +     * Resolve an <code>Object</code>/<code>Component</code>/<code>Service</code>
  +     * from a lookup parameter.  The Lookup parameter translates a URI into the
  +     * requested Object type.  The Resolver is free to directly resolve this uriQuery
  +     * directly, or it may create an interim Query object.
  +     *
  +     * <p>
  +     *  The psuedo-protocols that must be supported are: "component", "service", and
  +     *  "object".  Further protocols may be "jndi", "orb", etc.
  +     * </p>
  +     */
  +    Token lookup( String uriQuery )
  +        throws ResolverException;
  +
  +    /**
  +     * Test to see if the <code>Resolver</code> can resolve all the keys in
the
  +     * <code>Query</code> object.  The order of boolean responses matches the
order
  +     * of <code>Query</code> keys.
  +     */
  +    boolean[] hasReferences( Query query );
  +}
  
  
  
  1.3       +42 -42    jakarta-avalon/src/proposal/resolver/ResolverException.java
  
  Index: ResolverException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/proposal/resolver/ResolverException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResolverException.java	11 Feb 2002 16:08:40 -0000	1.2
  +++ ResolverException.java	26 Feb 2002 02:13:52 -0000	1.3
  @@ -1,42 +1,42 @@
  -/*
  - * Copyright (C) The Apache Software Foundation. All rights reserved.
  - *
  - * This software is published under the terms of the Apache Software License
  - * version 1.1, a copy of which has been included with this distribution in
  - * the LICENSE.txt file.
  - */
  -package org.apache.avalon.framework.resolver;
  -
  -import org.apache.avalon.framework.CascadingException;
  -
  -/**
  - * The exception thrown to indicate a problem with resolver or the resolver query.
  - * It is usually thrown by Resolver.
  - *
  - * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - */
  -public class ResolverException
  -    extends CascadingException
  -{
  -    /**
  -     * Construct a new <code>ResolverException</code> instance.
  -     *
  -     * @param message the exception message
  -     * @param throwable the throwable
  -     */
  -    public ResolverException( final String message, final Throwable throwable )
  -    {
  -        super( message, throwable );
  -    }
  -
  -    /**
  -     * Construct a new <code>ResolverException</code> instance.
  -     *
  -     * @param message the exception message
  -     */
  -    public ResolverException( final String message )
  -    {
  -        super( message, null );
  -    }
  -}
  +/*
  + * Copyright (C) The Apache Software Foundation. All rights reserved.
  + *
  + * This software is published under the terms of the Apache Software License
  + * version 1.1, a copy of which has been included with this distribution in
  + * the LICENSE.txt file.
  + */
  +package org.apache.avalon.framework.resolver;
  +
  +import org.apache.avalon.framework.CascadingException;
  +
  +/**
  + * The exception thrown to indicate a problem with resolver or the resolver query.
  + * It is usually thrown by Resolver.
  + *
  + * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  + * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  + */
  +public class ResolverException
  +    extends CascadingException
  +{
  +    /**
  +     * Construct a new <code>ResolverException</code> instance.
  +     *
  +     * @param message the exception message
  +     * @param throwable the throwable
  +     */
  +    public ResolverException( final String message, final Throwable throwable )
  +    {
  +        super( message, throwable );
  +    }
  +
  +    /**
  +     * Construct a new <code>ResolverException</code> instance.
  +     *
  +     * @param message the exception message
  +     */
  +    public ResolverException( final String message )
  +    {
  +        super( message, null );
  +    }
  +}
  
  
  
  1.4       +46 -46    jakarta-avalon/src/proposal/resolver/Token.java
  
  Index: Token.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/proposal/resolver/Token.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Token.java	12 Feb 2002 18:23:44 -0000	1.3
  +++ Token.java	26 Feb 2002 02:13:52 -0000	1.4
  @@ -1,46 +1,46 @@
  -/*
  - * Copyright (C) The Apache Software Foundation. All rights reserved.
  - *
  - * This software is published under the terms of the Apache Software License
  - * version 1.1, a copy of which has been included with this distribution in
  - * the LICENSE.txt file.
  - */
  -package org.apache.avalon.framework.Resolver;
  -
  -import java.util.Iterator;
  -
  -/**
  - * A <code>Token</code> is responsible for returning the actual Objects requested
  - * from the <code>Resolver</code>.  It is also responsible for collectively
returnning
  - * all the requested tokens back to the <code>Resolver</code> if they are pooled
  - * or otherwise managed resources.
  - *
  - * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - */
  -public interface Token
  -{
  -    /**
  -     * Obtain the actual references from the query.  The order of references must match
  -     * the order of keys in the Query object.
  -     */
  -    Object[] references();
  -
  -    /**
  -     * Obtain a reference to the first Object in the Token.  This is more for convenience
  -     * when only one object was requested to begin with.
  -     */
  -    Object reference();
  -
  -    /**
  -     * Obtain the reference to the Objects via an Iterator.  This is for the case where
  -     * you have many objects requested, and would rather use an iterator than the
  -     * array.
  -     */
  -    Iterator iterator();
  -
  -    /**
  -     * Releases the hold on all the referenced objects.  The <code>Token</code>
is no
  -     * longer usable, and should be discarded after this method is called.
  -     */
  -    void release();
  -}
  +/*
  + * Copyright (C) The Apache Software Foundation. All rights reserved.
  + *
  + * This software is published under the terms of the Apache Software License
  + * version 1.1, a copy of which has been included with this distribution in
  + * the LICENSE.txt file.
  + */
  +package org.apache.avalon.framework.Resolver;
  +
  +import java.util.Iterator;
  +
  +/**
  + * A <code>Token</code> is responsible for returning the actual Objects requested
  + * from the <code>Resolver</code>.  It is also responsible for collectively
returnning
  + * all the requested tokens back to the <code>Resolver</code> if they are pooled
  + * or otherwise managed resources.
  + *
  + * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  + */
  +public interface Token
  +{
  +    /**
  +     * Obtain the actual references from the query.  The order of references must match
  +     * the order of keys in the Query object.
  +     */
  +    Object[] references();
  +
  +    /**
  +     * Obtain a reference to the first Object in the Token.  This is more for convenience
  +     * when only one object was requested to begin with.
  +     */
  +    Object reference();
  +
  +    /**
  +     * Obtain the reference to the Objects via an Iterator.  This is for the case where
  +     * you have many objects requested, and would rather use an iterator than the
  +     * array.
  +     */
  +    Iterator iterator();
  +
  +    /**
  +     * Releases the hold on all the referenced objects.  The <code>Token</code>
is no
  +     * longer usable, and should be discarded after this method is called.
  +     */
  +    void release();
  +}
  
  
  

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


Mime
View raw message