maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject cvs commit: maven-scm/scm-api/src/java/org/apache/maven/scm/manager DefaultScmManager.java
Date Fri, 19 Mar 2004 12:26:59 GMT
evenisse    2004/03/19 04:26:59

  Modified:    scm-api/src/java/org/apache/maven/scm/manager
                        DefaultScmManager.java
  Log:
  Fix factories loading.
  
  Revision  Changes    Path
  1.3       +11 -2     maven-scm/scm-api/src/java/org/apache/maven/scm/manager/DefaultScmManager.java
  
  Index: DefaultScmManager.java
  ===================================================================
  RCS file: /home/cvs/maven-scm/scm-api/src/java/org/apache/maven/scm/manager/DefaultScmManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultScmManager.java	22 Feb 2004 07:57:12 -0000	1.2
  +++ DefaultScmManager.java	19 Mar 2004 12:26:59 -0000	1.3
  @@ -67,10 +67,12 @@
   import java.io.InputStream;
   import java.net.URL;
   import java.util.Enumeration;
  +import java.util.HashMap;
  +import java.util.Map;
   
   public class DefaultScmManager implements ScmManager
   {
  -    private ScmFactory scmFactory;
  +    private Map scmFactories = new HashMap();
   
       private RepositoryInfo repoInfo;
   
  @@ -160,7 +162,7 @@
   
                   ScmFactory factory = (ScmFactory) classLoader.loadClass( implementation
).newInstance();
   
  -                scmFactory = factory;
  +                scmFactories.put(factory.getSupportedScm(), factory);
               }
           }
           catch ( Exception e )
  @@ -172,6 +174,13 @@
       public Command getCommand( String commandName )
           throws ScmException
       {
  +        ScmFactory scmFactory = (ScmFactory)scmFactories.get( repoInfo.getType() );
  +        if ( scmFactory == null)
  +        {
  +            throw new ScmException("There is no providers corresponding to scm type ("
+
  +                repoInfo.getType() + ")");
  +        }
  +        
           return scmFactory.createCommand( repoInfo, commandName );
       }
   }
  
  
  

Mime
View raw message