mirror of https://github.com/apache/archiva.git
[MRM-463] Metadata merging doesn't work.
Updating guessing of intent on incoming request differently, to handle new metadata processing requirements. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@574122 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
047ec47c8b
commit
273ba79f76
|
@ -32,6 +32,8 @@ import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
|
||||||
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
|
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
|
||||||
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
|
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
|
||||||
import org.apache.maven.archiva.repository.layout.LayoutException;
|
import org.apache.maven.archiva.repository.layout.LayoutException;
|
||||||
|
import org.apache.maven.archiva.repository.metadata.MetadataTools;
|
||||||
|
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
|
||||||
import org.codehaus.plexus.webdav.AbstractDavServerComponent;
|
import org.codehaus.plexus.webdav.AbstractDavServerComponent;
|
||||||
import org.codehaus.plexus.webdav.DavServerComponent;
|
import org.codehaus.plexus.webdav.DavServerComponent;
|
||||||
import org.codehaus.plexus.webdav.DavServerException;
|
import org.codehaus.plexus.webdav.DavServerException;
|
||||||
|
@ -71,6 +73,11 @@ public class ProxiedDavServer
|
||||||
*/
|
*/
|
||||||
private RepositoryProxyConnectors connectors;
|
private RepositoryProxyConnectors connectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @plexus.requirement
|
||||||
|
*/
|
||||||
|
private MetadataTools metadataTools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @plexus.requirement
|
* @plexus.requirement
|
||||||
*/
|
*/
|
||||||
|
@ -160,10 +167,53 @@ public class ProxiedDavServer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
// Is it a Metadata resource?
|
||||||
|
if ( resource.endsWith( "/" + MetadataTools.MAVEN_METADATA ) )
|
||||||
{
|
{
|
||||||
ProjectReference project;
|
ProjectReference project;
|
||||||
VersionedReference versioned;
|
VersionedReference versioned;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
versioned = metadataTools.toVersionedReference( resource );
|
||||||
|
if ( versioned != null )
|
||||||
|
{
|
||||||
|
connectors.fetchFromProxies( managedRepository, versioned );
|
||||||
|
request.getRequest().setPathInfo( metadataTools.toPath( versioned ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( RepositoryMetadataException e )
|
||||||
|
{
|
||||||
|
/* eat it */
|
||||||
|
}
|
||||||
|
catch ( ProxyException e )
|
||||||
|
{
|
||||||
|
throw new ServletException( "Unable to fetch versioned metadata resource.", e );
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
project = metadataTools.toProjectReference( resource );
|
||||||
|
if ( project != null )
|
||||||
|
{
|
||||||
|
connectors.fetchFromProxies( managedRepository, project );
|
||||||
|
request.getRequest().setPathInfo( metadataTools.toPath( project ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( RepositoryMetadataException e )
|
||||||
|
{
|
||||||
|
/* eat it */
|
||||||
|
}
|
||||||
|
catch ( ProxyException e )
|
||||||
|
{
|
||||||
|
throw new ServletException( "Unable to fetch project metadata resource.", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not any of the above? Then it's gotta be an artifact reference.
|
||||||
ArtifactReference artifact;
|
ArtifactReference artifact;
|
||||||
BidirectionalRepositoryLayout resourceLayout;
|
BidirectionalRepositoryLayout resourceLayout;
|
||||||
|
|
||||||
|
@ -191,40 +241,9 @@ public class ProxiedDavServer
|
||||||
{
|
{
|
||||||
/* eat it */
|
/* eat it */
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
versioned = resourceLayout.toVersionedReference( resource );
|
|
||||||
if ( versioned != null )
|
|
||||||
{
|
|
||||||
connectors.fetchFromProxies( managedRepository, versioned );
|
|
||||||
request.getRequest().setPathInfo( layout.toPath( versioned ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch ( LayoutException e )
|
|
||||||
{
|
|
||||||
/* eat it */
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
project = resourceLayout.toProjectReference( resource );
|
|
||||||
if ( project != null )
|
|
||||||
{
|
|
||||||
connectors.fetchFromProxies( managedRepository, project );
|
|
||||||
request.getRequest().setPathInfo( layout.toPath( project ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch ( LayoutException e )
|
|
||||||
{
|
|
||||||
/* eat it */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch ( ProxyException e )
|
catch ( ProxyException e )
|
||||||
{
|
{
|
||||||
throw new ServletException( "Unable to fetch resource.", e );
|
throw new ServletException( "Unable to fetch artifact resource.", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue