Procházet zdrojové kódy

general clean up, addition of copyrights

git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@412295 13f79535-47bb-0310-9956-ffa450edef68
tags/archiva-0.9-alpha-1
Brett Porter před 18 roky
rodič
revize
8aad68cfe4
68 změnil soubory, kde provedl 737 přidání a 515 odebrání
  1. 6
    2
      maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java
  2. 16
    0
      maven-repository-artifact-applet/pom.xml
  3. 51
    32
      maven-repository-artifact-applet/src/main/java/org/apache/maven/repository/applet/ChecksumApplet.java
  4. 13
    1
      maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java
  5. 2
    2
      maven-repository-converter/src/main/java/org/apache/maven/repository/converter/transaction/TransactionEvent.java
  6. 1
    0
      maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties
  7. 4
    4
      maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java
  8. 0
    1
      maven-repository-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom
  9. 0
    1
      maven-repository-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom
  10. 0
    1
      maven-repository-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom
  11. 18
    6
      maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractArtifactDiscoverer.java
  12. 17
    1
      maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java
  13. 1
    1
      maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java
  14. 25
    28
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java
  15. 2
    16
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java
  16. 13
    10
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java
  17. 1
    2
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java
  18. 0
    2
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java
  19. 4
    6
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java
  20. 6
    4
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java
  21. 28
    29
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java
  22. 3
    3
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchHit.java
  23. 3
    4
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayer.java
  24. 1
    2
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java
  25. 4
    5
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/Query.java
  26. 7
    8
      maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/SinglePhraseQuery.java
  27. 3
    3
      maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java
  28. 19
    17
      maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java
  29. 8
    12
      maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java
  30. 8
    9
      maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java
  31. 7
    23
      maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java
  32. 3
    4
      maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/query/QueryTest.java
  33. 18
    1
      maven-repository-manager-site/pom.xml
  34. 18
    2
      maven-repository-manager-site/src/site/site.xml
  35. 3
    1
      maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java
  36. 1
    1
      maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java
  37. 49
    49
      maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoader.java
  38. 1
    1
      maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java
  39. 2
    2
      maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ValidationException.java
  40. 5
    5
      maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java
  41. 12
    12
      maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java
  42. 2
    2
      maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java
  43. 27
    43
      maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoaderTest.java
  44. 9
    5
      maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java
  45. 1
    3
      maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java
  46. 5
    0
      maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java
  47. 11
    11
      maven-repository-utils/src/main/java/org/apache/maven/repository/digest/DefaultDigester.java
  48. 16
    0
      maven-repository-utils/src/test/java/org/apache/maven/repository/ArtifactUtilsLegacyTest.java
  49. 16
    0
      maven-repository-webapp/pom.xml
  50. 2
    1
      maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
  51. 16
    0
      maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java
  52. 2
    3
      maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java
  53. 29
    14
      maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java
  54. 20
    59
      maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java
  55. 8
    7
      maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java
  56. 3
    19
      maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java
  57. 7
    18
      maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java
  58. 16
    0
      maven-repository-webapp/src/main/webapp/WEB-INF/decorators.xml
  59. 36
    16
      maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp
  60. 16
    0
      maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp
  61. 0
    1
      maven-repository-webapp/src/main/webapp/WEB-INF/jsp/form.jspf
  62. 16
    0
      maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp
  63. 16
    0
      maven-repository-webapp/src/main/webapp/WEB-INF/web.xml
  64. 16
    0
      maven-repository-webapp/src/main/webapp/css/maven-base.css
  65. 16
    0
      maven-repository-webapp/src/main/webapp/css/maven-theme.css
  66. 16
    0
      maven-repository-webapp/src/main/webapp/css/print.css
  67. 16
    0
      maven-repository-webapp/src/main/webapp/css/site.css
  68. 16
    0
      maven-repository-webapp/src/main/webapp/index.jsp

+ 6
- 2
maven-repository-application/src/main/java/org/apache/maven/repository/manager/cli/IndexSearcherCli.java Zobrazit soubor

import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.repository.indexing.ArtifactRepositoryIndex; import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
import org.apache.maven.repository.indexing.DefaultRepositoryIndexSearcher;
import org.apache.maven.repository.indexing.RepositoryIndexException; import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.repository.indexing.RepositoryIndexSearchException; import org.apache.maven.repository.indexing.RepositoryIndexSearchException;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory; import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.indexing.DefaultRepositoryIndexSearcher;
import org.apache.maven.repository.indexing.query.SinglePhraseQuery; import org.apache.maven.repository.indexing.query.SinglePhraseQuery;
import org.codehaus.classworlds.ClassWorld; import org.codehaus.classworlds.ClassWorld;
import org.codehaus.plexus.PlexusContainerException; import org.codehaus.plexus.PlexusContainerException;
*/ */
public class IndexSearcherCli public class IndexSearcherCli
{ {
private IndexSearcherCli()
{
}

public static void main( String[] args ) public static void main( String[] args )
throws PlexusContainerException, ComponentLookupException, RepositoryIndexException, MalformedURLException, throws PlexusContainerException, ComponentLookupException, RepositoryIndexException, MalformedURLException,
RepositoryIndexSearchException RepositoryIndexSearchException


ArtifactRepositoryIndex index = ArtifactRepositoryIndex index =
indexFactory.createArtifactRepositoryIndex( new File( args[0], ".index" ).getAbsolutePath(), repository ); indexFactory.createArtifactRepositoryIndex( new File( args[0], ".index" ).getAbsolutePath(), repository );
DefaultRepositoryIndexSearcher searcher = indexFactory.createDefaultRepositoryIndexSearcher( index ); DefaultRepositoryIndexSearcher searcher = indexFactory.createDefaultRepositoryIndexSearcher( index );


try try

+ 16
- 0
maven-repository-artifact-applet/pom.xml Zobrazit soubor

<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

+ 51
- 32
maven-repository-artifact-applet/src/main/java/org/apache/maven/repository/applet/ChecksumApplet.java Zobrazit soubor

* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*
*/ */


import javax.swing.*; import javax.swing.*;
public String generateMd5( final String file ) public String generateMd5( final String file )
throws IOException, NoSuchAlgorithmException throws IOException, NoSuchAlgorithmException
{ {
return (String) AccessController.doPrivileged( new PrivilegedAction()
Object o = AccessController.doPrivileged( new PrivilegedAction()
{ {
public Object run() public Object run()
{ {
try try
{ {
MessageDigest digest = MessageDigest.getInstance( "MD5" );

long total = new File( file ).length();
InputStream fis = new FileInputStream( file );
try
{
long totalRead = 0;
byte[] buffer = new byte[CHECKSUM_BUFFER_SIZE];
int numRead;
do
{
numRead = fis.read( buffer );
if ( numRead > 0 )
{
digest.update( buffer, 0, numRead );
totalRead += numRead;
progressBar.setValue( (int) ( totalRead * progressBar.getMaximum() / total ) );
}
}
while ( numRead != -1 );
}
finally
{
fis.close();
}

return byteArrayToHexStr( digest.digest() );
return checksumFile( file );
} }
catch ( NoSuchAlgorithmException e ) catch ( NoSuchAlgorithmException e )
{ {
throw new RuntimeException( e );
return e;
} }
catch ( IOException e ) catch ( IOException e )
{ {
throw new RuntimeException( e );
return e;
} }
} }
} ); } );

//noinspection ChainOfInstanceofChecks
if ( o instanceof IOException )
{
throw (IOException) o;
}
else if ( o instanceof NoSuchAlgorithmException )
{
throw (NoSuchAlgorithmException) o;
}
else
{
return (String) o;
}
}

protected String checksumFile( String file )
throws NoSuchAlgorithmException, IOException
{
MessageDigest digest = MessageDigest.getInstance( "MD5" );

long total = new File( file ).length();
InputStream fis = new FileInputStream( file );
try
{
long totalRead = 0;
byte[] buffer = new byte[CHECKSUM_BUFFER_SIZE];
int numRead;
do
{
numRead = fis.read( buffer );
if ( numRead > 0 )
{
digest.update( buffer, 0, numRead );
totalRead += numRead;
progressBar.setValue( (int) ( totalRead * progressBar.getMaximum() / total ) );
}
}
while ( numRead != -1 );
}
finally
{
fis.close();
}

return byteArrayToHexStr( digest.digest() );
} }


private static String byteArrayToHexStr( byte[] data )
protected static String byteArrayToHexStr( byte[] data )
{ {
String output = ""; String output = "";



+ 13
- 1
maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java Zobrazit soubor

import org.apache.maven.model.Relocation; import org.apache.maven.model.Relocation;
import org.apache.maven.model.converter.ArtifactPomRewriter; import org.apache.maven.model.converter.ArtifactPomRewriter;
import org.apache.maven.model.converter.ModelConverter; import org.apache.maven.model.converter.ModelConverter;
import org.apache.maven.model.converter.PomTranslationException;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader;
import org.apache.maven.repository.converter.transaction.FileTransaction; import org.apache.maven.repository.converter.transaction.FileTransaction;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.codehaus.plexus.util.xml.pull.XmlPullParserException;


import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
fileReader = new FileReader( file ); fileReader = new FileReader( file );
metadata = reader.read( fileReader ); metadata = reader.read( fileReader );
} }
catch ( FileNotFoundException e )
{
throw new RepositoryConversionException( "Error reading target metadata", e );
}
catch ( IOException e ) catch ( IOException e )
{ {
throw new RepositoryConversionException( "Error reading target metadata", e ); throw new RepositoryConversionException( "Error reading target metadata", e );
reporter.addFailure( artifact, getI18NString( "failure.invalid.source.pom", e.getMessage() ) ); reporter.addFailure( artifact, getI18NString( "failure.invalid.source.pom", e.getMessage() ) );
result = false; result = false;
} }
catch ( Exception e )
catch ( IOException e )
{ {
throw new RepositoryConversionException( "Unable to write converted POM", e ); throw new RepositoryConversionException( "Unable to write converted POM", e );
} }
catch ( PomTranslationException e )
{
// TODO! check handling, fix error message
reporter.addFailure( artifact, getI18NString( "failure.invalid.source.pom", e.getMessage() ) );
result = false;
}
finally finally
{ {
IOUtil.close( writer ); IOUtil.close( writer );

+ 2
- 2
maven-repository-converter/src/main/java/org/apache/maven/repository/converter/transaction/TransactionEvent.java Zobrazit soubor

package org.apache.maven.repository.converter.transaction; package org.apache.maven.repository.converter.transaction;


import java.io.IOException;

/* /*
* Copyright 2005-2006 The Apache Software Foundation. * Copyright 2005-2006 The Apache Software Foundation.
* *
* limitations under the License. * limitations under the License.
*/ */


import java.io.IOException;

/** /**
* Interface for individual events in a transaction. * Interface for individual events in a transaction.
* *

+ 1
- 0
maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties Zobrazit soubor



exception.repositories.match=Source and target repositories are identical. exception.repositories.match=Source and target repositories are identical.


# TODO! update definitions
failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect. failure.incorrect.groupMetadata.groupId=The group ID in the source group metadata is incorrect.


failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect. failure.incorrect.artifactMetadata.artifactId=The artifact ID in the source artifact metadata is incorrect.

+ 4
- 4
maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java Zobrazit soubor

File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) ); File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );


SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd", Locale.getDefault() );
long origTime = dateFormat.parse( "2006-03-03" ).getTime(); long origTime = dateFormat.parse( "2006-03-03" ).getTime();
targetFile.setLastModified( origTime );
targetPomFile.setLastModified( origTime );
targetFile.setLastModified( origTime );
targetPomFile.setLastModified( origTime );


sourceFile.setLastModified( dateFormat.parse( "2006-01-01" ).getTime() ); sourceFile.setLastModified( dateFormat.parse( "2006-01-01" ).getTime() );
sourcePomFile.setLastModified( dateFormat.parse( "2006-02-02" ).getTime() ); sourcePomFile.setLastModified( dateFormat.parse( "2006-02-02" ).getTime() );
} }
else if ( file.isDirectory() ) else if ( file.isDirectory() )
{ {
if ( !file.getName().equals( ".svn" ) )
if ( !".svn".equals( file.getName() ) )
{ {
if ( !destination.exists() && !destination.mkdirs() ) if ( !destination.exists() && !destination.mkdirs() )
{ {

+ 0
- 1
maven-repository-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom Zobrazit soubor

~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
~
--> -->


<project> <project>

+ 0
- 1
maven-repository-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom Zobrazit soubor

~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
~
--> -->


<project> <project>

+ 0
- 1
maven-repository-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom Zobrazit soubor

~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
~
--> -->


<project> <project>

+ 18
- 6
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractArtifactDiscoverer.java Zobrazit soubor

import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;


import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;


"**/*.MD5", "**/*.sha1", "**/*.SHA1", "**/*snapshot-version", "*/website/**", "*/licenses/**", "*/licences/**", "**/*.MD5", "**/*.sha1", "**/*.SHA1", "**/*snapshot-version", "*/website/**", "*/licenses/**", "*/licences/**",
"**/.htaccess", "**/*.html", "**/*.asc", "**/*.txt", "**/*.xml", "**/README*", "**/CHANGELOG*", "**/KEYS*"}; "**/.htaccess", "**/*.html", "**/*.asc", "**/*.txt", "**/*.xml", "**/README*", "**/CHANGELOG*", "**/KEYS*"};


protected static final String POM = ".pom";
private static final String POM = ".pom";


/** /**
* Scan the repository for artifact paths. * Scan the repository for artifact paths.
*/ */
protected String[] scanForArtifactPaths( File repositoryBase, String blacklistedPatterns )
private String[] scanForArtifactPaths( File repositoryBase, String blacklistedPatterns )
{ {
return scanForArtifactPaths( repositoryBase, blacklistedPatterns, null, STANDARD_DISCOVERY_EXCLUDES ); return scanForArtifactPaths( repositoryBase, blacklistedPatterns, null, STANDARD_DISCOVERY_EXCLUDES );
} }
try try
{ {
Model model = mavenReader.read( new FileReader( filename ) ); Model model = mavenReader.read( new FileReader( filename ) );
if ( ( pomArtifact != null ) && ( "pom".equals( model.getPackaging() ) ) )
if ( pomArtifact != null && "pom".equals( model.getPackaging() ) )
{ {
if ( includeSnapshots || !pomArtifact.isSnapshot() ) if ( includeSnapshots || !pomArtifact.isSnapshot() )
{ {
} }
} }
} }
catch ( Exception e )
catch ( FileNotFoundException e )
{ {
getLogger().info( "error reading file: " + filename );
e.printStackTrace();
// this should never happen
getLogger().error( "Error finding file during POM discovery: " + filename, e );
}
catch ( IOException e )
{
getLogger().error( "Error reading file during POM discovery: " + filename + ": " + e );
}
catch ( XmlPullParserException e )
{
getLogger().error(
"Parse error reading file during POM discovery: " + filename + ": " + e.getMessage() );
} }
} }
} }

+ 17
- 1
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractDiscoverer.java Zobrazit soubor

package org.apache.maven.repository.discovery; package org.apache.maven.repository.discovery;


/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.factory.ArtifactFactory;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.DirectoryScanner;
* *
* @author <a href="mailto:brett@apache.org">Brett Porter</a> * @author <a href="mailto:brett@apache.org">Brett Porter</a>
*/ */
public class AbstractDiscoverer
public abstract class AbstractDiscoverer
extends AbstractLogEnabled extends AbstractLogEnabled
{ {
private List kickedOutPaths = new ArrayList(); private List kickedOutPaths = new ArrayList();

+ 1
- 1
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultMetadataDiscoverer.java Zobrazit soubor

//} //}


Artifact artifact = null; Artifact artifact = null;
if ( metaVersion != null && !metaVersion.equals( "" ) )
if ( metaVersion != null && !"".equals( metaVersion ) )
{ {
artifact = artifactFactory.createBuildArtifact( metaGroupId, metaArtifactId, metaVersion, "jar" ); artifact = artifactFactory.createBuildArtifact( metaGroupId, metaArtifactId, metaVersion, "jar" );
} }

+ 25
- 28
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java Zobrazit soubor

* *
* @param indexPath * @param indexPath
* @param repository * @param repository
* @throws RepositoryIndexException
*/ */
protected AbstractRepositoryIndex( String indexPath, ArtifactRepository repository ) protected AbstractRepositoryIndex( String indexPath, ArtifactRepository repository )
throws RepositoryIndexException
{ {
this.repository = repository; this.repository = repository;
this.indexPath = indexPath; this.indexPath = indexPath;
* Check if the index already exists. * Check if the index already exists.
* *
* @return true if the index already exists * @return true if the index already exists
* @throws IOException
* @throws RepositoryIndexException * @throws RepositoryIndexException
*/ */
protected boolean indexExists() protected boolean indexExists()
throws IOException, RepositoryIndexException
throws RepositoryIndexException
{ {
File indexDir = new File( indexPath ); File indexDir = new File( indexPath );


return isAdded; return isAdded;
} }


private class ArtifactRepositoryIndexAnalyzer
private static class ArtifactRepositoryIndexAnalyzer
extends Analyzer extends Analyzer
{ {
private Analyzer defaultAnalyzer; private Analyzer defaultAnalyzer;
* *
* @param defaultAnalyzer the analyzer to use as default for the general fields of the artifact indeces * @param defaultAnalyzer the analyzer to use as default for the general fields of the artifact indeces
*/ */
public ArtifactRepositoryIndexAnalyzer( Analyzer defaultAnalyzer )
ArtifactRepositoryIndexAnalyzer( Analyzer defaultAnalyzer )
{ {
this.defaultAnalyzer = defaultAnalyzer; this.defaultAnalyzer = defaultAnalyzer;
} }


return tokenStream; return tokenStream;
} }
}


/**
* Class used to tokenize an artifact's version.
*/
private static class VersionTokenizer
extends CharTokenizer
{
/** /**
* Class used to tokenize an artifact's version.
* Constructor with the required reader to the index stream
*
* @param reader the Reader object of the index stream
*/ */
private class VersionTokenizer
extends CharTokenizer
VersionTokenizer( Reader reader )
{ {
/**
* Constructor with the required reader to the index stream
*
* @param reader the Reader object of the index stream
*/
VersionTokenizer( Reader reader )
{
super( reader );
}
super( reader );
}


/**
* method that lucene calls to check tokenization of a stream character
*
* @param character char currently being processed
* @return true if the char is a token, false if the char is a stop char
*/
protected boolean isTokenChar( char character )
{
return character != '.' && character != '-';
}
/**
* method that lucene calls to check tokenization of a stream character
*
* @param character char currently being processed
* @return true if the char is a token, false if the char is a stop char
*/
protected boolean isTokenChar( char character )
{
return character != '.' && character != '-';
} }
} }
} }

+ 2
- 16
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndex.java Zobrazit soubor

* @param indexPath the path where the lucene index will be created/updated. * @param indexPath the path where the lucene index will be created/updated.
* @param repository the repository where the indexed artifacts are located * @param repository the repository where the indexed artifacts are located
* @param digester the digester object to generate the checksum strings * @param digester the digester object to generate the checksum strings
* @throws RepositoryIndexException
*/ */
public ArtifactRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester ) public ArtifactRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester )
throws RepositoryIndexException
{ {
super( indexPath, repository ); super( indexPath, repository );
this.digester = digester; this.digester = digester;
* *
* @param name the complete path name of the class * @param name the complete path name of the class
* @param packages the packages buffer * @param packages the packages buffer
* @return true if the package is successfully added
*/ */
private boolean addClassPackage( String name, StringBuffer packages )
private void addClassPackage( String name, StringBuffer packages )
{ {
boolean isAdded = false;

int idx = name.lastIndexOf( '/' ); int idx = name.lastIndexOf( '/' );
if ( idx > 0 ) if ( idx > 0 )
{ {
{ {
packages.append( packageName ).append( "\n" ); packages.append( packageName ).append( "\n" );
} }
isAdded = true;
} }

return isAdded;
} }


/** /**
* *
* @param entry the zip entry to be added * @param entry the zip entry to be added
* @param files the buffer of files to update * @param files the buffer of files to update
* @return true if the file was successfully added
*/ */
private boolean addFile( ZipEntry entry, StringBuffer files )
private void addFile( ZipEntry entry, StringBuffer files )
{ {
String name = entry.getName(); String name = entry.getName();
int idx = name.lastIndexOf( '/' ); int idx = name.lastIndexOf( '/' );
name = name.substring( idx + 1 ); name = name.substring( idx + 1 );
} }


boolean isAdded = false;

if ( files.indexOf( name + "\n" ) < 0 ) if ( files.indexOf( name + "\n" ) < 0 )
{ {
files.append( name ).append( "\n" ); files.append( name ).append( "\n" );
isAdded = true;
} }

return isAdded;
} }
} }

+ 13
- 10
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexSearcher.java Zobrazit soubor

Hits hits = searcher.search( luceneQuery ); Hits hits = searcher.search( luceneQuery );
docs = buildList( hits ); docs = buildList( hits );
} }
catch ( MalformedURLException e )
{
throw new RepositoryIndexSearchException( "Unable to search index: " + e.getMessage(), e );
}
catch ( IOException e ) catch ( IOException e )
{ {
throw new RepositoryIndexSearchException( "Unable to search index: " + e.getMessage(), e ); throw new RepositoryIndexSearchException( "Unable to search index: " + e.getMessage(), e );
protected RepositoryIndexSearchHit createSearchedObjectFromIndexDocument( Document doc ) protected RepositoryIndexSearchHit createSearchedObjectFromIndexDocument( Document doc )
throws MalformedURLException, IOException, XmlPullParserException throws MalformedURLException, IOException, XmlPullParserException
{ {
String groupId, artifactId, version, name, packaging;
RepositoryIndexSearchHit searchHit = null; RepositoryIndexSearchHit searchHit = null;
// the document is of type artifact // the document is of type artifact
if ( doc.get( RepositoryIndex.FLD_DOCTYPE ).equals( RepositoryIndex.ARTIFACT ) ) if ( doc.get( RepositoryIndex.FLD_DOCTYPE ).equals( RepositoryIndex.ARTIFACT ) )
{ {
groupId = doc.get( RepositoryIndex.FLD_GROUPID );
artifactId = doc.get( RepositoryIndex.FLD_ARTIFACTID );
version = doc.get( RepositoryIndex.FLD_VERSION );
name = doc.get( RepositoryIndex.FLD_NAME );
packaging = doc.get( RepositoryIndex.FLD_PACKAGING );
String groupId = doc.get( RepositoryIndex.FLD_GROUPID );
String artifactId = doc.get( RepositoryIndex.FLD_ARTIFACTID );
String version = doc.get( RepositoryIndex.FLD_VERSION );
String packaging = doc.get( RepositoryIndex.FLD_PACKAGING );
Artifact artifact = factory.createBuildArtifact( groupId, artifactId, version, packaging ); Artifact artifact = factory.createBuildArtifact( groupId, artifactId, version, packaging );
artifact.setFile( artifact.setFile(
String metadataFile = (String) it.next(); String metadataFile = (String) it.next();
String tmpDir = (String) it.next(); String tmpDir = (String) it.next();
String metadataType = "";
String metadataType;
if ( tmpDir.equals( doc.get( RepositoryIndex.FLD_VERSION ) ) ) if ( tmpDir.equals( doc.get( RepositoryIndex.FLD_VERSION ) ) )
{ {
metadataType = MetadataRepositoryIndex.SNAPSHOT_METADATA; metadataType = MetadataRepositoryIndex.SNAPSHOT_METADATA;
* @param filename the name of the metadata file * @param filename the name of the metadata file
* @param metadataType the type of RepositoryMetadata object to be created (GROUP, ARTIFACT or SNAPSHOT) * @param metadataType the type of RepositoryMetadata object to be created (GROUP, ARTIFACT or SNAPSHOT)
* @return RepositoryMetadata * @return RepositoryMetadata
* @throws MalformedURLException
* @throws IOException * @throws IOException
* @throws XmlPullParserException * @throws XmlPullParserException
*/ */
private RepositoryMetadata getMetadata( String groupId, String artifactId, String version, String filename, private RepositoryMetadata getMetadata( String groupId, String artifactId, String version, String filename,
String metadataType ) String metadataType )
throws MalformedURLException, IOException, XmlPullParserException
throws IOException, XmlPullParserException
{ {
RepositoryMetadata repoMetadata = null; RepositoryMetadata repoMetadata = null;
InputStream is = null;
// TODO! file handles left open
InputStream is;
MetadataXpp3Reader metadataReader = new MetadataXpp3Reader(); MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
//group metadata //group metadata

+ 1
- 2
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/DefaultRepositoryIndexingFactory.java Zobrazit soubor

package org.apache.maven.repository.indexing; package org.apache.maven.repository.indexing;


/* /*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2005-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,

+ 0
- 2
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/EclipseRepositoryIndex.java Zobrazit soubor

* @param indexPath the path where the lucene index will be created/updated. * @param indexPath the path where the lucene index will be created/updated.
* @param repository the repository where the indexed artifacts are located * @param repository the repository where the indexed artifacts are located
* @param digester the digester object to generate the checksum strings * @param digester the digester object to generate the checksum strings
* @throws RepositoryIndexException
*/ */
public EclipseRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester ) public EclipseRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester )
throws RepositoryIndexException
{ {
super( indexPath, repository ); super( indexPath, repository );



+ 4
- 6
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/MetadataRepositoryIndex.java Zobrazit soubor

* *
* @param indexPath the path to the index * @param indexPath the path to the index
* @param repository the repository where the metadata to be indexed is located * @param repository the repository where the metadata to be indexed is located
* @throws RepositoryIndexException
*/ */
public MetadataRepositoryIndex( String indexPath, ArtifactRepository repository ) public MetadataRepositoryIndex( String indexPath, ArtifactRepository repository )
throws RepositoryIndexException
{ {
super( indexPath, repository ); super( indexPath, repository );
} }
repoMetadata.getBaseVersion() + "/"; repoMetadata.getBaseVersion() + "/";
} }
if ( !repoMetadata.getRemoteFilename().equals( "" ) && repoMetadata.getRemoteFilename() != null )
if ( !"".equals( repoMetadata.getRemoteFilename() ) && repoMetadata.getRemoteFilename() != null )
{ {
path = path + repoMetadata.getRemoteFilename(); path = path + repoMetadata.getRemoteFilename();
} }
for ( Iterator iter = plugins.iterator(); iter.hasNext(); ) for ( Iterator iter = plugins.iterator(); iter.hasNext(); )
{ {
Plugin plugin = (Plugin) iter.next(); Plugin plugin = (Plugin) iter.next();
if ( plugin.getPrefix() != null && !plugin.getPrefix().equals( "" ) )
if ( plugin.getPrefix() != null && !"".equals( plugin.getPrefix() ) )
{ {
pluginAppended = plugin.getPrefix() + "\n"; pluginAppended = plugin.getPrefix() + "\n";
} }
doc.add( Field.Text( FLD_PLUGINPREFIX, pluginAppended ) ); doc.add( Field.Text( FLD_PLUGINPREFIX, pluginAppended ) );
doc.add( Field.Text( FLD_GROUPID, metadata.getGroupId() ) ); doc.add( Field.Text( FLD_GROUPID, metadata.getGroupId() ) );
if ( metadata.getArtifactId() != null && !metadata.getArtifactId().equals( "" ) )
if ( metadata.getArtifactId() != null && !"".equals( metadata.getArtifactId() ) )
{ {
doc.add( Field.Text( FLD_ARTIFACTID, metadata.getArtifactId() ) ); doc.add( Field.Text( FLD_ARTIFACTID, metadata.getArtifactId() ) );
} }
doc.add( Field.Text( FLD_ARTIFACTID, "" ) ); doc.add( Field.Text( FLD_ARTIFACTID, "" ) );
} }
if ( metadata.getVersion() != null && !metadata.getVersion().equals( "" ) )
if ( metadata.getVersion() != null && !"".equals( metadata.getVersion() ) )
{ {
doc.add( Field.Text( FLD_VERSION, metadata.getVersion() ) ); doc.add( Field.Text( FLD_VERSION, metadata.getVersion() ) );
} }

+ 6
- 4
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/PomRepositoryIndex.java Zobrazit soubor

package org.apache.maven.repository.indexing; package org.apache.maven.repository.indexing;


/* /*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2005-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.StringUtils;


import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.Iterator; import java.util.Iterator;
* @param repository the repository where objects indexed by this class resides * @param repository the repository where objects indexed by this class resides
* @param digester the digester to be used for generating checksums * @param digester the digester to be used for generating checksums
* @param artifactFactory the factory for building artifact objects * @param artifactFactory the factory for building artifact objects
* @throws RepositoryIndexException
*/ */
public PomRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester, public PomRepositoryIndex( String indexPath, ArtifactRepository repository, Digester digester,
ArtifactFactory artifactFactory ) ArtifactFactory artifactFactory )
throws RepositoryIndexException
{ {
super( indexPath, repository ); super( indexPath, repository );
this.digester = digester; this.digester = digester;
{ {
return digester.createChecksum( new File( file ), algorithm ); return digester.createChecksum( new File( file ), algorithm );
} }
catch ( FileNotFoundException e )
{
throw new RepositoryIndexException( e.getMessage(), e );
}
catch ( IOException e ) catch ( IOException e )
{ {
throw new RepositoryIndexException( e.getMessage(), e ); throw new RepositoryIndexException( e.getMessage(), e );

+ 28
- 29
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java Zobrazit soubor

*/ */
public interface RepositoryIndex public interface RepositoryIndex
{ {
static final String POM = "POM";
String POM = "POM";


static final String METADATA = "METADATA";
String METADATA = "METADATA";


static final String ARTIFACT = "ARTIFACT";
String ARTIFACT = "ARTIFACT";


static final String FLD_ID = "id";
String FLD_ID = "id";


static final String FLD_NAME = "name";
String FLD_NAME = "name";


static final String FLD_DOCTYPE = "doctype";
String FLD_DOCTYPE = "doctype";


static final String FLD_GROUPID = "groupId";
String FLD_GROUPID = "groupId";


static final String FLD_ARTIFACTID = "artifactId";
String FLD_ARTIFACTID = "artifactId";


static final String FLD_VERSION = "version";
String FLD_VERSION = "version";


static final String FLD_PACKAGING = "packaging";
String FLD_PACKAGING = "packaging";


static final String FLD_SHA1 = "sha1";
String FLD_SHA1 = "sha1";


static final String FLD_MD5 = "md5";
String FLD_MD5 = "md5";


static final String FLD_LASTUPDATE = "last update";
String FLD_LASTUPDATE = "last update";


static final String FLD_PLUGINPREFIX = "plugin prefix";
String FLD_PLUGINPREFIX = "plugin prefix";


static final String FLD_CLASSES = "class";
String FLD_CLASSES = "class";


static final String FLD_PACKAGES = "package";
String FLD_PACKAGES = "package";


static final String FLD_FILES = "file";
String FLD_FILES = "file";


static final String FLD_LICENSE_URLS = "license url";
String FLD_LICENSE_URLS = "license url";


static final String FLD_DEPENDENCIES = "dependency";
String FLD_DEPENDENCIES = "dependency";


static final String FLD_PLUGINS_BUILD = "build plugin";
String FLD_PLUGINS_BUILD = "build plugin";


static final String FLD_PLUGINS_REPORT = "report plugin";
String FLD_PLUGINS_REPORT = "report plugin";


static final String FLD_PLUGINS_ALL = "plugins_all";
String FLD_PLUGINS_ALL = "plugins_all";


static final String[] FIELDS = {FLD_ID, FLD_NAME, FLD_DOCTYPE, FLD_GROUPID, FLD_ARTIFACTID, FLD_VERSION,
FLD_PACKAGING, FLD_SHA1, FLD_MD5, FLD_LASTUPDATE, FLD_PLUGINPREFIX, FLD_CLASSES, FLD_PACKAGES, FLD_FILES,
FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL};
String[] FIELDS = {FLD_ID, FLD_NAME, FLD_DOCTYPE, FLD_GROUPID, FLD_ARTIFACTID, FLD_VERSION, FLD_PACKAGING, FLD_SHA1,
FLD_MD5, FLD_LASTUPDATE, FLD_PLUGINPREFIX, FLD_CLASSES, FLD_PACKAGES, FLD_FILES, FLD_LICENSE_URLS,
FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL};


static final List KEYWORD_FIELDS = Arrays.asList( new String[]{FLD_ID, FLD_PACKAGING, FLD_LICENSE_URLS,
FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL} );
List KEYWORD_FIELDS = Arrays.asList( new String[]{FLD_ID, FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES,
FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL} );


static final String[] MODEL_FIELDS =
{FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT};
String[] MODEL_FIELDS = {FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT};


/** /**
* Method used to query the index status * Method used to query the index status

+ 3
- 3
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchHit.java Zobrazit soubor

{ {
private Object obj; private Object obj;
private boolean isHashMap = false;
private boolean isHashMap;
private boolean isMetadata = false;
private boolean isMetadata;
private boolean isModel = false;
private boolean isModel;
/** /**
* Class constructor * Class constructor

+ 3
- 4
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayer.java Zobrazit soubor

import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import org.apache.maven.model.Dependency; import org.apache.maven.model.Dependency;
import org.apache.maven.model.License; import org.apache.maven.model.License;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
else if ( hit.isMetadata() ) else if ( hit.isMetadata() )
{ {
//@todo what about metadata objects? //@todo what about metadata objects?
RepositoryMetadata metadata = (RepositoryMetadata) hit.getObject();
// RepositoryMetadata metadata = (RepositoryMetadata) hit.getObject();
} }
} }
} }
} }
if ( values != null && values.size() > 0 )
if ( !values.isEmpty() )
{ {
resultMap.put( key, values ); resultMap.put( key, values );
} }
} }
} }
if ( values.size() > 0 && values != null )
if ( !values.isEmpty() )
{ {
map.put( field, values ); map.put( field, values );
} }

+ 1
- 2
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndexingFactory.java Zobrazit soubor

package org.apache.maven.repository.indexing; package org.apache.maven.repository.indexing;


/* /*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2005-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0

* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,

+ 4
- 5
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/Query.java Zobrazit soubor

package org.apache.maven.repository.indexing.query; package org.apache.maven.repository.indexing.query;


import org.apache.lucene.queryParser.ParseException;
import org.apache.maven.repository.indexing.RepositoryIndex;

/* /*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2005-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* limitations under the License. * limitations under the License.
*/ */


import org.apache.lucene.queryParser.ParseException;
import org.apache.maven.repository.indexing.RepositoryIndex;

/** /**
* Interface to label the query classes * Interface to label the query classes
* *

+ 7
- 8
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/query/SinglePhraseQuery.java Zobrazit soubor

package org.apache.maven.repository.indexing.query; package org.apache.maven.repository.indexing.query;


import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.TermQuery;
import org.apache.maven.repository.indexing.RepositoryIndex;

/* /*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2005-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* limitations under the License. * limitations under the License.
*/ */


import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.TermQuery;
import org.apache.maven.repository.indexing.RepositoryIndex;

/** /**
* Class to hold a single field search condition * Class to hold a single field search condition
* *

+ 3
- 3
maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/ArtifactRepositoryIndexingTest.java Zobrazit soubor

try try
{ {
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_VERSION, "~~~~~" ); Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_VERSION, "~~~~~" );
List artifacts = repoSearchLayer.searchAdvanced( qry );
repoSearchLayer.searchAdvanced( qry );
fail( "Must throw an exception on unparseable query." ); fail( "Must throw an exception on unparseable query." );
} }
catch ( RepositoryIndexSearchException re ) catch ( RepositoryIndexSearchException re )
try try
{ {
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_VERSION, "1.0" ); Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_VERSION, "1.0" );
List artifacts = repoSearchLayer.searchAdvanced( qry );
repoSearchLayer.searchAdvanced( qry );
fail( "Must throw an exception on invalid index location." ); fail( "Must throw an exception on invalid index location." );
} }
catch ( RepositoryIndexSearchException re ) catch ( RepositoryIndexSearchException re )
RepositoryIndexSearcher repoSearcher = factory.createDefaultRepositoryIndexSearcher( indexer ); RepositoryIndexSearcher repoSearcher = factory.createDefaultRepositoryIndexSearcher( indexer );
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_ID, RepositoryIndex.ARTIFACT + artifact.getId() ); Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_ID, RepositoryIndex.ARTIFACT + artifact.getId() );
List artifacts = repoSearcher.search( qry ); List artifacts = repoSearcher.search( qry );
assertEquals( artifacts.size(), 0 );
assertEquals( 0, artifacts.size() );
} }


/** /**

+ 19
- 17
maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/EclipseRepositoryIndexTest.java Zobrazit soubor

package org.apache.maven.repository.indexing; package org.apache.maven.repository.indexing;


/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.apache.lucene.document.DateField; import org.apache.lucene.document.DateField;
import org.apache.lucene.document.Document; import org.apache.lucene.document.Document;
import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.queryParser.QueryParser;


import java.io.File; import java.io.File;


/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/** /**
* @author Edwin Punzalan * @author Edwin Punzalan
*/ */


private long artifactFileTime; private long artifactFileTime;


private static final long TIME_DIFFERENCE = 10000L;

protected void setUp() protected void setUp()
throws Exception throws Exception
{ {
indexer.optimize(); indexer.optimize();
indexer.close(); indexer.close();


long historicTime = artifactFileTime - 10000L;
long historicTime = artifactFileTime - TIME_DIFFERENCE;


artifact = getArtifact( "org.apache.maven", "maven-model", "2.0" ); artifact = getArtifact( "org.apache.maven", "maven-model", "2.0" );
artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) ); artifact.setFile( new File( repository.getBasedir(), repository.pathOf( artifact ) ) );

+ 8
- 12
maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/MetadataRepositoryIndexingTest.java Zobrazit soubor

private String indexPath; private String indexPath;
private MetadataRepositoryIndex indexer;
private ArtifactFactory artifactFactory; private ArtifactFactory artifactFactory;
/** /**
throws Exception throws Exception
{ {
RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE ); RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE );
indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
MetadataRepositoryIndex indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
RepositoryMetadata repoMetadata = RepositoryMetadata repoMetadata =
getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA ); getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA );
RepositoryIndexSearchLayer repoSearchLayer = factory.createRepositoryIndexSearchLayer( indexer ); RepositoryIndexSearchLayer repoSearchLayer = factory.createRepositoryIndexSearchLayer( indexer );
// search last update // search last update
org.apache.maven.repository.indexing.query.Query qry =
new SinglePhraseQuery( RepositoryIndex.FLD_LASTUPDATE, "20051212044643" );
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_LASTUPDATE, "20051212044643" );
List metadataList = repoSearchLayer.searchAdvanced( qry ); List metadataList = repoSearchLayer.searchAdvanced( qry );
//assertEquals( 1, metadataList.size() ); //assertEquals( 1, metadataList.size() );
for ( Iterator iter = metadataList.iterator(); iter.hasNext(); ) for ( Iterator iter = metadataList.iterator(); iter.hasNext(); )
rQry.addQuery( qry2 ); rQry.addQuery( qry2 );
metadataList = repoSearchLayer.searchAdvanced( rQry ); metadataList = repoSearchLayer.searchAdvanced( rQry );
assertEquals( metadataList.size(), 0 );
assertEquals( 0, metadataList.size() );
indexer.close(); indexer.close();
} }
{ {
//test when the object passed in the index(..) method is not a RepositoryMetadata instance //test when the object passed in the index(..) method is not a RepositoryMetadata instance
RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE ); RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE );
indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
MetadataRepositoryIndex indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
try try
{ {
Artifact artifact = getArtifact( "org.apache.maven", "maven-artifact", "2.0.1" ); Artifact artifact = getArtifact( "org.apache.maven", "maven-artifact", "2.0.1" );
createTestIndex(); createTestIndex();
RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE ); RepositoryIndexingFactory factory = (RepositoryIndexingFactory) lookup( RepositoryIndexingFactory.ROLE );
indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
MetadataRepositoryIndex indexer = factory.createMetadataRepositoryIndex( indexPath, repository );
RepositoryMetadata repoMetadata = RepositoryMetadata repoMetadata =
getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA ); getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA );
indexer.deleteDocument( RepositoryIndex.FLD_ID, (String) repoMetadata.getKey() ); indexer.deleteDocument( RepositoryIndex.FLD_ID, (String) repoMetadata.getKey() );
RepositoryIndexSearcher repoSearcher = factory.createDefaultRepositoryIndexSearcher( indexer ); RepositoryIndexSearcher repoSearcher = factory.createDefaultRepositoryIndexSearcher( indexer );
org.apache.maven.repository.indexing.query.Query qry =
new SinglePhraseQuery( RepositoryIndex.FLD_ID, (String) repoMetadata.getKey() );
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_ID, (String) repoMetadata.getKey() );
List metadataList = repoSearcher.search( qry ); List metadataList = repoSearcher.search( qry );
assertEquals( metadataList.size(), 0 );
assertEquals( 0, metadataList.size() );
} }
/** /**
{ {
RepositoryMetadata repoMetadata = null; RepositoryMetadata repoMetadata = null;
URL url; URL url;
InputStream is = null;
InputStream is;
MetadataXpp3Reader metadataReader = new MetadataXpp3Reader(); MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
//group metadata //group metadata

+ 8
- 9
maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/PomRepositoryIndexingTest.java Zobrazit soubor

package org.apache.maven.repository.indexing; package org.apache.maven.repository.indexing;


/**
/*
* Copyright 2005-2006 The Apache Software Foundation. * Copyright 2005-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
SearchResult result = (SearchResult) artifacts.next(); SearchResult result = (SearchResult) artifacts.next();
Map map = result.getFieldMatches(); Map map = result.getFieldMatches();
Set mapEntry = map.entrySet(); Set mapEntry = map.entrySet();
for ( Iterator it = mapEntry.iterator(); it.hasNext(); )
{
Map.Entry entry = (Map.Entry) it.next();
}
assertEquals( "jar", (String) map.get( RepositoryIndex.FLD_PACKAGING ) ); assertEquals( "jar", (String) map.get( RepositoryIndex.FLD_PACKAGING ) );
} }


SearchResult result = (SearchResult) artifacts.next(); SearchResult result = (SearchResult) artifacts.next();
Map map = result.getFieldMatches(); Map map = result.getFieldMatches();
boolean depFound = false; boolean depFound = false;
Iterator dependencies = ( (List) map.get( RepositoryIndex.FLD_DEPENDENCIES ) ).iterator();
List list = (List) map.get( RepositoryIndex.FLD_DEPENDENCIES );
Iterator dependencies = list.iterator();
while ( dependencies.hasNext() ) while ( dependencies.hasNext() )
{ {
String dep = (String) dependencies.next(); String dep = (String) dependencies.next();
{ {
SearchResult result = (SearchResult) artifacts.next(); SearchResult result = (SearchResult) artifacts.next();
Map map = result.getFieldMatches(); Map map = result.getFieldMatches();
Iterator plugins = ( (List) map.get( RepositoryIndex.FLD_PLUGINS_BUILD ) ).iterator();
List list = (List) map.get( RepositoryIndex.FLD_PLUGINS_BUILD );
Iterator plugins = list.iterator();
boolean found = false; boolean found = false;
while ( plugins.hasNext() ) while ( plugins.hasNext() )
{ {
{ {
SearchResult result = (SearchResult) artifacts.next(); SearchResult result = (SearchResult) artifacts.next();
Map map = result.getFieldMatches(); Map map = result.getFieldMatches();
Iterator plugins = ( (List) map.get( RepositoryIndex.FLD_PLUGINS_REPORT ) ).iterator();
List list = (List) map.get( RepositoryIndex.FLD_PLUGINS_REPORT );
Iterator plugins = list.iterator();
boolean found = false; boolean found = false;
while ( plugins.hasNext() ) while ( plugins.hasNext() )
{ {
RepositoryIndexSearcher repoSearcher = factory.createDefaultRepositoryIndexSearcher( indexer ); RepositoryIndexSearcher repoSearcher = factory.createDefaultRepositoryIndexSearcher( indexer );
Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_ID, RepositoryIndex.POM + pom.getId() ); Query qry = new SinglePhraseQuery( RepositoryIndex.FLD_ID, RepositoryIndex.POM + pom.getId() );
List artifactList = repoSearcher.search( qry ); List artifactList = repoSearcher.search( qry );
assertEquals( artifactList.size(), 0 );
assertEquals( 0, artifactList.size() );
} }


private Model getPom( String groupId, String artifactId, String version ) private Model getPom( String groupId, String artifactId, String version )

+ 7
- 23
maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/RepositoryIndexSearchLayerTest.java Zobrazit soubor

import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.repository.digest.DefaultDigester;
import org.apache.maven.repository.digest.Digester;
import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.FileUtils;
private ArtifactFactory artifactFactory; private ArtifactFactory artifactFactory;
private Digester digester;
private String indexPath; private String indexPath;
/** /**
ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null ); repository = repoFactory.createArtifactRepository( "test", repoDir, layout, null, null );
digester = new DefaultDigester();
indexPath = "target/index"; indexPath = "target/index";
FileUtils.deleteDirectory( indexPath ); FileUtils.deleteDirectory( indexPath );
} }
/**
* Tear down method
*
* @throws Exception
*/
protected void tearDown()
throws Exception
{
super.tearDown();
}
/** /**
* Method for creating the index used for testing * Method for creating the index used for testing
* *
MetadataRepositoryIndex metaIndexer = factory.createMetadataRepositoryIndex( indexPath, repository ); MetadataRepositoryIndex metaIndexer = factory.createMetadataRepositoryIndex( indexPath, repository );
RepositoryMetadata repoMetadata = RepositoryMetadata repoMetadata =
getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", metaIndexer.GROUP_METADATA );
getMetadata( "org.apache.maven", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA );
metaIndexer.index( repoMetadata ); metaIndexer.index( repoMetadata );
metaIndexer.optimize(); metaIndexer.optimize();
metaIndexer.close(); metaIndexer.close();
repoMetadata = getMetadata( "org.apache.maven", "maven-artifact", "2.0.1", "maven-metadata.xml", repoMetadata = getMetadata( "org.apache.maven", "maven-artifact", "2.0.1", "maven-metadata.xml",
metaIndexer.ARTIFACT_METADATA );
MetadataRepositoryIndex.ARTIFACT_METADATA );
metaIndexer.index( repoMetadata ); metaIndexer.index( repoMetadata );
metaIndexer.optimize(); metaIndexer.optimize();
metaIndexer.close(); metaIndexer.close();
repoMetadata = getMetadata( "org.apache.maven", "maven-artifact", "2.0.1", "maven-metadata.xml", repoMetadata = getMetadata( "org.apache.maven", "maven-artifact", "2.0.1", "maven-metadata.xml",
metaIndexer.SNAPSHOT_METADATA );
MetadataRepositoryIndex.SNAPSHOT_METADATA );
metaIndexer.index( repoMetadata ); metaIndexer.index( repoMetadata );
metaIndexer.optimize(); metaIndexer.optimize();
metaIndexer.close(); metaIndexer.close();
repoMetadata = getMetadata( "test", null, null, "maven-metadata.xml", metaIndexer.GROUP_METADATA );
repoMetadata = getMetadata( "test", null, null, "maven-metadata.xml", MetadataRepositoryIndex.GROUP_METADATA );
metaIndexer.index( repoMetadata ); metaIndexer.index( repoMetadata );
metaIndexer.optimize(); metaIndexer.optimize();
metaIndexer.close(); metaIndexer.close();
for ( Iterator iter = returnList.iterator(); iter.hasNext(); ) for ( Iterator iter = returnList.iterator(); iter.hasNext(); )
{ {
SearchResult result = (SearchResult) iter.next(); SearchResult result = (SearchResult) iter.next();
assertEquals( result.getArtifact().getGroupId(), "test" );
assertEquals( "test", result.getArtifact().getGroupId() );
} }
returnList = searchLayer.searchGeneral( "test-artifactId" ); returnList = searchLayer.searchGeneral( "test-artifactId" );
for ( Iterator iter = returnList.iterator(); iter.hasNext(); ) for ( Iterator iter = returnList.iterator(); iter.hasNext(); )
{ {
SearchResult result = (SearchResult) iter.next(); SearchResult result = (SearchResult) iter.next();
assertEquals( result.getArtifact().getArtifactId(), "test-artifactId" );
assertEquals( "test-artifactId", result.getArtifact().getArtifactId() );
} }
} }
{ {
RepositoryMetadata repoMetadata = null; RepositoryMetadata repoMetadata = null;
URL url; URL url;
InputStream is = null;
InputStream is;
MetadataXpp3Reader metadataReader = new MetadataXpp3Reader(); MetadataXpp3Reader metadataReader = new MetadataXpp3Reader();
//group metadata //group metadata

+ 3
- 4
maven-repository-indexer/src/test/java/org/apache/maven/repository/indexing/query/QueryTest.java Zobrazit soubor

package org.apache.maven.repository.indexing.query; package org.apache.maven.repository.indexing.query;


import junit.framework.TestCase;

/* /*
* Copyright 2001-2005 The Apache Software Foundation.
* Copyright 2005-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* limitations under the License. * limitations under the License.
*/ */


import junit.framework.TestCase;

/** /**
* @author Edwin Punzalan * @author Edwin Punzalan
*/ */

+ 18
- 1
maven-repository-manager-site/pom.xml Zobrazit soubor

<?xml version="1.0"?><project>
<?xml version="1.0"?>
<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project>
<parent> <parent>
<artifactId>maven-repository-manager</artifactId> <artifactId>maven-repository-manager</artifactId>
<groupId>org.apache.maven.repository</groupId> <groupId>org.apache.maven.repository</groupId>

+ 18
- 2
maven-repository-manager-site/src/site/site.xml Zobrazit soubor

<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project> <project>
<body> <body>
<links> <links>
<item name="Maven" href="http://maven.apache.org/"/> <item name="Maven" href="http://maven.apache.org/"/>
</links> </links>


<menu ref="reports" />
<menu ref="reports"/>


</body> </body>
<skin> <skin>
<groupId>org.apache.maven.skins</groupId> <groupId>org.apache.maven.skins</groupId>
<artifactId>maven-stylus-skin</artifactId> <artifactId>maven-stylus-skin</artifactId>
</skin> </skin>
<publishDate format="dd MMM yyyy" />
<publishDate format="dd MMM yyyy"/>
<bannerLeft> <bannerLeft>
<name>Maven</name> <name>Maven</name>
<src>http://maven.apache.org/images/apache-maven-project-2.png</src> <src>http://maven.apache.org/images/apache-maven-project-2.png</src>

+ 3
- 1
maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/DefaultProxyManager.java Zobrazit soubor

*/ */
private Map failuresCache = new HashMap(); private Map failuresCache = new HashMap();


private static final int MS_PER_SEC = 1000;

public void setConfiguration( ProxyConfiguration config ) public void setConfiguration( ProxyConfiguration config )
{ {
this.config = config; this.config = config;
} }
else else
{ {
long repoTimestamp = target.lastModified() + repository.getCachePeriod() * 1000;
long repoTimestamp = target.lastModified() + repository.getCachePeriod() * MS_PER_SEC;
wagon.getIfNewer( path, temp, repoTimestamp ); wagon.getIfNewer( path, temp, repoTimestamp );
} }



+ 1
- 1
maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/ProxyManager.java Zobrazit soubor

*/ */
public interface ProxyManager public interface ProxyManager
{ {
static String ROLE = ProxyManager.class.getName();
String ROLE = ProxyManager.class.getName();


/** /**
* Used to retrieve a cached path or retrieve one if the cache does not contain it yet. * Used to retrieve a cached path or retrieve one if the cache does not contain it yet.

+ 49
- 49
maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoader.java Zobrazit soubor

package org.apache.maven.repository.proxy.configuration; package org.apache.maven.repository.proxy.configuration;


/* /*
* Copyright 2003-2004 The Apache Software Foundation.
* Copyright 2005-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,


config.setRepositoryCachePath( getMandatoryProperty( props, REPO_LOCAL_STORE ) ); config.setRepositoryCachePath( getMandatoryProperty( props, REPO_LOCAL_STORE ) );


{//just get the first proxy and break
String propertyList = props.getProperty( PROXY_LIST );
if ( propertyList != null )
//just get the first proxy and break
String propertyList = props.getProperty( PROXY_LIST );
if ( propertyList != null )
{
StringTokenizer tok = new StringTokenizer( propertyList, "," );
while ( tok.hasMoreTokens() )
{ {
StringTokenizer tok = new StringTokenizer( propertyList, "," );
while ( tok.hasMoreTokens() )
String key = tok.nextToken();
if ( StringUtils.isNotEmpty( key ) )
{ {
String key = tok.nextToken();
if ( StringUtils.isNotEmpty( key ) )
String host = getMandatoryProperty( props, "proxy." + key + ".host" );
int port = Integer.parseInt( getMandatoryProperty( props, "proxy." + key + ".port" ) );

// the username and password isn't required
String username = props.getProperty( "proxy." + key + ".username" );
String password = props.getProperty( "proxy." + key + ".password" );

if ( StringUtils.isNotEmpty( username ) )
{ {
String host = getMandatoryProperty( props, "proxy." + key + ".host" );
int port = Integer.parseInt( getMandatoryProperty( props, "proxy." + key + ".port" ) );

// the username and password isn't required
String username = props.getProperty( "proxy." + key + ".username" );
String password = props.getProperty( "proxy." + key + ".password" );

if ( StringUtils.isNotEmpty( username ) )
{
config.setHttpProxy( host, port, username, password );
}
else
{
config.setHttpProxy( host, port );
}

//accept only one proxy configuration
break;
config.setHttpProxy( host, port, username, password );
} }
else
{
config.setHttpProxy( host, port );
}

//accept only one proxy configuration
break;
} }
} }
} }


List repositories = new ArrayList(); List repositories = new ArrayList();
{ //get the remote repository list
String repoList = getMandatoryProperty( props, REPO_LIST );


StringTokenizer tok = new StringTokenizer( repoList, "," );
while ( tok.hasMoreTokens() )
{
String key = tok.nextToken();
//get the remote repository list
String repoList = getMandatoryProperty( props, REPO_LIST );


Properties repoProps = getSubset( props, "repo." + key + "." );
String url = getMandatoryProperty( props, "repo." + key + ".url" );
String proxyKey = repoProps.getProperty( "proxy" );
StringTokenizer tok = new StringTokenizer( repoList, "," );
while ( tok.hasMoreTokens() )
{
String key = tok.nextToken();


boolean cacheFailures =
Boolean.valueOf( repoProps.getProperty( "cache.failures", "false" ) ).booleanValue();
boolean hardFail = Boolean.valueOf( repoProps.getProperty( "hardfail", "true" ) ).booleanValue();
long cachePeriod = Long.parseLong( repoProps.getProperty( "cache.period", "0" ) );
Properties repoProps = getSubset( props, "repo." + key + "." );
String url = getMandatoryProperty( props, "repo." + key + ".url" );
String proxyKey = repoProps.getProperty( "proxy" );


ProxyRepository repository =
new ProxyRepository( key, url, new DefaultRepositoryLayout(), cacheFailures, cachePeriod );
boolean cacheFailures =
Boolean.valueOf( repoProps.getProperty( "cache.failures", "false" ) ).booleanValue();
boolean hardFail = Boolean.valueOf( repoProps.getProperty( "hardfail", "true" ) ).booleanValue();
long cachePeriod = Long.parseLong( repoProps.getProperty( "cache.period", "0" ) );


repository.setHardfail( hardFail );
ProxyRepository repository =
new ProxyRepository( key, url, new DefaultRepositoryLayout(), cacheFailures, cachePeriod );


if ( StringUtils.isNotEmpty( proxyKey ) )
{
repository.setProxied( true );
}
repository.setHardfail( hardFail );


repositories.add( repository );
if ( StringUtils.isNotEmpty( proxyKey ) )
{
repository.setProxied( true );
} }

repositories.add( repository );
} }

config.setRepositories( repositories ); config.setRepositories( repositories );


validateDirectories( config ); validateDirectories( config );
private String getMandatoryProperty( Properties props, String key ) private String getMandatoryProperty( Properties props, String key )
throws ValidationException throws ValidationException
{ {
final String value = props.getProperty( key );
String value = props.getProperty( key );


if ( value == null ) if ( value == null )
{ {

+ 1
- 1
maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java Zobrazit soubor

proxyInfo.setHost( host ); proxyInfo.setHost( host );
proxyInfo.setPort( port ); proxyInfo.setPort( port );


setHttpProxy( proxyInfo );
httpProxy = proxyInfo;
} }


public void setHttpProxy( String host, int port, String username, String password ) public void setHttpProxy( String host, int port, String username, String password )

+ 2
- 2
maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ValidationException.java Zobrazit soubor

package org.apache.maven.repository.proxy.configuration; package org.apache.maven.repository.proxy.configuration;


/* /*
* Copyright 2003-2004 The Apache Software Foundation.
* Copyright 2005-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,

+ 5
- 5
maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/repository/ProxyRepository.java Zobrazit soubor

extends DefaultArtifactRepository extends DefaultArtifactRepository
{ {
// zero caches forever // zero caches forever
private long cachePeriod = 0;
private long cachePeriod;


private boolean cacheFailures = false;
private boolean cacheFailures;


private boolean hardfail = true; private boolean hardfail = true;


private boolean proxied = false;
private boolean proxied;


public ProxyRepository( String id, String url, ArtifactRepositoryLayout layout, boolean cacheFailures, public ProxyRepository( String id, String url, ArtifactRepositoryLayout layout, boolean cacheFailures,
long cachePeriod ) long cachePeriod )
{ {
this( id, url, layout ); this( id, url, layout );


setCacheFailures( cacheFailures );
this.cacheFailures = cacheFailures;


setCachePeriod( cachePeriod );
this.cachePeriod = cachePeriod;
} }


public ProxyRepository( String id, String url, ArtifactRepositoryLayout layout ) public ProxyRepository( String id, String url, ArtifactRepositoryLayout layout )

+ 12
- 12
maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/DefaultProxyManagerTest.java Zobrazit soubor

package org.apache.maven.repository.proxy; package org.apache.maven.repository.proxy;


import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.repository.proxy.configuration.ProxyConfiguration;
import org.apache.maven.repository.proxy.repository.ProxyRepository;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;

import java.io.File;

/* /*
* Copyright 2005-2006 The Apache Software Foundation. * Copyright 2005-2006 The Apache Software Foundation.
* *
* limitations under the License. * limitations under the License.
*/ */


import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.repository.proxy.configuration.ProxyConfiguration;
import org.apache.maven.repository.proxy.repository.ProxyRepository;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;

import java.io.File;

/** /**
* @author Edwin Punzalan * @author Edwin Punzalan
*/ */
file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) ); file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );


//test cache //test cache
file = proxy.get( "/commons-logging/commons-logging/1.0/commons-logging-1.0.jar" );
proxy.get( "/commons-logging/commons-logging/1.0/commons-logging-1.0.jar" );


try try
{ {
file = proxy.get( "/commons-logging/commons-logging/2.0/commons-logging-2.0.jar" );
proxy.get( "/commons-logging/commons-logging/2.0/commons-logging-2.0.jar" );
fail( "Expected ResourceDoesNotExistException exception not thrown" ); fail( "Expected ResourceDoesNotExistException exception not thrown" );
} }
catch ( ResourceDoesNotExistException e ) catch ( ResourceDoesNotExistException e )

+ 2
- 2
maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/LegacyProxyManagerTest.java Zobrazit soubor

file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) ); file.getAbsolutePath().startsWith( proxy.getConfiguration().getRepositoryCachePath() ) );


//test cache //test cache
file = proxy.get( "/commons-logging/jars/commons-logging-1.0.jar" );
proxy.get( "/commons-logging/jars/commons-logging-1.0.jar" );


try try
{ {
file = proxy.get( "/commons-logging/jars/commons-logging-2.0.jar" );
proxy.get( "/commons-logging/jars/commons-logging-2.0.jar" );
fail( "Expected ResourceDoesNotExistException exception not thrown" ); fail( "Expected ResourceDoesNotExistException exception not thrown" );
} }
catch ( ResourceDoesNotExistException e ) catch ( ResourceDoesNotExistException e )

+ 27
- 43
maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/MavenProxyPropertyLoaderTest.java Zobrazit soubor

import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator;




/** /**
public class MavenProxyPropertyLoaderTest public class MavenProxyPropertyLoaderTest
extends PlexusTestCase extends PlexusTestCase
{ {
private static final int DEFAULT_CACHE_PERIOD = 3600;

public void testLoadValidMavenProxyConfiguration() public void testLoadValidMavenProxyConfiguration()
throws ValidationException, IOException throws ValidationException, IOException
{ {


assertEquals( "Count repositories", 4, config.getRepositories().size() ); assertEquals( "Count repositories", 4, config.getRepositories().size() );


int idx = 0;
for ( Iterator repos = config.getRepositories().iterator(); repos.hasNext(); )
{
idx++;

ProxyRepository repo = (ProxyRepository) repos.next();

//switch is made to check for ordering
switch ( idx )
{
case 1:
assertEquals( "Repository name not as expected", "local-repo", repo.getKey() );
assertEquals( "Repository url does not match its name", "file://target", repo.getUrl() );
assertEquals( "Repository cache period check failed", 0, repo.getCachePeriod() );
assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
break;
case 2:
assertEquals( "Repository name not as expected", "www-ibiblio-org", repo.getKey() );
assertEquals( "Repository url does not match its name", "http://www.ibiblio.org/maven2",
repo.getUrl() );
assertEquals( "Repository cache period check failed", 3600, repo.getCachePeriod() );
assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
break;
case 3:
assertEquals( "Repository name not as expected", "dist-codehaus-org", repo.getKey() );
assertEquals( "Repository url does not match its name", "http://dist.codehaus.org",
repo.getUrl() );
assertEquals( "Repository cache period check failed", 3600, repo.getCachePeriod() );
assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );
break;
case 4:
assertEquals( "Repository name not as expected", "private-example-com", repo.getKey() );
assertEquals( "Repository url does not match its name", "http://private.example.com/internal",
repo.getUrl() );
assertEquals( "Repository cache period check failed", 3600, repo.getCachePeriod() );
assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
break;
default:
fail( "Unexpected order count" );
}
}
ProxyRepository repo = (ProxyRepository) config.getRepositories().get( 0 );
assertEquals( "Repository name not as expected", "local-repo", repo.getKey() );
assertEquals( "Repository url does not match its name", "file://target", repo.getUrl() );
assertEquals( "Repository cache period check failed", 0, repo.getCachePeriod() );
assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );

repo = (ProxyRepository) config.getRepositories().get( 1 );
assertEquals( "Repository name not as expected", "www-ibiblio-org", repo.getKey() );
assertEquals( "Repository url does not match its name", "http://www.ibiblio.org/maven2", repo.getUrl() );
assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getCachePeriod() );
assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );

repo = (ProxyRepository) config.getRepositories().get( 2 );
assertEquals( "Repository name not as expected", "dist-codehaus-org", repo.getKey() );
assertEquals( "Repository url does not match its name", "http://dist.codehaus.org", repo.getUrl() );
assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getCachePeriod() );
assertTrue( "Repository failure caching check failed", repo.isCacheFailures() );

repo = (ProxyRepository) config.getRepositories().get( 3 );
assertEquals( "Repository name not as expected", "private-example-com", repo.getKey() );
assertEquals( "Repository url does not match its name", "http://private.example.com/internal",
repo.getUrl() );
assertEquals( "Repository cache period check failed", DEFAULT_CACHE_PERIOD, repo.getCachePeriod() );
assertFalse( "Repository failure caching check failed", repo.isCacheFailures() );
} }
//make sure to delete the test directory after tests
finally finally
{ {
//make sure to delete the test directory after tests
FileUtils.deleteDirectory( "target/remote-repo1" ); FileUtils.deleteDirectory( "target/remote-repo1" );
} }
} }

+ 9
- 5
maven-repository-proxy/src/test/java/org/apache/maven/repository/proxy/configuration/ProxyConfigurationTest.java Zobrazit soubor

{ {
private ProxyConfiguration config; private ProxyConfiguration config;
private static final int DEFAULT_CACHE_PERIOD = 3600;
private static final int DEFAULT_PORT = 80;
protected void setUp() protected void setUp()
throws Exception throws Exception
{ {
ArtifactRepositoryLayout legacyLayout = new LegacyRepositoryLayout(); ArtifactRepositoryLayout legacyLayout = new LegacyRepositoryLayout();
ProxyRepository repo2 = new ProxyRepository( "repo2", "http://www.ibiblio.org/maven", legacyLayout ); ProxyRepository repo2 = new ProxyRepository( "repo2", "http://www.ibiblio.org/maven", legacyLayout );
repo2.setCacheFailures( false ); repo2.setCacheFailures( false );
repo2.setCachePeriod( 3600 );
repo2.setCachePeriod( DEFAULT_CACHE_PERIOD );
repo2.setProxied( true ); repo2.setProxied( true );
config.setHttpProxy( "some.local.proxy", 80, "username", "password" );
config.setHttpProxy( "some.local.proxy", DEFAULT_PORT, "username", "password" );
config.addRepository( repo2 ); config.addRepository( repo2 );
assertEquals( 2, config.getRepositories().size() ); assertEquals( 2, config.getRepositories().size() );
assertEquals( "http://www.ibiblio.org/maven", repo.getUrl() ); assertEquals( "http://www.ibiblio.org/maven", repo.getUrl() );
assertFalse( repo.isCacheFailures() ); assertFalse( repo.isCacheFailures() );
assertTrue( repo.isHardfail() ); assertTrue( repo.isHardfail() );
assertEquals( 3600, repo.getCachePeriod() );
assertEquals( DEFAULT_CACHE_PERIOD, repo.getCachePeriod() );
assertEquals( repo2, repo ); assertEquals( repo2, repo );
assertTrue( repo.isProxied() ); assertTrue( repo.isProxied() );
ProxyInfo proxyInfo = config.getHttpProxy(); ProxyInfo proxyInfo = config.getHttpProxy();
assertNotNull( proxyInfo ); assertNotNull( proxyInfo );
assertEquals( "some.local.proxy", proxyInfo.getHost() ); assertEquals( "some.local.proxy", proxyInfo.getHost() );
assertEquals( 80, proxyInfo.getPort() );
assertEquals( DEFAULT_PORT, proxyInfo.getPort() );
assertEquals( "username", proxyInfo.getUserName() ); assertEquals( "username", proxyInfo.getUserName() );
assertEquals( "password", proxyInfo.getPassword() ); assertEquals( "password", proxyInfo.getPassword() );
repositories.add( new ProxyRepository( "repo", "url", defLayout ) ); repositories.add( new ProxyRepository( "repo", "url", defLayout ) );
fail( "Expected UnsupportedOperationException not thrown." ); fail( "Expected UnsupportedOperationException not thrown." );
} }
catch ( java.lang.UnsupportedOperationException e )
catch ( UnsupportedOperationException e )
{ {
assertTrue( true ); assertTrue( true );
} }

+ 1
- 3
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java Zobrazit soubor

* @param key the object to map the valued object * @param key the object to map the valued object
* @param value the object to cache * @param value the object to cache
*/ */
public Object put( Object key, Object value )
public void put( Object key, Object value )
{ {
Object old = null; Object old = null;


} }


manageCache(); manageCache();

return old;
} }


/** /**

+ 5
- 0
maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java Zobrazit soubor

*/ */
public class ArtifactUtils public class ArtifactUtils
{ {
private ArtifactUtils()
{
}

/** /**
* Method used to build an artifact and then set its repository and file fields with the proper values * Method used to build an artifact and then set its repository and file fields with the proper values
* *
// contains artifactId, version, classifier, and extension. // contains artifactId, version, classifier, and extension.
String avceGlob = tokens.nextToken(); String avceGlob = tokens.nextToken();


//noinspection CollectionDeclaredAsConcreteClass
LinkedList avceTokenList = new LinkedList(); LinkedList avceTokenList = new LinkedList();


StringTokenizer avceTokenizer = new StringTokenizer( avceGlob, "-" ); StringTokenizer avceTokenizer = new StringTokenizer( avceGlob, "-" );

+ 11
- 11
maven-repository-utils/src/main/java/org/apache/maven/repository/digest/DefaultDigester.java Zobrazit soubor

package org.apache.maven.repository.digest; package org.apache.maven.repository.digest;


import org.codehaus.plexus.util.IOUtil;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/* /*
* Copyright 2005-2006 The Apache Software Foundation. * Copyright 2005-2006 The Apache Software Foundation.
* *
* limitations under the License. * limitations under the License.
*/ */


import org.codehaus.plexus.util.IOUtil;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/** /**
* Create a digest for a file. * Create a digest for a file.
* *

+ 16
- 0
maven-repository-utils/src/test/java/org/apache/maven/repository/ArtifactUtilsLegacyTest.java Zobrazit soubor

package org.apache.maven.repository; package org.apache.maven.repository;


/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.factory.ArtifactFactory;
import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.PlexusTestCase;

+ 16
- 0
maven-repository-webapp/pom.xml Zobrazit soubor

<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

+ 2
- 1
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java Zobrazit soubor

*/ */
import com.opensymphony.xwork.Action; import com.opensymphony.xwork.Action;
import org.apache.maven.repository.manager.web.job.DiscovererScheduler;
import org.apache.maven.repository.manager.web.execution.DiscovererExecution; import org.apache.maven.repository.manager.web.execution.DiscovererExecution;
import org.apache.maven.repository.manager.web.job.DiscovererScheduler;
/** /**
* This is the Action class of index.jsp, which is the initial page of the web application. * This is the Action class of index.jsp, which is the initial page of the web application.
} }
catch ( Exception e ) catch ( Exception e )
{ {
// TODO: better exception handling!
e.printStackTrace(); e.printStackTrace();
return ERROR; return ERROR;
} }

+ 16
- 0
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/GeneralSearchAction.java Zobrazit soubor

package org.apache.maven.repository.manager.web.action; package org.apache.maven.repository.manager.web.action;
/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.opensymphony.xwork.Action; import com.opensymphony.xwork.Action;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;

+ 2
- 3
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/PackageSearchAction.java Zobrazit soubor

import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.repository.indexing.ArtifactRepositoryIndex; import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
import org.apache.maven.repository.indexing.DefaultRepositoryIndexSearcher;
import org.apache.maven.repository.indexing.RepositoryIndex;
import org.apache.maven.repository.indexing.RepositoryIndexException; import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.repository.indexing.RepositoryIndexSearchException; import org.apache.maven.repository.indexing.RepositoryIndexSearchException;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.indexing.RepositoryIndexSearchLayer; import org.apache.maven.repository.indexing.RepositoryIndexSearchLayer;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.indexing.query.SinglePhraseQuery; import org.apache.maven.repository.indexing.query.SinglePhraseQuery;
import org.apache.maven.repository.manager.web.job.Configuration; import org.apache.maven.repository.manager.web.job.Configuration;
import org.apache.maven.repository.indexing.RepositoryIndex;


import java.io.File; import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;

+ 29
- 14
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/RepositoryBrowseAction.java Zobrazit soubor

package org.apache.maven.repository.manager.web.action; package org.apache.maven.repository.manager.web.action;
/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.opensymphony.xwork.Action; import com.opensymphony.xwork.Action;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
/** /**
private String group; private String group;
private TreeMap artifactMap;
private Map artifactMap;
private String folder; private String folder;
private int idx; private int idx;
public String execute() public String execute()
throws Exception
{ {
// TODO! fix hardcoded path
String path = "E:/jeprox/maven-repository-manager/trunk/maven-repository-discovery/src/test/repository"; String path = "E:/jeprox/maven-repository-manager/trunk/maven-repository-discovery/src/test/repository";
ArtifactRepository repository = ArtifactRepository repository =
artifactMap = new TreeMap(); artifactMap = new TreeMap();
String groupId;
while ( iterator.hasNext() ) while ( iterator.hasNext() )
{ {
Artifact artifact = (Artifact) iterator.next(); Artifact artifact = (Artifact) iterator.next();
groupId = artifact.getGroupId();
String groupId = artifact.getGroupId();
String key = groupId.replace( '.', '/' ) + "/" + artifact.getArtifactId() + "/" + artifact.getVersion(); String key = groupId.replace( '.', '/' ) + "/" + artifact.getArtifactId() + "/" + artifact.getVersion();
ArrayList artifactList;
List artifactList;
if ( artifactMap.containsKey( key ) ) if ( artifactMap.containsKey( key ) )
{ {
artifactList = (ArrayList) artifactMap.get( key );
artifactList = (List) artifactMap.get( key );
} }
else else
{ {
} }
//set the index for folder level to be displayed //set the index for folder level to be displayed
setIdx( 1 );
idx = 1;
setFolder( "" );
folder = "";
return SUCCESS; return SUCCESS;
} }
// TODO! is this method needed?
public String doEdit() public String doEdit()
throws Exception
{ {
setIdx( getIdx() + 1 );
idx = idx + 1;
//set folder to "" if we are at the root directory //set folder to "" if we are at the root directory
if ( getIdx() == 1 )
if ( idx == 1 )
{ {
setFolder( "" );
folder = "";
} }
return SUCCESS; return SUCCESS;
} }
public TreeMap getArtifactMap()
public Map getArtifactMap()
{ {
return artifactMap; return artifactMap;
} }

+ 20
- 59
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java Zobrazit soubor

* limitations under the License. * limitations under the License.
*/ */


import org.apache.lucene.index.IndexReader;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory; import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.model.Model;
import org.apache.maven.repository.discovery.ArtifactDiscoverer;
import org.apache.maven.repository.discovery.MetadataDiscoverer;
import org.apache.maven.repository.indexing.ArtifactRepositoryIndex; import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
import org.apache.maven.repository.indexing.MetadataRepositoryIndex; import org.apache.maven.repository.indexing.MetadataRepositoryIndex;
import org.apache.maven.repository.indexing.PomRepositoryIndex; import org.apache.maven.repository.indexing.PomRepositoryIndex;
import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory; import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.manager.web.job.Configuration; import org.apache.maven.repository.manager.web.job.Configuration;
import org.apache.maven.repository.discovery.ArtifactDiscoverer;
import org.apache.maven.repository.discovery.MetadataDiscoverer;
import org.apache.maven.model.Model;
import org.apache.lucene.index.IndexReader;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;


import java.util.List;
import java.util.Iterator;
import java.util.Properties;
import java.io.File; import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;


/** /**
* This is the class that executes the discoverer and indexer. * This is the class that executes the discoverer and indexer.


private ArtifactRepositoryLayout layout; private ArtifactRepositoryLayout layout;


private Properties props;

private String indexPath; private String indexPath;


private String blacklistedPatterns; private String blacklistedPatterns;
public void executeDiscovererIfIndexDoesNotExist() public void executeDiscovererIfIndexDoesNotExist()
throws MalformedURLException, RepositoryIndexException throws MalformedURLException, RepositoryIndexException
{ {
props = config.getProperties();
Properties props = config.getProperties();
indexPath = props.getProperty( "index.path" ); indexPath = props.getProperty( "index.path" );


File indexDir = new File( indexPath ); File indexDir = new File( indexPath );
boolean isExisting;
boolean isExisting = false;


if ( IndexReader.indexExists( indexDir ) ) if ( IndexReader.indexExists( indexDir ) )
{ {
isExisting = true; isExisting = true;
} }
else if ( !indexDir.exists() )
{
isExisting = false;
}
else
{
isExisting = false;
}


if ( !isExisting ) if ( !isExisting )
{ {
public void executeDiscoverer() public void executeDiscoverer()
throws MalformedURLException, RepositoryIndexException throws MalformedURLException, RepositoryIndexException
{ {
props = config.getProperties();
Properties props = config.getProperties();
indexPath = props.getProperty( "index.path" ); indexPath = props.getProperty( "index.path" );
layout = config.getLayout(); layout = config.getLayout();
blacklistedPatterns = props.getProperty( "blacklist.patterns" ); blacklistedPatterns = props.getProperty( "blacklist.patterns" );
includeSnapshots = new Boolean( props.getProperty( "include.snapshots" ) ).booleanValue();
convertSnapshots = new Boolean( props.getProperty( "convert.snapshots" ) ).booleanValue();
includeSnapshots = Boolean.valueOf( props.getProperty( "include.snapshots" ) ).booleanValue();
convertSnapshots = Boolean.valueOf( props.getProperty( "convert.snapshots" ) ).booleanValue();


try try
{ {
} }


getLogger().info( "[DiscovererExecution] Started discovery and indexing.." ); getLogger().info( "[DiscovererExecution] Started discovery and indexing.." );
if ( props.getProperty( "layout" ).equals( "default" ) )
if ( "default".equals( props.getProperty( "layout" ) ) )
{ {
executeDiscovererInDefaultRepo(); executeDiscovererInDefaultRepo();
} }
else if ( props.getProperty( "layout" ).equals( "legacy" ) )
else if ( "legacy".equals( props.getProperty( "layout" ) ) )
{ {
executeDiscovererInLegacyRepo(); executeDiscovererInLegacyRepo();
} }
for ( Iterator iter = artifacts.iterator(); iter.hasNext(); ) for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
{ {
Artifact artifact = (Artifact) iter.next(); Artifact artifact = (Artifact) iter.next();
try
{
artifactIndex.indexArtifact( artifact );
}
catch ( Exception e )
{
if ( e instanceof RepositoryIndexException )
{
throw (RepositoryIndexException) e;
}
}
artifactIndex.indexArtifact( artifact );


if ( artifactIndex.isOpen() ) if ( artifactIndex.isOpen() )
{ {
for ( Iterator iter = metadataList.iterator(); iter.hasNext(); ) for ( Iterator iter = metadataList.iterator(); iter.hasNext(); )
{ {
RepositoryMetadata repoMetadata = (RepositoryMetadata) iter.next(); RepositoryMetadata repoMetadata = (RepositoryMetadata) iter.next();
try
{
metadataIndex.index( repoMetadata );
}
catch ( Exception e )
{
if ( e instanceof RepositoryIndexException )
{
throw (RepositoryIndexException) e;
}
}
metadataIndex.index( repoMetadata );

if ( metadataIndex.isOpen() ) if ( metadataIndex.isOpen() )
{ {
metadataIndex.optimize(); metadataIndex.optimize();
for ( Iterator iter = models.iterator(); iter.hasNext(); ) for ( Iterator iter = models.iterator(); iter.hasNext(); )
{ {
Model model = (Model) iter.next(); Model model = (Model) iter.next();
try
{
pomIndex.indexPom( model );
}
catch ( Exception e )
{
if ( e instanceof RepositoryIndexException )
{
throw (RepositoryIndexException) e;
}
}
pomIndex.indexPom( model );


if ( pomIndex.isOpen() ) if ( pomIndex.isOpen() )
{ {

+ 8
- 7
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/Configuration.java Zobrazit soubor

package org.apache.maven.repository.manager.web.job; package org.apache.maven.repository.manager.web.job;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import java.util.Properties;
/* /*
* Copyright 2005-2006 The Apache Software Foundation. * Copyright 2005-2006 The Apache Software Foundation.
* *
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import java.util.Properties;
/** /**
* This class contains the configuration values to be used by the scheduler * This class contains the configuration values to be used by the scheduler
*/ */

+ 3
- 19
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererJob.java Zobrazit soubor

* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import org.apache.maven.model.Model;
import org.apache.maven.repository.discovery.ArtifactDiscoverer;
import org.apache.maven.repository.discovery.DefaultArtifactDiscoverer;
import org.apache.maven.repository.discovery.DefaultMetadataDiscoverer;
import org.apache.maven.repository.discovery.LegacyArtifactDiscoverer;
import org.apache.maven.repository.discovery.MetadataDiscoverer;
import org.apache.maven.repository.indexing.ArtifactRepositoryIndex;
import org.apache.maven.repository.indexing.MetadataRepositoryIndex;
import org.apache.maven.repository.indexing.PomRepositoryIndex;
import org.apache.maven.repository.indexing.RepositoryIndexException; import org.apache.maven.repository.indexing.RepositoryIndexException;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.manager.web.execution.DiscovererExecution; import org.apache.maven.repository.manager.web.execution.DiscovererExecution;
import org.codehaus.plexus.scheduler.AbstractJob; import org.codehaus.plexus.scheduler.AbstractJob;
import org.quartz.JobDataMap; import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException; import org.quartz.JobExecutionException;
import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.List;
/** /**
* This class is the discoverer job that is executed by the scheduler. * This class is the discoverer job that is executed by the scheduler.
{ {
public static final String ROLE = DiscovererJob.class.getName(); public static final String ROLE = DiscovererJob.class.getName();
public static String MAP_DISCOVERER_EXECUTION = "EXECUTION";
public static final String MAP_DISCOVERER_EXECUTION = "EXECUTION";
/** /**
* Execute the discoverer and the indexer. * Execute the discoverer and the indexer.
} }
catch ( RepositoryIndexException e ) catch ( RepositoryIndexException e )
{ {
// TODO!
e.printStackTrace(); e.printStackTrace();
} }
catch ( MalformedURLException me ) catch ( MalformedURLException me )
{ {
// TODO!
me.printStackTrace(); me.printStackTrace();
} }

+ 7
- 18
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/job/DiscovererScheduler.java Zobrazit soubor

* limitations under the License. * limitations under the License.
*/ */
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.text.ParseException;
import java.util.Properties;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory;
import org.apache.maven.repository.discovery.ArtifactDiscoverer;
import org.apache.maven.repository.discovery.MetadataDiscoverer;
import org.apache.maven.repository.indexing.RepositoryIndexingFactory;
import org.apache.maven.repository.manager.web.execution.DiscovererExecution; import org.apache.maven.repository.manager.web.execution.DiscovererExecution;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.scheduler.AbstractJob;
import org.codehaus.plexus.scheduler.Scheduler; import org.codehaus.plexus.scheduler.Scheduler;
import org.quartz.CronTrigger; import org.quartz.CronTrigger;
import org.quartz.JobDataMap; import org.quartz.JobDataMap;
import org.quartz.JobDetail; import org.quartz.JobDetail;
import org.quartz.SchedulerException; import org.quartz.SchedulerException;
import java.text.ParseException;
import java.util.Properties;
/** /**
* This class sets the job to be executed in the plexus-quartz scheduler * This class sets the job to be executed in the plexus-quartz scheduler
* *
*/ */
private Scheduler scheduler; private Scheduler scheduler;
private Properties props;
/** /**
* @plexus.requirement * @plexus.requirement
*/ */
/** /**
* Method that sets the schedule in the plexus-quartz scheduler * Method that sets the schedule in the plexus-quartz scheduler
* *
* @throws IOException
* @throws ParseException * @throws ParseException
* @throws SchedulerException * @throws SchedulerException
*/ */
public void setSchedule() public void setSchedule()
throws IOException, ParseException, SchedulerException
throws ParseException, SchedulerException
{ {
props = config.getProperties();
Properties props = config.getProperties();
JobDetail jobDetail = new JobDetail( "discovererJob", "DISCOVERER", DiscovererJob.class ); JobDetail jobDetail = new JobDetail( "discovererJob", "DISCOVERER", DiscovererJob.class );
JobDataMap dataMap = new JobDataMap(); JobDataMap dataMap = new JobDataMap();
dataMap.put( DiscovererJob.LOGGER, getLogger() );
dataMap.put( AbstractJob.LOGGER, getLogger() );
dataMap.put( DiscovererJob.MAP_DISCOVERER_EXECUTION, execution ); dataMap.put( DiscovererJob.MAP_DISCOVERER_EXECUTION, execution );
jobDetail.setJobDataMap( dataMap ); jobDetail.setJobDataMap( dataMap );

+ 16
- 0
maven-repository-webapp/src/main/webapp/WEB-INF/decorators.xml Zobrazit soubor

<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<decorators defaultdir="/WEB-INF/jsp/decorators"> <decorators defaultdir="/WEB-INF/jsp/decorators">
<decorator name="default" page="default.jsp"> <decorator name="default" page="default.jsp">
<pattern>/*</pattern> <pattern>/*</pattern>

+ 36
- 16
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/browse.jsp Zobrazit soubor

<%--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
--%>
<%@ taglib uri="webwork" prefix="ww" %> <%@ taglib uri="webwork" prefix="ww" %>
<html> <html>
<body> <body>
<h3><a href="<ww:url value="browse!edit.action"><ww:param name="idx" value="0"/></ww:url>">basedir</a> / <h3><a href="<ww:url value="browse!edit.action"><ww:param name="idx" value="0"/></ww:url>">basedir</a> /
<ww:set name="previousFolder" value="''"/>
<ww:set name="counter" value="0"/>
<ww:set name="previousFolder" value="''" />
<ww:set name="counter" value="0" />
<ww:if test="folder != ''"> <ww:if test="folder != ''">
<ww:set name="folderHeader" value="folder.split('/')"/>
<ww:set name="folderHeader" value="folder.split('/')" />
<ww:iterator value="#folderHeader"> <ww:iterator value="#folderHeader">
<ww:set name="counter" value="#counter + 1"/>
<ww:set name="counter" value="#counter + 1" />
<ww:if test="#previousFolder == ''"> <ww:if test="#previousFolder == ''">
<ww:set name="previousFolder" value="top"/>
<ww:set name="previousFolder" value="top" />
</ww:if> </ww:if>
<ww:else> <ww:else>
<ww:set name="previousFolder" value="#previousFolder + '/' + top"/>
<ww:set name="previousFolder" value="#previousFolder + '/' + top" />
</ww:else> </ww:else>
<ww:if test="idx > (#counter + 1)"><a href="<ww:url value="browse!edit.action"><ww:param name="idx"><ww:property <ww:if test="idx > (#counter + 1)"><a href="<ww:url value="browse!edit.action"><ww:param name="idx"><ww:property
value="#counter"/></ww:param><ww:param name="folder"></ww:param></ww:url>"></ww:if><ww:property/></a> /
value="#counter" /></ww:param><ww:param name="folder"></ww:param></ww:url>"></ww:if><ww:property /></a> /
</ww:iterator> </ww:iterator>
</ww:if> </ww:if>
</h3> </h3>
<br/>
<br />
<ww:set name="previousFolder" value="'the previous folder'"/> <ww:set name="previousFolder" value="'the previous folder'"/>
<ww:set name="in" value="idx" scope="page"/> <ww:set name="in" value="idx" scope="page"/>
<ww:if test="idx == 1 || (folder != '' and #groupName.startsWith(folder))"> <ww:if test="idx == 1 || (folder != '' and #groupName.startsWith(folder))">
<% <%
int ctr = 1; int ctr = 1;
%> %>
<ww:set name="groupFolder" value="#groupName.split('/')"/> <ww:set name="groupFolder" value="#groupName.split('/')"/>
<ww:iterator value="#groupFolder"> <ww:iterator value="#groupFolder">
<% <%
if (ctr == ((Integer)pageContext.getAttribute("in")).intValue()) { if (ctr == ((Integer)pageContext.getAttribute("in")).intValue()) {
%> %>
<ww:if test="top != #previousFolder"> <ww:if test="top != #previousFolder">
<ww:set name="previousFolder" value="top"/> <ww:set name="previousFolder" value="top"/>
</ww:iterator> </ww:iterator>
<ww:if test="folder != ''"> <ww:if test="folder != ''">
<ww:set name="previousFolder" value="''"/>
<ww:set name="artifactList" value="artifactMap.get(folder)"/>
<ww:set name="previousFolder" value="''" />
<ww:set name="artifactList" value="artifactMap.get(folder)" />
<ww:iterator value="#artifactList"> <ww:iterator value="#artifactList">
<table border="1"> <table border="1">
<tr align="left"> <tr align="left">
<th>Group ID</th> <th>Group ID</th>
<td><ww:property value="groupId"/></td>
<td><ww:property value="groupId" /></td>
</tr> </tr>
<tr align="left"> <tr align="left">
<th>Artifact ID</th> <th>Artifact ID</th>
<td><ww:property value="artifactId"/></td>
<td><ww:property value="artifactId" /></td>
</tr> </tr>
<tr align="left"> <tr align="left">
<th>Version</th> <th>Version</th>
<td><ww:property value="version"/></td>
<td><ww:property value="version" /></td>
</tr> </tr>
<tr align="left"> <tr align="left">
<th>Derivatives</th> <th>Derivatives</th>
<td><ww:property value="groupId"/></td>
<td><ww:property value="groupId" /></td>
</tr> </tr>
<tr align="left"> <tr align="left">
<th>Parent</th> <th>Parent</th>
<td><ww:property value="folder"/></td>
<td><ww:property value="folder" /></td>
</tr> </tr>
</table> </table>
<br/>
<br />
</ww:iterator> </ww:iterator>
</ww:if> </ww:if>
</body> </body>

+ 16
- 0
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp Zobrazit soubor

<%--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
--%>

<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %> <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<html> <html>
<head> <head>

+ 0
- 1
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/form.jspf Zobrazit soubor

~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and ~ See the License for the specific language governing permissions and
~ limitations under the License. ~ limitations under the License.
~
--%> --%>


<script type="text/javascript"> <script type="text/javascript">

+ 16
- 0
maven-repository-webapp/src/main/webapp/WEB-INF/jsp/index.jsp Zobrazit soubor

<%--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
--%>

<%@ taglib uri="webwork" prefix="ww" %> <%@ taglib uri="webwork" prefix="ww" %>
<html> <html>
<head> <head>

+ 16
- 0
maven-repository-webapp/src/main/webapp/WEB-INF/web.xml Zobrazit soubor

<!--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<!DOCTYPE web-app PUBLIC <!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" > "http://java.sun.com/dtd/web-app_2_3.dtd" >

+ 16
- 0
maven-repository-webapp/src/main/webapp/css/maven-base.css Zobrazit soubor

/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

body { body {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;

+ 16
- 0
maven-repository-webapp/src/main/webapp/css/maven-theme.css Zobrazit soubor

/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

body { body {
padding: 0px 0px 10px 0px; padding: 0px 0px 10px 0px;
} }

+ 16
- 0
maven-repository-webapp/src/main/webapp/css/print.css Zobrazit soubor

/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn { #banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn {
display: none !important; display: none !important;
} }

+ 16
- 0
maven-repository-webapp/src/main/webapp/css/site.css Zobrazit soubor

/*
* Copyright 2005-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#sidebar { #sidebar {
float: right; float: right;
font-size: small; font-size: small;

+ 16
- 0
maven-repository-webapp/src/main/webapp/index.jsp Zobrazit soubor

<%--
~ Copyright 2005-2006 The Apache Software Foundation.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
--%>

<%response.sendRedirect( request.getContextPath() + "/index.action" );%> <%response.sendRedirect( request.getContextPath() + "/index.action" );%>

Načítá se…
Zrušit
Uložit