o Removed obsolete code (plugin descriptors are cached by dedicated component)

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@805876 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-19 16:41:56 +00:00
parent 188543b54f
commit 90333e8cd9
2 changed files with 0 additions and 53 deletions

View File

@ -31,7 +31,6 @@ import org.apache.maven.model.Dependency;
import org.apache.maven.model.Exclusion; import org.apache.maven.model.Exclusion;
import org.apache.maven.model.Plugin; import org.apache.maven.model.Plugin;
import org.apache.maven.model.building.ModelUtils; import org.apache.maven.model.building.ModelUtils;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.codehaus.plexus.classworlds.realm.ClassRealm; import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Component;
@ -88,8 +87,6 @@ public class DefaultPluginCache
} }
} }
protected final Map<CacheKey, PluginDescriptor> descriptorsCache = new HashMap<CacheKey, PluginDescriptor>();
protected final Map<CacheKey, CacheRecord> cache = new HashMap<CacheKey, CacheRecord>(); protected final Map<CacheKey, CacheRecord> cache = new HashMap<CacheKey, CacheRecord>();
public CacheRecord get( Plugin plugin, ArtifactRepository localRepository, public CacheRecord get( Plugin plugin, ArtifactRepository localRepository,
@ -98,41 +95,6 @@ public class DefaultPluginCache
return cache.get( new CacheKey( plugin, localRepository, remoteRepositories ) ); return cache.get( new CacheKey( plugin, localRepository, remoteRepositories ) );
} }
public PluginDescriptor getPluginDescriptor( Plugin plugin, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories )
{
return clone( descriptorsCache.get( new CacheKey( plugin, localRepository, remoteRepositories ) ) );
}
protected static PluginDescriptor clone( PluginDescriptor original )
{
if ( original == null )
{
return null;
}
PluginDescriptor cloned = new PluginDescriptor();
cloned.setGroupId( original.getGroupId() );
cloned.setArtifactId( original.getArtifactId() );
cloned.setVersion( original.getVersion() );
cloned.setGoalPrefix( original.getGoalPrefix() );
cloned.setSource( original.getSource() );
cloned.setInheritedByDefault( original.isInheritedByDefault() );
cloned.setIntroducedDependencyArtifacts( original.getIntroducedDependencyArtifacts() ); // TODO do we need to clone this?
cloned.setName( original.getName() );
cloned.setDescription( original.getDescription() );
cloned.setPlugin( ModelUtils.clonePlugin( original.getPlugin() ) ); // TODO not sure I need to clone here
cloned.setPluginArtifact( original.getPluginArtifact() );
cloned.setId( original.getId() );
cloned.setIsolatedRealm( original.isIsolatedRealm() );
cloned.setComponents( original.getComponents() );
cloned.setDependencies( original.getDependencies() );
return cloned;
}
public void put( Plugin plugin, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, public void put( Plugin plugin, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,
ClassRealm pluginRealm, List<Artifact> pluginArtifacts ) ClassRealm pluginRealm, List<Artifact> pluginArtifacts )
{ {
@ -152,17 +114,9 @@ public class DefaultPluginCache
cache.put( key, record ); cache.put( key, record );
} }
public void putPluginDescriptor( Plugin plugin, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, PluginDescriptor pluginDescriptor )
{
CacheKey key = new CacheKey( plugin, localRepository, remoteRepositories );
descriptorsCache.put( key, clone( pluginDescriptor ) );
}
public void flush() public void flush()
{ {
cache.clear(); cache.clear();
descriptorsCache.clear();
} }
protected static int pluginHashCode( Plugin plugin ) protected static int pluginHashCode( Plugin plugin )

View File

@ -24,7 +24,6 @@ import java.util.List;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Plugin; import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.codehaus.plexus.classworlds.realm.ClassRealm; import org.codehaus.plexus.classworlds.realm.ClassRealm;
public interface PluginCache public interface PluginCache
@ -42,12 +41,6 @@ public interface PluginCache
} }
} }
PluginDescriptor getPluginDescriptor( Plugin plugin, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories );
void putPluginDescriptor( Plugin plugin, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories, PluginDescriptor pluginDescriptor );
CacheRecord get( Plugin plugin, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories ); CacheRecord get( Plugin plugin, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories );
void put( Plugin plugin, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories, void put( Plugin plugin, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories,