Detangled profile activitation dependency on realm manager. Move org.apache.maven.realm package to maven-core project.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@695332 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2008-09-15 02:54:31 +00:00
parent 180bf37d84
commit bc3660ec47
9 changed files with 3 additions and 45 deletions

View File

@ -742,8 +742,8 @@ public class DefaultMavenExecutionRequestPopulator
ProfileActivationContext activationContext = request.getProfileActivationContext(); ProfileActivationContext activationContext = request.getProfileActivationContext();
if ( activationContext == null ) if ( activationContext == null )
{ {
activationContext = new DefaultProfileActivationContext( request.getRealmManager(), activationContext = new DefaultProfileActivationContext(
request.getProperties(), false ); request.getProperties(), false );
} }
activationContext.setExplicitlyActiveProfileIds( request.getActiveProfiles() ); activationContext.setExplicitlyActiveProfileIds( request.getActiveProfiles() );

View File

@ -27,13 +27,9 @@ import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
import org.apache.maven.profiles.activation.ProfileActivationContext; import org.apache.maven.profiles.activation.ProfileActivationContext;
import org.apache.maven.profiles.activation.ProfileActivationException; import org.apache.maven.profiles.activation.ProfileActivationException;
import org.apache.maven.profiles.activation.ProfileActivator; import org.apache.maven.profiles.activation.ProfileActivator;
import org.apache.maven.realm.DefaultMavenRealmManager;
import org.apache.maven.realm.MavenRealmManager;
import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException; import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.logging.Logger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
@ -81,11 +77,8 @@ public class DefaultProfileManager
private ProfileActivationContext createDefaultActivationContext() private ProfileActivationContext createDefaultActivationContext()
{ {
// create the necessary bits to get a skeletal profile manager running.
Logger logger = container.getLoggerManager().getLoggerForComponent( DefaultProfileManager.class.getName() );
MavenRealmManager manager = new DefaultMavenRealmManager( container, logger );
return new DefaultProfileActivationContext( manager, System.getProperties(), false ); return new DefaultProfileActivationContext(System.getProperties(), false );
} }
public ProfileActivationContext getProfileActivationContext() public ProfileActivationContext getProfileActivationContext()
@ -190,17 +183,6 @@ public class DefaultProfileManager
public List getActiveProfiles( Model model ) public List getActiveProfiles( Model model )
throws ProfileActivationException throws ProfileActivationException
{ {
MavenRealmManager realmManager = profileActivationContext.getRealmManager();
ClassRealm projectRealm = null;
ClassRealm oldLookupRealm = null;
if ( ( model != null ) && ( realmManager != null ) )
{
projectRealm = realmManager.getProjectRealm( getGroupId( model ), model.getArtifactId(),
getVersion( model ) );
oldLookupRealm = container.setLookupRealm( projectRealm );
}
try try
{ {
@ -271,10 +253,6 @@ public class DefaultProfileManager
} }
finally finally
{ {
if ( projectRealm != null )
{
container.setLookupRealm( oldLookupRealm );
}
} }
} }

View File

@ -19,7 +19,6 @@ package org.apache.maven.profiles.activation;
* under the License. * under the License.
*/ */
import org.apache.maven.realm.MavenRealmManager;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -38,21 +37,10 @@ public class DefaultProfileActivationContext
List explicitlyInactive; List explicitlyInactive;
private final MavenRealmManager realmManager;
private List activeByDefault; private List activeByDefault;
public DefaultProfileActivationContext( MavenRealmManager realmManager, Properties executionProperties,
boolean isCustomActivatorFailureSuppressed )
{
this.realmManager = realmManager;
this.executionProperties = executionProperties;
this.isCustomActivatorFailureSuppressed = isCustomActivatorFailureSuppressed;
}
public DefaultProfileActivationContext( Properties executionProperties, boolean isCustomActivatorFailureSuppressed ) public DefaultProfileActivationContext( Properties executionProperties, boolean isCustomActivatorFailureSuppressed )
{ {
realmManager = null;
this.executionProperties = executionProperties; this.executionProperties = executionProperties;
this.isCustomActivatorFailureSuppressed = isCustomActivatorFailureSuppressed; this.isCustomActivatorFailureSuppressed = isCustomActivatorFailureSuppressed;
} }
@ -102,11 +90,6 @@ public class DefaultProfileActivationContext
explicitlyInactive = inactive; explicitlyInactive = inactive;
} }
public MavenRealmManager getRealmManager()
{
return realmManager;
}
public void setActive( String profileId ) public void setActive( String profileId )
{ {
if ( explicitlyActive == null ) if ( explicitlyActive == null )

View File

@ -19,7 +19,6 @@ package org.apache.maven.profiles.activation;
* under the License. * under the License.
*/ */
import org.apache.maven.realm.MavenRealmManager;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@ -31,8 +30,6 @@ public interface ProfileActivationContext
List getExplicitlyInactiveProfileIds(); List getExplicitlyInactiveProfileIds();
MavenRealmManager getRealmManager();
Properties getExecutionProperties(); Properties getExecutionProperties();
boolean isCustomActivatorFailureSuppressed(); boolean isCustomActivatorFailureSuppressed();