diff options
author | Joakim Erdfelt <joakime@apache.org> | 2007-03-15 16:48:40 +0000 |
---|---|---|
committer | Joakim Erdfelt <joakime@apache.org> | 2007-03-15 16:48:40 +0000 |
commit | 7a5f50c9f625ed9fdf291dfc1d7d95a2eebc59ba (patch) | |
tree | 75b2471103bc683ac5c23e66da013e3e4d593743 /archiva-database/src/main | |
parent | 344fe5c34e0487dede12feee7950aaaa2ec3c3cf (diff) | |
download | archiva-7a5f50c9f625ed9fdf291dfc1d7d95a2eebc59ba.tar.gz archiva-7a5f50c9f625ed9fdf291dfc1d7d95a2eebc59ba.zip |
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
Diffstat (limited to 'archiva-database/src/main')
12 files changed, 886 insertions, 984 deletions
diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/AbstractIbatisStore.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/AbstractIbatisStore.java deleted file mode 100644 index 0e25a028c..000000000 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/AbstractIbatisStore.java +++ /dev/null @@ -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(); - } - } - } - - -} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/AbstractMetadataKeyDatabase.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/AbstractMetadataKeyDatabase.java deleted file mode 100644 index dda52114a..000000000 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/AbstractMetadataKeyDatabase.java +++ /dev/null @@ -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(); - } - } -} - -} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java new file mode 100644 index 000000000..ef56ad1b1 --- /dev/null +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/ArchivaDAO.java @@ -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; + +} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/Constraint.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/Constraint.java new file mode 100644 index 000000000..eac67f913 --- /dev/null +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/Constraint.java @@ -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(); +} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/ObjectNotFoundException.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/ObjectNotFoundException.java new file mode 100644 index 000000000..e9dfc01d0 --- /dev/null +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/ObjectNotFoundException.java @@ -0,0 +1,53 @@ +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. + */ + +/** + * ObjectNotFoundException + * + * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @version $Id$ + */ +public class ObjectNotFoundException + extends ArchivaDatabaseException +{ + private Object id; + + public ObjectNotFoundException( String message, Throwable cause, Object id ) + { + super( message, cause ); + this.id = id; + } + + public ObjectNotFoundException( String message, Throwable cause ) + { + super( message, cause ); + } + + public ObjectNotFoundException( String message ) + { + super( message ); + } + + public Object getId() + { + return id; + } +} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryMetadataDatabase.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryMetadataDatabase.java deleted file mode 100644 index 5434e6071..000000000 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/RepositoryMetadataDatabase.java +++ /dev/null @@ -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 ); - } - } - - -} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/artifact/ArtifactKey.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/artifact/ArtifactKey.java deleted file mode 100644 index e1f00ab98..000000000 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/artifact/ArtifactKey.java +++ /dev/null @@ -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; - } -} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/artifact/ArtifactPersistence.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/artifact/ArtifactPersistence.java deleted file mode 100644 index d59cbf9cc..000000000 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/artifact/ArtifactPersistence.java +++ /dev/null @@ -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 ) - { - - } - -} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ArchivaRepositoryByUrlConstraint.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ArchivaRepositoryByUrlConstraint.java new file mode 100644 index 000000000..8abc14bec --- /dev/null +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/ArchivaRepositoryByUrlConstraint.java @@ -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; + } +} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java new file mode 100644 index 000000000..7ab55087e --- /dev/null +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoAccess.java @@ -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; + } + +} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java new file mode 100644 index 000000000..00af94585 --- /dev/null +++ b/archiva-database/src/main/java/org/apache/maven/archiva/database/jdo/JdoArchivaDAO.java @@ -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 + + } + +} diff --git a/archiva-database/src/main/java/org/apache/maven/archiva/database/key/MetadataKey.java b/archiva-database/src/main/java/org/apache/maven/archiva/database/key/MetadataKey.java deleted file mode 100644 index b06e03b17..000000000 --- a/archiva-database/src/main/java/org/apache/maven/archiva/database/key/MetadataKey.java +++ /dev/null @@ -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; - } - - - -} |