From c002a8d22eb2fdd624b57dd0f008d1fd78f348f7 Mon Sep 17 00:00:00 2001 From: Britton Isbell Date: Thu, 26 Feb 2009 17:28:25 +0000 Subject: [PATCH] Removed remaining activator interfaces and uses. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@748216 13f79535-47bb-0310-9956-ffa450edef68 --- .../errors/DefaultProjectErrorReporter.java | 47 +----- .../maven/errors/ProjectErrorReporter.java | 24 --- .../apache/maven/errors/ProjectErrorTips.java | 15 -- .../maven/profiles/AlwaysOnActivation.java | 28 ---- .../activation/AlwaysOnProfileActivator.java | 39 ----- .../profiles/activation/CustomActivator.java | 154 ------------------ .../CustomActivatorExpressionEvaluator.java | 44 ----- .../activation/DetectedProfileActivator.java | 54 ------ .../profiles/activation/ProfileActivator.java | 34 ---- .../validation/DefaultModelValidator.java | 1 - 10 files changed, 1 insertion(+), 439 deletions(-) delete mode 100644 maven-project/src/main/java/org/apache/maven/profiles/AlwaysOnActivation.java delete mode 100644 maven-project/src/main/java/org/apache/maven/profiles/activation/AlwaysOnProfileActivator.java delete mode 100644 maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivator.java delete mode 100644 maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivatorExpressionEvaluator.java delete mode 100644 maven-project/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java delete mode 100644 maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java diff --git a/maven-core/src/main/java/org/apache/maven/errors/DefaultProjectErrorReporter.java b/maven-core/src/main/java/org/apache/maven/errors/DefaultProjectErrorReporter.java index 72f46849c3..9bae584f87 100644 --- a/maven-core/src/main/java/org/apache/maven/errors/DefaultProjectErrorReporter.java +++ b/maven-core/src/main/java/org/apache/maven/errors/DefaultProjectErrorReporter.java @@ -13,7 +13,6 @@ import org.apache.maven.model.Profile; import org.apache.maven.model.Repository; import org.apache.maven.profiles.activation.ProfileActivationContext; import org.apache.maven.profiles.activation.ProfileActivationException; -import org.apache.maven.profiles.activation.ProfileActivator; import org.apache.maven.execution.DuplicateProjectException; import org.apache.maven.project.InvalidProjectModelException; import org.apache.maven.project.InvalidProjectVersionException; @@ -74,7 +73,6 @@ public class DefaultProjectErrorReporter } /** - * @see ProjectErrorReporter#hasInformationFor(java.lang.Throwable) */ public Throwable findReportedException( Throwable error ) { @@ -137,48 +135,7 @@ public class DefaultProjectErrorReporter formattedMessages.put( error, formattedMessage ); } - /** - * @see ProjectErrorReporter#reportActivatorErrorWhileApplyingProfiles(org.apache.maven.profiles.activation.ProfileActivator, org.apache.maven.model.Model, java.io.File, org.apache.maven.model.Profile, org.apache.maven.profiles.activation.ProfileActivationContext, org.apache.maven.profiles.activation.ProfileActivationException) - */ - public void reportActivatorError( ProfileActivator activator, - Model model, - File pomFile, - Profile profile, - ProfileActivationContext context, - ProfileActivationException cause ) - { - StringWriter writer = new StringWriter(); - writer.write( NEWLINE ); - writer.write( "Profile activator: " ); - writer.write( activator.getClass().getName() ); - writer.write( " experienced an error while processing profile:" ); - writer.write( NEWLINE ); - writer.write( NEWLINE ); - writer.write( profile.getId() ); - writer.write( " (source: " ); - writer.write( profile.getSource() ); - writer.write( ")" ); - writer.write( NEWLINE ); - writer.write( NEWLINE ); - writer.write( "Error message: " ); - writer.write( NEWLINE ); - writer.write( cause.getMessage() ); - - addStandardInfo( model.getId(), pomFile, writer ); - addTips( ProjectErrorTips.getTipsForActivatorError( activator, - model.getId(), - pomFile, - profile, - context, - cause ), writer ); - - registerBuildError( cause, writer.toString(), cause.getCause() ); - } - - /** - * @see ProjectErrorReporter#reportActivatorLookupError(java.lang.String, java.io.File, org.apache.maven.model.Profile, org.codehaus.plexus.component.repository.exception.ComponentLookupException) - */ public void reportActivatorLookupError( Model model, File pomFile, Profile profile, @@ -275,9 +232,7 @@ public class DefaultProjectErrorReporter registerBuildError( cause, writer.toString(), cause.getCause() ); } - /** - * @see ProjectErrorReporter#reportInvalidRepositoryWhileGettingRepositoriesFromProfiles(org.apache.maven.model.Repository, java.lang.String, java.io.File, org.apache.maven.artifact.InvalidRepositoryException) - */ + public void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo, Model model, File pomFile, diff --git a/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorReporter.java b/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorReporter.java index 70a824feb9..93c7a4413f 100644 --- a/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorReporter.java +++ b/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorReporter.java @@ -7,7 +7,6 @@ import org.apache.maven.model.Profile; import org.apache.maven.model.Repository; import org.apache.maven.profiles.activation.ProfileActivationContext; import org.apache.maven.profiles.activation.ProfileActivationException; -import org.apache.maven.profiles.activation.ProfileActivator; import org.apache.maven.execution.DuplicateProjectException; import org.apache.maven.project.InvalidProjectModelException; import org.apache.maven.project.InvalidProjectVersionException; @@ -35,29 +34,6 @@ public interface ProjectErrorReporter boolean isStackTraceRecommended( Throwable error ); - /** - * Call Stack: - *
- *
-     * DefaultProfileAdvisor.applyActivatedProfiles(..)
-     * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
-     * --> DefaultProfileAdvisor.applyActivatedProfiles(..) (private)
-     * --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
-     *     --> DefaultProfileManager.getActiveProfiles(..)
-     *         --> DefaultProfileManager.isActive(..) (private)
-     *             --> ProfileActivator.canDetermineActivation(..)
-     *             --> ProfileActivator.isActive(..)
-     *         <------ ProfileActivationException
-     * <------ ProjectBuildingException
-     * 
- */ - void reportActivatorError( ProfileActivator activator, - Model model, - File pomFile, - Profile profile, - ProfileActivationContext context, - ProfileActivationException cause ); - /** * Call Stack: *
diff --git a/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorTips.java b/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorTips.java index 0b47a386af..0244a6bf8b 100644 --- a/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorTips.java +++ b/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorTips.java @@ -7,7 +7,6 @@ import org.apache.maven.model.Profile; import org.apache.maven.model.RepositoryBase; import org.apache.maven.profiles.activation.ProfileActivationContext; import org.apache.maven.profiles.activation.ProfileActivationException; -import org.apache.maven.profiles.activation.ProfileActivator; import org.apache.maven.execution.DuplicateProjectException; import org.apache.maven.project.InvalidProjectVersionException; import org.apache.maven.project.MavenProject; @@ -32,20 +31,6 @@ public final class ProjectErrorTips { } - public static List getTipsForActivatorError( ProfileActivator activator, - String projectId, - File pomFile, - Profile profile, - ProfileActivationContext context, - ProfileActivationException cause ) - { - return listOf( new String[]{ "If this is a standard profile activator, see " - + "http://maven.apache.org/pom.html#Activation for help configuring profile activation.", - "XSD location for pom.xml: http://maven.apache.org/xsd/maven-4.0.0.xsd", - "XSD location for settings.xml: http://maven.apache.org/xsd/settings-1.0.0.xsd", - "XSD location for profiles.xml: http://maven.apache.org/xsd/profiles-1.0.0.xsd" } ); - } - public static List getTipsForActivatorLookupError( String projectId, File pomFile, Profile profile, diff --git a/maven-project/src/main/java/org/apache/maven/profiles/AlwaysOnActivation.java b/maven-project/src/main/java/org/apache/maven/profiles/AlwaysOnActivation.java deleted file mode 100644 index d0b2263515..0000000000 --- a/maven-project/src/main/java/org/apache/maven/profiles/AlwaysOnActivation.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.maven.profiles; - -/* - * 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.model.Activation; - -public class AlwaysOnActivation - extends Activation -{ - -} diff --git a/maven-project/src/main/java/org/apache/maven/profiles/activation/AlwaysOnProfileActivator.java b/maven-project/src/main/java/org/apache/maven/profiles/activation/AlwaysOnProfileActivator.java deleted file mode 100644 index 762e51f2a1..0000000000 --- a/maven-project/src/main/java/org/apache/maven/profiles/activation/AlwaysOnProfileActivator.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.model.Profile; -import org.apache.maven.profiles.AlwaysOnActivation; -import org.codehaus.plexus.component.annotations.Component; - -@Component(role = ProfileActivator.class, hint = "always-on") -public class AlwaysOnProfileActivator - implements ProfileActivator -{ - public boolean canDetermineActivation( Profile profile, ProfileActivationContext context ) - { - return ( profile.getActivation() != null ) && ( profile.getActivation() instanceof AlwaysOnActivation ); - } - - public boolean isActive( Profile profile, ProfileActivationContext context ) - { - return true; - } -} diff --git a/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivator.java b/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivator.java deleted file mode 100644 index 23d016a2b9..0000000000 --- a/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivator.java +++ /dev/null @@ -1,154 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.model.Activation; -//import org.apache.maven.model.ActivationCustom; -import org.apache.maven.model.Profile; -import org.codehaus.plexus.PlexusConstants; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.component.configurator.BasicComponentConfigurator; -import org.codehaus.plexus.component.configurator.ComponentConfigurationException; -import org.codehaus.plexus.component.configurator.ComponentConfigurator; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.configuration.PlexusConfiguration; -import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; -import org.codehaus.plexus.context.Context; -import org.codehaus.plexus.context.ContextException; -import org.codehaus.plexus.logging.LogEnabled; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.logging.console.ConsoleLogger; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; -import org.codehaus.plexus.util.xml.Xpp3Dom; - -/** - * Profile activator that allows the use of custom third-party activators, by specifying a type - - * or role-hint - for the activator, along with a configuration (in the form of a DOM) to be used - * in configuring the activator. This activator will lookup/configure custom activators on-the-fly, - * without caching any of the lookups from the container. - */ -@Component(role = ProfileActivator.class, hint = "custom") -public class CustomActivator - implements ProfileActivator, LogEnabled -{ - @Requirement - private PlexusContainer container; - - private Logger logger; - - public boolean canDetermineActivation( Profile profile, ProfileActivationContext context ) - throws ProfileActivationException - { - /* - Activation activation = profile.getActivation(); - - if ( activation != null ) - { - ActivationCustom custom = activation.getCustom(); - - if ( custom != null ) - { - ProfileActivator activator = loadProfileActivator( custom, context ); - - if ( activator != null ) - { - return activator.canDetermineActivation( profile, context ); - } - } - } - */ - - return false; - } - - /* - private ProfileActivator loadProfileActivator( ActivationCustom custom, ProfileActivationContext context ) - throws ProfileActivationException - { - String type = custom.getType(); - - ProfileActivator activator = null; - - try - { - activator = container.lookup( ProfileActivator.class, type ); - } - catch ( ComponentLookupException e ) - { - if ( !context.isCustomActivatorFailureSuppressed() ) - { - throw new ProfileActivationException( - "Cannot find custom ProfileActivator: " + type + ". \nPerhaps you're missing a build extension?", - e ); - } - } - - PlexusConfiguration configuration = new XmlPlexusConfiguration( (Xpp3Dom) custom.getConfiguration() ); - - ComponentConfigurator configurator = new BasicComponentConfigurator(); - - try - { - configurator.configureComponent( activator, configuration, container.getContainerRealm() ); - } - catch ( ComponentConfigurationException e ) - { - if ( !context.isCustomActivatorFailureSuppressed() ) - { - throw new ProfileActivationException( "Failed to configure custom ProfileActivator: " + type + ".", e ); - } - } - - return activator; - } - */ - - public boolean isActive( Profile profile, ProfileActivationContext context ) - throws ProfileActivationException - { - /* - ActivationCustom custom = profile.getActivation().getCustom(); - - ProfileActivator activator = loadProfileActivator( custom, context ); - - return activator.isActive( profile, context ); - */ - - return false; - } - - protected Logger getLogger() - { - if ( logger == null ) - { - logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "CustomActivator-instantiated" ); - } - - return logger; - } - - public void enableLogging( Logger logger ) - { - this.logger = logger; - } - -} diff --git a/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivatorExpressionEvaluator.java b/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivatorExpressionEvaluator.java deleted file mode 100644 index a901d7f6e2..0000000000 --- a/maven-project/src/main/java/org/apache/maven/profiles/activation/CustomActivatorExpressionEvaluator.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException; -import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; - -import java.io.File; - -public class CustomActivatorExpressionEvaluator - implements ExpressionEvaluator -{ - - public File alignToBaseDirectory( File file ) - { - // TODO Auto-generated method stub - return null; - } - - public Object evaluate( String expression ) - throws ExpressionEvaluationException - { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/maven-project/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java b/maven-project/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java deleted file mode 100644 index 581fde7a4a..0000000000 --- a/maven-project/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.model.Profile; -import org.codehaus.plexus.logging.LogEnabled; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.logging.console.ConsoleLogger; - -public abstract class DetectedProfileActivator - implements ProfileActivator, LogEnabled -{ - private Logger logger; - - public boolean canDetermineActivation( Profile profile, ProfileActivationContext context ) - { - return canDetectActivation( profile, context ); - } - - protected Logger getLogger() - { - if ( logger == null ) - { - logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "DetectedProfileActivator:internal" ); - } - - return logger; - } - - public void enableLogging( Logger logger ) - { - this.logger = logger; - } - - protected abstract boolean canDetectActivation( Profile profile, ProfileActivationContext context ); - -} diff --git a/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java b/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java deleted file mode 100644 index b6562bbece..0000000000 --- a/maven-project/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.apache.maven.profiles.activation; - -/* - * 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.model.Profile; - -public interface ProfileActivator -{ - static final String ROLE = ProfileActivator.class.getName(); - - boolean canDetermineActivation( Profile profile, ProfileActivationContext context ) - throws ProfileActivationException; - - boolean isActive( Profile profile, ProfileActivationContext context ) - throws ProfileActivationException; - -} diff --git a/maven-project/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java b/maven-project/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java index 3b04a3c9ca..29821faea3 100644 --- a/maven-project/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java +++ b/maven-project/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java @@ -30,7 +30,6 @@ import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.Reporting; import org.apache.maven.model.Repository; import org.apache.maven.model.Resource; -import org.apache.maven.profiles.activation.ProfileActivator; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.util.StringUtils;