mirror of https://github.com/apache/archiva.git
[MRM-1167]
o fix xmlrpc search service git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@778106 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa24587f89
commit
302186acd1
|
@ -63,10 +63,10 @@
|
||||||
<mainClass>org.apache.archiva.web.xmlrpc.client.SampleClient</mainClass>
|
<mainClass>org.apache.archiva.web.xmlrpc.client.SampleClient</mainClass>
|
||||||
<arguments>
|
<arguments>
|
||||||
<!--
|
<!--
|
||||||
URL: ex. http://127.0.0.1:9091/xmlrpc
|
URL: ex. http://127.0.0.1:8080/archiva/xmlrpc
|
||||||
USERNAME & PASSWORD: Archiva credentials
|
USERNAME & PASSWORD: Archiva credentials
|
||||||
-->
|
-->
|
||||||
<argument>http://127.0.0.1:9091/xmlrpc</argument>
|
<argument>http://127.0.0.1:8080/archiva/xmlrpc</argument>
|
||||||
<argument>admin</argument>
|
<argument>admin</argument>
|
||||||
<argument>${password}</argument>
|
<argument>${password}</argument>
|
||||||
</arguments>
|
</arguments>
|
||||||
|
|
|
@ -40,6 +40,8 @@ import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
|
||||||
import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint;
|
import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint;
|
||||||
import org.apache.maven.archiva.model.ArchivaArtifact;
|
import org.apache.maven.archiva.model.ArchivaArtifact;
|
||||||
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SearchServiceImpl
|
* SearchServiceImpl
|
||||||
|
@ -49,6 +51,8 @@ import org.apache.maven.archiva.model.ArchivaProjectModel;
|
||||||
public class SearchServiceImpl
|
public class SearchServiceImpl
|
||||||
implements SearchService
|
implements SearchService
|
||||||
{
|
{
|
||||||
|
private Logger log = LoggerFactory.getLogger( SearchServiceImpl.class );
|
||||||
|
|
||||||
private RepositorySearch search;
|
private RepositorySearch search;
|
||||||
|
|
||||||
private XmlRpcUserRepositories xmlRpcUserRepositories;
|
private XmlRpcUserRepositories xmlRpcUserRepositories;
|
||||||
|
@ -89,35 +93,43 @@ public class SearchServiceImpl
|
||||||
SearchResults results = null;
|
SearchResults results = null;
|
||||||
|
|
||||||
results = search.search( "", observableRepos, queryString, limits, null );
|
results = search.search( "", observableRepos, queryString, limits, null );
|
||||||
|
|
||||||
List<SearchResultHit> hits = results.getHits();
|
List<SearchResultHit> hits = results.getHits();
|
||||||
|
|
||||||
for( SearchResultHit hit : hits )
|
for( SearchResultHit hit : hits )
|
||||||
{
|
{
|
||||||
ArtifactDAO artifactDAO = archivaDAO.getArtifactDAO();
|
ArtifactDAO artifactDAO = archivaDAO.getArtifactDAO();
|
||||||
try
|
|
||||||
|
List<String> versions = hit.getVersions();
|
||||||
|
if( versions != null )
|
||||||
{
|
{
|
||||||
ArchivaArtifact pomArtifact = artifactDAO.getArtifact(
|
for( String version : versions )
|
||||||
hit.getGroupId(), hit.getArtifactId(), hit.getVersion(), "", "pom", hit.getRepositoryId() );
|
{
|
||||||
|
for( String repo : observableRepos )
|
||||||
if( pomArtifact != null )
|
{
|
||||||
{
|
try
|
||||||
Artifact artifact = new Artifact( pomArtifact.getModel().getRepositoryId(), pomArtifact.getGroupId(), pomArtifact.getArtifactId(), pomArtifact.getVersion(),
|
{
|
||||||
pomArtifact.getType() );
|
ArchivaArtifact pomArtifact = artifactDAO.getArtifact(
|
||||||
//pomArtifact.getType(), pomArtifact.getModel().getWhenGathered() );
|
hit.getGroupId(), hit.getArtifactId(), version, null, "pom", repo );
|
||||||
artifacts.add( artifact );
|
if( pomArtifact != null )
|
||||||
|
{
|
||||||
|
Artifact artifact = new Artifact( pomArtifact.getModel().getRepositoryId(), pomArtifact.getGroupId(), pomArtifact.getArtifactId(), pomArtifact.getVersion(),
|
||||||
|
pomArtifact.getType() );
|
||||||
|
//pomArtifact.getType(), pomArtifact.getModel().getWhenGathered() );
|
||||||
|
artifacts.add( artifact );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( ObjectNotFoundException e )
|
||||||
|
{
|
||||||
|
log.debug( "Unable to find pom artifact : " + e.getMessage() );
|
||||||
|
}
|
||||||
|
catch( ArchivaDatabaseException e )
|
||||||
|
{
|
||||||
|
log.debug( "Error occurred while getting pom artifact from database : " + e.getMessage() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch ( ObjectNotFoundException e )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
catch ( ArchivaDatabaseException e )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue