View Javadoc
1   package org.eclipse.aether.spi.connector;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   * 
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   * 
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.File;
23  
24  import org.eclipse.aether.RequestTrace;
25  import org.eclipse.aether.artifact.Artifact;
26  import org.eclipse.aether.transfer.ArtifactTransferException;
27  import org.eclipse.aether.transfer.TransferListener;
28  
29  /**
30   * An upload of an artifact to a remote repository. A repository connector processing this upload has to use
31   * {@link #setException(ArtifactTransferException)} to report the results of the transfer.
32   */
33  public final class ArtifactUpload
34      extends ArtifactTransfer
35  {
36  
37      /**
38       * Creates a new uninitialized upload.
39       */
40      public ArtifactUpload()
41      {
42          // enables default constructor
43      }
44  
45      /**
46       * Creates a new upload with the specified properties.
47       * 
48       * @param artifact The artifact to upload, may be {@code null}.
49       * @param file The local file to upload the artifact from, may be {@code null}.
50       */
51      public ArtifactUpload( Artifact artifact, File file )
52      {
53          setArtifact( artifact );
54          setFile( file );
55      }
56  
57      @Override
58      public ArtifactUpload setArtifact( Artifact artifact )
59      {
60          super.setArtifact( artifact );
61          return this;
62      }
63  
64      @Override
65      public ArtifactUpload setFile( File file )
66      {
67          super.setFile( file );
68          return this;
69      }
70  
71      @Override
72      public ArtifactUpload setException( ArtifactTransferException exception )
73      {
74          super.setException( exception );
75          return this;
76      }
77  
78      @Override
79      public ArtifactUpload setListener( TransferListener listener )
80      {
81          super.setListener( listener );
82          return this;
83      }
84  
85      @Override
86      public ArtifactUpload setTrace( RequestTrace trace )
87      {
88          super.setTrace( trace );
89          return this;
90      }
91  
92      @Override
93      public String toString()
94      {
95          return getArtifact() + " - " + getFile();
96      }
97  
98  }