org.sonatype.aether.repository
Class RemoteRepository

java.lang.Object
  extended by org.sonatype.aether.repository.RemoteRepository
All Implemented Interfaces:
ArtifactRepository

public class RemoteRepository
extends Object
implements ArtifactRepository

A repository on a remote server.

Author:
Benjamin Bentmann

Constructor Summary
RemoteRepository()
          Creates a new repository using the default release/snapshot policies.
RemoteRepository(RemoteRepository repository)
          Creates a shallow copy of the specified repository.
RemoteRepository(String id, String type, String url)
          Creates a new repository with the specified properties and the default policies.
 
Method Summary
 boolean equals(Object obj)
           
 Authentication getAuthentication()
          Gets the authentication that has been selected for this repository.
 String getContentType()
          Gets the type of the repository, for example "default".
 String getHost()
          Gets the host part from the repository's URL.
 String getId()
          Gets the identifier of this repository.
 List<RemoteRepository> getMirroredRepositories()
          Gets the repositories that this repository serves as a mirror for.
 RepositoryPolicy getPolicy(boolean snapshot)
          Gets the policy to apply for snapshot/release artifacts.
 String getProtocol()
          Gets the protocol part from the repository's URL, for example file or http.
 Proxy getProxy()
          Gets the proxy that has been selected for this repository.
 String getUrl()
          Gets the (base) URL of this repository.
 int hashCode()
           
 boolean isRepositoryManager()
          Indicates whether this repository refers to a repository manager or not.
 RemoteRepository setAuthentication(Authentication authentication)
          Sets the authentication to use in order to access this repository.
 RemoteRepository setContentType(String type)
          Sets the type of this repository, e.g.
 RemoteRepository setId(String id)
          Sets the identifier of this repository.
 RemoteRepository setMirroredRepositories(List<RemoteRepository> mirroredRepositories)
          Sets the repositories being mirrored by this repository.
 RemoteRepository setPolicy(boolean snapshot, RepositoryPolicy policy)
          Sets the policy to apply for snapshot/release artifacts.
 RemoteRepository setProxy(Proxy proxy)
          Sets the proxy to use in order to access this repository.
 RemoteRepository setRepositoryManager(boolean repositoryManager)
          Marks this repository as a repository manager or not.
 RemoteRepository setUrl(String url)
          Sets the (base) URL of this repository.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteRepository

public RemoteRepository()
Creates a new repository using the default release/snapshot policies.


RemoteRepository

public RemoteRepository(RemoteRepository repository)
Creates a shallow copy of the specified repository.

Parameters:
repository - The repository to copy, must not be null.

RemoteRepository

public RemoteRepository(String id,
                        String type,
                        String url)
Creates a new repository with the specified properties and the default policies.

Parameters:
id - The identifier of the repository, may be null.
type - The type of the repository, may be null.
url - The (base) URL of the repository, may be null.
Method Detail

getId

public String getId()
Description copied from interface: ArtifactRepository
Gets the identifier of this repository.

Specified by:
getId in interface ArtifactRepository
Returns:
The (case-sensitive) identifier, never null.

setId

public RemoteRepository setId(String id)
Sets the identifier of this repository.

Parameters:
id - The identifier of this repository, may be null.
Returns:
This repository for chaining, never null.

getContentType

public String getContentType()
Description copied from interface: ArtifactRepository
Gets the type of the repository, for example "default".

Specified by:
getContentType in interface ArtifactRepository
Returns:
The (case-sensitive) type of the repository, never null.

setContentType

public RemoteRepository setContentType(String type)
Sets the type of this repository, e.g. "default".

Parameters:
type - The type of this repository, may be null.
Returns:
This repository for chaining, never null.

getUrl

public String getUrl()
Gets the (base) URL of this repository.

Returns:
The (base) URL of this repository, never null.

setUrl

public RemoteRepository setUrl(String url)
Sets the (base) URL of this repository.

Parameters:
url - The URL of this repository, may be null.
Returns:
This repository for chaining, never null.

getProtocol

public String getProtocol()
Gets the protocol part from the repository's URL, for example file or http. As suggested by RFC 2396, section 3.1 "Scheme Component", the protocol name should be treated case-insensitively.

Returns:
The protocol or an empty string if none, never null.

getHost

public String getHost()
Gets the host part from the repository's URL.

Returns:
The host or an empty string if none, never null.

getPolicy

public RepositoryPolicy getPolicy(boolean snapshot)
Gets the policy to apply for snapshot/release artifacts.

Parameters:
snapshot - true to retrieve the snapshot policy, false to retrieve the release policy.
Returns:
The requested repository policy, never null.

setPolicy

public RemoteRepository setPolicy(boolean snapshot,
                                  RepositoryPolicy policy)
Sets the policy to apply for snapshot/release artifacts.

Parameters:
snapshot - true to set the snapshot policy, false to set the release policy.
policy - The repository policy to set, may be null to use a default policy.
Returns:
This repository for chaining, never null.

getProxy

public Proxy getProxy()
Gets the proxy that has been selected for this repository.

Returns:
The selected proxy or null if none.

setProxy

public RemoteRepository setProxy(Proxy proxy)
Sets the proxy to use in order to access this repository.

Parameters:
proxy - The proxy to use, may be null.
Returns:
This repository for chaining, never null.

getAuthentication

public Authentication getAuthentication()
Gets the authentication that has been selected for this repository.

Returns:
The selected authentication or null if none.

setAuthentication

public RemoteRepository setAuthentication(Authentication authentication)
Sets the authentication to use in order to access this repository.

Parameters:
authentication - The authentication to use, may be null.
Returns:
This repository for chaining, never null.

getMirroredRepositories

public List<RemoteRepository> getMirroredRepositories()
Gets the repositories that this repository serves as a mirror for.

Returns:
The repositories being mirrored by this repository, never null.

setMirroredRepositories

public RemoteRepository setMirroredRepositories(List<RemoteRepository> mirroredRepositories)
Sets the repositories being mirrored by this repository.

Parameters:
mirroredRepositories - The repositories being mirrored by this repository, may be null.
Returns:
This repository for chaining, never null.

isRepositoryManager

public boolean isRepositoryManager()
Indicates whether this repository refers to a repository manager or not.

Returns:
true if this repository is a repository manager, false otherwise.

setRepositoryManager

public RemoteRepository setRepositoryManager(boolean repositoryManager)
Marks this repository as a repository manager or not.

Parameters:
repositoryManager - true if this repository points at a repository manager, false if the repository is just serving static contents.
Returns:
This repository for chaining, never null.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2010-2012. All Rights Reserved.