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

cvs commit: jakarta-avalon/src/proposal/resolver Resolvable.java Query.java Resolver.java Token.java Resolveable.java

bloritsch    02/02/12 10:23:44

  Modified:    src/proposal/resolver Query.java Resolver.java Token.java
  Added:       src/proposal/resolver Resolvable.java
  Removed:     src/proposal/resolver Resolveable.java
  Log:
  update Resolvable package with comments from anryoshi@users.sourceforge.net
  
  Revision  Changes    Path
  1.4       +10 -5     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Query.java	11 Feb 2002 16:08:40 -0000	1.3
  +++ Query.java	12 Feb 2002 18:23:44 -0000	1.4
  @@ -20,15 +20,20 @@
    */
   public interface Query
   {
  -    Integer COMPONENT = new Integer(0x01);
  -    Integer SERVICE   = new Integer(0x02);
  -    Integer OBJECT    = new Integer(0x04);
   
       /**
  -     * Add a lookup key.  The Lookup key consists of an enumerated type, and the key
  +     * 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( int type, String value );
  +    void addKey( String value );
   
       /**
        * Remove a lookup key.  This facilitates a quick test/resolve approach.  The
  
  
  
  1.4       +14 -0     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Resolver.java	11 Feb 2002 16:08:40 -0000	1.3
  +++ Resolver.java	12 Feb 2002 18:23:44 -0000	1.4
  @@ -30,6 +30,20 @@
           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.
  
  
  
  1.3       +15 -0     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Token.java	11 Feb 2002 16:08:40 -0000	1.2
  +++ Token.java	12 Feb 2002 18:23:44 -0000	1.3
  @@ -7,6 +7,8 @@
    */
   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
  @@ -22,6 +24,19 @@
        * 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
  
  
  
  1.1                  jakarta-avalon/src/proposal/resolver/Resolvable.java
  
  Index: Resolvable.java
  ===================================================================
  /*
   * 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;
  
  }
  
  
  

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