You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/08/21 13:47:18 UTC

cvs commit: jakarta-commons/discovery/src/java/org/apache/commons/discovery ServiceDiscovery.java ServiceDiscoveryTask.java

jstrachan    2002/08/21 04:47:18

  Modified:    discovery/src/java/org/apache/commons/discovery
                        ServiceDiscovery.java ServiceDiscoveryTask.java
  Log:
  Now deprecated the getServiceDiscovery() method on ServiceDiscovery.
  Now using a static newInstance() instead which follows the JAXP naming conventions, and makes it more clear that its not returning a singleton.
  
  Revision  Changes    Path
  1.2       +15 -1     jakarta-commons/discovery/src/java/org/apache/commons/discovery/ServiceDiscovery.java
  
  Index: ServiceDiscovery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/discovery/src/java/org/apache/commons/discovery/ServiceDiscovery.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServiceDiscovery.java	17 Aug 2002 06:36:11 -0000	1.1
  +++ ServiceDiscovery.java	21 Aug 2002 11:47:18 -0000	1.2
  @@ -87,6 +87,7 @@
    * @author Richard A. Sitze
    * @author Craig R. McClanahan
    * @author Costin Manolache
  + * @author James Strachan
    */
   public abstract class ServiceDiscovery
   {
  @@ -99,10 +100,23 @@
       protected ServiceDiscovery() {
       }
   
  -    public static ServiceDiscovery getServiceDiscovery() {
  +    /**
  +     * Creates a new instance of a ServiceDiscovery instance based on the 
  +     * abilities of the current JDK. The later the JDK the neater the implementation
  +     * of service discovery. 
  +     * ServiceDiscovery12 will be used on JDK 1.2 or later JDKs.
  +     */
  +    public static ServiceDiscovery newInstance() {
           // This is _not_ singleton. 
           return new ServiceDiscovery12();
           // XXX Check if JDK1.1 is used and return the specific version 
  +    }
  +
  +    /**
  +     * @deprecated  please now use {@link #newInstance()}
  +     */
  +    public static ServiceDiscovery getServiceDiscovery() {
  +        return newInstance();
       }
   
       /** Specify a new class loader to be used in searching.
  
  
  
  1.2       +1 -1      jakarta-commons/discovery/src/java/org/apache/commons/discovery/ServiceDiscoveryTask.java
  
  Index: ServiceDiscoveryTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/discovery/src/java/org/apache/commons/discovery/ServiceDiscoveryTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServiceDiscoveryTask.java	17 Aug 2002 06:36:11 -0000	1.1
  +++ ServiceDiscoveryTask.java	21 Aug 2002 11:47:18 -0000	1.2
  @@ -93,7 +93,7 @@
   
       public void execute() throws Exception {
           System.out.println("XXX ");
  -        ServiceDiscovery disc=ServiceDiscovery.getServiceDiscovery();
  +        ServiceDiscovery disc=ServiceDiscovery.newInstance();
   
           disc.addClassLoader( disc.getThreadClassLoader() );
           disc.addClassLoader( this.getClass().getClassLoader() );
  
  
  

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