Partial work against jpox database refactoring.

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@518686 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Joakim Erdfelt 2007-03-15 16:48:40 +00:00
parent 344fe5c34e
commit 7a5f50c9f6
63 changed files with 1988 additions and 2097 deletions

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.repository;
package org.apache.maven.archiva.common.utils;
/*
* Licensed to the Apache Software Foundation (ASF) under one

View File

@ -23,12 +23,9 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
@ -40,48 +37,6 @@ import java.util.List;
public abstract class AbstractArchivaCommonTestCase
extends PlexusTestCase
{
protected ArtifactRepository getLegacyRepository()
throws Exception
{
File repoBaseDir = new File( getBasedir(), "src/test/legacy-repository" );
ArtifactRepository repository = createRepository( repoBaseDir, "legacy" );
resetRepositoryState( repository );
return repository;
}
protected ArtifactRepository getDefaultRepository()
throws Exception
{
File repoBaseDir = new File( getBasedir(), "src/test/repository" );
ArtifactRepository repository = createRepository( repoBaseDir, "default" );
resetRepositoryState( repository );
return repository;
}
private void resetRepositoryState( ArtifactRepository repository )
throws IOException
{
File repoBaseDir = new File( repository.getBasedir() );
List tmpfiles = FileUtils.getFiles( repoBaseDir, ".*", "" );
for ( Iterator it = tmpfiles.iterator(); it.hasNext(); )
{
File hit = (File) it.next();
if ( hit.exists() )
{
if ( hit.isFile() )
{
hit.delete();
}
if ( hit.isDirectory() )
{
FileUtils.deleteDirectory( hit );
}
}
}
}
protected ArtifactRepository createRepository( File basedir, String layout )
throws Exception
{

View File

@ -36,7 +36,6 @@ public class AllTests
TestSuite suite = new TestSuite( "Test for org.apache.maven.archiva.common" );
//$JUnit-BEGIN$
suite.addTest( org.apache.maven.archiva.common.artifact.builder.AllTests.suite() );
suite.addTest( org.apache.maven.archiva.common.consumers.AllTests.suite() );
suite.addTest( org.apache.maven.archiva.common.utils.AllTests.suite() );
//$JUnit-END$
return suite;

61
archiva-consumer-api/pom.xml Executable file
View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you 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"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>archiva-consumer-api</artifactId>
<name>Archiva Consumer API</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-model</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -19,8 +19,8 @@ package org.apache.maven.archiva.common.consumers;
* under the License.
*/
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.util.Collections;
@ -41,7 +41,7 @@ public abstract class AbstractConsumer
*/
protected ArtifactFactory artifactFactory;
protected ArtifactRepository repository;
protected ArchivaRepository repository;
protected AbstractConsumer()
{
@ -53,7 +53,7 @@ public abstract class AbstractConsumer
return Collections.EMPTY_LIST;
}
public boolean init( ArtifactRepository repository )
public boolean init( ArchivaRepository repository )
{
this.repository = repository;
return isEnabled();

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -20,6 +20,7 @@ package org.apache.maven.archiva.common.consumers;
*/
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.artifact.repository.ArtifactRepository;
import java.util.List;
@ -51,7 +52,7 @@ public interface Consumer
* @return true if the repository is valid for this consumer. false will result in consumer being disabled
* for the provided repository.
*/
public boolean init( ArtifactRepository repository );
public boolean init( ArchivaRepository repository );
/**
* Get the List of excluded file patterns for this consumer.

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -24,8 +24,8 @@ import org.apache.maven.archiva.common.artifact.builder.DefaultLayoutArtifactBui
import org.apache.maven.archiva.common.artifact.builder.LayoutArtifactBuilder;
import org.apache.maven.archiva.common.artifact.builder.LegacyLayoutArtifactBuilder;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
@ -66,7 +66,7 @@ public abstract class GenericArtifactConsumer
private String layoutId = "default";
public boolean init( ArtifactRepository repository )
public boolean init( ArchivaRepository repository )
{
this.artifactBuilders.clear();
this.artifactBuilders.put( "default", new DefaultLayoutArtifactBuilder( artifactFactory ) );
@ -122,7 +122,7 @@ public abstract class GenericArtifactConsumer
LayoutArtifactBuilder builder = (LayoutArtifactBuilder) artifactBuilders.get( layoutId );
Artifact artifact = builder.build( file.getRelativePath() );
artifact.setRepository( repository );
// artifact.setRepository( repository );
artifact.setFile( file );
return artifact;

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one

View File

@ -0,0 +1,152 @@
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.archiva.model.ArchivaRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* AbstractConsumerTestCase
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class AbstractConsumerTestCase extends PlexusTestCase
{
protected ArchivaRepository getLegacyRepository() throws Exception
{
File repoBaseDir = new File( getBasedir(), "src/test/legacy-repository" );
ArchivaRepository repository = createRepository( repoBaseDir, "legacy" );
resetRepositoryState( repository );
return repository;
}
protected ArchivaRepository getDefaultRepository() throws Exception
{
File repoBaseDir = new File( getBasedir(), "src/test/repository" );
ArchivaRepository repository = createRepository( repoBaseDir, "default" );
resetRepositoryState( repository );
return repository;
}
private void resetRepositoryState( ArchivaRepository repository ) throws IOException
{
File repoBaseDir = new File( repository.getRepositoryURL().getPath() );
List tmpfiles = FileUtils.getFiles( repoBaseDir, ".*", "" );
for ( Iterator it = tmpfiles.iterator(); it.hasNext(); )
{
File hit = (File) it.next();
if ( hit.exists() )
{
if ( hit.isFile() )
{
hit.delete();
}
if ( hit.isDirectory() )
{
FileUtils.deleteDirectory( hit );
}
}
}
}
protected ArchivaRepository createRepository( File basedir, String layout ) throws Exception
{
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, layout );
ArchivaRepository repo = new ArchivaRepository();
repo.setId( "discoveryRepo" );
repo.setUrl( "file://" + basedir );
repo.setLayout( repoLayout );
return repo;
}
public List getLegacyLayoutArtifactPaths()
{
List files = new ArrayList();
files.add( "invalid/jars/1.0/invalid-1.0.jar" );
files.add( "invalid/jars/invalid-1.0.rar" );
files.add( "invalid/jars/invalid.jar" );
files.add( "invalid/invalid-1.0.jar" );
files.add( "javax.sql/jars/jdbc-2.0.jar" );
files.add( "org.apache.maven/jars/some-ejb-1.0-client.jar" );
files.add( "org.apache.maven/jars/testing-1.0.jar" );
files.add( "org.apache.maven/jars/testing-1.0-sources.jar" );
files.add( "org.apache.maven/jars/testing-UNKNOWN.jar" );
files.add( "org.apache.maven/jars/testing-1.0.zip" );
files.add( "org.apache.maven/jars/testing-1.0-20050611.112233-1.jar" );
files.add( "org.apache.maven/jars/testing-1.0.tar.gz" );
files.add( "org.apache.maven.update/jars/test-not-updated-1.0.jar" );
files.add( "org.apache.maven.update/jars/test-updated-1.0.jar" );
return files;
}
public List getDefaultLayoutArtifactPaths()
{
List files = new ArrayList();
files.add( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar" );
files.add( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar" );
files.add( "invalid/invalid/1.0/invalid-1.0b.jar" );
files.add( "invalid/invalid/1.0/invalid-2.0.jar" );
files.add( "invalid/invalid-1.0.jar" );
files.add( "org/apache/maven/test/1.0-SNAPSHOT/wrong-artifactId-1.0-20050611.112233-1.jar" );
files.add( "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1-javadoc.jar" );
files.add( "org/apache/maven/test/1.0-SNAPSHOT/test-1.0-20050611.112233-1.jar" );
files.add( "org/apache/maven/A/1.0/A-1.0.war" );
files.add( "org/apache/maven/A/1.0/A-1.0.pom" );
files.add( "org/apache/maven/B/2.0/B-2.0.pom" );
files.add( "org/apache/maven/B/1.0/B-1.0.pom" );
files.add( "org/apache/maven/some-ejb/1.0/some-ejb-1.0-client.jar" );
files.add( "org/apache/maven/C/1.0/C-1.0.war" );
files.add( "org/apache/maven/C/1.0/C-1.0.pom" );
files.add( "org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.pom" );
files.add( "org/apache/maven/update/test-not-updated/1.0/test-not-updated-1.0.jar" );
files.add( "org/apache/maven/update/test-updated/1.0/test-updated-1.0.pom" );
files.add( "org/apache/maven/update/test-updated/1.0/test-updated-1.0.jar" );
files.add( "org/apache/maven/discovery/1.0/discovery-1.0.pom" );
files.add( "org/apache/maven/testing/1.0/testing-1.0-test-sources.jar" );
files.add( "org/apache/maven/testing/1.0/testing-1.0.jar" );
files.add( "org/apache/maven/testing/1.0/testing-1.0-sources.jar" );
files.add( "org/apache/maven/testing/1.0/testing-1.0.zip" );
files.add( "org/apache/maven/testing/1.0/testing-1.0.tar.gz" );
files.add( "org/apache/maven/samplejar/2.0/samplejar-2.0.pom" );
files.add( "org/apache/maven/samplejar/2.0/samplejar-2.0.jar" );
files.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.pom" );
files.add( "org/apache/maven/samplejar/1.0/samplejar-1.0.jar" );
files.add( "org/apache/testgroup/discovery/1.0/discovery-1.0.pom" );
files.add( "javax/sql/jdbc/2.0/jdbc-2.0.jar" );
return files;
}
}

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -19,7 +19,6 @@ package org.apache.maven.archiva.common.consumers;
* under the License.
*/
import org.apache.maven.archiva.common.AbstractArchivaCommonTestCase;
/**
* AbstractGenericConsumerTestCase
@ -28,7 +27,7 @@ import org.apache.maven.archiva.common.AbstractArchivaCommonTestCase;
* @version $Id$
*/
public abstract class AbstractGenericConsumerTestCase
extends AbstractArchivaCommonTestCase
extends AbstractConsumerTestCase
{
protected ConsumerFactory consumerFactory;

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -20,6 +20,7 @@ package org.apache.maven.archiva.common.consumers;
*/
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.codehaus.plexus.util.StringUtils;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -21,8 +21,8 @@ package org.apache.maven.archiva.common.consumers;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import java.util.ArrayList;
import java.util.Collection;
@ -47,7 +47,7 @@ public class GenericArtifactConsumerTest
public void testScanLegacy()
throws Exception
{
ArtifactRepository repository = getLegacyRepository();
ArchivaRepository repository = getLegacyRepository();
List consumers = new ArrayList();
MockArtifactConsumer mockConsumer = getMockArtifactConsumer();
@ -61,7 +61,7 @@ public class GenericArtifactConsumerTest
String path = (String) it.next();
try
{
mockConsumer.processFile( new BaseFile( repository.getBasedir(), path ) );
mockConsumer.processFile( new BaseFile( repository.getRepositoryURL().getPath(), path ) );
}
catch ( ConsumerException e )
{
@ -87,7 +87,7 @@ public class GenericArtifactConsumerTest
public void testScanDefault()
throws Exception
{
ArtifactRepository repository = getDefaultRepository();
ArchivaRepository repository = getDefaultRepository();
List consumers = new ArrayList();
MockArtifactConsumer mockConsumer = getMockArtifactConsumer();
@ -101,7 +101,7 @@ public class GenericArtifactConsumerTest
String path = (String) it.next();
try
{
mockConsumer.processFile( new BaseFile( repository.getBasedir(), path ) );
mockConsumer.processFile( new BaseFile( repository.getRepositoryURL().getPath(), path ) );
}
catch ( ConsumerException e )
{

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -45,7 +45,7 @@ public class MockArtifactConsumer
public void processArtifact( Artifact artifact, BaseFile file )
{
String relpath = PathUtil.getRelative( repository.getBasedir(), file );
String relpath = PathUtil.getRelative( repository.getRepositoryURL().getPath(), file );
artifactMap.put( relpath, artifact );
}

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -20,6 +20,7 @@ package org.apache.maven.archiva.common.consumers;
*/
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.consumers.GenericModelConsumer;
import org.apache.maven.model.Model;
import java.util.HashMap;

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.common.consumers;
package org.apache.maven.archiva.consumers;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -20,6 +20,7 @@ package org.apache.maven.archiva.common.consumers;
*/
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.consumers.GenericRepositoryMetadataConsumer;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import java.util.HashMap;

View File

@ -29,6 +29,10 @@
<artifactId>archiva-converter</artifactId>
<name>Archiva Repository Converter</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-consumer-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-discoverer</artifactId>

View File

@ -19,8 +19,8 @@ package org.apache.maven.archiva.converter.legacy;
* under the License.
*/
import org.apache.maven.archiva.common.consumers.GenericArtifactConsumer;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.consumers.GenericArtifactConsumer;
import org.apache.maven.archiva.converter.ConversionListener;
import org.apache.maven.archiva.converter.RepositoryConversionException;
import org.apache.maven.archiva.converter.RepositoryConverter;

View File

@ -29,6 +29,10 @@
<artifactId>archiva-core</artifactId>
<name>Archiva Core</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-consumer-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-configuration</artifactId>

View File

@ -19,7 +19,6 @@ package org.apache.maven.archiva.consumers;
* under the License.
*/
import org.apache.maven.archiva.common.consumers.GenericArtifactConsumer;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.reporting.database.ArtifactResultsDatabase;
import org.apache.maven.archiva.reporting.group.ReportGroup;

View File

@ -19,7 +19,6 @@ package org.apache.maven.archiva.consumers;
* under the License.
*/
import org.apache.maven.archiva.common.consumers.GenericArtifactConsumer;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;

View File

@ -19,7 +19,6 @@ package org.apache.maven.archiva.consumers;
* under the License.
*/
import org.apache.maven.archiva.common.consumers.GenericRepositoryMetadataConsumer;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.reporting.database.MetadataResultsDatabase;
import org.apache.maven.archiva.reporting.group.ReportGroup;

View File

@ -19,13 +19,13 @@ package org.apache.maven.archiva.scheduler.executors;
* under the License.
*/
import org.apache.maven.archiva.common.consumers.Consumer;
import org.apache.maven.archiva.common.consumers.ConsumerException;
import org.apache.maven.archiva.common.consumers.ConsumerFactory;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
import org.apache.maven.archiva.configuration.RepositoryConfiguration;
import org.apache.maven.archiva.consumers.Consumer;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.ConsumerFactory;
import org.apache.maven.archiva.discoverer.Discoverer;
import org.apache.maven.archiva.discoverer.DiscovererException;
import org.apache.maven.archiva.discoverer.DiscovererStatistics;

View File

@ -30,30 +30,37 @@
<name>Archiva Database</name>
<dependencies>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-manager</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-repository-metadata</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-ibatis</artifactId>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-model</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<artifactId>plexus-jdo2</artifactId>
<version>1.0-alpha-8</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xmlParserAPIs</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jpox</groupId>
<artifactId>jpox</artifactId>
<version>1.1.7</version>
<scope>compile</scope>
<exclusions>
<!-- targeting JDK 1.4 we don't need this -->
<exclusion>
<groupId>javax.sql</groupId>
<artifactId>jdbc-stdext</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>

View File

@ -1,180 +0,0 @@
package org.apache.maven.archiva.database;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.ibatis.sqlmap.client.SqlMapClient;
import org.codehaus.plexus.ibatis.PlexusIbatisHelper;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* AbstractIbatisStore
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public abstract class AbstractIbatisStore
extends AbstractLogEnabled
implements Initializable
{
/**
* @plexus.requirement
*/
protected PlexusIbatisHelper ibatisHelper;
/**
* @plexus.configuration default-value="create"
*/
private String createPrefix;
/**
* @plexus.configuration default-value="drop"
*/
private String dropPrefix;
protected abstract String[] getTableNames();
public void initialize()
throws InitializationException
{
try
{
String tableNames[] = getTableNames();
for ( int i = 0; i < tableNames.length; i++ )
{
String tableName = tableNames[i];
initializeTable( tableName );
}
}
catch ( ArchivaDatabaseException e )
{
throw new InitializationException( "Unable to initialize the database: " + e.getMessage(), e );
}
}
protected void initializeTable( String tableName )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
Connection con = sqlMap.getCurrentConnection();
DatabaseMetaData databaseMetaData = con.getMetaData();
ResultSet rs = databaseMetaData.getTables( con.getCatalog(), null, null, null );
// check if the index database exists in the database
while ( rs.next() )
{
String dbTableName = rs.getString( "TABLE_NAME" );
// if it does then we are already initialized
if ( dbTableName.toLowerCase().equals( tableName.toLowerCase() ) )
{
return;
}
}
// Create the tables
getLogger().info( "Creating table: " + tableName );
sqlMap.update( createPrefix + tableName, null );
sqlMap.commitTransaction();
}
catch ( SQLException e )
{
getLogger().error( "Error while initializing database, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while setting up database.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
protected void dropTable( String tableName )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
getLogger().info( "Dropping table: " + tableName );
sqlMap.update( dropPrefix + tableName, null );
sqlMap.commitTransaction();
}
catch ( SQLException e )
{
getLogger().error( "Error while dropping database, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while dropping database.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
}

View File

@ -1,288 +0,0 @@
package org.apache.maven.archiva.database;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.ibatis.sqlmap.client.SqlMapClient;
import org.apache.maven.archiva.database.key.MetadataKey;
import org.apache.maven.artifact.repository.metadata.Metadata;
import org.codehaus.plexus.ibatis.PlexusIbatisHelper;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* IbatisMetadataStore
*
* @author <a href="mailto:jmcconnell@apache.com">Jesse McConnell</a>
* @version $Id$
*
*/
public class AbstractMetadataKeyDatabase
extends AbstractLogEnabled
implements Initializable
{
/**
* @plexus.requirement
*/
protected PlexusIbatisHelper ibatisHelper;
/**
* @plexus.configuration default-value="create"
*/
private String createPrefix;
/**
* @plexus.configuration default-value="drop"
*/
private String dropPrefix;
public MetadataKey getMetadataKey( Metadata metadata )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
getLogger().info( "Getting metadata key" );
MetadataKey newMetadataKey = (MetadataKey) sqlMap.queryForObject( "getMetadataKey", metadata );
if ( newMetadataKey == null )
{
getLogger().info( "added new metadata" );
sqlMap.update( "addMetadataKey", metadata );
newMetadataKey = (MetadataKey) sqlMap.queryForObject( "getMetadataKey", metadata );
if ( newMetadataKey == null )
{
throw new ArchivaDatabaseException( "unable to create new MetadataKeys" );
}
}
return newMetadataKey;
}
catch ( SQLException e )
{
getLogger().error( "Error while adding metadata, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException ( "Error while interacting with the database.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
protected void initializeTable( String tableName )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
Connection con = sqlMap.getCurrentConnection();
DatabaseMetaData databaseMetaData = con.getMetaData();
ResultSet rs = databaseMetaData.getTables( con.getCatalog(), null, null, null );
// check if the index database exists in the database
while ( rs.next() )
{
String dbTableName = rs.getString( "TABLE_NAME" );
// if it does then we are already initialized
if ( dbTableName.toLowerCase().equals( tableName.toLowerCase() ) )
{
return;
}
}
// Create the tables
getLogger().info( "Creating table: " + tableName );
sqlMap.update( createPrefix + tableName, null );
sqlMap.commitTransaction();
}
catch ( SQLException e )
{
getLogger().error( "Error while initializing database, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while setting up database.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
protected void dropTable( String tableName )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
getLogger().info( "Dropping table: " + tableName );
sqlMap.update( dropPrefix + tableName, null );
sqlMap.commitTransaction();
}
catch ( SQLException e )
{
getLogger().error( "Error while dropping database, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while dropping database.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
public void initialize()
throws InitializationException
{
try
{
initializeTable( "MetadataKeys" );
}
catch ( ArchivaDatabaseException ade )
{
throw new InitializationException( "unable to initialize metadata keys database" );
}
}
protected boolean tableExists( String tableName )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
Connection con = sqlMap.getCurrentConnection();
DatabaseMetaData databaseMetaData = con.getMetaData();
ResultSet rs = databaseMetaData.getTables( con.getCatalog(), null, null, null );
// check if the index database exists in the database
while ( rs.next() )
{
String dbTableName = rs.getString( "TABLE_NAME" );
// if it does then we are already initialized
if ( dbTableName.toLowerCase().equals( tableName.toLowerCase() ) )
{
return true;
}
}
return false;
}
catch ( SQLException e )
{
getLogger().error( "Error while check database, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while checking database.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
}

View File

@ -0,0 +1,110 @@
package org.apache.maven.archiva.database;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.RepositoryContent;
import java.util.List;
/**
* ArchivaDAO - The interface for all content within the database.
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public interface ArchivaDAO
{
/* NOTE TO ARCHIVA DEVELOPERS.
*
* Please keep this interface clean and lean.
* We don't want a repeat of the Continuum Store.
* You should have the following methods per object type ...
*
* (Required Methods)
*
* DatabaseObject .createDatabaseObject( Required Params ) ;
* List .queryDatabaseObject( Constraint ) throws ObjectNotFoundException, DatabaseException;
* DatabaseObject .saveDatabaseObject( DatabaseObject ) throws DatabaseException;
*
* (Optional Methods)
*
* DatabaseObject .getDatabaseObject( Id ) throws ObjectNotFoundException, DatabaseException;
* List .getDatabaseObjects() throws ObjectNotFoundException, DatabaseException;
* void .deleteDatabaseObject( DatabaseObject ) throws DatabaseException;
*
* This is the only list of options created in this DAO.
*/
/* .\ Archiva Repository \.____________________________________________________________ */
public ArchivaRepository createRepository( String id, String url );
public List /*<ArchivaRepository>*/getRepositories()
throws ObjectNotFoundException, ArchivaDatabaseException;
public ArchivaRepository getRepository( String id )
throws ObjectNotFoundException, ArchivaDatabaseException;
public List queryRepository( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException;
public ArchivaRepository saveRepository( ArchivaRepository repository )
throws ArchivaDatabaseException;
public void deleteRepository( ArchivaRepository repository )
throws ArchivaDatabaseException;
/* .\ Repository Content \.____________________________________________________________ */
public RepositoryContent createRepositoryContent( String groupId, String artifactId, String version,
String repositoryId );
public RepositoryContent getRepositoryContent( String groupId, String artifactId, String version,
String repositoryId )
throws ObjectNotFoundException, ArchivaDatabaseException;
public List /*<RepositoryContent>*/queryRepositoryContents( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException;
public RepositoryContent saveRepositoryContent( RepositoryContent repoContent )
throws ArchivaDatabaseException;
public void deleteRepositoryContent( RepositoryContent repoContent )
throws ArchivaDatabaseException;
/* .\ Archiva Artifact \. _____________________________________________________________ */
public ArchivaArtifact createArtifact( RepositoryContent repoContent, String classifier, String type );
public ArchivaArtifact getArtifact( RepositoryContent repoContent, String classifier, String type )
throws ObjectNotFoundException, ArchivaDatabaseException;
public List /*<ArchivaArtifact>*/queryArtifacts( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException;
public ArchivaArtifact saveArtifact( ArchivaArtifact artifact )
throws ArchivaDatabaseException;
public void deleteArtifact( ArchivaArtifact artifact )
throws ArchivaDatabaseException;
}

View File

@ -0,0 +1,42 @@
package org.apache.maven.archiva.database;
/**
* Constraint
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public interface Constraint
{
public static final String ASCENDING = "ascending";
public static final String DESCENDING = "descending";
/**
* Get the fetch limits on the object.
*
* @return the fetch limits on the object. (can be null) (O/RM specific)
*/
public String getFetchLimits();
/**
* Get the SELECT WHERE (condition) value for the constraint.
*
* @return the equivalent of the SELECT WHERE (condition) value for this constraint. (can be null)
*/
public String getWhereCondition();
/**
* Get the sort column name.
*
* @return the sort column name. (can be null)
*/
public String getSortColumn();
/**
* Get the sort direction name.
*
* @return the sort direction name. ("ASC" or "DESC") (only valid if {@link #getSortColumn()} is specified.)
*/
public String getSortDirection();
}

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.model.health;
package org.apache.maven.archiva.database;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -19,45 +19,35 @@ package org.apache.maven.archiva.model.health;
* under the License.
*/
import org.apache.maven.archiva.model.ArchivaArtifact;
import java.util.ArrayList;
import java.util.List;
/**
* ArtifactHealth
* ObjectNotFoundException
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class ArtifactHealth
public class ObjectNotFoundException
extends ArchivaDatabaseException
{
private ArchivaArtifact artifact;
private Object id;
private List problems = new ArrayList();
public void addProblem( HealthProblem problem )
public ObjectNotFoundException( String message, Throwable cause, Object id )
{
this.problems.add( problem );
super( message, cause );
this.id = id;
}
public ArchivaArtifact getArtifact()
public ObjectNotFoundException( String message, Throwable cause )
{
return artifact;
super( message, cause );
}
public List getProblems()
public ObjectNotFoundException( String message )
{
return problems;
super( message );
}
public void setArtifact( ArchivaArtifact artifact )
public Object getId()
{
this.artifact = artifact;
}
public void setProblems( List problems )
{
this.problems = problems;
return id;
}
}

View File

@ -1,232 +0,0 @@
package org.apache.maven.archiva.database;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.ibatis.sqlmap.client.SqlMapClient;
import org.apache.maven.archiva.database.key.MetadataKey;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import java.sql.SQLException;
/**
* RepositoryMetadataDatabase
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*
* @plexus.component role="org.apache.maven.archiva.database.RepositoryMetadataDatabase" role-hint="default"
*/
public class RepositoryMetadataDatabase extends AbstractMetadataKeyDatabase
{
public void create( RepositoryMetadata metadata )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
getLogger().info( "Adding repository metadata" );
sqlMap.update( "addRepositoryMetadata", metadata );
sqlMap.commitTransaction();
}
catch ( SQLException e )
{
getLogger().error( "Error while executing statement, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while executing statement.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
public RepositoryMetadata read( String groupId, String artifactId, String version )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
getLogger().info( "Reading repository metadata" );
RepositoryMetadata repositoryMetadata = (RepositoryMetadata) sqlMap.queryForObject( "getRepositoryMetadata", new MetadataKey( groupId, artifactId, version ) );
return repositoryMetadata;
}
catch ( SQLException e )
{
getLogger().error( "Error while executing statement, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while executing statement.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
/**
* not implemented yet
*
* @param metadata
* @throws ArchivaDatabaseException
*/
public void update( RepositoryMetadata metadata )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
getLogger().info( "Updating repository metadata" );
sqlMap.update( "updateRepositoryMetadata", metadata );
sqlMap.commitTransaction();
}
catch ( SQLException e )
{
getLogger().error( "Error while executing statement, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while executing statement.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
public void delete( RepositoryMetadata metadata )
throws ArchivaDatabaseException
{
// FIXME is this right? baseVersion seems wrong but I don't know enough about the metadata to say
delete( metadata.getGroupId(), metadata.getArtifactId(), metadata.getBaseVersion() );
}
public void delete( String groupId, String artifactId, String version )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
getLogger().info( "Removing repository metadata" );
sqlMap.update( "removeRepositoryMetadata", new MetadataKey( groupId, artifactId, version ) );
sqlMap.commitTransaction();
}
catch ( SQLException e )
{
getLogger().error( "Error while executing statement, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while executing statement.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
public void initialize()
throws InitializationException
{
super.initialize();
try
{
initializeTable( "RepositoryMetadata" );
}
catch ( ArchivaDatabaseException ade )
{
throw new InitializationException( "unable to initialize repository metadata table", ade );
}
}
}

View File

@ -1,101 +0,0 @@
package org.apache.maven.archiva.database.artifact;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/**
* ArtifactKey
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class ArtifactKey
{
private String groupId;
private String artifactId;
private String version;
private String classifier;
private String type;
private long id;
public String getArtifactId()
{
return artifactId;
}
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
}
public String getClassifier()
{
return classifier;
}
public void setClassifier( String classifier )
{
this.classifier = classifier;
}
public String getGroupId()
{
return groupId;
}
public void setGroupId( String groupId )
{
this.groupId = groupId;
}
public long getId()
{
return id;
}
public void setId( long id )
{
this.id = id;
}
public String getType()
{
return type;
}
public void setType( String type )
{
this.type = type;
}
public String getVersion()
{
return version;
}
public void setVersion( String version )
{
this.version = version;
}
}

View File

@ -1,137 +0,0 @@
package org.apache.maven.archiva.database.artifact;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.ibatis.sqlmap.client.SqlMapClient;
import org.apache.maven.archiva.database.AbstractIbatisStore;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.artifact.Artifact;
import java.sql.SQLException;
/**
* ArtifactPersistence
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*
* @plexus.component role="org.apache.maven.archiva.database.artifact.ArtifactPersistence"
*/
public class ArtifactPersistence
extends AbstractIbatisStore
{
protected String[] getTableNames()
{
return new String[] { "ArtifactKeys" };
}
private ArtifactKey toKey( Artifact artifact )
{
ArtifactKey key = new ArtifactKey();
key.setGroupId( artifact.getGroupId() );
key.setArtifactId( artifact.getArtifactId() );
key.setVersion( artifact.getVersion() );
key.setClassifier( artifact.getClassifier() );
key.setType( artifact.getType() );
return key;
}
public void create( Artifact artifact )
throws ArchivaDatabaseException
{
SqlMapClient sqlMap = ibatisHelper.getSqlMapClient();
try
{
sqlMap.startTransaction();
getLogger().info( "Adding artifact." );
sqlMap.update( "addArtifact", artifact );
sqlMap.commitTransaction();
}
catch ( SQLException e )
{
getLogger().error( "Error while executing statement, showing all linked exceptions in SQLException." );
while ( e != null )
{
getLogger().error( e.getMessage(), e );
e = e.getNextException();
}
throw new ArchivaDatabaseException( "Error while executing statement.", e );
}
finally
{
try
{
sqlMap.endTransaction();
}
catch ( SQLException e )
{
e.printStackTrace();
}
}
}
public Artifact read( String groupId, String artifactId, String version )
{
return null;
}
public Artifact read( String groupId, String artifactId, String version, String type )
{
return null;
}
public Artifact read( String groupId, String artifactId, String version, String classifier, String type )
{
return null;
}
public void update( Artifact artifact )
{
}
public void delete( Artifact artifact )
{
}
public void delete( String groupId, String artifactId, String version )
{
}
public void delete( String groupId, String artifactId, String version, String type )
{
}
public void delete( String groupId, String artifactId, String version, String classifier, String type )
{
}
}

View File

@ -0,0 +1,40 @@
package org.apache.maven.archiva.database.constraints;
import org.apache.maven.archiva.database.Constraint;
/**
* ArchivaRepositoryByUrlConstraint
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class ArchivaRepositoryByUrlConstraint
implements Constraint
{
private String whereCondition;
public ArchivaRepositoryByUrlConstraint( String url )
{
whereCondition = "this.url == '" + url + "'";
}
public String getWhereCondition()
{
return whereCondition;
}
public String getFetchLimits()
{
return null;
}
public String getSortColumn()
{
return "url";
}
public String getSortDirection()
{
return Constraint.ASCENDING;
}
}

View File

@ -0,0 +1,459 @@
package org.apache.maven.archiva.database.jdo;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.commons.lang.StringUtils;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.Constraint;
import org.apache.maven.archiva.database.ObjectNotFoundException;
import org.codehaus.plexus.jdo.JdoFactory;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import java.io.PrintStream;
import java.util.List;
import javax.jdo.Extent;
import javax.jdo.JDOException;
import javax.jdo.JDOHelper;
import javax.jdo.JDOObjectNotFoundException;
import javax.jdo.JDOUserException;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.Query;
import javax.jdo.Transaction;
import javax.jdo.datastore.DataStoreCache;
import javax.jdo.listener.InstanceLifecycleEvent;
import javax.jdo.listener.InstanceLifecycleListener;
import javax.jdo.listener.StoreLifecycleListener;
import javax.jdo.spi.Detachable;
import javax.jdo.spi.PersistenceCapable;
/**
* JdoAccess
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class JdoAccess
implements Initializable, InstanceLifecycleListener, StoreLifecycleListener
{
/**
* @plexus.requirement role-hint="users"
*/
private JdoFactory jdoFactory;
private PersistenceManagerFactory pmf;
public void initialize()
throws InitializationException
{
pmf = jdoFactory.getPersistenceManagerFactory();
pmf.addInstanceLifecycleListener( this, null );
}
public static void dumpObjectState( PrintStream out, Object o )
{
final String STATE = "[STATE] ";
final String INDENT = " ";
if ( o == null )
{
out.println( STATE + "Object is null." );
return;
}
out.println( STATE + "Object " + o.getClass().getName() );
if ( !( o instanceof PersistenceCapable ) )
{
out.println( INDENT + "is NOT PersistenceCapable (not a jdo object?)" );
return;
}
out.println( INDENT + "is PersistenceCapable." );
if ( o instanceof Detachable )
{
out.println( INDENT + "is Detachable" );
}
out.println( INDENT + "is new : " + Boolean.toString( JDOHelper.isNew( o ) ) );
out.println( INDENT + "is transactional : " + Boolean.toString( JDOHelper.isTransactional( o ) ) );
out.println( INDENT + "is deleted : " + Boolean.toString( JDOHelper.isDeleted( o ) ) );
out.println( INDENT + "is detached : " + Boolean.toString( JDOHelper.isDetached( o ) ) );
out.println( INDENT + "is dirty : " + Boolean.toString( JDOHelper.isDirty( o ) ) );
out.println( INDENT + "is persistent : " + Boolean.toString( JDOHelper.isPersistent( o ) ) );
out.println( INDENT + "object id : " + JDOHelper.getObjectId( o ) );
}
public PersistenceManager getPersistenceManager()
{
PersistenceManager pm = pmf.getPersistenceManager();
pm.getFetchPlan().setMaxFetchDepth( -1 );
return pm;
}
public void enableCache( Class clazz )
{
DataStoreCache cache = pmf.getDataStoreCache();
cache.pinAll( clazz, false ); // Pin all objects of type clazz from now on
}
public Object saveObject( Object object )
{
return saveObject( object, null );
}
public Object saveObject( Object object, String[] fetchGroups )
{
PersistenceManager pm = getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();
if ( ( JDOHelper.getObjectId( object ) != null ) && !JDOHelper.isDetached( object ) )
{
// This is a fatal error that means we need to fix our code.
// Leave it as a JDOUserException, it's intentional.
throw new JDOUserException( "Existing object is not detached: " + object, object );
}
if ( fetchGroups != null )
{
for ( int i = 0; i >= fetchGroups.length; i++ )
{
pm.getFetchPlan().addGroup( fetchGroups[i] );
}
}
pm.makePersistent( object );
object = pm.detachCopy( object );
tx.commit();
return object;
}
finally
{
rollbackIfActive( tx );
}
}
public List getAllObjects( Class clazz )
{
return getAllObjects( clazz, null );
}
public List getAllObjects( Class clazz, Constraint constraint )
{
PersistenceManager pm = getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();
Extent extent = pm.getExtent( clazz, true );
Query query = pm.newQuery( extent );
if ( constraint != null )
{
if ( constraint.getSortColumn() != null )
{
String ordering = constraint.getSortColumn();
if ( constraint.getSortDirection() != null )
{
ordering += " " + constraint.getSortDirection();
}
query.setOrdering( ordering );
}
if ( constraint.getFetchLimits() != null )
{
pm.getFetchPlan().addGroup( constraint.getFetchLimits() );
}
if ( constraint.getWhereCondition() != null )
{
query.setFilter( constraint.getWhereCondition() );
}
}
List result = (List) query.execute();
result = (List) pm.detachCopyAll( result );
tx.commit();
return result;
}
finally
{
rollbackIfActive( tx );
}
}
// public List getUserAssignmentsForRoles( Class clazz, String ordering, Collection roleNames )
// {
// PersistenceManager pm = getPersistenceManager();
// Transaction tx = pm.currentTransaction();
//
// try
// {
// tx.begin();
//
// Extent extent = pm.getExtent( clazz, true );
//
// Query query = pm.newQuery( extent );
//
// if ( ordering != null )
// {
// query.setOrdering( ordering );
// }
//
// query.declareImports( "import java.lang.String" );
//
// StringBuffer filter = new StringBuffer();
//
// Iterator i = roleNames.iterator();
//
// if ( roleNames.size() > 0 )
// {
// filter.append( "this.roleNames.contains(\"" ).append( i.next() ).append( "\")" );
//
// while ( i.hasNext() )
// {
// filter.append( " || this.roleNames.contains(\"" ).append( i.next() ).append( "\")" );
// }
//
// query.setFilter( filter.toString() );
// }
//
// List result = (List) query.execute();
//
// result = (List) pm.detachCopyAll( result );
//
// tx.commit();
//
// return result;
// }
// finally
// {
// rollbackIfActive( tx );
// }
// }
public Object getObjectById( Class clazz, Object id, String fetchGroup )
throws ObjectNotFoundException, ArchivaDatabaseException
{
if ( id == null )
{
throw new ObjectNotFoundException( "Unable to get object '" + clazz.getName()
+ "' from jdo using null id." );
}
PersistenceManager pm = getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();
if ( fetchGroup != null )
{
pm.getFetchPlan().addGroup( fetchGroup );
}
Object objectId = pm.newObjectIdInstance( clazz, id );
Object object = pm.getObjectById( objectId );
object = pm.detachCopy( object );
tx.commit();
return object;
}
catch ( JDOObjectNotFoundException e )
{
throw new ObjectNotFoundException( "Unable to find Database Object '" + id + "' of type " + clazz.getName()
+ " using fetch-group '" + fetchGroup + "'", e, id );
}
catch ( JDOException e )
{
throw new ArchivaDatabaseException( "Error in JDO during get of Database object id '" + id + "' of type "
+ clazz.getName() + " using fetch-group '" + fetchGroup + "'", e );
}
finally
{
rollbackIfActive( tx );
}
}
public Object getObjectById( Class clazz, String id, String fetchGroup )
throws ObjectNotFoundException, ArchivaDatabaseException
{
if ( StringUtils.isEmpty( id ) )
{
throw new ObjectNotFoundException( "Unable to get object '" + clazz.getName()
+ "' from jdo using null/empty id." );
}
return getObjectById( clazz, (Object) id, fetchGroup );
}
public boolean objectExists( Object object )
{
return ( JDOHelper.getObjectId( object ) != null );
}
public boolean objectExistsById( Class clazz, String id )
throws ArchivaDatabaseException
{
try
{
Object o = getObjectById( clazz, id, null );
return ( o != null );
}
catch ( ObjectNotFoundException e )
{
return false;
}
}
public void removeObject( Object o )
throws ArchivaDatabaseException
{
if ( o == null )
{
throw new ArchivaDatabaseException( "Unable to remove null object '" + o.getClass().getName() + "'" );
}
PersistenceManager pm = getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();
o = pm.getObjectById( pm.getObjectId( o ) );
pm.deletePersistent( o );
tx.commit();
}
finally
{
rollbackIfActive( tx );
}
}
public void rollbackIfActive( Transaction tx )
{
PersistenceManager pm = tx.getPersistenceManager();
try
{
if ( tx.isActive() )
{
tx.rollback();
}
}
finally
{
closePersistenceManager( pm );
}
}
public void closePersistenceManager( PersistenceManager pm )
{
try
{
pm.close();
}
catch ( JDOUserException e )
{
// ignore
}
}
public void postDelete( InstanceLifecycleEvent evt )
{
PersistenceCapable obj = ( (PersistenceCapable) evt.getSource() );
if ( obj == null )
{
// Do not track null objects.
// These events are typically a product of an internal lifecycle event.
return;
}
}
public void preDelete( InstanceLifecycleEvent evt )
{
// ignore
}
public void postStore( InstanceLifecycleEvent evt )
{
// PersistenceCapable obj = ( (PersistenceCapable) evt.getSource() );
}
public void preStore( InstanceLifecycleEvent evt )
{
// ignore
}
public void removeAll( Class aClass )
{
PersistenceManager pm = getPersistenceManager();
Transaction tx = pm.currentTransaction();
try
{
tx.begin();
Query query = pm.newQuery( aClass );
query.deletePersistentAll();
tx.commit();
}
finally
{
rollbackIfActive( tx );
}
}
public JdoFactory getJdoFactory()
{
return jdoFactory;
}
}

View File

@ -0,0 +1,182 @@
package org.apache.maven.archiva.database.jdo;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.Constraint;
import org.apache.maven.archiva.database.ObjectNotFoundException;
import org.apache.maven.archiva.database.constraints.ArchivaRepositoryByUrlConstraint;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.RepositoryContent;
import org.apache.maven.archiva.model.RepositoryContentKey;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.util.List;
/**
* JdoArchivaDAO
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*
* @plexus.component role="org.apache.maven.archiva.database.ArchivaDAO"
* role-hint="jdo"
*/
public class JdoArchivaDAO
extends AbstractLogEnabled
implements ArchivaDAO
{
/**
* @plexus.requirement
*/
private JdoAccess jdo;
/* .\ Archiva Repository \.____________________________________________________________ */
public ArchivaRepository createRepository( String id, String url )
{
ArchivaRepository repo;
try
{
repo = getRepository( id );
}
catch ( ArchivaDatabaseException e )
{
repo = new ArchivaRepository();
repo.setId( id );
repo.setUrl( url );
}
return repo;
}
public List getRepositories()
throws ObjectNotFoundException, ArchivaDatabaseException
{
return jdo.getAllObjects( ArchivaRepository.class );
}
public ArchivaRepository getRepository( String id )
throws ObjectNotFoundException, ArchivaDatabaseException
{
return (ArchivaRepository) jdo.getObjectById( ArchivaRepository.class, id, null );
}
public List queryRepository( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException
{
return jdo.getAllObjects( ArchivaRepository.class, constraint );
}
public ArchivaRepository saveRepository( ArchivaRepository repository )
{
return (ArchivaRepository) jdo.saveObject( repository );
}
public void deleteRepository( ArchivaRepository repository )
throws ArchivaDatabaseException
{
jdo.removeObject( repository );
}
/* .\ Repository Content \.____________________________________________________________ */
public RepositoryContent createRepositoryContent( String groupId, String artifactId, String version,
String repositoryId )
{
RepositoryContent repoContent;
try
{
repoContent = getRepositoryContent( groupId, artifactId, version, repositoryId );
}
catch ( ArchivaDatabaseException e )
{
repoContent = new RepositoryContent( repositoryId, groupId, artifactId, version );
}
return repoContent;
}
public RepositoryContent getRepositoryContent( String groupId, String artifactId, String version,
String repositoryId )
throws ObjectNotFoundException, ArchivaDatabaseException
{
RepositoryContentKey key = new RepositoryContentKey();
key.groupId = groupId;
key.artifactId = artifactId;
key.version = version;
key.repositoryId = repositoryId;
return (RepositoryContent) jdo.getObjectById( RepositoryContent.class, key, null );
}
public List queryRepositoryContents( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException
{
return jdo.getAllObjects( RepositoryContent.class, constraint );
}
public RepositoryContent saveRepositoryContent( RepositoryContent repoContent )
throws ArchivaDatabaseException
{
return (RepositoryContent) jdo.saveObject( repoContent );
}
public void deleteRepositoryContent( RepositoryContent repoContent )
throws ArchivaDatabaseException
{
jdo.removeObject( repoContent );
}
/* .\ Archiva Artifact \. _____________________________________________________________ */
public ArchivaArtifact createArtifact( RepositoryContent repoContent, String classifier, String type )
{
ArchivaArtifact artifact;
try
{
artifact = getArtifact( repoContent, classifier, type );
}
catch ( ArchivaDatabaseException e )
{
artifact = new ArchivaArtifact();
artifact.setContentKey( repoContent );
artifact.setClassifier( classifier );
artifact.setType( type );
}
return artifact;
}
public ArchivaArtifact getArtifact( RepositoryContent repoContent, String classifier, String type )
throws ObjectNotFoundException, ArchivaDatabaseException
{
return null;
}
public List queryArtifacts( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException
{
// TODO Auto-generated method stub
return null;
}
public ArchivaArtifact saveArtifact( ArchivaArtifact artifact )
throws ArchivaDatabaseException
{
// TODO Auto-generated method stub
return null;
}
public void deleteArtifact( ArchivaArtifact artifact )
throws ArchivaDatabaseException
{
// TODO Auto-generated method stub
}
}

View File

@ -1,46 +0,0 @@
package org.apache.maven.archiva.database.key;
public class MetadataKey {
private String groupId;
private String artifactId;
private String version;
private int metadataKey;
public MetadataKey( String groupId, String artifactId, String version )
{
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
}
public MetadataKey() {}
public String getArtifactId() {
return artifactId;
}
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public int getMetadataKey() {
return metadataKey;
}
public void setMetadataKey(int id) {
this.metadataKey = id;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
}

View File

@ -1,87 +0,0 @@
package org.apache.maven.archiva.database;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.archiva.database.key.MetadataKey;
import org.apache.maven.artifact.repository.metadata.Metadata;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.ibatis.PlexusIbatisHelper;
/**
* RepositoryMetadataDatabaseTest
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class RepositoryMetadataDatabaseTest
extends PlexusTestCase
{
/**
* @plexus.requirement
*/
protected PlexusIbatisHelper ibatisHelper;
protected void setUp()
throws Exception
{
super.setUp();
}
public void testRepositoryMetadataCreationAndDeletion() throws Exception
{
RepositoryMetadataDatabase db = (RepositoryMetadataDatabase) lookup( "org.apache.maven.archiva.database.RepositoryMetadataDatabase", "default" );
assertNotNull( db );
assertTrue( db.tableExists( "RepositoryMetadata" ) );
assertTrue( db.tableExists( "MetadataKeys" ) );
db.dropTable( "RepositoryMetadata" );
db.dropTable( "MetadataKeys" );
assertFalse( db.tableExists( "RepositoryMetadata" ) );
assertFalse( db.tableExists( "MetadataKeys" ) );
}
public void testMetadataKeyRetrieval() throws Exception
{
RepositoryMetadataDatabase db = (RepositoryMetadataDatabase) lookup( "org.apache.maven.archiva.database.RepositoryMetadataDatabase", "default" );
Metadata metadata = new Metadata();
metadata.setArtifactId( "testArtifactId" );
metadata.setGroupId( "testGroupId" );
metadata.setVersion( "testVersion" );
MetadataKey metadataKey = db.getMetadataKey( metadata );
assertTrue( metadataKey.getMetadataKey() > 0 );
assertEquals( metadataKey.getArtifactId(), metadata.getArtifactId() );
assertEquals( metadataKey.getGroupId(), metadata.getGroupId() );
assertEquals( metadataKey.getVersion(), metadata.getVersion() );
db.dropTable( "RepositoryMetadata" );
db.dropTable( "MetadataKeys" );
assertFalse( db.tableExists( "RepositoryMetadata" ) );
assertFalse( db.tableExists( "MetadataKeys" ) );
}
}

View File

@ -1,70 +0,0 @@
package org.apache.maven.archiva.database.artifact;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.archiva.database.AbstractArchivaDatabaseTestCase;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
/**
* ArtifactPersistenceTest
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class ArtifactPersistenceTest
extends AbstractArchivaDatabaseTestCase
{
private ArtifactFactory artifactFactory;
private ArtifactPersistence db;
protected void setUp()
throws Exception
{
super.setUp();
artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
db = (ArtifactPersistence) lookup( ArtifactPersistence.class.getName() );
}
public void testLookup()
{
assertNotNull( db );
}
public void testAddArtifact() throws ArchivaDatabaseException
{
String groupId = "org.apache.maven.archiva";
String artifactId = "archiva-test-artifact";
String version = "1.0";
Artifact artifact = artifactFactory
.createArtifact( groupId, artifactId, version, Artifact.SCOPE_COMPILE, "jar" );
db.create( artifact );
Artifact fetched = db.read( groupId, artifactId, version );
assertNotNull( "Should have fetched an Artifact.", fetched );
assertEquals( "Should have fetched the expected Artifact.", artifact, fetched );
}
}

View File

@ -29,6 +29,10 @@
<artifactId>archiva-discoverer</artifactId>
<name>Archiva Discoverer</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-consumer-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-common</artifactId>

View File

@ -19,7 +19,7 @@ package org.apache.maven.archiva.discoverer;
* under the License.
*/
import org.apache.maven.archiva.common.consumers.Consumer;
import org.apache.maven.archiva.consumers.Consumer;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.DirectoryWalker;

View File

@ -20,8 +20,8 @@ package org.apache.maven.archiva.discoverer;
*/
import org.apache.commons.lang.SystemUtils;
import org.apache.maven.archiva.common.consumers.Consumer;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.consumers.Consumer;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.DirectoryWalkListener;

View File

@ -3,9 +3,9 @@
*/
package org.apache.maven.archiva.discoverer;
import org.apache.maven.archiva.common.consumers.Consumer;
import org.apache.maven.archiva.common.consumers.ConsumerException;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.consumers.Consumer;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import java.util.ArrayList;

View File

@ -30,16 +30,8 @@
<name>Archiva Model</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact-manager</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-repository-metadata</artifactId>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-common</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@ -64,6 +56,62 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.modello</groupId>
<artifactId>modello-maven-plugin</artifactId>
<version>1.0-alpha-15-SNAPSHOT</version>
<configuration>
<version>1.0.0</version>
<packageWithVersion>false</packageWithVersion>
<model>src/main/mdo/archiva.xml</model>
</configuration>
<executions>
<execution>
<id>modello-java</id>
<goals>
<goal>java</goal>
<goal>jpox-metadata-class</goal>
<!--
<goal>xpp3-writer</goal>
<goal>xpp3-reader</goal>
-->
</goals>
</execution>
<execution>
<id>jpox-jdo-mapping</id>
<goals>
<goal>jpox-jdo-mapping</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/org/apache/maven/archiva/model/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jpox-maven-plugin</artifactId>
<version>1.1.6</version>
<executions>
<execution>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<configuration>
<instrumentation>
<!-- exclude generated -->
<excludes>
<exclude>org/apache/maven/archiva/reporting/model/**</exclude>
</excludes>
</instrumentation>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -30,23 +30,18 @@ import java.util.Map;
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*
* @plexus.component role="org.apache.maven.archiva.model.ArchivaArtifact"
*/
public class ArchivaArtifact
implements RepositoryContent
public abstract class AbstractArchivaArtifact
{
private Map attached;
private String classifier;
private RepositoryContentKey key;
private RepositoryContent key;
private String type;
public ArchivaArtifact( ArtifactRepository repository, String groupId, String artifactId, String version, String classifier, String type )
public AbstractArchivaArtifact( ArchivaRepository repository, String groupId, String artifactId, String version, String classifier, String type )
{
this.key = new RepositoryContentKey( repository, groupId, artifactId, version );
this.key = new RepositoryContent( repository, groupId, artifactId, version );
this.classifier = classifier;
@ -55,29 +50,12 @@ public class ArchivaArtifact
validateIdentity();
}
public void addAttached( ArchivaArtifact attachedArtifact )
{
attached.put( attachedArtifact.getClassifier(), attachedArtifact );
// Naughty, Attached shouldn't have it's own attached artifacts!
attachedArtifact.clearAttached();
}
public void clearAttached()
{
attached.clear();
}
public Map getAttached()
{
return attached;
}
public String getClassifier()
{
return classifier;
}
public RepositoryContentKey getRepositoryContentKey()
public RepositoryContent getRepositoryContent()
{
return key;
}
@ -92,12 +70,7 @@ public class ArchivaArtifact
return StringUtils.isNotEmpty( classifier );
}
public void setAttached( Map attached )
{
this.attached = attached;
}
public void setRepositoryContentKey( RepositoryContentKey key )
public void setRepositoryContent( RepositoryContent key )
{
this.key = key;
}
@ -132,12 +105,12 @@ public class ArchivaArtifact
}
}
private boolean empty( String value )
protected boolean empty( String value )
{
return value == null || value.trim().length() < 1;
}
private void validateIdentity()
protected void validateIdentity()
{
if ( empty( key.getGroupId() ) )
{

View File

@ -0,0 +1,125 @@
package org.apache.maven.archiva.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.archiva.common.utils.RepositoryURL;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
/**
* AbstractArchivaRepository
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public abstract class AbstractArchivaRepository
{
protected ArtifactRepositoryLayout layout;
protected ArtifactRepositoryPolicy releases;
protected ArtifactRepositoryPolicy snapshots;
protected boolean blacklisted;
public AbstractArchivaRepository()
{
}
/**
* Construct a Repository.
*
* @param id the unique identifier for this repository.
* @param name the name for this repository.
* @param url the base URL for this repository (this should point to the top level URL for the entire repository)
* @param layout the layout technique for this repository.
*/
public AbstractArchivaRepository( String id, String name, String url, ArtifactRepositoryLayout layout )
{
setId( id );
setName( name );
setUrl( url );
setLayout( layout );
}
public abstract void setUrl( String url );
public abstract String getUrl();
public abstract void setName( String name );
public abstract void setId( String id );
public boolean isBlacklisted()
{
return blacklisted;
}
public void setBlacklisted( boolean blacklisted )
{
this.blacklisted = blacklisted;
}
public ArtifactRepositoryLayout getLayout()
{
return layout;
}
public void setLayout( ArtifactRepositoryLayout layout )
{
this.layout = layout;
}
public ArtifactRepositoryPolicy getReleases()
{
return releases;
}
public void setReleases( ArtifactRepositoryPolicy releases )
{
this.releases = releases;
}
public ArtifactRepositoryPolicy getSnapshots()
{
return snapshots;
}
public void setSnapshots( ArtifactRepositoryPolicy snapshots )
{
this.snapshots = snapshots;
}
public boolean isRemote()
{
return !getRepositoryURL().getProtocol().equals( "file" );
}
public boolean isManaged()
{
return getRepositoryURL().getProtocol().equals( "file" );
}
public RepositoryURL getRepositoryURL()
{
return new RepositoryURL( getUrl() );
}
}

View File

@ -1,77 +0,0 @@
package org.apache.maven.archiva.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.repository.ArtifactRepository;
import java.util.ArrayList;
import java.util.List;
/**
* ArchivaRepositoryMetadata
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class ArchivaRepositoryMetadata
implements RepositoryContent
{
private List availableVersions = new ArrayList();
private RepositoryContentKey key;
private String releasedVersion;
public ArchivaRepositoryMetadata( ArtifactRepository repository, String groupId, String artifactId, String version )
{
this.key = new RepositoryContentKey( repository, groupId, artifactId, version );
}
public List getAvailableVersions()
{
return availableVersions;
}
public String getReleasedVersion()
{
return releasedVersion;
}
public RepositoryContentKey getRepositoryContentKey()
{
return this.key;
}
public void setAvailableVersions( List availableVersions )
{
this.availableVersions = availableVersions;
}
public void setReleasedVersion( String releasedVersion )
{
this.releasedVersion = releasedVersion;
}
public void setRepositoryContentKey( RepositoryContentKey key )
{
this.key = key;
}
}

View File

@ -19,69 +19,152 @@ package org.apache.maven.archiva.model;
* under the License.
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.commons.lang.StringUtils;
import java.io.Serializable;
/**
* RepositoryContentKey - the golden key for all content within the repository.
* RepositoryContentKey - the jpox application key support class for all content within the repository.
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class RepositoryContentKey
public class RepositoryContentKey implements Serializable
{
private String artifactId;
/**
* The Repository ID. (JPOX Requires this remain public)
*/
public String repositoryId = "";
private String groupId;
/**
* The Group ID. (JPOX Requires this remain public)
*/
public String groupId = "";
private ArtifactRepository repository;
/**
* The Artifact ID. (JPOX Requires this remain public)
*/
public String artifactId = "";
private String version;
/**
* The Version. (JPOX Requires this remain public)
*/
public String version = "";
public RepositoryContentKey( ArtifactRepository repository, String groupId, String artifactId, String version )
/**
* Default Constructor. Required by JPOX.
*/
public RepositoryContentKey()
{
this.repository = repository;
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
}
public String getArtifactId()
/**
* Key Based Constructor. Required by JPOX.
*
* @param key the String representing this object's values.
*/
public RepositoryContentKey( String key )
{
return artifactId;
String parts[] = StringUtils.splitPreserveAllTokens( key, ':' );
repositoryId = parts[0];
groupId = parts[1];
artifactId = parts[2];
version = parts[3];
}
public String getGroupId()
/**
* Get the String representation of this object. - Required by JPOX.
*/
public String toString()
{
return groupId;
return StringUtils.join( new String[] { repositoryId, groupId, artifactId, version } );
}
public ArtifactRepository getRepository()
/**
* Get the hashcode for this object's values - Required by JPOX.
*/
public int hashCode()
{
return repository;
final int PRIME = 31;
int result = 1;
result = PRIME * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() );
result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() );
return result;
}
public String getVersion()
/**
* Get the equals for this object's values - Required by JPOX.
*/
public boolean equals( Object obj )
{
return version;
}
if ( this == obj )
{
return true;
}
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
}
if ( obj == null )
{
return false;
}
public void setGroupId( String groupId )
{
this.groupId = groupId;
}
if ( getClass() != obj.getClass() )
{
return false;
}
public void setRepository( ArtifactRepository repository )
{
this.repository = repository;
}
final RepositoryContentKey other = (RepositoryContentKey) obj;
public void setVersion( String version )
{
this.version = version;
if ( repositoryId == null )
{
if ( other.repositoryId != null )
{
return false;
}
}
else if ( !repositoryId.equals( other.repositoryId ) )
{
return false;
}
if ( groupId == null )
{
if ( other.groupId != null )
{
return false;
}
}
else if ( !groupId.equals( other.groupId ) )
{
return false;
}
if ( artifactId == null )
{
if ( other.artifactId != null )
{
return false;
}
}
else if ( !artifactId.equals( other.artifactId ) )
{
return false;
}
if ( version == null )
{
if ( other.version != null )
{
return false;
}
}
else if ( !version.equals( other.version ) )
{
return false;
}
return true;
}
}

View File

@ -1,77 +0,0 @@
package org.apache.maven.archiva.model.health;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/**
* HealthProblem
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class HealthProblem
{
private String type;
private String origin;
private String message;
public HealthProblem()
{
}
public HealthProblem( String type, String origin, String message )
{
this.type = type;
this.origin = origin;
this.message = message;
}
public String getMessage()
{
return message;
}
public void setMessage( String message )
{
this.message = message;
}
public String getOrigin()
{
return origin;
}
public void setOrigin( String origin )
{
this.origin = origin;
}
public String getType()
{
return type;
}
public void setType( String type )
{
this.type = type;
}
}

View File

@ -1,63 +0,0 @@
package org.apache.maven.archiva.model.health;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.archiva.model.ArchivaRepositoryMetadata;
import java.util.ArrayList;
import java.util.List;
/**
* RepositoryMetadataHealth
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class RepositoryMetadataHealth
{
private ArchivaRepositoryMetadata repositoryMetadata;
private List problems = new ArrayList();
public void addProblem( HealthProblem problem )
{
this.problems.add( problem );
}
public List getProblems()
{
return problems;
}
public void setProblems( List problems )
{
this.problems = problems;
}
public ArchivaRepositoryMetadata getRepositoryMetadata()
{
return repositoryMetadata;
}
public void setRepositoryMetadata( ArchivaRepositoryMetadata repositoryMetadata )
{
this.repositoryMetadata = repositoryMetadata;
}
}

View File

@ -0,0 +1,454 @@
<?xml version="1.0" ?>
<model jpox.table-prefix="ARCHIVA_">
<id>archiva-model</id>
<name>ArchivaModel</name>
<version>1.0.0</version>
<description>Archiva Model</description>
<defaults>
<default>
<key>package</key>
<value>org.apache.maven.archiva.model</value>
</default>
</defaults>
<classes>
<class stash.storable="false" rootElement="true">
<name>ArchivaDatabase</name>
<version>1.0.0+</version>
<fields>
<field>
<name>Repositories</name>
<version>1.0.0+</version>
<association>
<type>ArchivaRepository</type>
<multiplicity>*</multiplicity>
</association>
</field>
</fields>
</class>
<class stash.storable="true">
<superClass>AbstractArchivaRepository</superClass>
<name>ArchivaRepository</name>
<version>1.0.0+</version>
<fields>
<field>
<name>id</name>
<identity>true</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The unique ID for the repository.
</description>
</field>
<field>
<name>name</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The Name of the repository.
</description>
</field>
<field>
<name>url</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The URL of the repository.
</description>
</field>
<field>
<name>creationSource</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The Source of this repository.
(Example: Configuration, POM)
</description>
</field>
<field>
<name>layoutName</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The layout of the repository.
(Either 'default', or 'legacy')
</description>
</field>
<field>
<name>releasePolicy</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The releases policy of the repository.
</description>
</field>
<field>
<name>snapshotPolicy</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The snapshot policy of the repository.
</description>
</field>
</fields>
</class>
<class stash.storable="true"
jpox.use-identifiers-as-primary-key="true"
jpox.identity-type="application"
jpox.identity-class="RepositoryContentKey">
<name>RepositoryContent</name>
<version>1.0.0+</version>
<description>
Repository Content Identifier.
</description>
<fields>
<field jpox.primary-key="true"
jpox.value-strategy="off"
jpox.persistence-modifier="persistent">
<name>groupId</name>
<identity>true</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The Group ID of the repository content.
</description>
</field>
<field jpox.primary-key="true"
jpox.value-strategy="off"
jpox.persistence-modifier="persistent">
<name>artifactId</name>
<identity>true</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The Artifact ID of the repository content.
</description>
</field>
<field jpox.primary-key="true"
jpox.value-strategy="off"
jpox.persistence-modifier="persistent">
<name>version</name>
<identity>true</identity>
<version>1.0.0+</version>
<type>String</type>
<required>false</required>
<description>
The version of the repository content.
</description>
</field>
<field jpox.primary-key="true"
jpox.value-strategy="off"
jpox.persistence-modifier="persistent">
<name>repositoryId</name>
<identity>true</identity>
<version>1.0.0+</version>
<required>true</required>
<type>String</type>
<description>
The repository associated with this content.
</description>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>1.0.0+</version>
<code>
public RepositoryContent( String repositoryId, String groupId, String artifactId, String version )
{
this.setRepositoryId( repositoryId );
this.setGroupId( groupId );
this.setArtifactId( artifactId );
this.setVersion( version );
}
public RepositoryContent( ArchivaRepository repository, String groupId, String artifactId, String version )
{
this.setRepositoryId( repository.getId() );
this.setGroupId( groupId );
this.setArtifactId( artifactId );
this.setVersion( version );
}
</code>
</codeSegment>
</codeSegments>
</class>
<class>
<name>ArchivaArtifact</name>
<version>1.0.0+</version>
<fields>
<field>
<name>contentKey</name>
<identity>true</identity>
<version>1.0.0+</version>
<required>true</required>
<association>
<type>RepositoryContent</type>
<multiplicity>1</multiplicity>
</association>
<description>
The content key for this artifact.
</description>
</field>
<field>
<name>classifier</name>
<identity>false</identity>
<version>1.0.0+</version>
<type>String</type>
<required>false</required>
<description>
The classifier for this artifact.
</description>
</field>
<field jpox.column="FILE_TYPE">
<name>type</name>
<identity>true</identity>
<version>1.0.0+</version>
<type>String</type>
<required>true</required>
<description>
The type of artifact.
</description>
</field>
</fields>
</class>
<class>
<name>ArchivaRepositoryMetadata</name>
<version>1.0.0+</version>
<fields>
<field>
<name>contentKey</name>
<identity>true</identity>
<version>1.0.0+</version>
<required>true</required>
<association>
<type>RepositoryContent</type>
<multiplicity>1</multiplicity>
</association>
<description>
The content key for this repository metadata.
</description>
</field>
<field>
<name>releasedVersion</name>
<identity>false</identity>
<version>1.0.0+</version>
<required>false</required>
<type>String</type>
<description>
The released version id.
</description>
</field>
<field>
<name>availableVersions</name>
<identity>false</identity>
<version>1.0.0+</version>
<required>false</required>
<association>
<type>String</type>
<multiplicity>*</multiplicity>
</association>
<description>
The list of available version ids.
</description>
</field>
</fields>
</class>
<class>
<name>HealthProblem</name>
<version>1.0.0+</version>
<fields>
<field jpox.column="PROBLEM_TYPE">
<name>type</name>
<identity>false</identity>
<version>1.0.0+</version>
<required>true</required>
<type>String</type>
<description>
The type of health problem.
</description>
</field>
<field jpox.column="PROBLEM_ORIGIN">
<name>origin</name>
<identity>false</identity>
<version>1.0.0+</version>
<required>true</required>
<type>String</type>
<description>
The origin of the health problem.
</description>
</field>
<field>
<name>message</name>
<identity>false</identity>
<version>1.0.0+</version>
<required>true</required>
<type>String</type>
<description>
The origin of the health problem.
</description>
</field>
</fields>
</class>
<class>
<name>ArchivaArtifactHealth</name>
<version>1.0.0+</version>
<fields>
<field>
<name>artifact</name>
<identity>true</identity>
<version>1.0.0+</version>
<required>true</required>
<association>
<type>ArchivaArtifact</type>
<multiplicity>1</multiplicity>
</association>
<description>
The Artifact to report on.
</description>
</field>
<field>
<name>problems</name>
<identity>false</identity>
<version>1.0.0+</version>
<required>false</required>
<association>
<type>HealthProblem</type>
<multiplicity>*</multiplicity>
</association>
<description>
The list of problems associated with this artifact.
</description>
</field>
</fields>
</class>
<class>
<name>ArchivaRepositoryMetadataHealth</name>
<version>1.0.0+</version>
<fields>
<field>
<name>repositoryMetadata</name>
<identity>true</identity>
<version>1.0.0+</version>
<required>true</required>
<association>
<type>ArchivaRepositoryMetadata</type>
<multiplicity>1</multiplicity>
</association>
<description>
The ArchivaRepositoryMetadata to report on.
</description>
</field>
<field>
<name>problems</name>
<identity>false</identity>
<version>1.0.0+</version>
<required>false</required>
<association>
<type>HealthProblem</type>
<multiplicity>*</multiplicity>
</association>
<description>
The list of problems associated with this repository metadata.
</description>
</field>
</fields>
</class>
<class>
<name>RepositoryContentStatistics</name>
<version>1.0.0+</version>
<fields>
<field>
<name>repositoryId</name>
<version>1.0.0+</version>
<identity>false</identity>
<required>true</required>
<type>String</type>
<description>
The repository id the statistics belong to.
</description>
</field>
<field>
<name>whenGathered</name>
<version>1.0.0+</version>
<identity>false</identity>
<required>true</required>
<type>Date</type>
<description>
The timestamp on when this set of statistics was gathered.
</description>
</field>
<field>
<name>duration</name>
<version>1.0.0+</version>
<identity>false</identity>
<required>true</required>
<type>long</type>
<description>
The duration (in milliseconds) for the gathering of the statistics.
</description>
</field>
<field>
<name>totalFileCount</name>
<version>1.0.0+</version>
<identity>false</identity>
<required>true</required>
<type>long</type>
<description>
The total number of files in the repository.
</description>
</field>
<field>
<name>newFileCount</name>
<version>1.0.0+</version>
<identity>false</identity>
<required>true</required>
<type>long</type>
<description>
The number of new files discovered.
</description>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>1.0.0+</version>
<code>
private transient long startTimestamp;
public void triggerStart() {
startTimestamp = System.currentTimeMillis();
}
public void triggerFinished() {
long finished = System.currentTimeMillis();
setDuration( finished - startTimestamp );
setWhenGathered( new java.util.Date( finished ) );
}
public void increaseFileCount() {
this.totalFileCount++;
}
public void increaseNewFileCount() {
this.newFileCount++;
}
</code>
</codeSegment>
</codeSegments>
</class>
</classes>
</model>

View File

@ -30,10 +30,19 @@
<artifactId>archiva-repository-layer</artifactId>
<name>Archiva Repository Interface Layer</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-consumer-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-model</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>

View File

@ -1,74 +0,0 @@
package org.apache.maven.archiva.repository;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 java.util.List;
/**
* DefinedRepositories - maintains the list of defined repositories.
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public interface DefinedRepositories
{
/**
* Get the entire list of repositories.
*
* @return the list of repositories.
*/
public List getAllRepositories();
/**
* Get the list of managed (local) repositories.
*
* @return the list of managed (local) repositories.
*/
public List getManagedRepositories();
/**
* Get the list of remote repositories.
*
* @return the list of remote repositories.
*/
public List getRemoteRepositories();
/**
* Add a repository.
*
* @param repository the repository to add.
*/
public void addRepository( Repository repository );
/**
* Remove a repository.
*
* @param repository the repository to add.
*/
public void removeRepository( Repository repository );
/**
* Get a repository using the provided repository key.
*
* @param repositoryKey the repository key to find the repository via.
* @return the repository associated with the provided Repository Key, or null if not found.
*/
public Repository getRepository( String repositoryKey );
}

View File

@ -1,211 +0,0 @@
package org.apache.maven.archiva.repository;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
/**
* Repository
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class Repository
implements ArtifactRepository
{
protected String id;
protected String name;
protected String source;
protected RepositoryURL url;
protected ArtifactRepositoryLayout layout;
protected ArtifactRepositoryPolicy releases;
protected ArtifactRepositoryPolicy snapshots;
protected boolean blacklisted;
/* .\ Constructor \.__________________________________________________ */
/**
* Construct a Repository.
*
* @param id the unique identifier for this repository.
* @param name the name for this repository.
* @param url the base URL for this repository (this should point to the top level URL for the entire repository)
* @param layout the layout technique for this repository.
*/
public Repository( String id, String name, String url, ArtifactRepositoryLayout layout )
{
this.id = id;
this.name = name;
this.url = new RepositoryURL( url );
this.layout = layout;
}
/* .\ Information \.__________________________________________________ */
/**
* Get the unique ID for this repository.
*
* @return the unique ID for this repository.
*/
public String getId()
{
return id;
}
/**
* Get the Name of this repository.
* This is usually the human readable name for the repository.
*
* @return the name of this repository.
*/
public String getName()
{
return name;
}
public String getUrl()
{
return url.toString();
}
public void setLayout( ArtifactRepositoryLayout layout )
{
this.layout = layout;
}
public ArtifactRepositoryLayout getLayout()
{
return layout;
}
public void setSource( String source )
{
this.source = source;
}
public String getSource()
{
return source;
}
/* .\ Tasks \.________________________________________________________ */
public String pathOf( Artifact artifact )
{
return getLayout().pathOf( artifact );
}
/* .\ State \.________________________________________________________ */
public void setBlacklisted( boolean blacklisted )
{
this.blacklisted = blacklisted;
}
public boolean isBlacklisted()
{
return blacklisted;
}
public boolean isManaged()
{
return this.url.getProtocol().equals( "file" );
}
public boolean isRemote()
{
return !this.url.getProtocol().equals( "file" );
}
public void setSnapshots( ArtifactRepositoryPolicy snapshots )
{
this.snapshots = snapshots;
}
public ArtifactRepositoryPolicy getSnapshots()
{
return snapshots;
}
public void setReleases( ArtifactRepositoryPolicy releases )
{
this.releases = releases;
}
public ArtifactRepositoryPolicy getReleases()
{
return releases;
}
public boolean equals( Object other )
{
return ( other == this || ( ( other instanceof Repository ) && ( (Repository) other ).getId().equals( getId() ) ) );
}
public int hashCode()
{
return getId().hashCode();
}
/* .\ ArtifactRepository Requirements \.______________________________ */
public String getBasedir()
{
return url.getPath();
}
public String getKey()
{
return getId();
}
public String getProtocol()
{
return url.getProtocol();
}
public boolean isUniqueVersion()
{
// TODO: Determine Importance
return false;
}
public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
{
return layout.pathOfRemoteRepositoryMetadata( artifactMetadata );
}
public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
{
return layout.pathOfLocalRepositoryMetadata( metadata, repository );
}
}

View File

@ -19,7 +19,7 @@ package org.apache.maven.archiva.repository.connector;
* under the License.
*/
import org.apache.maven.archiva.repository.Repository;
import org.apache.maven.archiva.model.ArchivaRepository;
import java.util.List;
@ -31,9 +31,9 @@ import java.util.List;
*/
public interface RepositoryConnector
{
public Repository getSourceRepository();
public ArchivaRepository getSourceRepository();
public Repository getTargetRepository();
public ArchivaRepository getTargetRepository();
public List getBlacklist();

View File

@ -1,4 +1,4 @@
package org.apache.maven.archiva.model;
package org.apache.maven.archiva.repository.content;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@ -19,15 +19,24 @@ package org.apache.maven.archiva.model;
* under the License.
*/
import org.apache.maven.archiva.model.ArchivaArtifact;
/**
* RepositoryContent
* BidirectionalRepositoryLayout - Similar in scope to ArtifactRepositoryLayout, but does
* the both the Path to Artifact and Artifact to Path conversions.
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public interface RepositoryContent
public interface BidirectionalRepositoryLayout
{
public RepositoryContentKey getRepositoryContentKey();
/**
* Given an ArchivaArtifact
*
* @param artifact
* @return
*/
public String pathOf( ArchivaArtifact artifact );
public void setRepositoryContentKey( RepositoryContentKey key );
ArchivaArtifact toArtifact( String path );
}

View File

@ -19,9 +19,10 @@ package org.apache.maven.archiva.repository.scanner;
* under the License.
*/
import org.apache.maven.archiva.common.consumers.Consumer;
import org.apache.maven.archiva.consumers.Consumer;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.RepositoryContentStatistics;
import org.apache.maven.archiva.repository.RepositoryException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.codehaus.plexus.util.DirectoryWalker;
import org.codehaus.plexus.util.FileUtils;
@ -72,7 +73,7 @@ public class RepositoryScanner
* @return the statistics for this scan.
* @throws RepositoryException if there was a fundamental problem with getting the discoverer started.
*/
public ScanStatistics scan( ArtifactRepository repository, List consumers, boolean includeSnapshots )
public RepositoryContentStatistics scan( ArchivaRepository repository, List consumers, boolean includeSnapshots )
throws RepositoryException
{
return scan( repository, consumers, includeSnapshots, 0, null, null );
@ -93,7 +94,7 @@ public class RepositoryScanner
* @return the statistics for this scan.
* @throws RepositoryException if there was a fundamental problem with getting the discoverer started.
*/
public ScanStatistics scan( ArtifactRepository repository, List consumers, boolean includeSnapshots,
public RepositoryContentStatistics scan( ArchivaRepository repository, List consumers, boolean includeSnapshots,
long onlyModifiedAfterTimestamp, List extraFileExclusions, List extraFileInclusions )
throws RepositoryException
{
@ -102,12 +103,12 @@ public class RepositoryScanner
throw new IllegalArgumentException( "Unable to operate on a null repository." );
}
if ( !"file".equals( repository.getProtocol() ) )
if ( !"file".equals( repository.getRepositoryURL().getProtocol() ) )
{
throw new UnsupportedOperationException( "Only filesystem repositories are supported." );
}
File repositoryBase = new File( repository.getBasedir() );
File repositoryBase = new File( repository.getRepositoryURL().getPath() );
if ( !repositoryBase.exists() )
{

View File

@ -20,8 +20,10 @@ package org.apache.maven.archiva.repository.scanner;
*/
import org.apache.commons.lang.SystemUtils;
import org.apache.maven.archiva.common.consumers.Consumer;
import org.apache.maven.archiva.common.utils.BaseFile;
import org.apache.maven.archiva.consumers.Consumer;
import org.apache.maven.archiva.model.ArchivaRepository;
import org.apache.maven.archiva.model.RepositoryContentStatistics;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.codehaus.plexus.util.DirectoryWalkListener;
import org.codehaus.plexus.util.SelectorUtils;
@ -45,19 +47,21 @@ public class RepositoryScannerInstance implements DirectoryWalkListener
private List consumers;
private ArtifactRepository repository;
private ArchivaRepository repository;
private boolean isCaseSensitive = true;
private ScanStatistics stats;
private RepositoryContentStatistics stats;
private long onlyModifiedAfterTimestamp = 0;
public RepositoryScannerInstance( ArtifactRepository repository, List consumerList )
public RepositoryScannerInstance( ArchivaRepository repository, List consumerList )
{
this.repository = repository;
this.consumers = consumerList;
stats = new ScanStatistics( repository );
stats = new RepositoryContentStatistics();
stats.setRepositoryId( repository.getId() );
Iterator it = this.consumers.iterator();
while ( it.hasNext() )
@ -77,36 +81,36 @@ public class RepositoryScannerInstance implements DirectoryWalkListener
}
}
public ScanStatistics getStatistics()
public RepositoryContentStatistics getStatistics()
{
return stats;
}
public void directoryWalkStarting( File basedir )
{
log.info( "Walk Started: [" + this.repository.getId() + "] " + this.repository.getBasedir() );
stats.reset();
stats.timestampStarted = System.currentTimeMillis();
log.info( "Walk Started: [" + this.repository.getId() + "] " + this.repository.getRepositoryURL() );
stats.triggerStart();
}
public void directoryWalkStep( int percentage, File file )
{
log.debug( "Walk Step: " + percentage + ", " + file );
stats.increaseFileCount();
// Timestamp finished points to the last successful scan, not this current one.
if ( file.lastModified() < onlyModifiedAfterTimestamp )
{
// Skip file as no change has occured.
log.debug( "Skipping, No Change: " + file.getAbsolutePath() );
stats.filesSkipped++;
return;
}
synchronized ( consumers )
{
stats.filesIncluded++;
stats.increaseNewFileCount();
BaseFile basefile = new BaseFile( repository.getBasedir(), file );
BaseFile basefile = new BaseFile( repository.getRepositoryURL().getPath(), file );
Iterator itConsumers = this.consumers.iterator();
while ( itConsumers.hasNext() )
@ -118,7 +122,6 @@ public class RepositoryScannerInstance implements DirectoryWalkListener
try
{
log.debug( "Sending to consumer: " + consumer.getName() );
stats.filesConsumed++;
consumer.processFile( basefile );
}
catch ( Exception e )
@ -141,8 +144,8 @@ public class RepositoryScannerInstance implements DirectoryWalkListener
public void directoryWalkFinished()
{
log.info( "Walk Finished: [" + this.repository.getId() + "] " + this.repository.getBasedir() );
stats.timestampFinished = System.currentTimeMillis();
log.info( "Walk Finished: [" + this.repository.getId() + "] " + this.repository.getRepositoryURL() );
stats.triggerFinished();
}
private boolean wantsFile( Consumer consumer, String relativePath )

View File

@ -1,198 +0,0 @@
package org.apache.maven.archiva.repository.scanner;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.commons.lang.math.NumberUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.IOUtil;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
/**
* ScanStatistics
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public class ScanStatistics
{
private static final String PROP_FILES_CONSUMED = "scan.consumed.files";
private static final String PROP_FILES_INCLUDED = "scan.included.files";
private static final String PROP_FILES_SKIPPED = "scan.skipped.files";
private static final String PROP_TIMESTAMP_STARTED = "scan.started.timestamp";
private static final String PROP_TIMESTAMP_FINISHED = "scan.finished.timestamp";
protected long timestampStarted = 0;
protected long timestampFinished = 0;
protected long filesIncluded = 0;
protected long filesConsumed = 0;
protected long filesSkipped = 0;
private ArtifactRepository repository;
public ScanStatistics( ArtifactRepository repository )
{
this.repository = repository;
}
public void load( String filename )
throws IOException
{
File repositoryBase = new File( this.repository.getBasedir() );
File scanProperties = new File( repositoryBase, filename );
FileInputStream fis = null;
try
{
Properties props = new Properties();
fis = new FileInputStream( scanProperties );
props.load( fis );
timestampFinished = NumberUtils.toLong( props.getProperty( PROP_TIMESTAMP_FINISHED ), 0 );
timestampStarted = NumberUtils.toLong( props.getProperty( PROP_TIMESTAMP_STARTED ), 0 );
filesIncluded = NumberUtils.toLong( props.getProperty( PROP_FILES_INCLUDED ), 0 );
filesConsumed = NumberUtils.toLong( props.getProperty( PROP_FILES_CONSUMED ), 0 );
filesSkipped = NumberUtils.toLong( props.getProperty( PROP_FILES_SKIPPED ), 0 );
}
catch ( IOException e )
{
reset();
throw e;
}
finally
{
IOUtil.close( fis );
}
}
public void save( String filename )
throws IOException
{
Properties props = new Properties();
props.setProperty( PROP_TIMESTAMP_FINISHED, String.valueOf( timestampFinished ) );
props.setProperty( PROP_TIMESTAMP_STARTED, String.valueOf( timestampStarted ) );
props.setProperty( PROP_FILES_INCLUDED, String.valueOf( filesIncluded ) );
props.setProperty( PROP_FILES_CONSUMED, String.valueOf( filesConsumed ) );
props.setProperty( PROP_FILES_SKIPPED, String.valueOf( filesSkipped ) );
File repositoryBase = new File( this.repository.getBasedir() );
File statsFile = new File( repositoryBase, filename );
FileOutputStream fos = null;
try
{
fos = new FileOutputStream( statsFile );
props.store( fos, "Last Scan Information, managed by Archiva. DO NOT EDIT" );
fos.flush();
}
finally
{
IOUtil.close( fos );
}
}
public void reset()
{
timestampStarted = 0;
timestampFinished = 0;
filesIncluded = 0;
filesConsumed = 0;
filesSkipped = 0;
}
public long getElapsedMilliseconds()
{
return timestampFinished - timestampStarted;
}
public long getFilesConsumed()
{
return filesConsumed;
}
public long getFilesIncluded()
{
return filesIncluded;
}
public ArtifactRepository getRepository()
{
return repository;
}
public long getTimestampFinished()
{
return timestampFinished;
}
public long getTimestampStarted()
{
return timestampStarted;
}
public long getFilesSkipped()
{
return filesSkipped;
}
public void setTimestampFinished( long timestampFinished )
{
this.timestampFinished = timestampFinished;
}
public void setTimestampStarted( long timestampStarted )
{
this.timestampStarted = timestampStarted;
}
public void dump( Logger logger )
{
logger.info( "----------------------------------------------------" );
logger.info( "Scan of Repository: " + repository.getId() );
logger.info( " Started : " + toHumanTimestamp( this.getTimestampStarted() ) );
logger.info( " Finished: " + toHumanTimestamp( this.getTimestampFinished() ) );
// TODO: pretty print ellapsed time.
logger.info( " Duration: " + this.getElapsedMilliseconds() + "ms" );
logger.info( " Files : " + this.getFilesIncluded() );
logger.info( " Consumed: " + this.getFilesConsumed() );
logger.info( " Skipped : " + this.getFilesSkipped() );
}
private String toHumanTimestamp( long timestamp )
{
SimpleDateFormat dateFormat = new SimpleDateFormat();
return dateFormat.format( new Date( timestamp ) );
}
}

View File

@ -19,6 +19,8 @@ package org.apache.maven.archiva.repository;
* under the License.
*/
import org.apache.maven.archiva.common.utils.RepositoryURL;
import java.net.MalformedURLException;
import junit.framework.TestCase;

44
pom.xml
View File

@ -228,13 +228,13 @@
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-common</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<!--
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-common</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
@ -242,62 +242,77 @@
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-core</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-reports-standard</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-model</artifactId>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-database</artifactId>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-consumer-api</artifactId>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-discoverer</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-repository-layer</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-indexer</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-proxy</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-applet</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-security</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-configuration</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-converter</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-utils</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-webapp</artifactId>
<version>${pom.version}</version>
<version>${archiva.version}</version>
<type>war</type>
</dependency>
<dependency>
@ -552,6 +567,7 @@
</pluginRepository>
</pluginRepositories>
<properties>
<archiva.version>1.0-SNAPSHOT</archiva.version>
<maven.version>2.0.5</maven.version>
<wagon.version>1.0-beta-2</wagon.version>
<plexus-security.version>1.0-alpha-11-SNAPSHOT</plexus-security.version>