maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/app ProjectVerifier.java
Date Sat, 30 Nov 2002 17:17:55 GMT
jvanzyl     2002/11/30 09:17:55

  Modified:    src/java/org/apache/maven/app ProjectVerifier.java
  Log:
  refactoring
  
  Revision  Changes    Path
  1.24      +16 -208   jakarta-turbine-maven/src/java/org/apache/maven/app/ProjectVerifier.java
  
  Index: ProjectVerifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/ProjectVerifier.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ProjectVerifier.java	27 Nov 2002 01:39:49 -0000	1.23
  +++ ProjectVerifier.java	30 Nov 2002 17:17:55 -0000	1.24
  @@ -100,15 +100,6 @@
       /** Log. */
       private static final Log log = LogFactory.getLog( ProjectVerifier.class );
   
  -    /** Maven project. */
  -    private Project mavenProject;
  -
  -    /** Maven local repo */
  -    private String mavenLocalRepo;
  -
  -    /** Maven remote repo locations */
  -    private List mavenRemoteRepos = new ArrayList();
  -
       /** Verbosity during downloading of missing resources. */
       private boolean verbose = false;
   
  @@ -127,28 +118,10 @@
       /** Map of failed downloads. Key is URL, value is Boolean */
       private Map failedDownloads = new HashMap();
   
  -    /** Proxy host */
  -    private String proxyHost;
  -
  -    /** Proxy port */
  -    private String proxyPort;
  -
  -    /** Proxy userName */
  -    private String proxyUserName;
  -
  -    /** Proxy password */
  -    private String proxyPassword;
  -
  -    /**
  -     * Name of the file in the maven.remoteRepo that enumerates the
  -     * JARs that cannot be distributed by Maven.
  -     */
  +    /* JARs that cannot be distributed by Maven. */
       private static final String NON_DIST_JAR_LIST =
           "non-distributable-jars.list";
   
  -    /** whether the user is 'online' */
  -    private boolean online = true;
  -
       /** Maven Jelly context being used. */
       private MavenJellyContext context;
   
  @@ -159,26 +132,6 @@
       }
   
       /**
  -     * Set the Maven project.
  -     *
  -     * @param mavenProject The maven project.
  -     */
  -    public void setMavenProject( Project mavenProject )
  -    {
  -        this.mavenProject = mavenProject;
  -    }
  -
  -    /**
  -     * Get the Maven project.
  -     *
  -     * @return The maven project.
  -     */
  -    public Project getMavenProject()
  -    {
  -        return mavenProject;
  -    }
  -
  -    /**
        * Sets the context attribute.
        * @param context The Maven Jelly Context to use
        */
  @@ -197,104 +150,11 @@
       }
   
       /**
  -     * Sets the proxyHost attribute.
  -     * @param proxyHost the value to set
  -     */
  -    public void setProxyHost( String proxyHost )
  -    {
  -        this.proxyHost = proxyHost;
  -    }
  -
  -    /**
  -     * Sets the proxyPort attribute.
  -     * @param proxyPort the value to set
  -     */
  -    public void setProxyPort( String proxyPort )
  -    {
  -        this.proxyPort = proxyPort;
  -    }
  -
  -    /**
  -     * Sets the proxyUserName attribute.
  -     * @param proxyUserName the value to set
  -     */
  -    public void setProxyUserName( String proxyUserName )
  -    {
  -        this.proxyUserName = proxyUserName;
  -    }
  -
  -    /**
  -     * Sets the proxyPassword attribute.
  -     * @param proxyPassword the value to set
  -     */
  -    public void setProxyPassword( String proxyPassword )
  -    {
  -        this.proxyPassword = proxyPassword;
  -    }
  -
  -    /**
  -     * Sets the mavenLocalRepo attribute.
  -     * @param mavenLocalRepo the local repository
  -     */
  -    public void setMavenLocalRepo( String mavenLocalRepo )
  -    {
  -        this.mavenLocalRepo = mavenLocalRepo;
  -    }
  -
  -    /**
  -     * Get the maven local repo.
  -     * @return the local repo
  -     */
  -    public String getMavenLocalRepo()
  -    {
  -        return mavenLocalRepo;
  -    }
  -
  -    /**
  -     * Sets the mavenRemoteRepo attribute.  This can be a comma separated list
  -     * of URLs.
  -     * @param mavenRemoteRepo the new value to set
  -     */
  -    public void setMavenRemoteRepo( String mavenRemoteRepo )
  -    {
  -        if ( mavenRemoteRepo == null )
  -        {
  -            return;
  -        }            
  -    
  -        StringTokenizer st = new StringTokenizer( mavenRemoteRepo, "," );
  -        
  -        if ( st.hasMoreTokens() )
  -        {
  -            int size = mavenRemoteRepos.size();
  -            for ( int i = 0; i < size; i++ )
  -            {
  -                mavenRemoteRepos.remove( i );
  -            }
  -        }            
  -        
  -        while ( st.hasMoreTokens() )
  -        {
  -            mavenRemoteRepos.add( st.nextToken().trim() );
  -        }
  -    }
  -
  -    /**
  -     * Get the maven remote repository list of URLs.
  -     *
  -     * @return the remote repositories as a {@link List} of strings
  -     */
  -    public List getMavenRemoteRepo()
  -    {
  -        return mavenRemoteRepos;
  -    }
  -
  -    /**
        * Execute the verification process.
        *
        * @throws Exception If an error occurs while verifying.
        */
  -    public void doExecute()
  +    public void execute()
           throws Exception
       {
           verifySettings();
  @@ -312,7 +172,7 @@
           throws Exception
       {
           // Get local repo property.
  -        String localRepoProp = (String) getContext().getVariable( MavenConstants.REPO_LOCAL
);
  +        String localRepoProp = getContext().getMavenRepoLocal();
   
           if ( localRepoProp == null )
           {
  @@ -321,16 +181,6 @@
               throw new RepoConfigException( "maven.repo.local not set" );
           }
   
  -        String remoteRepoProp = (String) getContext()
  -            .getVariable( MavenConstants.REPO_REMOTE );
  -
  -        if ( remoteRepoProp == null )
  -        {
  -            // This is not likely to happen any more as the default is
  -            // set in the driver.properties.
  -            throw new RepoConfigException( "maven.repo.remote not set" );
  -        }
  -
           File localRepo = new File( localRepoProp );
   
           if ( !localRepo.exists() )
  @@ -354,9 +204,6 @@
           {
               throw new RepoConfigException( localRepo + " is not writable." );
           }
  -
  -        setMavenRemoteRepo( remoteRepoProp );
  -        setMavenLocalRepo( localRepoProp );
       }
   
       /**
  @@ -366,26 +213,6 @@
        */
       private void contextualize( MavenJellyContext context )
       {
  -        // The project may have already been set by the plugin manager.
  -        if ( getMavenProject() == null )
  -        {
  -            setMavenProject( (Project) context.getVariable( MavenConstants.MAVEN_POM )
);
  -        }
  -
  -        String proxyHost = (String) context.getVariable( MavenConstants.PROXY_HOST );
  -        if ( proxyHost != null )
  -        {
  -            setProxyHost( proxyHost );
  -            setProxyPort( (String) context.getVariable( MavenConstants.PROXY_PORT ) );
  -            setProxyUserName( (String) context.getVariable( MavenConstants.PROXY_USERNAME
) );
  -            setProxyPassword( (String) context.getVariable( MavenConstants.PROXY_PASSWORD
) );
  -        }
  -
  -        Boolean online = context.getBoolean( MavenConstants.ONLINE );
  -        if ( online != null && !online.booleanValue() )
  -        {
  -            setOnline( false );
  -        }
       }
   
       /**
  @@ -415,7 +242,7 @@
   
           clearFailedDependencies();
   
  -        for ( Iterator i = getMavenProject().getDependencies().iterator(); i.hasNext();
)
  +        for ( Iterator i = getContext().getProject().getDependencies().iterator(); i.hasNext();
)
           {
               Dependency dependency = (Dependency) i.next();
               String jar = dependency.getJar();
  @@ -429,7 +256,7 @@
   
               Artifact artifact = DefaultArtifactFactory.createArtifact( dependency );
               String path = artifact.getPath();
  -            File jarFile = new File( getMavenLocalRepo(), path );
  +            File jarFile = new File( getContext().getMavenRepoLocal(), path );
   
   
               if ( log.isDebugEnabled() )
  @@ -464,9 +291,9 @@
           if ( failedDependencies.size() > 0 )
           {
               Map nonDistMap;
  -            File f = new File( getMavenLocalRepo(), NON_DIST_JAR_LIST );
  +            File f = new File( getContext().getMavenRepoLocal(), NON_DIST_JAR_LIST );
   
  -            if ( isOnline() && !getRemoteFile( NON_DIST_JAR_LIST, f ) )
  +            if ( getContext().getOnline().booleanValue() && !getRemoteFile( NON_DIST_JAR_LIST,
f ) )
               {
                   StringBuffer msg = new StringBuffer( 128 );
                   msg.append( "-----------------------------------------------\n" )
  @@ -490,7 +317,7 @@
               for ( Iterator i = failedDependencies.iterator(); i.hasNext(); )
               {
                   Artifact artifact = (Artifact) i.next();
  -                File destinationFile = new File( getMavenLocalRepo(),
  +                File destinationFile = new File( getContext().getMavenRepoLocal(),
                                                    artifact.getPath() );
                   String artifactName = artifact.getName();
   
  @@ -521,7 +348,7 @@
                       continue;
                   }
   
  -                if ( isOnline() && !hasFailedDownload( artifact.getUrlPath() )
  +                if ( getContext().getOnline().booleanValue() && !hasFailedDownload(
artifact.getUrlPath() )
                       && !getRemoteFile( artifact.getUrlPath(), destinationFile )
)
                   {
                       failedDownloads.put( artifact.getUrlPath(), Boolean.TRUE );
  @@ -567,13 +394,13 @@
        */
       private boolean getRemoteFile( String remoteFile, File localFile )
       {
  -        if ( !isOnline() )
  +        if ( getContext().getOnline().booleanValue() )
           {
               return false;
           }
   
           boolean gotFile = false;
  -        Iterator i = getMavenRemoteRepo().iterator();
  +        Iterator i = getContext().getMavenRepoRemote().iterator();
   
           while ( !gotFile && i.hasNext() )
           {
  @@ -587,8 +414,10 @@
                   gotFile = HttpUtils.getFile( new URL( url ),
                                                localFile, url, verbose,
                                                ignoreErrors, useTimestamp, "", "",
  -                                             proxyHost, proxyPort,
  -                                             proxyUserName, proxyPassword );
  +                                             getContext().getProxyHost(),
  +                                             getContext().getProxyPort(),
  +                                             getContext().getProxyUserName(),
  +                                             getContext().getProxyPassword() );
               }
               catch ( MalformedURLException mue )
               {
  @@ -638,25 +467,4 @@
   
           return nonDistMap;
       }
  -
  -    /**
  -     * Whether the user is currently online
  -     *
  -     * @return Value of property online.
  -     */
  -    public boolean isOnline()
  -    {
  -        return online;
  -    }
  -
  -    /**
  -     * Set the user to be online (true) or offline (false)
  -     *
  -     * @param online New value of property online.
  -     */
  -    public void setOnline( boolean online )
  -    {
  -        this.online = online;
  -    }
  -
   }
  
  
  

Mime
View raw message