aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata')
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java558
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java119
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java172
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java40
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java98
6 files changed, 0 insertions, 1026 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java
deleted file mode 100644
index e7937134..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java
+++ /dev/null
@@ -1,558 +0,0 @@
-package org.apache.maven.artifact.repository.metadata;
-
-/*
- * 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.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-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.DefaultRepositoryRequest;
-import org.apache.maven.artifact.repository.RepositoryRequest;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
-import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer;
-import org.apache.maven.repository.legacy.UpdateCheckManager;
-import org.apache.maven.repository.legacy.WagonManager;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
-import org.apache.maven.wagon.TransferFailedException;
-import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.ReaderFactory;
-import org.codehaus.plexus.util.WriterFactory;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-/**
- * @author Jason van Zyl
- */
-@Component( role = RepositoryMetadataManager.class )
-public class DefaultRepositoryMetadataManager
- extends AbstractLogEnabled
- implements RepositoryMetadataManager
-{
- @Requirement
- private WagonManager wagonManager;
-
- @Requirement
- private UpdateCheckManager updateCheckManager;
-
- public void resolve( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories,
- ArtifactRepository localRepository )
- throws RepositoryMetadataResolutionException
- {
- RepositoryRequest request = new DefaultRepositoryRequest();
- request.setLocalRepository( localRepository );
- request.setRemoteRepositories( remoteRepositories );
- resolve( metadata, request );
- }
-
- public void resolve( RepositoryMetadata metadata, RepositoryRequest request )
- throws RepositoryMetadataResolutionException
- {
- ArtifactRepository localRepo = request.getLocalRepository();
- List<ArtifactRepository> remoteRepositories = request.getRemoteRepositories();
-
- if ( !request.isOffline() )
- {
- Date localCopyLastModified = null;
- if ( metadata.getBaseVersion() != null )
- {
- localCopyLastModified = getLocalCopyLastModified( localRepo, metadata );
- }
-
- for ( ArtifactRepository repository : remoteRepositories )
- {
- ArtifactRepositoryPolicy policy = metadata.getPolicy( repository );
-
- File file =
- new File( localRepo.getBasedir(), localRepo.pathOfLocalRepositoryMetadata( metadata, repository ) );
- boolean update;
-
- if ( !policy.isEnabled() )
- {
- update = false;
-
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug(
- "Skipping update check for " + metadata.getKey() + " (" + file
- + ") from disabled repository " + repository.getId() + " ("
- + repository.getUrl() + ")" );
- }
- }
- else if ( request.isForceUpdate() )
- {
- update = true;
- }
- else if ( localCopyLastModified != null && !policy.checkOutOfDate( localCopyLastModified ) )
- {
- update = false;
-
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug(
- "Skipping update check for " + metadata.getKey() + " (" + file
- + ") from repository " + repository.getId() + " (" + repository.getUrl()
- + ") in favor of local copy" );
- }
- }
- else
- {
- update = updateCheckManager.isUpdateRequired( metadata, repository, file );
- }
-
- if ( update )
- {
- getLogger().info( metadata.getKey() + ": checking for updates from " + repository.getId() );
- try
- {
- wagonManager.getArtifactMetadata( metadata, repository, file, policy.getChecksumPolicy() );
- }
- catch ( ResourceDoesNotExistException e )
- {
- getLogger().debug( metadata + " could not be found on repository: " + repository.getId() );
-
- // delete the local copy so the old details aren't used.
- if ( file.exists() )
- {
- if ( !file.delete() )
- {
- // sleep for 10ms just in case this is windows holding a file lock
- try
- {
- Thread.sleep( 10 );
- }
- catch ( InterruptedException ie )
- {
- // ignore
- }
- file.delete(); // if this fails, forget about it
- }
- }
- }
- catch ( TransferFailedException e )
- {
- getLogger().warn( metadata + " could not be retrieved from repository: " + repository.getId()
- + " due to an error: " + e.getMessage() );
- getLogger().debug( "Exception", e );
- }
- finally
- {
- updateCheckManager.touch( metadata, repository, file );
- }
- }
-
- // TODO: should this be inside the above check?
- // touch file so that this is not checked again until interval has passed
- if ( file.exists() )
- {
- file.setLastModified( System.currentTimeMillis() );
- }
- }
- }
-
- try
- {
- mergeMetadata( metadata, remoteRepositories, localRepo );
- }
- catch ( RepositoryMetadataStoreException e )
- {
- throw new RepositoryMetadataResolutionException( "Unable to store local copy of metadata: "
- + e.getMessage(), e );
- }
- }
-
- private Date getLocalCopyLastModified( ArtifactRepository localRepository, RepositoryMetadata metadata )
- {
- String metadataPath = localRepository.pathOfLocalRepositoryMetadata( metadata, localRepository );
- File metadataFile = new File( localRepository.getBasedir(), metadataPath );
- return metadataFile.isFile() ? new Date( metadataFile.lastModified() ) : null;
- }
-
- private void mergeMetadata( RepositoryMetadata metadata, List<ArtifactRepository> remoteRepositories,
- ArtifactRepository localRepository )
- throws RepositoryMetadataStoreException
- {
- // TODO: currently this is first wins, but really we should take the latest by comparing either the
- // snapshot timestamp, or some other timestamp later encoded into the metadata.
- // TODO: this needs to be repeated here so the merging doesn't interfere with the written metadata
- // - we'd be much better having a pristine input, and an ongoing metadata for merging instead
-
- Map<ArtifactRepository, Metadata> previousMetadata = new HashMap<ArtifactRepository, Metadata>();
- ArtifactRepository selected = null;
- for ( ArtifactRepository repository : remoteRepositories )
- {
- ArtifactRepositoryPolicy policy = metadata.getPolicy( repository );
-
- if ( policy.isEnabled() && loadMetadata( metadata, repository, localRepository, previousMetadata ) )
- {
- metadata.setRepository( repository );
- selected = repository;
- }
- }
- if ( loadMetadata( metadata, localRepository, localRepository, previousMetadata ) )
- {
- metadata.setRepository( null );
- selected = localRepository;
- }
-
- updateSnapshotMetadata( metadata, previousMetadata, selected, localRepository );
- }
-
- private void updateSnapshotMetadata( RepositoryMetadata metadata,
- Map<ArtifactRepository, Metadata> previousMetadata,
- ArtifactRepository selected, ArtifactRepository localRepository )
- throws RepositoryMetadataStoreException
- {
- // TODO: this could be a lot nicer... should really be in the snapshot transformation?
- if ( metadata.isSnapshot() )
- {
- Metadata prevMetadata = metadata.getMetadata();
-
- for ( ArtifactRepository repository : previousMetadata.keySet() )
- {
- Metadata m = previousMetadata.get( repository );
- if ( repository.equals( selected ) )
- {
- if ( m.getVersioning() == null )
- {
- m.setVersioning( new Versioning() );
- }
-
- if ( m.getVersioning().getSnapshot() == null )
- {
- m.getVersioning().setSnapshot( new Snapshot() );
- }
- }
- else
- {
- if ( ( m.getVersioning() != null ) && ( m.getVersioning().getSnapshot() != null )
- && m.getVersioning().getSnapshot().isLocalCopy() )
- {
- m.getVersioning().getSnapshot().setLocalCopy( false );
- metadata.setMetadata( m );
- metadata.storeInLocalRepository( localRepository, repository );
- }
- }
- }
-
- metadata.setMetadata( prevMetadata );
- }
- }
-
- private boolean loadMetadata( RepositoryMetadata repoMetadata, ArtifactRepository remoteRepository,
- ArtifactRepository localRepository, Map<ArtifactRepository,
- Metadata> previousMetadata )
- {
- boolean setRepository = false;
-
- File metadataFile =
- new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( repoMetadata,
- remoteRepository ) );
-
- if ( metadataFile.exists() )
- {
- Metadata metadata;
-
- try
- {
- metadata = readMetadata( metadataFile );
- }
- catch ( RepositoryMetadataReadException e )
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().warn( e.getMessage(), e );
- }
- else
- {
- getLogger().warn( e.getMessage() );
- }
- return setRepository;
- }
-
- if ( repoMetadata.isSnapshot() && ( previousMetadata != null ) )
- {
- previousMetadata.put( remoteRepository, metadata );
- }
-
- if ( repoMetadata.getMetadata() != null )
- {
- setRepository = repoMetadata.getMetadata().merge( metadata );
- }
- else
- {
- repoMetadata.setMetadata( metadata );
- setRepository = true;
- }
- }
- return setRepository;
- }
-
- /** @todo share with DefaultPluginMappingManager. */
- protected Metadata readMetadata( File mappingFile )
- throws RepositoryMetadataReadException
- {
- Metadata result;
-
- Reader reader = null;
- try
- {
- reader = ReaderFactory.newXmlReader( mappingFile );
-
- MetadataXpp3Reader mappingReader = new MetadataXpp3Reader();
-
- result = mappingReader.read( reader, false );
- }
- catch ( FileNotFoundException e )
- {
- throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "'", e );
- }
- catch ( IOException e )
- {
- throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': "
- + e.getMessage(), e );
- }
- catch ( XmlPullParserException e )
- {
- throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': "
- + e.getMessage(), e );
- }
- finally
- {
- IOUtil.close( reader );
- }
-
- return result;
- }
-
- /**
- * Ensures the last updated timestamp of the specified metadata does not refer to the future and fixes the local
- * metadata if necessary to allow proper merging/updating of metadata during deployment.
- */
- private void fixTimestamp( File metadataFile, Metadata metadata, Metadata reference )
- {
- boolean changed = false;
-
- if ( metadata != null && reference != null )
- {
- Versioning versioning = metadata.getVersioning();
- Versioning versioningRef = reference.getVersioning();
- if ( versioning != null && versioningRef != null )
- {
- String lastUpdated = versioning.getLastUpdated();
- String now = versioningRef.getLastUpdated();
- if ( lastUpdated != null && now != null && now.compareTo( lastUpdated ) < 0 )
- {
- getLogger().warn(
- "The last updated timestamp in " + metadataFile + " refers to the future (now = "
- + now + ", lastUpdated = " + lastUpdated
- + "). Please verify that the clocks of all"
- + " deploying machines are reasonably synchronized." );
- versioning.setLastUpdated( now );
- changed = true;
- }
- }
- }
-
- if ( changed )
- {
- getLogger().debug( "Repairing metadata in " + metadataFile );
-
- Writer writer = null;
- try
- {
- writer = WriterFactory.newXmlWriter( metadataFile );
- new MetadataXpp3Writer().write( writer, metadata );
- }
- catch ( IOException e )
- {
- String msg = "Could not write fixed metadata to " + metadataFile + ": " + e.getMessage();
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().warn( msg, e );
- }
- else
- {
- getLogger().warn( msg );
- }
- }
- finally
- {
- IOUtil.close( writer );
- }
- }
- }
-
- public void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository,
- ArtifactRepository remoteRepository )
- throws RepositoryMetadataResolutionException
- {
- File file;
- try
- {
- file = getArtifactMetadataFromDeploymentRepository( metadata, localRepository, remoteRepository );
- }
- catch ( TransferFailedException e )
- {
- throw new RepositoryMetadataResolutionException( metadata + " could not be retrieved from repository: "
- + remoteRepository.getId() + " due to an error: " + e.getMessage(), e );
- }
-
- try
- {
- if ( file.exists() )
- {
- Metadata prevMetadata = readMetadata( file );
- metadata.setMetadata( prevMetadata );
- }
- }
- catch ( RepositoryMetadataReadException e )
- {
- throw new RepositoryMetadataResolutionException( e.getMessage(), e );
- }
- }
-
- private File getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata,
- ArtifactRepository localRepo,
- ArtifactRepository remoteRepository )
- throws TransferFailedException
- {
- File file =
- new File( localRepo.getBasedir(), localRepo.pathOfLocalRepositoryMetadata( metadata, remoteRepository ) );
-
- try
- {
- wagonManager.getArtifactMetadataFromDeploymentRepository( metadata, remoteRepository, file,
- ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
- }
- catch ( ResourceDoesNotExistException e )
- {
- getLogger().info( metadata + " could not be found on repository: " + remoteRepository.getId()
- + ", so will be created" );
-
- // delete the local copy so the old details aren't used.
- if ( file.exists() )
- {
- if ( !file.delete() )
- {
- // sleep for 10ms just in case this is windows holding a file lock
- try
- {
- Thread.sleep( 10 );
- }
- catch ( InterruptedException ie )
- {
- // ignore
- }
- file.delete(); // if this fails, forget about it
- }
- }
- }
- finally
- {
- if ( metadata instanceof RepositoryMetadata )
- {
- updateCheckManager.touch( (RepositoryMetadata) metadata, remoteRepository, file );
- }
- }
- return file;
- }
-
- public void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository,
- ArtifactRepository deploymentRepository )
- throws RepositoryMetadataDeploymentException
- {
- File file;
- if ( metadata instanceof RepositoryMetadata )
- {
- getLogger().info( "Retrieving previous metadata from " + deploymentRepository.getId() );
- try
- {
- file = getArtifactMetadataFromDeploymentRepository( metadata, localRepository, deploymentRepository );
- }
- catch ( TransferFailedException e )
- {
- throw new RepositoryMetadataDeploymentException( metadata + " could not be retrieved from repository: "
- + deploymentRepository.getId() + " due to an error: " + e.getMessage(), e );
- }
-
- if ( file.isFile() )
- {
- try
- {
- fixTimestamp( file, readMetadata( file ), ( (RepositoryMetadata) metadata ).getMetadata() );
- }
- catch ( RepositoryMetadataReadException e )
- {
- // will be reported via storeInlocalRepository
- }
- }
- }
- else
- {
- // It's a POM - we don't need to retrieve it first
- file =
- new File( localRepository.getBasedir(),
- localRepository.pathOfLocalRepositoryMetadata( metadata, deploymentRepository ) );
- }
-
- try
- {
- metadata.storeInLocalRepository( localRepository, deploymentRepository );
- }
- catch ( RepositoryMetadataStoreException e )
- {
- throw new RepositoryMetadataDeploymentException( "Error installing metadata: " + e.getMessage(), e );
- }
-
- try
- {
- wagonManager.putArtifactMetadata( file, metadata, deploymentRepository );
- }
- catch ( TransferFailedException e )
- {
- throw new RepositoryMetadataDeploymentException( "Error while deploying metadata: " + e.getMessage(), e );
- }
- }
-
- public void install( ArtifactMetadata metadata, ArtifactRepository localRepository )
- throws RepositoryMetadataInstallationException
- {
- try
- {
- metadata.storeInLocalRepository( localRepository, localRepository );
- }
- catch ( RepositoryMetadataStoreException e )
- {
- throw new RepositoryMetadataInstallationException( "Error installing metadata: " + e.getMessage(), e );
- }
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java
deleted file mode 100644
index 490b47f3..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.apache.maven.artifact.repository.metadata;
-
-/*
- * 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.Iterator;
-import java.util.List;
-
-/**
- * Metadata for the group directory of the repository.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class GroupRepositoryMetadata
- extends AbstractRepositoryMetadata
-{
- private final String groupId;
-
- public GroupRepositoryMetadata( String groupId )
- {
- super( new Metadata() );
- this.groupId = groupId;
- }
-
- public boolean storedInGroupDirectory()
- {
- return true;
- }
-
- public boolean storedInArtifactVersionDirectory()
- {
- return false;
- }
-
- public String getGroupId()
- {
- return groupId;
- }
-
- public String getArtifactId()
- {
- return null;
- }
-
- public String getBaseVersion()
- {
- return null;
- }
-
- public void addPluginMapping( String goalPrefix,
- String artifactId )
- {
- addPluginMapping( goalPrefix, artifactId, artifactId );
- }
-
- public void addPluginMapping( String goalPrefix,
- String artifactId,
- String name )
- {
- List plugins = getMetadata().getPlugins();
- boolean found = false;
- for ( Iterator i = plugins.iterator(); i.hasNext() && !found; )
- {
- Plugin plugin = (Plugin) i.next();
- if ( plugin.getPrefix().equals( goalPrefix ) )
- {
- found = true;
- }
- }
- if ( !found )
- {
- Plugin plugin = new Plugin();
- plugin.setPrefix( goalPrefix );
- plugin.setArtifactId( artifactId );
- plugin.setName( name );
-
-
- getMetadata().addPlugin( plugin );
- }
- }
-
- public Object getKey()
- {
- return groupId;
- }
-
- public boolean isSnapshot()
- {
- return false;
- }
-
- public ArtifactRepository getRepository()
- {
- return null;
- }
-
- public void setRepository( ArtifactRepository remoteRepository )
- {
- // intentionally blank
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java
deleted file mode 100644
index bf199218..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package org.apache.maven.artifact.repository.metadata;
-
-/*
- * 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.io.File;
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.maven.artifact.metadata.ArtifactMetadata;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.codehaus.plexus.util.FileUtils;
-import org.eclipse.aether.RepositoryException;
-import org.eclipse.aether.metadata.AbstractMetadata;
-import org.eclipse.aether.metadata.MergeableMetadata;
-import org.eclipse.aether.metadata.Metadata;
-
-/**
- * <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
- * of the public API. In particular, this class can be changed or deleted without prior notice.
- *
- * @author Benjamin Bentmann
- */
-public final class MetadataBridge
- extends AbstractMetadata
- implements MergeableMetadata
-{
-
- private ArtifactMetadata metadata;
-
- private boolean merged;
-
- public MetadataBridge( ArtifactMetadata metadata )
- {
- this.metadata = metadata;
- }
-
- public void merge( File current, File result )
- throws RepositoryException
- {
- try
- {
- if ( current.exists() )
- {
- FileUtils.copyFile( current, result );
- }
- ArtifactRepository localRepo = new MetadataRepository( result );
- metadata.storeInLocalRepository( localRepo, localRepo );
- merged = true;
- }
- catch ( Exception e )
- {
- throw new RepositoryException( e.getMessage(), e );
- }
- }
-
- public boolean isMerged()
- {
- return merged;
- }
-
- public String getGroupId()
- {
- return emptify( metadata.getGroupId() );
- }
-
- public String getArtifactId()
- {
- return metadata.storedInGroupDirectory() ? "" : emptify( metadata.getArtifactId() );
- }
-
- public String getVersion()
- {
- return metadata.storedInArtifactVersionDirectory() ? emptify( metadata.getBaseVersion() ) : "";
- }
-
- public String getType()
- {
- return metadata.getRemoteFilename();
- }
-
- private String emptify( String string )
- {
- return ( string != null ) ? string : "";
- }
-
- public File getFile()
- {
- return null;
- }
-
- public MetadataBridge setFile( File file )
- {
- return this;
- }
-
- public Nature getNature()
- {
- if ( metadata instanceof RepositoryMetadata )
- {
- switch ( ( (RepositoryMetadata) metadata ).getNature() )
- {
- case RepositoryMetadata.RELEASE_OR_SNAPSHOT:
- return Nature.RELEASE_OR_SNAPSHOT;
- case RepositoryMetadata.SNAPSHOT:
- return Nature.SNAPSHOT;
- default:
- return Nature.RELEASE;
- }
- }
- else
- {
- return Nature.RELEASE;
- }
- }
-
- public Map<String, String> getProperties()
- {
- return Collections.emptyMap();
- }
-
- @Override
- public Metadata setProperties( Map<String, String> properties )
- {
- return this;
- }
-
- @SuppressWarnings( "deprecation" )
- static class MetadataRepository
- extends DefaultArtifactRepository
- {
-
- private File metadataFile;
-
- public MetadataRepository( File metadataFile )
- {
- super( "local", "", null );
- this.metadataFile = metadataFile;
- }
-
- @Override
- public String getBasedir()
- {
- return metadataFile.getParent();
- }
-
- @Override
- public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
- {
- return metadataFile.getName();
- }
-
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java
deleted file mode 100644
index bdc4a795..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.apache.maven.artifact.repository.metadata;
-
-/*
- * 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.
- */
-
-/**
- * Assists in handling repository metadata.
- *
- * @author Benjamin Bentmann
- */
-class MetadataUtils
-{
-
- public static Metadata cloneMetadata( Metadata src )
- {
- if ( src == null )
- {
- return null;
- }
- return src.clone();
- }
-
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java
deleted file mode 100644
index 23e59841..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.apache.maven.artifact.repository.metadata;
-
-/*
- * 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.
- */
-
-/**
- * Problem storing the repository metadata in the local repository.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- */
-public class RepositoryMetadataReadException
- extends Exception
-{
- public RepositoryMetadataReadException( String message )
- {
- super( message );
- }
-
- public RepositoryMetadataReadException( String message,
- Exception e )
- {
- super( message, e );
- }
-}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java
deleted file mode 100644
index 359ab2ce..00000000
--- a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.apache.maven.artifact.repository.metadata;
-
-/*
- * 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.repository.ArtifactRepository;
-
-/**
- * Metadata for the artifact version directory of the repository.
- *
- * @author <a href="mailto:brett@apache.org">Brett Porter</a>
- * @todo split instantiation (versioning, plugin mappings) from definition
- */
-public class SnapshotArtifactRepositoryMetadata
- extends AbstractRepositoryMetadata
-{
- private Artifact artifact;
-
- public SnapshotArtifactRepositoryMetadata( Artifact artifact )
- {
- super( createMetadata( artifact, null ) );
- this.artifact = artifact;
- }
-
- public SnapshotArtifactRepositoryMetadata( Artifact artifact,
- Snapshot snapshot )
- {
- super( createMetadata( artifact, createVersioning( snapshot ) ) );
- this.artifact = artifact;
- }
-
- public boolean storedInGroupDirectory()
- {
- return false;
- }
-
- public boolean storedInArtifactVersionDirectory()
- {
- return true;
- }
-
- public String getGroupId()
- {
- return artifact.getGroupId();
- }
-
- public String getArtifactId()
- {
- return artifact.getArtifactId();
- }
-
- public String getBaseVersion()
- {
- return artifact.getBaseVersion();
- }
-
- public Object getKey()
- {
- return "snapshot " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getBaseVersion();
- }
-
- public boolean isSnapshot()
- {
- return artifact.isSnapshot();
- }
-
- public int getNature()
- {
- return isSnapshot() ? SNAPSHOT : RELEASE;
- }
-
- public ArtifactRepository getRepository()
- {
- return artifact.getRepository();
- }
-
- public void setRepository( ArtifactRepository remoteRepository )
- {
- artifact.setRepository( remoteRepository );
- }
-}