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.metadata.Metadata;
26  import org.eclipse.aether.transfer.MetadataTransferException;
27  import org.eclipse.aether.transfer.TransferListener;
28  
29  /**
30   * An upload of metadata to a remote repository. A repository connector processing this upload has to use
31   * {@link #setException(MetadataTransferException)} to report the results of the transfer.
32   */
33  public final class MetadataUpload
34      extends MetadataTransfer
35  {
36  
37      /**
38       * Creates a new uninitialized upload.
39       */
40      public MetadataUpload()
41      {
42          // enables default constructor
43      }
44  
45      /**
46       * Creates a new upload with the specified properties.
47       * 
48       * @param metadata The metadata to upload, may be {@code null}.
49       * @param file The local file to upload the metadata from, may be {@code null}.
50       */
51      public MetadataUpload( Metadata metadata, File file )
52      {
53          setMetadata( metadata );
54          setFile( file );
55      }
56  
57      @Override
58      public MetadataUpload setMetadata( Metadata metadata )
59      {
60          super.setMetadata( metadata );
61          return this;
62      }
63  
64      @Override
65      public MetadataUpload setFile( File file )
66      {
67          super.setFile( file );
68          return this;
69      }
70  
71      @Override
72      public MetadataUpload setException( MetadataTransferException exception )
73      {
74          super.setException( exception );
75          return this;
76      }
77  
78      @Override
79      public MetadataUpload setListener( TransferListener listener )
80      {
81          super.setListener( listener );
82          return this;
83      }
84  
85      @Override
86      public MetadataUpload setTrace( RequestTrace trace )
87      {
88          super.setTrace( trace );
89          return this;
90      }
91  
92      @Override
93      public String toString()
94      {
95          return getMetadata() + " - " + getFile();
96      }
97  
98  }