Class WagonTransporter
- java.lang.Object
-
- org.eclipse.aether.transport.wagon.WagonTransporter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,Transporter
final class WagonTransporter extends java.lang.Object implements Transporter
A transporter using Maven Wagon.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classWagonTransporter.GetTaskRunnerprivate static classWagonTransporter.PeekTaskRunnerprivate classWagonTransporter.PutTaskRunnerprivate static interfaceWagonTransporter.TaskRunner
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBooleanclosedprivate static java.lang.StringCONFIG_PROP_CONFIGprivate static java.lang.StringCONFIG_PROP_DIR_MODEprivate static java.lang.StringCONFIG_PROP_FILE_MODEprivate static java.lang.StringCONFIG_PROP_GROUPprivate java.util.Propertiesheadersprivate static org.slf4j.LoggerLOGGERprivate AuthenticationContextproxyAuthContextprivate AuthenticationContextrepoAuthContextprivate RemoteRepositoryrepositoryprivate RepositorySystemSessionsessionprivate org.apache.maven.wagon.authentication.AuthenticationInfowagonAuthprivate WagonConfiguratorwagonConfiguratorprivate java.lang.StringwagonHintprivate WagonProviderwagonProviderprivate org.apache.maven.wagon.proxy.ProxyInfoProviderwagonProxyprivate org.apache.maven.wagon.repository.RepositorywagonRepoprivate java.util.Queue<org.apache.maven.wagon.Wagon>wagons-
Fields inherited from interface org.eclipse.aether.spi.connector.transport.Transporter
ERROR_NOT_FOUND, ERROR_OTHER
-
-
Constructor Summary
Constructors Constructor Description WagonTransporter(WagonProvider wagonProvider, WagonConfigurator wagonConfigurator, RemoteRepository repository, RepositorySystemSession session)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intclassify(java.lang.Throwable error)Classifies the type of exception that has been thrown from a previous request to the transporter.voidclose()Closes this transporter and frees any network resources associated with it.private voidconnectWagon(org.apache.maven.wagon.Wagon wagon)private static voidcopy(java.io.OutputStream os, java.io.InputStream is)private voiddelTempFile(java.io.File path)private voiddisconnectWagon(org.apache.maven.wagon.Wagon wagon)private voidexecute(TransportTask task, WagonTransporter.TaskRunner runner)voidget(GetTask task)Downloads a resource from the repository.private org.apache.maven.wagon.authentication.AuthenticationInfogetAuthenticationInfo(RemoteRepository repository, AuthenticationContext authContext)private static org.apache.maven.wagon.repository.RepositoryPermissionsgetPermissions(java.lang.String repoId, RepositorySystemSession session)private org.apache.maven.wagon.proxy.ProxyInfoProvidergetProxy(RemoteRepository repository, AuthenticationContext authContext)private org.apache.maven.wagon.WagonlookupWagon()private static java.io.FilenewTempFile()voidpeek(PeekTask task)Checks the existence of a resource in the repository.private org.apache.maven.wagon.WagonpollWagon()voidput(PutTask task)Uploads a resource to the repository.private voidreleaseWagon(org.apache.maven.wagon.Wagon wagon)
-
-
-
Field Detail
-
CONFIG_PROP_CONFIG
private static final java.lang.String CONFIG_PROP_CONFIG
- See Also:
- Constant Field Values
-
CONFIG_PROP_FILE_MODE
private static final java.lang.String CONFIG_PROP_FILE_MODE
- See Also:
- Constant Field Values
-
CONFIG_PROP_DIR_MODE
private static final java.lang.String CONFIG_PROP_DIR_MODE
- See Also:
- Constant Field Values
-
CONFIG_PROP_GROUP
private static final java.lang.String CONFIG_PROP_GROUP
- See Also:
- Constant Field Values
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
repository
private final RemoteRepository repository
-
session
private final RepositorySystemSession session
-
repoAuthContext
private final AuthenticationContext repoAuthContext
-
proxyAuthContext
private final AuthenticationContext proxyAuthContext
-
wagonProvider
private final WagonProvider wagonProvider
-
wagonConfigurator
private final WagonConfigurator wagonConfigurator
-
wagonHint
private final java.lang.String wagonHint
-
wagonRepo
private final org.apache.maven.wagon.repository.Repository wagonRepo
-
wagonAuth
private final org.apache.maven.wagon.authentication.AuthenticationInfo wagonAuth
-
wagonProxy
private final org.apache.maven.wagon.proxy.ProxyInfoProvider wagonProxy
-
headers
private final java.util.Properties headers
-
wagons
private final java.util.Queue<org.apache.maven.wagon.Wagon> wagons
-
closed
private final java.util.concurrent.atomic.AtomicBoolean closed
-
-
Constructor Detail
-
WagonTransporter
WagonTransporter(WagonProvider wagonProvider, WagonConfigurator wagonConfigurator, RemoteRepository repository, RepositorySystemSession session) throws NoTransporterException
- Throws:
NoTransporterException
-
-
Method Detail
-
getPermissions
private static org.apache.maven.wagon.repository.RepositoryPermissions getPermissions(java.lang.String repoId, RepositorySystemSession session)
-
getAuthenticationInfo
private org.apache.maven.wagon.authentication.AuthenticationInfo getAuthenticationInfo(RemoteRepository repository, AuthenticationContext authContext)
-
getProxy
private org.apache.maven.wagon.proxy.ProxyInfoProvider getProxy(RemoteRepository repository, AuthenticationContext authContext)
-
lookupWagon
private org.apache.maven.wagon.Wagon lookupWagon() throws java.lang.Exception- Throws:
java.lang.Exception
-
releaseWagon
private void releaseWagon(org.apache.maven.wagon.Wagon wagon)
-
connectWagon
private void connectWagon(org.apache.maven.wagon.Wagon wagon) throws org.apache.maven.wagon.WagonException- Throws:
org.apache.maven.wagon.WagonException
-
disconnectWagon
private void disconnectWagon(org.apache.maven.wagon.Wagon wagon)
-
pollWagon
private org.apache.maven.wagon.Wagon pollWagon() throws java.lang.Exception- Throws:
java.lang.Exception
-
classify
public int classify(java.lang.Throwable error)
Description copied from interface:TransporterClassifies the type of exception that has been thrown from a previous request to the transporter. The exception types employed by a transporter are generally unknown to its caller. Where a caller needs to distinguish between certain error cases, it employs this method to detect which error case corresponds to the exception.- Specified by:
classifyin interfaceTransporter- Parameters:
error- The exception to classify, must not benull.- Returns:
- The classification of the error, either
Transporter.ERROR_NOT_FOUNDorTransporter.ERROR_OTHER.
-
peek
public void peek(PeekTask task) throws java.lang.Exception
Description copied from interface:TransporterChecks the existence of a resource in the repository. If the remote repository can be contacted successfully but indicates the resource specified in the request does not exist, an exception is thrown such that invokingTransporter.classify(Throwable)with that exception yieldsTransporter.ERROR_NOT_FOUND.- Specified by:
peekin interfaceTransporter- Parameters:
task- The existence check to perform, must not benull.- Throws:
java.lang.Exception- If the existence of the specified resource could not be confirmed.
-
get
public void get(GetTask task) throws java.lang.Exception
Description copied from interface:TransporterDownloads a resource from the repository. If the resource is downloaded to a file as given byGetTask.getDataFile()and the operation fails midway, the transporter should not delete the partial file but leave its management to the caller.- Specified by:
getin interfaceTransporter- Parameters:
task- The download to perform, must not benull.- Throws:
java.lang.Exception- If the transfer failed.
-
put
public void put(PutTask task) throws java.lang.Exception
Description copied from interface:TransporterUploads a resource to the repository.- Specified by:
putin interfaceTransporter- Parameters:
task- The upload to perform, must not benull.- Throws:
java.lang.Exception- If the transfer failed.
-
execute
private void execute(TransportTask task, WagonTransporter.TaskRunner runner) throws java.lang.Exception
- Throws:
java.lang.Exception
-
newTempFile
private static java.io.File newTempFile() throws java.io.IOException- Throws:
java.io.IOException
-
delTempFile
private void delTempFile(java.io.File path)
-
copy
private static void copy(java.io.OutputStream os, java.io.InputStream is) throws java.io.IOException- Throws:
java.io.IOException
-
close
public void close()
Description copied from interface:TransporterCloses this transporter and frees any network resources associated with it. Once closed, a transporter must not be used for further transfers, any attempt to do so would yield aIllegalStateExceptionor similar. Closing an already closed transporter is harmless and has no effect.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceTransporter
-
-