001    package org.apache.maven.repository.legacy.metadata;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    import java.util.List;
023    
024    import org.apache.maven.artifact.Artifact;
025    import org.apache.maven.artifact.repository.ArtifactRepository;
026    import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
027    import org.apache.maven.artifact.repository.RepositoryRequest;
028    import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
029    
030    /**
031     * Forms a request to retrieve artifact metadata.
032     * 
033     * @author Benjamin Bentmann
034     */
035    public class DefaultMetadataResolutionRequest
036        implements MetadataResolutionRequest
037    {
038    
039        private Artifact artifact;
040    
041        private boolean resolveManagedVersions;
042    
043        private RepositoryRequest repositoryRequest;
044    
045        public DefaultMetadataResolutionRequest()
046        {
047            repositoryRequest = new DefaultRepositoryRequest();
048        }
049    
050        public DefaultMetadataResolutionRequest( RepositoryRequest repositoryRequest )
051        {
052            this.repositoryRequest = new DefaultRepositoryRequest( repositoryRequest );
053        }
054    
055        public DefaultMetadataResolutionRequest( ArtifactResolutionRequest resolutionRequest )
056        {
057            this.repositoryRequest = new DefaultRepositoryRequest( resolutionRequest );
058        }
059    
060        public Artifact getArtifact()
061        {
062            return artifact;
063        }
064    
065        public DefaultMetadataResolutionRequest setArtifact( Artifact artifact )
066        {
067            this.artifact = artifact;
068    
069            return this;
070        }
071    
072        public ArtifactRepository getLocalRepository()
073        {
074            return repositoryRequest.getLocalRepository();
075        }
076    
077        public DefaultMetadataResolutionRequest setLocalRepository( ArtifactRepository localRepository )
078        {
079            repositoryRequest.setLocalRepository( localRepository );
080    
081            return this;
082        }
083    
084        public List<ArtifactRepository> getRemoteRepositories()
085        {
086            return repositoryRequest.getRemoteRepositories();
087        }
088    
089        public DefaultMetadataResolutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
090        {
091            repositoryRequest.setRemoteRepositories( remoteRepositories );
092    
093            return this;
094        }
095    
096        public boolean isResolveManagedVersions()
097        {
098            return resolveManagedVersions;
099        }
100    
101        public DefaultMetadataResolutionRequest setResolveManagedVersions( boolean resolveManagedVersions )
102        {
103            this.resolveManagedVersions = resolveManagedVersions;
104    
105            return this;
106        }
107    
108        public boolean isOffline()
109        {
110            return repositoryRequest.isOffline();
111        }
112    
113        public DefaultMetadataResolutionRequest setOffline( boolean offline )
114        {
115            repositoryRequest.setOffline( offline );
116    
117            return this;
118        }
119    
120        public boolean isForceUpdate()
121        {
122            return repositoryRequest.isForceUpdate();
123        }
124    
125        public DefaultMetadataResolutionRequest setForceUpdate( boolean forceUpdate )
126        {
127            repositoryRequest.setForceUpdate( forceUpdate );
128    
129            return this;
130        }
131    
132    }