org.fusesource.fabric.maven.impl
Class MavenProxyServletSupport

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.fusesource.fabric.maven.impl.MavenProxyServletSupport
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig, MavenProxy
Direct Known Subclasses:
MavenDownloadProxyServlet

public class MavenProxyServletSupport
extends javax.servlet.http.HttpServlet
implements MavenProxy

See Also:
Serialized Form

Nested Class Summary
static class MavenProxyServletSupport.LogAdapter
           
static class MavenProxyServletSupport.ManualWagonProvider
           
 
Field Summary
static java.util.regex.Pattern ARTIFACT_METADATA_URL_REGEX
           
static java.util.regex.Pattern ARTIFACT_REQUEST_URL_REGEX
           
protected  java.lang.String checksumPolicy
           
protected  java.lang.String localRepository
           
protected static java.util.logging.Logger LOGGER
           
protected  java.lang.String remoteRepositories
           
protected  java.util.Map<java.lang.String,org.sonatype.aether.repository.RemoteRepository> repositories
           
static java.util.regex.Pattern REPOSITORY_ID_REGEX
           
protected  org.sonatype.aether.RepositorySystemSession session
           
protected  org.sonatype.aether.RepositorySystem system
           
protected  java.io.File tmpFolder
           
protected  java.lang.String updatePolicy
           
 
Fields inherited from interface org.fusesource.fabric.maven.MavenProxy
DOWNLOAD_TYPE, UPLOAD_TYPE
 
Constructor Summary
MavenProxyServletSupport()
           
 
Method Summary
protected  java.lang.String cleanUpRepositorySpec(java.lang.String spec)
          Removes all options from the repository spec.
protected  org.sonatype.aether.artifact.Artifact convertPathToArtifact(java.lang.String path)
          Converts the path of the request to an Artifact.
protected  org.sonatype.aether.metadata.Metadata convertPathToMetadata(java.lang.String path)
          Converts the path of the request to Metadata.
protected  java.lang.String convertToMavenUrl(java.lang.String path)
          Converts the path of the request to maven coords.
 java.io.File download(java.lang.String path)
          Downloads a File from the MavenProxy.
 java.lang.String getChecksumPolicy()
           
 java.lang.String getProxyHost()
           
 java.lang.String getProxyNonProxyHosts()
           
 java.lang.String getProxyPassword()
           
 int getProxyPort()
           
 java.lang.String getProxyProtocol()
           
 java.lang.String getProxyUsername()
           
 java.lang.String getRemoteRepositories()
           
 java.lang.String getUpdatePolicy()
           
 boolean isAppendSystemRepos()
           
protected  org.sonatype.aether.RepositorySystem newRepositorySystem()
           
protected  org.sonatype.aether.RepositorySystemSession newSession(org.sonatype.aether.RepositorySystem system, java.lang.String localRepository)
           
protected  java.io.File readFile(java.io.InputStream is, java.io.File tempLocation, java.lang.String name)
          Reads a File from the InputStream then saves it under a temp location and returns the file.
 void setAppendSystemRepos(boolean appendSystemRepos)
           
 void setChecksumPolicy(java.lang.String checksumPolicy)
           
 void setLocalRepository(java.lang.String localRepository)
           
 void setProxyHost(java.lang.String proxyHost)
           
 void setProxyNonProxyHosts(java.lang.String proxyNonProxyHosts)
           
 void setProxyPassword(java.lang.String proxyPassword)
           
 void setProxyPort(int proxyPort)
           
 void setProxyProtocol(java.lang.String proxyProtocol)
           
 void setProxyUsername(java.lang.String proxyUsername)
           
 void setRemoteRepositories(java.lang.String remoteRepositories)
           
 void setUpdatePolicy(java.lang.String updatePolicy)
           
 void start()
           
 void stop()
           
 boolean upload(java.io.InputStream is, java.lang.String path)
          Upload a File to the MavenProxy.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final java.util.logging.Logger LOGGER

ARTIFACT_REQUEST_URL_REGEX

public static final java.util.regex.Pattern ARTIFACT_REQUEST_URL_REGEX

ARTIFACT_METADATA_URL_REGEX

public static final java.util.regex.Pattern ARTIFACT_METADATA_URL_REGEX

REPOSITORY_ID_REGEX

public static final java.util.regex.Pattern REPOSITORY_ID_REGEX

localRepository

protected java.lang.String localRepository

remoteRepositories

protected java.lang.String remoteRepositories

updatePolicy

protected java.lang.String updatePolicy

checksumPolicy

protected java.lang.String checksumPolicy

repositories

protected java.util.Map<java.lang.String,org.sonatype.aether.repository.RemoteRepository> repositories

system

protected org.sonatype.aether.RepositorySystem system

session

protected org.sonatype.aether.RepositorySystemSession session

tmpFolder

protected java.io.File tmpFolder
Constructor Detail

MavenProxyServletSupport

public MavenProxyServletSupport()
Method Detail

start

public void start()
           throws java.io.IOException
Specified by:
start in interface MavenProxy
Throws:
java.io.IOException

stop

public void stop()
Specified by:
stop in interface MavenProxy

download

public java.io.File download(java.lang.String path)
                      throws InvalidMavenArtifactRequest
Description copied from interface: MavenProxy
Downloads a File from the MavenProxy.

Specified by:
download in interface MavenProxy
Parameters:
path - The path from which to download the File.
Returns:
Throws:
InvalidMavenArtifactRequest

upload

public boolean upload(java.io.InputStream is,
                      java.lang.String path)
               throws InvalidMavenArtifactRequest
Description copied from interface: MavenProxy
Upload a File to the MavenProxy.

Specified by:
upload in interface MavenProxy
Parameters:
is - The InputStream to upload.
path - The upload path.
Returns:
true/false based on the outcome of the upload.
Throws:
InvalidMavenArtifactRequest

newSession

protected org.sonatype.aether.RepositorySystemSession newSession(org.sonatype.aether.RepositorySystem system,
                                                                 java.lang.String localRepository)

newRepositorySystem

protected org.sonatype.aether.RepositorySystem newRepositorySystem()

convertToMavenUrl

protected java.lang.String convertToMavenUrl(java.lang.String path)
                                      throws InvalidMavenArtifactRequest
Converts the path of the request to maven coords. The format is the same as the one used in DefaultArtifact.

Parameters:
path - The request path, following the format: <groupId>/<artifactId>/<version>/<artifactId>-<version>-[<classifier>].extension
Returns:
A String in the following format: <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
Throws:
InvalidMavenArtifactRequest

convertPathToArtifact

protected org.sonatype.aether.artifact.Artifact convertPathToArtifact(java.lang.String path)
                                                               throws InvalidMavenArtifactRequest
Converts the path of the request to an Artifact.

Parameters:
path - The request path, following the format: <groupId>/<artifactId>/<version>/<artifactId>-<version>-[<classifier>].extension
Returns:
A DefaultArtifact that matches the request path.
Throws:
InvalidMavenArtifactRequest

convertPathToMetadata

protected org.sonatype.aether.metadata.Metadata convertPathToMetadata(java.lang.String path)
                                                               throws InvalidMavenArtifactRequest
Converts the path of the request to Metadata.

Parameters:
path - The request path, following the format: <groupId>/<artifactId>/<version>/<artifactId>-<version>-[<classifier>].extension
Returns:
Throws:
InvalidMavenArtifactRequest

readFile

protected java.io.File readFile(java.io.InputStream is,
                                java.io.File tempLocation,
                                java.lang.String name)
                         throws java.io.FileNotFoundException
Reads a File from the InputStream then saves it under a temp location and returns the file.

Parameters:
is - The source input stream.
tempLocation - The temporary location to save the content of the stream.
name - The name of the file.
Returns:
Throws:
java.io.FileNotFoundException

cleanUpRepositorySpec

protected java.lang.String cleanUpRepositorySpec(java.lang.String spec)
Removes all options from the repository spec.

Parameters:
spec -
Returns:

setLocalRepository

public void setLocalRepository(java.lang.String localRepository)

getRemoteRepositories

public java.lang.String getRemoteRepositories()

setRemoteRepositories

public void setRemoteRepositories(java.lang.String remoteRepositories)

getUpdatePolicy

public java.lang.String getUpdatePolicy()

setUpdatePolicy

public void setUpdatePolicy(java.lang.String updatePolicy)

getChecksumPolicy

public java.lang.String getChecksumPolicy()

setChecksumPolicy

public void setChecksumPolicy(java.lang.String checksumPolicy)

getProxyProtocol

public java.lang.String getProxyProtocol()

setProxyProtocol

public void setProxyProtocol(java.lang.String proxyProtocol)

getProxyHost

public java.lang.String getProxyHost()

setProxyHost

public void setProxyHost(java.lang.String proxyHost)

getProxyPort

public int getProxyPort()

setProxyPort

public void setProxyPort(int proxyPort)

getProxyUsername

public java.lang.String getProxyUsername()

setProxyUsername

public void setProxyUsername(java.lang.String proxyUsername)

getProxyPassword

public java.lang.String getProxyPassword()

setProxyPassword

public void setProxyPassword(java.lang.String proxyPassword)

getProxyNonProxyHosts

public java.lang.String getProxyNonProxyHosts()

setProxyNonProxyHosts

public void setProxyNonProxyHosts(java.lang.String proxyNonProxyHosts)

isAppendSystemRepos

public boolean isAppendSystemRepos()

setAppendSystemRepos

public void setAppendSystemRepos(boolean appendSystemRepos)


Copyright © 2013 Red Hat. All Rights Reserved.