avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: jakarta-avalon/src/proposal/service ServiceSelector.java ServiceResolver.java ServiceReclaimer.java ServiceChooser.java package.html ServiceManager.java Serviceable.java DefaultServiceManager.java
Date Mon, 18 Feb 2002 15:13:14 GMT
mcconnell    02/02/18 07:13:14

  Modified:    src/proposal/service ServiceManager.java Serviceable.java
                        DefaultServiceManager.java
  Added:       src/proposal/service ServiceSelector.java
                        ServiceResolver.java ServiceReclaimer.java
                        ServiceChooser.java package.html
  Log:
  updated proposal
  
  Revision  Changes    Path
  1.2       +0 -11     jakarta-avalon/src/proposal/service/ServiceManager.java
  
  Index: ServiceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/proposal/service/ServiceManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServiceManager.java	10 Feb 2002 05:39:53 -0000	1.1
  +++ ServiceManager.java	18 Feb 2002 15:13:14 -0000	1.2
  @@ -73,15 +73,4 @@
        * @return True if the object exists, False if it does not.
        */
       boolean hasService( String role );
  -
  -    /**
  -     * Return the <code>Object</code> when you are finished with it.  This
  -     * allows the <code>ServiceManager</code> to handle the End-Of-Life Lifecycle
  -     * events associated with the Object.  Please note, that no Exceptions
  -     * should be thrown at this point.  This is to allow easy use of the
  -     * ServiceManager system without having to trap Exceptions on a release.
  -     *
  -     * @param object The Object we are releasing.
  -     */
  -    void release( Object object );
   }
  
  
  
  1.2       +3 -0      jakarta-avalon/src/proposal/service/Serviceable.java
  
  Index: Serviceable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/proposal/service/Serviceable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Serviceable.java	10 Feb 2002 05:39:53 -0000	1.1
  +++ Serviceable.java	18 Feb 2002 15:13:14 -0000	1.2
  @@ -20,6 +20,9 @@
    * the <code>compose</code> method before the <code>Serviceable</code>

    * can be considered valid. 
    *
  + * @see org.apache.avalon.framework.service.ServiceManager
  + * @see org.apache.avalon.framework.service.ServiceResolver
  + *
    * @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
    * @author <a href="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  
  
  
  1.2       +1 -13     jakarta-avalon/src/proposal/service/DefaultServiceManager.java
  
  Index: DefaultServiceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/proposal/service/DefaultServiceManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultServiceManager.java	10 Feb 2002 05:39:53 -0000	1.1
  +++ DefaultServiceManager.java	18 Feb 2002 15:13:14 -0000	1.2
  @@ -77,14 +77,13 @@
   
           try
           {
  -            this.release(this.lookup(role));
  +            this.lookup(role);
               componentExists = true;
           }
           catch (Throwable t)
           {
               // Ignore all throwables--we want a yes or no answer.
           }
  -
           return componentExists;
       }
   
  @@ -98,17 +97,6 @@
       {
           checkWriteable();
           m_components.put( role, object );
  -    }
  -
  -    /**
  -     * Release component.
  -     *
  -     * @param component the component
  -     */
  -    public void release( final Object component )
  -    {
  -        // if the ServiceManager handled pooling, it would be
  -        // returned to the pool here.
       }
   
       /**
  
  
  
  1.1                  jakarta-avalon/src/proposal/service/ServiceSelector.java
  
  Index: ServiceSelector.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.service;
  
  /**
   * A <code>ServiceSelector</code> selects <code>Object</code>s based
on a
   * supplied policy.  The contract is that all the <code>Object</code>s implement
the
   * same role.
   *
   * @see org.apache.avalon.framework.service.Serviceable
   * @see org.apache.avalon.framework.service.ServiceManager
   * @see org.apache.avalon.framework.service.ServiceChooser
   *
   * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   */
  public interface ServiceSelector
  {
      /**
       * Select the <code>Object</code> associated with the given policy.
       * For instance, If the <code>ServiceSelector</code> has a
       * <code>Generator</code> stored and referenced by a URL, I would use the
       * following call:
       *
       * <pre>
       * try
       * {
       *     Generator input;
       *     input = (Generator)selector.select( new URL("foo://demo/url") );
       * }
       * catch (...)
       * {
       *     ...
       * }
       * </pre>
       *
       * @param policy A criteria against which a <code>Object</code> is selected.
       *
       * @exception ServiceSelector If the requested <code>Object</code> cannot
be supplied
       */
      Object select( Object policy )
          throws ServiceException;
  
      /**
       * Check to see if a <code>Object</code> exists relative to the supplied
policy.
       *
       * @param policy a <code>Object</code> containing the selection criteria
       * @return True if the component is available, False if it not.
       */
      boolean isSelectable( Object policy );
  
  }
  
  
  
  1.1                  jakarta-avalon/src/proposal/service/ServiceResolver.java
  
  Index: ServiceResolver.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.service;
  
  /**
   * A <code>ServiceResolver</code> selects pooled <code>Object</code>s
based on a
   * role.  The contract is that all the <code>Object</code>s implement the
   * differing roles and there is one <code>Object</code> per role.  If you
   * need to select on of many <code>Object</code>s that implement the same
   * role, then you need to use a <code>ServiceSelector</code>.  Roles are
   * usually the full interface name.
   *
   * Object aquired via the <code>ServiceResolver</code> must be returned
   * using the release and releaseAll methods.  This allows the resolver to 
   * to maintain a pool of objects.
   *
   * @see org.apache.avalon.framework.service.ServiceManager
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   */
  public interface ServiceResolver extends ServiceManager, ServiceReclaimer
  {
      /**
       * Get the <code>Object</code> associated with the given role.  For
       * instance, If the <code>ServiceResolver</code> had a
       * <code>LoggerComponent</code> stored and referenced by role, I would use
       * the following call:
       * <pre>
       * try
       * {
       *     MyComponent log;
       *     myComponent = (MyComponent) manager.checkout(MyComponent.ROLE);
       * }
       * catch (...)
       * {
       *     ...
       * }
       * </pre>
       *
       * The when the client is finished using the supplied object, it must relase 
       * the object back to the resolver using the <code>release</code> method.
       * @param name The role name of the <code>Object</code> to retrieve.
       * @exception ServiceException if an error occurs
       */
      Object checkout( String role )
          throws ServiceException;
  
      /**
       * Get the <code>Object</code> associated with the given role and allocated
against 
       * supplied token .  For instance, If the <code>ServiceResolver</code> had
a
       * <code>LoggerComponent</code> stored and referenced by role, I would use
       * the following call:
       * <pre>
       * try
       * {
       *     MyComponent log;
       *     myComponent = (MyComponent) manager.checkout(MyComponent.ROLE, this );
       * }
       * catch (...)
       * {
       *     ...
       * }
       * </pre>
       *
       * The when the client is finished using the supplied object, it must relase 
       * the object back to the resolver using the <code>release</code> or 
       * <code>releaseAll</code> methods.
       * <pre>
       *     manager.release( log );
       *     // or
       *     manager.releaseAll( this );
       * </pre>
       *
       * @param token An object identifying the usage that may be used as a key
       * @param role The role name of the <code>Object</code> to retrieve.
       *  when releasing mutliple usages.
       * @exception ServiceException if an error occurs
       */
      Object checkout( Object token, String role )
          throws ServiceException;
  
  }
  
  
  
  1.1                  jakarta-avalon/src/proposal/service/ServiceReclaimer.java
  
  Index: ServiceReclaimer.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.service;
  
  /**
   * A <code>ServiceReclaimer</code> is an abstract interface inherited by 
   * types that manage a pool of service.  The interface provides support for 
   * the release of object references back to the pool enabling object recycling.
   *
   * @see org.apache.avalon.framework.service.ServiceResolver
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   */
  public interface ServiceReclaimer
  {
  
      /**
       * Release component.
       *
       * @param object the object to release
       */
      public void release( Object object );
  
      /**
       * Release all objects associated with the supplied token.
       * @param token a token supplied to a <code>ServiceResolver</code>
       *   during service aquisition.
       */
      public void releaseAll( Object token );
  }
  
  
  
  1.1                  jakarta-avalon/src/proposal/service/ServiceChooser.java
  
  Index: ServiceChooser.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.service;
  
  /**
   * A <code>ServiceChooser</code> selects pooled <code>Object</code>s
based on a
   * supplied policy and optional token.  
   *
   * @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
   */
  public interface ServiceChooser extends ServiceSelector, ServiceReclaimer
  {
  
      /**
       * Select the <code>Object</code> associated based on a supplied policy.
 
       * <pre>
       * try
       * {
       *     MyComponent log;
       *     myComponent = (MyComponent) chooser.choose( MyComponent.ROLE );
       * }
       * catch (...)
       * {
       *     ...
       * }
       * </pre>
       *
       * The when the client is finished using the supplied object, it must relase 
       * the object back to the resolver using the <code>release</code> method.
       * @param policy The policy defining the selection criteria against which
       *   an <code>Object</code> is supplied.
       * @exception ServiceException if an error occurs
       */
      Object choose( Object policy )
          throws ServiceException;
  
      /**
       * Select the <code>Object</code> associated based on a supplied usage token

       * and policy.  
       * <pre>
       * try
       * {
       *     MyComponent log;
       *     myComponent = (MyComponent) chooser.choose( this, MyComponent.ROLE );
       * }
       * catch (...)
       * {
       *     ...
       * }
       * </pre>
       *
       * The when the client is finished using the supplied object, it must relase 
       * the object back to the resolver using the <code>release</code> or 
       * <code>releaseAll</code> methods.
       * <pre>
       *     manager.release( log );
       *     // or
       *     manager.releaseAll( this );
       * </pre>
       *
       * @param token An object identifying the usage that may be used as a key
       * @param policy The policy defining the selection criteria against which
       *   an <code>Object</code> is supplied.
       * @exception ServiceException if an error occurs
       */
      Object choose( Object token, Object policy )
          throws ServiceException;
  
  }
  
  
  
  1.1                  jakarta-avalon/src/proposal/service/package.html
  
  Index: package.html
  ===================================================================
  <body>
  Extension interfaces and default implementation of a service management framework supporting
container based service lookup and decommissioning - PROPOSAL. 
  </body>
  
  
  

--
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